1
use super::Seq;
2

            
3
#[test]
4
1
fn only_the_latest_request_is_awaited() {
5
1
    let mut seq = Seq::default();
6
1
    let first = seq.advance();
7
1
    let second = seq.advance();
8
1
    assert_ne!(first, second);
9
1
    assert!(!seq.awaits(first));
10
1
    assert!(seq.awaits(second));
11
1
}
12

            
13
#[test]
14
1
fn the_counter_wraps_instead_of_overflowing() {
15
1
    let mut seq = Seq(u64::MAX);
16
1
    let wrapped = seq.advance();
17
1
    assert_eq!(wrapped, 0);
18
1
    assert!(seq.awaits(0));
19
1
}
20

            
21
#[test]
22
1
fn the_current_id_is_the_latest_started() {
23
1
    let mut seq = Seq::default();
24
1
    let started = seq.advance();
25
1
    assert_eq!(seq.current(), started);
26
1
}