diff options
| author | Marcello Seri <marcello.seri@gmail.com> | 2015-10-16 22:54:14 +0100 |
|---|---|---|
| committer | Marcello Seri <marcello.seri@gmail.com> | 2015-10-17 10:20:50 +0100 |
| commit | d0bd5e87a2f811e9eff7e0a695086de2cc9a4fa7 (patch) | |
| tree | ae135065f529681392952437951135f2f57851fe | |
| parent | 65547ff5a2cc3c8c040302ab04cbc3bef50beec4 (diff) | |
| download | rust-d0bd5e87a2f811e9eff7e0a695086de2cc9a4fa7.tar.gz rust-d0bd5e87a2f811e9eff7e0a695086de2cc9a4fa7.zip | |
attitional tests fixups
| -rw-r--r-- | src/librand/chacha.rs | 61 | ||||
| -rw-r--r-- | src/librand/isaac.rs | 51 |
2 files changed, 26 insertions, 86 deletions
diff --git a/src/librand/chacha.rs b/src/librand/chacha.rs index 1ea18593315..411ca836080 100644 --- a/src/librand/chacha.rs +++ b/src/librand/chacha.rs @@ -245,6 +245,7 @@ mod tests { } #[test] + #[rustfmt_skip] fn test_rng_true_values() { // Test vectors 1 and 2 from // http://tools.ietf.org/html/draft-nir-cfrg-chacha20-poly1305-04 @@ -253,41 +254,17 @@ mod tests { let v = (0..16).map(|_| ra.next_u32()).collect::<Vec<_>>(); assert_eq!(v, - vec!(0xade0b876, - 0x903df1a0, - 0xe56a5d40, - 0x28bd8653, - 0xb819d2bd, - 0x1aed8da0, - 0xccef36a8, - 0xc70d778b, - 0x7c5941da, - 0x8d485751, - 0x3fe02477, - 0x374ad8b8, - 0xf4b8436a, - 0x1ca11815, - 0x69b687c3, - 0x8665eeb2)); + vec!(0xade0b876, 0x903df1a0, 0xe56a5d40, 0x28bd8653, + 0xb819d2bd, 0x1aed8da0, 0xccef36a8, 0xc70d778b, + 0x7c5941da, 0x8d485751, 0x3fe02477, 0x374ad8b8, + 0xf4b8436a, 0x1ca11815, 0x69b687c3, 0x8665eeb2)); let v = (0..16).map(|_| ra.next_u32()).collect::<Vec<_>>(); assert_eq!(v, - vec!(0xbee7079f, - 0x7a385155, - 0x7c97ba98, - 0x0d082d73, - 0xa0290fcb, - 0x6965e348, - 0x3e53c612, - 0xed7aee32, - 0x7621b729, - 0x434ee69c, - 0xb03371d5, - 0xd539d874, - 0x281fed31, - 0x45fb0a51, - 0x1f0ae1ac, - 0x6f4d794b)); + vec!(0xbee7079f, 0x7a385155, 0x7c97ba98, 0x0d082d73, + 0xa0290fcb, 0x6965e348, 0x3e53c612, 0xed7aee32, + 0x7621b729, 0x434ee69c, 0xb03371d5, 0xd539d874, + 0x281fed31, 0x45fb0a51, 0x1f0ae1ac, 0x6f4d794b)); let seed: &[_] = &[0, 1, 2, 3, 4, 5, 6, 7]; @@ -304,22 +281,10 @@ mod tests { } assert_eq!(v, - vec!(0xf225c81a, - 0x6ab1be57, - 0x04d42951, - 0x70858036, - 0x49884684, - 0x64efec72, - 0x4be2d186, - 0x3615b384, - 0x11cfa18e, - 0xd3c50049, - 0x75c775f6, - 0x434c6530, - 0x2c5bad8f, - 0x898881dc, - 0x5f1c86d9, - 0xc1f8e7f4)); + vec!(0xf225c81a, 0x6ab1be57, 0x04d42951, 0x70858036, + 0x49884684, 0x64efec72, 0x4be2d186, 0x3615b384, + 0x11cfa18e, 0xd3c50049, 0x75c775f6, 0x434c6530, + 0x2c5bad8f, 0x898881dc, 0x5f1c86d9, 0xc1f8e7f4)); } #[test] diff --git a/src/librand/isaac.rs b/src/librand/isaac.rs index 8f83f3d7538..47351a6bf28 100644 --- a/src/librand/isaac.rs +++ b/src/librand/isaac.rs @@ -591,22 +591,15 @@ mod tests { } #[test] + #[rustfmt_skip] fn test_rng_32_true_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..10).map(|_| ra.next_u32()).collect::<Vec<_>>(); assert_eq!(v, - vec!(2558573138, - 873787463, - 263499565, - 2103644246, - 3595684709, - 4203127393, - 264982119, - 2765226902, - 2737944514, - 3900253796)); + vec!(2558573138, 873787463, 263499565, 2103644246, 3595684709, + 4203127393, 264982119, 2765226902, 2737944514, 3900253796)); let seed: &[_] = &[12345, 67890, 54321, 9876]; let mut rb: IsaacRng = SeedableRng::from_seed(seed); @@ -617,33 +610,20 @@ mod tests { let v = (0..10).map(|_| rb.next_u32()).collect::<Vec<_>>(); assert_eq!(v, - vec!(3676831399, - 3183332890, - 2834741178, - 3854698763, - 2717568474, - 1576568959, - 3507990155, - 179069555, - 141456972, - 2478885421)); + vec!(3676831399, 3183332890, 2834741178, 3854698763, 2717568474, + 1576568959, 3507990155, 179069555, 141456972, 2478885421)); } #[test] + #[rustfmt_skip] fn test_rng_64_true_values() { let seed: &[_] = &[1, 23, 456, 7890, 12345]; let mut ra: Isaac64Rng = SeedableRng::from_seed(seed); // Regression test that isaac is actually using the above vector let v = (0..10).map(|_| ra.next_u64()).collect::<Vec<_>>(); assert_eq!(v, - vec!(547121783600835980, - 14377643087320773276, - 17351601304698403469, - 1238879483818134882, - 11952566807690396487, - 13970131091560099343, - 4469761996653280935, - 15552757044682284409, - 6860251611068737823, + vec!(547121783600835980, 14377643087320773276, 17351601304698403469, + 1238879483818134882, 11952566807690396487, 13970131091560099343, + 4469761996653280935, 15552757044682284409, 6860251611068737823, 13722198873481261842)); let seed: &[_] = &[12345, 67890, 54321, 9876]; @@ -655,16 +635,11 @@ mod tests { let v = (0..10).map(|_| rb.next_u64()).collect::<Vec<_>>(); assert_eq!(v, - vec!(18143823860592706164, - 8491801882678285927, - 2699425367717515619, - 17196852593171130876, - 2606123525235546165, - 15790932315217671084, - 596345674630742204, - 9947027391921273664, - 11788097613744130851, + vec!(18143823860592706164, 8491801882678285927, 2699425367717515619, + 17196852593171130876, 2606123525235546165, 15790932315217671084, + 596345674630742204, 9947027391921273664, 11788097613744130851, 10391409374914919106)); + } #[test] |
