zebra_chain/work/arbitrary.rs
1use super::*;
2
3use proptest::{collection::vec, prelude::*};
4
5impl Arbitrary for equihash::Solution {
6 type Parameters = ();
7
8 fn arbitrary_with(_args: Self::Parameters) -> Self::Strategy {
9 (vec(any::<u8>(), equihash::SOLUTION_SIZE))
10 .prop_map(|v| {
11 let mut bytes = [0; equihash::SOLUTION_SIZE];
12 bytes.copy_from_slice(v.as_slice());
13 Self::Common(bytes)
14 })
15 .boxed()
16 }
17
18 type Strategy = BoxedStrategy<Self>;
19}