From bf9f9059a5485e309617d465ee915f432ac67993 Mon Sep 17 00:00:00 2001 From: Diggory Hardy Date: Wed, 20 Dec 2017 16:21:15 +0000 Subject: [PATCH] Test next_u64 on 32-bit generator to check LE conversion --- src/prng/isaac.rs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/prng/isaac.rs b/src/prng/isaac.rs index 5aa0e69046c..16b6f6b74a5 100644 --- a/src/prng/isaac.rs +++ b/src/prng/isaac.rs @@ -421,6 +421,17 @@ mod test { 1576568959, 3507990155, 179069555, 141456972, 2478885421)); } + #[test] + fn test_rng_64_true_values() { + // As above, using little-endian versions of above values + let seed: &[_] = &[1, 23, 456, 7890, 12345]; + let mut ra: IsaacRng = SeedableRng::from_seed(seed); + // Regression test that isaac is actually using the above vector + let v = (0..5).map(|_| ra.next_u64()).collect::>(); + assert_eq!(v, + vec!(3752888579798383186, 9035083239252078381, 18052294697452424037, 11876559110374379111, 16751462502657800130)); + } + #[test] fn test_isaac_true_bytes() { let seed: &[_] = &[1, 23, 456, 7890, 12345];