-
Notifications
You must be signed in to change notification settings - Fork 2k
/
Copy pathrandom_seed_test.ts
29 lines (27 loc) · 998 Bytes
/
random_seed_test.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
/**
* @license
* Copyright 2023 CodeSmith LLC
*
* Use of this source code is governed by an MIT-style
* license that can be found in the LICENSE file or at
* https://opensource.org/licenses/MIT.
* =============================================================================
*/
import {RandomSeed} from './random_seed';
import {describeMathCPUAndGPU} from '../utils/test_utils';
describeMathCPUAndGPU('RandomSeed', () => {
it('Checking if RandomSeed class handles pseudo randomness.', () => {
const randomSeed = new RandomSeed(42);
const firstSeed = randomSeed.seed;
randomSeed.next();
const secondSeed = randomSeed.seed;
expect(firstSeed).not.toEqual(secondSeed);
});
it('Checking if RandomSeed class handles undefined seed.', () => {
const randomSeed = new RandomSeed(undefined);
const firstSeed = randomSeed.seed;
const secondSeed = randomSeed.next();
expect(firstSeed).toEqual(undefined);
expect(secondSeed).toEqual(undefined);
});
});