diff --git a/data_types/src/sequence_number_set.rs b/data_types/src/sequence_number_set.rs index 3c496f18c3..2c00606597 100644 --- a/data_types/src/sequence_number_set.rs +++ b/data_types/src/sequence_number_set.rs @@ -3,7 +3,7 @@ use crate::SequenceNumber; /// A space-efficient encoded set of [`SequenceNumber`]. -#[derive(Debug, Default, Clone)] +#[derive(Debug, Default, Clone, PartialEq)] pub struct SequenceNumberSet(croaring::Bitmap); impl SequenceNumberSet { @@ -155,4 +155,24 @@ mod tests { assert!(a.contains(SequenceNumber::new(4))); assert!(a.contains(SequenceNumber::new(2))); } + + #[test] + fn test_partial_eq() { + let mut a = SequenceNumberSet::default(); + let mut b = SequenceNumberSet::default(); + + assert_eq!(a, b); + + a.add(SequenceNumber::new(42)); + assert_ne!(a, b); + + b.add(SequenceNumber::new(42)); + assert_eq!(a, b); + + b.add(SequenceNumber::new(24)); + assert_ne!(a, b); + + a.add(SequenceNumber::new(24)); + assert_eq!(a, b); + } }