diff options
author | Daniel Mueller <deso@posteo.net> | 2020-04-04 14:39:19 -0700 |
---|---|---|
committer | Daniel Mueller <deso@posteo.net> | 2020-04-04 14:39:19 -0700 |
commit | d0d9683df8398696147e7ee1fcffb2e4e957008c (patch) | |
tree | 4baa76712a76f4d072ee3936c07956580b230820 /rand/rand_pcg/tests | |
parent | 203e691f46d591a2cc8acdfd850fa9f5b0fb8a98 (diff) | |
download | nitrocli-d0d9683df8398696147e7ee1fcffb2e4e957008c.tar.gz nitrocli-d0d9683df8398696147e7ee1fcffb2e4e957008c.tar.bz2 |
Remove vendored dependencies
While it appears that by now we actually can get successful builds
without Cargo insisting on Internet access by virtue of using the
--frozen flag, maintaining vendored dependencies is somewhat of a pain
point. This state will also get worse with upcoming changes that replace
argparse in favor of structopt and pull in a slew of new dependencies by
doing so. Then there is also the repository structure aspect, which is
non-standard due to the way we vendor dependencies and a potential
source of confusion.
In order to fix these problems, this change removes all the vendored
dependencies we have.
Delete subrepo argparse/:argparse
Delete subrepo base32/:base32
Delete subrepo cc/:cc
Delete subrepo cfg-if/:cfg-if
Delete subrepo getrandom/:getrandom
Delete subrepo lazy-static/:lazy-static
Delete subrepo libc/:libc
Delete subrepo nitrokey-sys/:nitrokey-sys
Delete subrepo nitrokey/:nitrokey
Delete subrepo rand/:rand
Diffstat (limited to 'rand/rand_pcg/tests')
-rw-r--r-- | rand/rand_pcg/tests/lcg128xsl64.rs | 55 | ||||
-rw-r--r-- | rand/rand_pcg/tests/lcg64xsh32.rs | 54 | ||||
-rw-r--r-- | rand/rand_pcg/tests/mcg128xsl64.rs | 54 |
3 files changed, 0 insertions, 163 deletions
diff --git a/rand/rand_pcg/tests/lcg128xsl64.rs b/rand/rand_pcg/tests/lcg128xsl64.rs deleted file mode 100644 index efc72ff..0000000 --- a/rand/rand_pcg/tests/lcg128xsl64.rs +++ /dev/null @@ -1,55 +0,0 @@ -use rand_core::{RngCore, SeedableRng}; -use rand_pcg::{Lcg128Xsl64, Pcg64}; - -#[test] -fn test_lcg128xsl64_construction() { - // Test that various construction techniques produce a working RNG. - let seed = [1,2,3,4, 5,6,7,8, 9,10,11,12, 13,14,15,16, - 17,18,19,20, 21,22,23,24, 25,26,27,28, 29,30,31,32]; - let mut rng1 = Lcg128Xsl64::from_seed(seed); - assert_eq!(rng1.next_u64(), 8740028313290271629); - - let mut rng2 = Lcg128Xsl64::from_rng(&mut rng1).unwrap(); - assert_eq!(rng2.next_u64(), 1922280315005786345); - - let mut rng3 = Lcg128Xsl64::seed_from_u64(0); - assert_eq!(rng3.next_u64(), 2354861276966075475); - - // This is the same as Lcg128Xsl64, so we only have a single test: - let mut rng4 = Pcg64::seed_from_u64(0); - assert_eq!(rng4.next_u64(), 2354861276966075475); -} - -#[test] -fn test_lcg128xsl64_true_values() { - // Numbers copied from official test suite (C version). - let mut rng = Lcg128Xsl64::new(42, 54); - - let mut results = [0u64; 6]; - for i in results.iter_mut() { *i = rng.next_u64(); } - let expected: [u64; 6] = [0x86b1da1d72062b68, 0x1304aa46c9853d39, - 0xa3670e9e0dd50358, 0xf9090e529a7dae00, 0xc85b9fd837996f2c, 0x606121f8e3919196]; - assert_eq!(results, expected); -} - -#[cfg(feature="serde1")] -#[test] -fn test_lcg128xsl64_serde() { - use bincode; - use std::io::{BufWriter, BufReader}; - - let mut rng = Lcg128Xsl64::seed_from_u64(0); - - let buf: Vec<u8> = Vec::new(); - let mut buf = BufWriter::new(buf); - bincode::serialize_into(&mut buf, &rng).expect("Could not serialize"); - - let buf = buf.into_inner().unwrap(); - let mut read = BufReader::new(&buf[..]); - let mut deserialized: Lcg128Xsl64 = bincode::deserialize_from(&mut read) - .expect("Could not deserialize"); - - for _ in 0..16 { - assert_eq!(rng.next_u64(), deserialized.next_u64()); - } -} diff --git a/rand/rand_pcg/tests/lcg64xsh32.rs b/rand/rand_pcg/tests/lcg64xsh32.rs deleted file mode 100644 index e05bcc1..0000000 --- a/rand/rand_pcg/tests/lcg64xsh32.rs +++ /dev/null @@ -1,54 +0,0 @@ -use rand_core::{RngCore, SeedableRng}; -use rand_pcg::{Lcg64Xsh32, Pcg32}; - -#[test] -fn test_lcg64xsh32_construction() { - // Test that various construction techniques produce a working RNG. - let seed = [1,2,3,4, 5,6,7,8, 9,10,11,12, 13,14,15,16]; - let mut rng1 = Lcg64Xsh32::from_seed(seed); - assert_eq!(rng1.next_u64(), 1204678643940597513); - - let mut rng2 = Lcg64Xsh32::from_rng(&mut rng1).unwrap(); - assert_eq!(rng2.next_u64(), 12384929573776311845); - - let mut rng3 = Lcg64Xsh32::seed_from_u64(0); - assert_eq!(rng3.next_u64(), 18195738587432868099); - - // This is the same as Lcg64Xsh32, so we only have a single test: - let mut rng4 = Pcg32::seed_from_u64(0); - assert_eq!(rng4.next_u64(), 18195738587432868099); -} - -#[test] -fn test_lcg64xsh32_true_values() { - // Numbers copied from official test suite. - let mut rng = Lcg64Xsh32::new(42, 54); - - let mut results = [0u32; 6]; - for i in results.iter_mut() { *i = rng.next_u32(); } - let expected: [u32; 6] = [0xa15c02b7, 0x7b47f409, 0xba1d3330, - 0x83d2f293, 0xbfa4784b, 0xcbed606e]; - assert_eq!(results, expected); -} - -#[cfg(feature="serde1")] -#[test] -fn test_lcg64xsh32_serde() { - use bincode; - use std::io::{BufWriter, BufReader}; - - let mut rng = Lcg64Xsh32::seed_from_u64(0); - - let buf: Vec<u8> = Vec::new(); - let mut buf = BufWriter::new(buf); - bincode::serialize_into(&mut buf, &rng).expect("Could not serialize"); - - let buf = buf.into_inner().unwrap(); - let mut read = BufReader::new(&buf[..]); - let mut deserialized: Lcg64Xsh32 = bincode::deserialize_from(&mut read) - .expect("Could not deserialize"); - - for _ in 0..16 { - assert_eq!(rng.next_u64(), deserialized.next_u64()); - } -} diff --git a/rand/rand_pcg/tests/mcg128xsl64.rs b/rand/rand_pcg/tests/mcg128xsl64.rs deleted file mode 100644 index d58fa75..0000000 --- a/rand/rand_pcg/tests/mcg128xsl64.rs +++ /dev/null @@ -1,54 +0,0 @@ -use rand_core::{RngCore, SeedableRng}; -use rand_pcg::{Mcg128Xsl64, Pcg64Mcg}; - -#[test] -fn test_mcg128xsl64_construction() { - // Test that various construction techniques produce a working RNG. - let seed = [1,2,3,4, 5,6,7,8, 9,10,11,12, 13,14,15,16]; - let mut rng1 = Mcg128Xsl64::from_seed(seed); - assert_eq!(rng1.next_u64(), 7071994460355047496); - - let mut rng2 = Mcg128Xsl64::from_rng(&mut rng1).unwrap(); - assert_eq!(rng2.next_u64(), 12300796107712034932); - - let mut rng3 = Mcg128Xsl64::seed_from_u64(0); - assert_eq!(rng3.next_u64(), 6198063878555692194); - - // This is the same as Mcg128Xsl64, so we only have a single test: - let mut rng4 = Pcg64Mcg::seed_from_u64(0); - assert_eq!(rng4.next_u64(), 6198063878555692194); -} - -#[test] -fn test_mcg128xsl64_true_values() { - // Numbers copied from official test suite (C version). - let mut rng = Mcg128Xsl64::new(42); - - let mut results = [0u64; 6]; - for i in results.iter_mut() { *i = rng.next_u64(); } - let expected: [u64; 6] = [0x63b4a3a813ce700a, 0x382954200617ab24, - 0xa7fd85ae3fe950ce, 0xd715286aa2887737, 0x60c92fee2e59f32c, 0x84c4e96beff30017]; - assert_eq!(results, expected); -} - -#[cfg(feature="serde1")] -#[test] -fn test_mcg128xsl64_serde() { - use bincode; - use std::io::{BufWriter, BufReader}; - - let mut rng = Mcg128Xsl64::seed_from_u64(0); - - let buf: Vec<u8> = Vec::new(); - let mut buf = BufWriter::new(buf); - bincode::serialize_into(&mut buf, &rng).expect("Could not serialize"); - - let buf = buf.into_inner().unwrap(); - let mut read = BufReader::new(&buf[..]); - let mut deserialized: Mcg128Xsl64 = bincode::deserialize_from(&mut read) - .expect("Could not deserialize"); - - for _ in 0..16 { - assert_eq!(rng.next_u64(), deserialized.next_u64()); - } -} |