From 278b41c8efff564850131cd5a58815b042095a0d Mon Sep 17 00:00:00 2001 From: thojest Date: Fri, 22 Feb 2019 16:05:52 +0100 Subject: [PATCH] decided against moving test_utils (lighthouse-246) --- Cargo.toml | 1 - eth2/utils/test_random/Cargo.toml | 8 ----- eth2/utils/test_random/src/lib.rs | 39 ------------------------ eth2/utils/test_random_derive/Cargo.toml | 2 -- 4 files changed, 50 deletions(-) delete mode 100644 eth2/utils/test_random/Cargo.toml delete mode 100644 eth2/utils/test_random/src/lib.rs diff --git a/Cargo.toml b/Cargo.toml index a557339a56..42d69489b3 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -15,7 +15,6 @@ members = [ "eth2/utils/ssz_derive", "eth2/utils/swap_or_not_shuffle", "eth2/utils/fisher_yates_shuffle", - "eth2/utils/test_random", "eth2/utils/test_random_derive", "beacon_node", "beacon_node/db", diff --git a/eth2/utils/test_random/Cargo.toml b/eth2/utils/test_random/Cargo.toml deleted file mode 100644 index 6346aa6282..0000000000 --- a/eth2/utils/test_random/Cargo.toml +++ /dev/null @@ -1,8 +0,0 @@ -[package] -name = "test_random" -version = "0.1.0" -authors = ["thojest "] -edition = "2018" - -[dependencies] -rand = "0.5.5" \ No newline at end of file diff --git a/eth2/utils/test_random/src/lib.rs b/eth2/utils/test_random/src/lib.rs deleted file mode 100644 index aa0d38a5a5..0000000000 --- a/eth2/utils/test_random/src/lib.rs +++ /dev/null @@ -1,39 +0,0 @@ -use rand::RngCore; - -pub trait TestRandom -where - T: RngCore, -{ - fn random_for_test(rng: &mut T) -> Self; -} - -impl TestRandom for u64 { - fn random_for_test(rng: &mut T) -> Self { - rng.next_u64() - } -} - -impl TestRandom for u32 { - fn random_for_test(rng: &mut T) -> Self { - rng.next_u32() - } -} - -impl TestRandom for usize { - fn random_for_test(rng: &mut T) -> Self { - rng.next_u32() as usize - } -} - -impl TestRandom for Vec -where - U: TestRandom, -{ - fn random_for_test(rng: &mut T) -> Self { - vec![ - ::random_for_test(rng), - ::random_for_test(rng), - ::random_for_test(rng), - ] - } -} diff --git a/eth2/utils/test_random_derive/Cargo.toml b/eth2/utils/test_random_derive/Cargo.toml index e596ad29c8..4559befafd 100644 --- a/eth2/utils/test_random_derive/Cargo.toml +++ b/eth2/utils/test_random_derive/Cargo.toml @@ -11,5 +11,3 @@ proc-macro = true [dependencies] syn = "0.15" quote = "0.6" -test_random = {path = "../test_random"} -