Skip to content

Commit f9d42f0

Browse files
committed
add tests for is_clear()
1 parent f9c9c09 commit f9d42f0

1 file changed

Lines changed: 20 additions & 0 deletions

File tree

src/lib.rs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1651,3 +1651,23 @@ fn test_serialize() {
16511651
let serialized = serde_json::to_string(&fb).unwrap();
16521652
assert_eq!(r#"{"data":[332],"length":10}"#, serialized);
16531653
}
1654+
1655+
#[test]
1656+
fn test_is_clear() {
1657+
let mut fb = FixedBitSet::with_capacity(0);
1658+
assert!(fb.is_clear());
1659+
1660+
fb.grow(1);
1661+
assert!(fb.is_clear());
1662+
1663+
fb.put(0);
1664+
assert!(!fb.is_clear());
1665+
1666+
fb.grow(42);
1667+
fb.clear();
1668+
assert!(fb.is_clear());
1669+
1670+
fb.put(17);
1671+
fb.put(19);
1672+
assert!(!fb.is_clear());
1673+
}

0 commit comments

Comments
 (0)