Add a roundtrip (de)serialization proptest for EquihashSolution
This commit is contained in:
parent
c2bb6c15f8
commit
d5800e168c
|
|
@ -85,3 +85,20 @@ impl Arbitrary for EquihashSolution {
|
||||||
|
|
||||||
type Strategy = BoxedStrategy<Self>;
|
type Strategy = BoxedStrategy<Self>;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
proptest! {
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn encrypted_ciphertext_roundtrip(solution in any::<EquihashSolution>()) {
|
||||||
|
|
||||||
|
let mut data = Vec::new();
|
||||||
|
|
||||||
|
solution.zcash_serialize(&mut data).expect("EquihashSolution should serialize");
|
||||||
|
|
||||||
|
let solution2 = EquihashSolution::zcash_deserialize(&data[..]).expect("randomized EquihashSolution should deserialize");
|
||||||
|
|
||||||
|
prop_assert_eq![solution, solution2];
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue