@@ -7,27 +7,27 @@ import "cheats/Vm.sol";
77contract RandomUint is DSTest {
88 Vm constant vm = Vm (HEVM_ADDRESS);
99
10- // All tests use `>=` and `<=` to verify that ranges are inclusive and that
11- // a value of zero may be generated.
1210 function testRandomUint () public {
13- uint256 rand = vm.randomUint ();
14- assertTrue (rand >= 0 );
11+ vm.randomUint ();
1512 }
1613
17- function testRandomUint (uint256 min , uint256 max ) public {
18- vm.assume (max >= min);
19- uint256 rand = vm.randomUint (min, max);
20- assertTrue (rand >= min, "rand >= min " );
21- assertTrue (rand <= max, "rand <= max " );
14+ function testRandomUintRangeOverflow () public {
15+ vm.randomUint (0 , uint256 (int256 (- 1 )));
2216 }
2317
24- function testRandomUint (uint256 val ) public {
18+ function testRandomUintSame (uint256 val ) public {
2519 uint256 rand = vm.randomUint (val, val);
2620 assertTrue (rand == val);
2721 }
2822
23+ function testRandomUintRange (uint256 min , uint256 max ) public {
24+ vm.assume (max >= min);
25+ uint256 rand = vm.randomUint (min, max);
26+ assertTrue (rand >= min, "rand >= min " );
27+ assertTrue (rand <= max, "rand <= max " );
28+ }
29+
2930 function testRandomAddress () public {
30- address rand = vm.randomAddress ();
31- assertTrue (rand >= address (0 ));
31+ vm.randomAddress ();
3232 }
3333}
0 commit comments