1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
use crate::account::{xus_currency_code, Account, AccountData, AccountRoleSpecifier};
use proptest::prelude::*;
impl Arbitrary for Account {
type Parameters = ();
fn arbitrary_with(_params: ()) -> Self::Strategy {
Account::new as Self::Strategy
}
type Strategy = fn() -> Account;
}
impl AccountData {
pub fn strategy(balance_strategy: impl Strategy<Value = u64>) -> impl Strategy<Value = Self> {
let sequence_strategy = 0u64..(1 << 32);
let event_count_strategy = 0u64..(1 << 32);
(
any::<Account>(),
balance_strategy,
sequence_strategy,
event_count_strategy.clone(),
event_count_strategy,
)
.prop_map(
|(account, balance, sequence_number, sent_events_count, received_events_count)| {
AccountData::with_account_and_event_counts(
account,
balance,
xus_currency_code(), sequence_number,
sent_events_count,
received_events_count,
AccountRoleSpecifier::default(), )
},
)
}
}