zebra_chain/value_balance/
arbitrary.rs
1use crate::{amount::*, value_balance::*};
2use proptest::prelude::*;
3
4impl Arbitrary for ValueBalance<NegativeAllowed> {
5 type Parameters = ();
6
7 fn arbitrary_with(_args: Self::Parameters) -> Self::Strategy {
8 (
9 any::<Amount<NegativeAllowed>>(),
10 any::<Amount<NegativeAllowed>>(),
11 any::<Amount<NegativeAllowed>>(),
12 any::<Amount<NegativeAllowed>>(),
13 any::<Amount<NegativeAllowed>>(),
14 )
15 .prop_map(|(transparent, sprout, sapling, orchard, deferred)| Self {
16 transparent,
17 sprout,
18 sapling,
19 orchard,
20 deferred,
21 })
22 .boxed()
23 }
24
25 type Strategy = BoxedStrategy<Self>;
26}
27
28impl Arbitrary for ValueBalance<NonNegative> {
29 type Parameters = ();
30
31 fn arbitrary_with(_args: Self::Parameters) -> Self::Strategy {
32 (
33 any::<Amount<NonNegative>>(),
34 any::<Amount<NonNegative>>(),
35 any::<Amount<NonNegative>>(),
36 any::<Amount<NonNegative>>(),
37 any::<Amount<NonNegative>>(),
38 )
39 .prop_map(|(transparent, sprout, sapling, orchard, deferred)| Self {
40 transparent,
41 sprout,
42 sapling,
43 orchard,
44 deferred,
45 })
46 .boxed()
47 }
48
49 type Strategy = BoxedStrategy<Self>;
50}