diff options
Diffstat (limited to 'rand/rand_xorshift/tests/mod.rs')
-rw-r--r-- | rand/rand_xorshift/tests/mod.rs | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/rand/rand_xorshift/tests/mod.rs b/rand/rand_xorshift/tests/mod.rs index 8374b64..7ecdeae 100644 --- a/rand/rand_xorshift/tests/mod.rs +++ b/rand/rand_xorshift/tests/mod.rs @@ -1,7 +1,3 @@ -extern crate rand_core; -extern crate rand_xorshift; -#[cfg(all(feature="serde1", test))] extern crate bincode; - use rand_core::{RngCore, SeedableRng}; use rand_xorshift::XorShiftRng; @@ -12,9 +8,10 @@ fn test_xorshift_construction() { let mut rng1 = XorShiftRng::from_seed(seed); assert_eq!(rng1.next_u64(), 4325440999699518727); - let _rng2 = XorShiftRng::from_rng(rng1).unwrap(); - // Note: we cannot test the state of _rng2 because from_rng does not - // fix Endianness. This is allowed in the trait specification. + let mut rng2 = XorShiftRng::from_rng(&mut rng1).unwrap(); + // Yes, this makes rng2 a clone of rng1! + assert_eq!(rng1.next_u64(), 15614385950550801700); + assert_eq!(rng2.next_u64(), 15614385950550801700); } #[test] |