zebra_chain/work/
arbitrary.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
use super::*;

use proptest::{collection::vec, prelude::*};

impl Arbitrary for equihash::Solution {
    type Parameters = ();

    fn arbitrary_with(_args: Self::Parameters) -> Self::Strategy {
        (vec(any::<u8>(), equihash::SOLUTION_SIZE))
            .prop_map(|v| {
                let mut bytes = [0; equihash::SOLUTION_SIZE];
                bytes.copy_from_slice(v.as_slice());
                Self::Common(bytes)
            })
            .boxed()
    }

    type Strategy = BoxedStrategy<Self>;
}