From b47e886eed8fb37b311b28655223778f1b94a3bf Mon Sep 17 00:00:00 2001 From: Deirdre Connolly Date: Tue, 21 Jan 2020 18:29:23 -0500 Subject: [PATCH] Add transaction v3 proptest strategy --- zebra-chain/src/transaction/tests.rs | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/zebra-chain/src/transaction/tests.rs b/zebra-chain/src/transaction/tests.rs index b1760ed3..72d3ca02 100644 --- a/zebra-chain/src/transaction/tests.rs +++ b/zebra-chain/src/transaction/tests.rs @@ -49,6 +49,26 @@ impl Transaction { ) .boxed() } + + pub fn v3_strategy() -> impl Strategy { + ( + vec(any::(), 0..10), + vec(any::(), 0..10), + any::(), + any::(), + option::of(any::>()), + ) + .prop_map( + |(inputs, outputs, lock_time, expiry_height, joinsplit_data)| Transaction::V3 { + inputs: inputs, + outputs: outputs, + lock_time: lock_time, + expiry_height: expiry_height, + joinsplit_data: joinsplit_data, + }, + ) + .boxed() + } } #[cfg(test)] @@ -56,7 +76,7 @@ impl Arbitrary for Transaction { type Parameters = (); fn arbitrary_with(_args: ()) -> Self::Strategy { - prop_oneof![Self::v1_strategy(), Self::v2_strategy()].boxed() + prop_oneof![Self::v1_strategy(), Self::v2_strategy(), Self::v3_strategy()].boxed() } type Strategy = BoxedStrategy;