Fix issues with previous cherry pick
This commit is contained in:
parent
6101036c8e
commit
f68f52e206
@ -1,3 +1,5 @@
|
|||||||
|
#[macro_use]
|
||||||
|
mod macros;
|
||||||
mod generate_deterministic_keypairs;
|
mod generate_deterministic_keypairs;
|
||||||
mod keypairs_file;
|
mod keypairs_file;
|
||||||
mod test_random;
|
mod test_random;
|
||||||
@ -13,57 +15,12 @@ mod testing_voluntary_exit_builder;
|
|||||||
pub use generate_deterministic_keypairs::generate_deterministic_keypairs;
|
pub use generate_deterministic_keypairs::generate_deterministic_keypairs;
|
||||||
pub use keypairs_file::KeypairsFile;
|
pub use keypairs_file::KeypairsFile;
|
||||||
pub use rand::{prng::XorShiftRng, SeedableRng};
|
pub use rand::{prng::XorShiftRng, SeedableRng};
|
||||||
|
pub use test_random::TestRandom;
|
||||||
pub mod address;
|
pub use testing_attestation_builder::TestingAttestationBuilder;
|
||||||
pub mod aggregate_signature;
|
pub use testing_attester_slashing_builder::TestingAttesterSlashingBuilder;
|
||||||
pub mod bitfield;
|
pub use testing_beacon_block_builder::TestingBeaconBlockBuilder;
|
||||||
pub mod hash256;
|
pub use testing_beacon_state_builder::{keypairs_path, TestingBeaconStateBuilder};
|
||||||
#[macro_use]
|
pub use testing_deposit_builder::TestingDepositBuilder;
|
||||||
mod macros;
|
pub use testing_proposer_slashing_builder::TestingProposerSlashingBuilder;
|
||||||
pub mod public_key;
|
pub use testing_transfer_builder::TestingTransferBuilder;
|
||||||
pub mod secret_key;
|
pub use testing_voluntary_exit_builder::TestingVoluntaryExitBuilder;
|
||||||
pub mod signature;
|
|
||||||
|
|
||||||
pub trait TestRandom<T>
|
|
||||||
where
|
|
||||||
T: RngCore,
|
|
||||||
{
|
|
||||||
fn random_for_test(rng: &mut T) -> Self;
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<T: RngCore> TestRandom<T> for bool {
|
|
||||||
fn random_for_test(rng: &mut T) -> Self {
|
|
||||||
(rng.next_u32() % 2) == 1
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<T: RngCore> TestRandom<T> for u64 {
|
|
||||||
fn random_for_test(rng: &mut T) -> Self {
|
|
||||||
rng.next_u64()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<T: RngCore> TestRandom<T> for u32 {
|
|
||||||
fn random_for_test(rng: &mut T) -> Self {
|
|
||||||
rng.next_u32()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<T: RngCore> TestRandom<T> for usize {
|
|
||||||
fn random_for_test(rng: &mut T) -> Self {
|
|
||||||
rng.next_u32() as usize
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<T: RngCore, U> TestRandom<T> for Vec<U>
|
|
||||||
where
|
|
||||||
U: TestRandom<T>,
|
|
||||||
{
|
|
||||||
fn random_for_test(rng: &mut T) -> Self {
|
|
||||||
vec![
|
|
||||||
<U>::random_for_test(rng),
|
|
||||||
<U>::random_for_test(rng),
|
|
||||||
<U>::random_for_test(rng),
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
Loading…
Reference in New Issue
Block a user