Skip to content

Commit

Permalink
test: add remove() test cases for BTreeSet
Browse files Browse the repository at this point in the history
  • Loading branch information
Gumichocopengin8 committed Apr 14, 2022
1 parent 21d3f84 commit 50c339e
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions library/alloc/src/collections/btree/set/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -427,6 +427,26 @@ fn test_clear() {
x.clear();
assert!(x.is_empty());
}
#[test]
fn test_remove() {
let mut x = BTreeSet::new();
assert!(x.is_empty());

x.insert(1);
x.insert(2);
x.insert(3);
x.insert(4);

assert_eq!(x.remove(&2), true);
assert_eq!(x.remove(&0), false);
assert_eq!(x.remove(&5), false);
assert_eq!(x.remove(&1), true);
assert_eq!(x.remove(&2), false);
assert_eq!(x.remove(&3), true);
assert_eq!(x.remove(&4), true);
assert_eq!(x.remove(&4), false);
assert!(x.is_empty());
}

#[test]
fn test_zip() {
Expand Down

0 comments on commit 50c339e

Please sign in to comment.