Add a roundtrip (de)serialization proptest for EquihashSolution

This commit is contained in:
Deirdre Connolly 2020-01-31 23:29:08 -05:00 committed by Deirdre Connolly
parent c2bb6c15f8
commit d5800e168c
1 changed files with 17 additions and 0 deletions

View File

@ -85,3 +85,20 @@ impl Arbitrary for EquihashSolution {
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];
}
}