From c979d2125568a245295e3ee531edcbb23159b3d5 Mon Sep 17 00:00:00 2001 From: David Lechner Date: Thu, 21 May 2020 20:43:05 -0500 Subject: [PATCH] use describe in math tests just for better organization --- src/utils/math.test.ts | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/src/utils/math.test.ts b/src/utils/math.test.ts index c0197710..bafd1297 100644 --- a/src/utils/math.test.ts +++ b/src/utils/math.test.ts @@ -1,16 +1,20 @@ import { fmod, sumComplement32 } from './math'; -test('fmod of positive numbers', () => { - expect(fmod(3, 4)).toBe(3 % 4); +describe('fmod', () => { + test('positive numbers', () => { + expect(fmod(3, 4)).toBe(3 % 4); + }); + + test('negative and positive number', () => { + expect(fmod(-3, 4)).toBe(1); + }); }); -test('fmod of negative and positive number', () => { - expect(fmod(-3, 4)).toBe(1); -}); - -test('sumComplement32', () => { - // basic test - expect(sumComplement32([1, 2, 3, 4, 5])).toBe(-(1 + 2 + 3 + 4 + 5)); - // overflow - expect(sumComplement32([0xffffffff, 0xffffffff])).toBe(-(-1 + -1)); +describe('sumComplement32', () => { + test('basic', () => { + expect(sumComplement32([1, 2, 3, 4, 5])).toBe(-(1 + 2 + 3 + 4 + 5)); + }); + test('overflow', () => { + expect(sumComplement32([0xffffffff, 0xffffffff])).toBe(-(-1 + -1)); + }); });