Skip to content

Commit

Permalink
testing: kani test for packet number map
Browse files Browse the repository at this point in the history
  • Loading branch information
toidiu committed Sep 22, 2022
1 parent b8f38ad commit 88618ae
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions quic/s2n-quic-core/src/packet/number/map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -769,4 +769,27 @@ mod tests {
.with_type::<Vec<Operation>>()
.for_each(|ops| model(ops))
}


#[test]
#[cfg_attr(kani, kani::proof, kani::unwind(9))]
fn kani_test() {
// Confirm that a
let gen = gen::<VarInt>();

check!()
.with_generator(gen)
.cloned()
.for_each(|pn| {
let space = PacketNumberSpace::ApplicationData;
let mut map = Map::default();
assert!(map.is_empty());
let pn = space.new_packet_number(pn);

map.insert(pn, ());

assert!(map.get(pn).is_some());
assert!(!map.is_empty());
});
}
}

0 comments on commit 88618ae

Please sign in to comment.