Skip to content

Commit

Permalink
Assert masks
Browse files Browse the repository at this point in the history
  • Loading branch information
Shatur committed Nov 20, 2024
1 parent 5e50ca1 commit 5ae9e5f
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions src/client/confirm_history.rs
Original file line number Diff line number Diff line change
Expand Up @@ -219,8 +219,8 @@ mod tests {
#[test]
fn confirm_newer() {
let mut history = ConfirmHistory::new(RepliconTick::new(1));

history.confirm(RepliconTick::new(2));
assert_eq!(history.mask(), 0b11);

assert!(!history.contains(RepliconTick::new(0)));
assert!(history.contains(RepliconTick::new(1)));
Expand All @@ -230,8 +230,6 @@ mod tests {
#[test]
fn confirm_older() {
let mut history = ConfirmHistory::new(RepliconTick::new(1));
assert_eq!(history.mask(), 0b1);

history.confirm(RepliconTick::new(0));
assert_eq!(history.mask(), 0b11);

Expand All @@ -243,8 +241,8 @@ mod tests {
#[test]
fn confirm_same() {
let mut history = ConfirmHistory::new(RepliconTick::new(1));

history.confirm(RepliconTick::new(1));
assert_eq!(history.mask(), 0b1);

assert!(!history.contains(RepliconTick::new(0)));
assert!(history.contains(RepliconTick::new(1)));
Expand All @@ -254,8 +252,8 @@ mod tests {
#[test]
fn confirm_with_wrapping() {
let mut history = ConfirmHistory::new(RepliconTick::new(1));

history.confirm(RepliconTick::new(u64::BITS + 1));
assert_eq!(history.mask(), 0b1);

assert!(history.contains(RepliconTick::new(0)));
assert!(history.contains(RepliconTick::new(1)));
Expand All @@ -268,8 +266,8 @@ mod tests {
#[test]
fn confirm_with_overflow() {
let mut history = ConfirmHistory::new(RepliconTick::new(u32::MAX));

history.confirm(RepliconTick::new(1));
assert_eq!(history.mask(), 0b101);

assert!(!history.contains(RepliconTick::new(0)));
assert!(history.contains(RepliconTick::new(1)));
Expand Down

0 comments on commit 5ae9e5f

Please sign in to comment.