From 2df20b9e6cb411977771bed9c43ce3e01b50af49 Mon Sep 17 00:00:00 2001 From: Deirdre Connolly Date: Mon, 27 Jan 2020 23:47:59 -0500 Subject: [PATCH] Add (de)serialization roundtrip proptext for joinsplit::EncryptedCiphertext --- zebra-chain/src/transaction/joinsplit.rs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/zebra-chain/src/transaction/joinsplit.rs b/zebra-chain/src/transaction/joinsplit.rs index 562cf722..53d3647f 100644 --- a/zebra-chain/src/transaction/joinsplit.rs +++ b/zebra-chain/src/transaction/joinsplit.rs @@ -183,3 +183,19 @@ impl Arbitrary for EncryptedCiphertext { type Strategy = BoxedStrategy; } + +#[cfg(test)] +proptest! { + + #[test] + fn encrypted_ciphertext_roundtrip(ec in any::()) { + + let mut data = Vec::new(); + + ec.zcash_serialize(&mut data).expect("EncryptedCiphertext should serialize"); + + let ec2 = EncryptedCiphertext::zcash_deserialize(&data[..]).expect("randomized EncryptedCiphertext should deserialize"); + + prop_assert_eq![ec, ec2]; + } +}