Add transaction v3 proptest strategy

This commit is contained in:
Deirdre Connolly 2020-01-21 18:29:23 -05:00 committed by Deirdre Connolly
parent b786e1e19c
commit b47e886eed
1 changed files with 21 additions and 1 deletions

View File

@ -49,6 +49,26 @@ impl Transaction {
)
.boxed()
}
pub fn v3_strategy() -> impl Strategy<Value = Self> {
(
vec(any::<TransparentInput>(), 0..10),
vec(any::<TransparentOutput>(), 0..10),
any::<LockTime>(),
any::<BlockHeight>(),
option::of(any::<JoinSplitData<Bctv14Proof>>()),
)
.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<Self>;