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
use crate::{Epoch, EpochPosition, EpochSlotOffset, Slot, TimeEra};
use quickcheck::{Arbitrary, Gen};

impl Arbitrary for TimeEra {
    fn arbitrary<G: Gen>(g: &mut G) -> Self {
        TimeEra::new(
            Arbitrary::arbitrary(g),
            Arbitrary::arbitrary(g),
            u32::arbitrary(g) % 127 + 1,
        )
    }
}

impl Arbitrary for Slot {
    fn arbitrary<G: Gen>(g: &mut G) -> Self {
        Slot(Arbitrary::arbitrary(g))
    }
}

impl Arbitrary for Epoch {
    fn arbitrary<G: Gen>(g: &mut G) -> Self {
        Epoch(Arbitrary::arbitrary(g))
    }
}

impl Arbitrary for EpochPosition {
    fn arbitrary<G: Gen>(g: &mut G) -> Self {
        EpochPosition {
            epoch: Epoch(Arbitrary::arbitrary(g)),
            slot: EpochSlotOffset(u32::arbitrary(g)),
        }
    }
}