Skip to content

Commit 97f6a4e

Browse files
authored
Update random.test.ts
1 parent 93ab44e commit 97f6a4e

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

src/math/random.test.ts

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,34 @@
1+
import { assertGreaterOrEqual } from "https://deno.land/std@0.224.0/assert/assert_greater_or_equal.ts";
2+
import { assertLessOrEqual } from "https://deno.land/std@0.224.0/assert/assert_less_or_equal.ts";
3+
import random from './random.ts';
14

5+
Deno.test(
6+
'Generate a random number.',
7+
async (test) => {
8+
await test.step({
9+
name: 'Number is not below min.',
10+
fn: () => {
11+
assertGreaterOrEqual(
12+
random(
13+
10,
14+
20,
15+
),
16+
10,
17+
);
18+
},
19+
});
20+
21+
await test.step({
22+
name: 'Number is not above max.',
23+
fn: () => {
24+
assertLessOrEqual(
25+
random(
26+
10,
27+
20,
28+
),
29+
20,
30+
);
31+
},
32+
});
33+
},
34+
);

0 commit comments

Comments
 (0)