1use invocation_counter::Counter;
2
3fn main() {
4 const BUCKET_COUNT: usize = 16;
5 const SUB_BUCKET_COUNT: usize = 2;
6 const GROUP_SHIFT_FACTOR: u32 = 4;
7 let counter = Counter::<BUCKET_COUNT, SUB_BUCKET_COUNT>::new(GROUP_SHIFT_FACTOR);
10
11 let mut now: u64 = 0;
13 counter.increment_by_one(now);
14
15 now += 1; counter.increment_by_one(now);
17
18 assert_eq!(counter.get_count_till(now), 2);
19
20 now += 2_u64.pow(GROUP_SHIFT_FACTOR) * BUCKET_COUNT as u64; counter.increment_by_one(now);
22 assert_eq!(counter.get_count_till(now), 1);
24}