From: Jérôme Benoit Date: Tue, 20 Dec 2022 17:14:20 +0000 (+0100) Subject: UT: improve RNG tests X-Git-Tag: v1.1.89~64 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=7253a9bfc4bd9cff364b29b4b191a0e8b8f98d99;p=e-mobility-charging-stations-simulator.git UT: improve RNG tests Signed-off-by: Jérôme Benoit --- 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'));