File tree 2 files changed +8
-4
lines changed
2 files changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -19,7 +19,9 @@ mod test {
19
19
fn rng ( ) {
20
20
let mut rng = rand:: rngs:: StdRng :: seed_from_u64 ( 0xcafebeef ) ;
21
21
let x: u32 = rng. gen ( ) ;
22
- let y: u32 = rng. gen ( ) ;
23
- assert_ne ! ( x, y) ;
22
+ let y: usize = rng. gen ( ) ;
23
+ let z: u128 = rng. gen ( ) ;
24
+ assert_ne ! ( x as usize , y) ;
25
+ assert_ne ! ( y as u128 , z) ;
24
26
}
25
27
}
Original file line number Diff line number Diff line change @@ -7,17 +7,19 @@ fn simple() {
7
7
assert_eq ! ( 4 , 4 ) ;
8
8
}
9
9
10
- // Having more than 1 test does seem to make a difference
11
- // (i.e., this calls ptr::swap which having just one test does not).
12
10
#[ test]
13
11
fn entropy_rng ( ) {
14
12
// Use this opportunity to test querying the RNG (needs an external crate, hence tested here and not in the compiletest suite)
15
13
let mut rng = SmallRng :: from_entropy ( ) ;
16
14
let _val = rng. gen :: < i32 > ( ) ;
15
+ let _val = rng. gen :: < isize > ( ) ;
16
+ let _val = rng. gen :: < i128 > ( ) ;
17
17
18
18
// Also try per-thread RNG.
19
19
let mut rng = rand:: thread_rng ( ) ;
20
20
let _val = rng. gen :: < i32 > ( ) ;
21
+ let _val = rng. gen :: < isize > ( ) ;
22
+ let _val = rng. gen :: < i128 > ( ) ;
21
23
}
22
24
23
25
// A test that won't work on miri
You can’t perform that action at this time.
0 commit comments