From 7253a9bfc4bd9cff364b29b4b191a0e8b8f98d99 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=B4me=20Benoit?= Date: Tue, 20 Dec 2022 18:14:20 +0100 Subject: [PATCH] UT: improve RNG tests MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Jérôme Benoit --- test/utils/UtilsTest.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/test/utils/UtilsTest.ts b/test/utils/UtilsTest.ts index 8093d5e7..b621f88a 100644 --- a/test/utils/UtilsTest.ts +++ b/test/utils/UtilsTest.ts @@ -108,6 +108,7 @@ describe('Utils test suite', () => { expect(Number.isSafeInteger(randomInteger)).toBe(true); expect(randomInteger).toBeGreaterThanOrEqual(0); expect(randomInteger).toBeLessThanOrEqual(Number.MAX_SAFE_INTEGER); + expect(randomInteger).not.toEqual(Utils.getRandomInteger()); expect(() => Utils.getRandomInteger(0, 1)).toThrowError(new RangeError('Invalid interval')); expect(() => Utils.getRandomInteger(-1)).toThrowError(new RangeError('Invalid interval')); expect(() => Utils.getRandomInteger(0, -1)).toThrowError(new RangeError('Invalid interval')); @@ -126,6 +127,7 @@ describe('Utils test suite', () => { expect(typeof randomFloat === 'number').toBe(true); expect(randomFloat).toBeGreaterThanOrEqual(0); expect(randomFloat).toBeLessThanOrEqual(Number.MAX_VALUE); + expect(randomFloat).not.toEqual(Utils.getRandomFloat()); expect(() => Utils.getRandomFloat(0, 1)).toThrowError(new RangeError('Invalid interval')); expect(() => Utils.getRandomFloat(-1)).toThrowError(new RangeError('Invalid interval')); expect(() => Utils.getRandomFloat(0, -1)).toThrowError(new RangeError('Invalid interval')); -- 2.34.1