Skip to content

Commit

Permalink
test BTree a bit more
Browse files Browse the repository at this point in the history
  • Loading branch information
RalfJung committed Feb 22, 2019
1 parent 76138c5 commit edd9e5b
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion tests/run-pass/btreemap.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
use std::collections::{BTreeMap, BTreeSet};

#[derive(PartialEq, Eq, PartialOrd, Ord)]
pub enum Foo {
A(&'static str),
Expand All @@ -6,11 +8,22 @@ pub enum Foo {
}

pub fn main() {
let mut b = std::collections::BTreeSet::new();
let mut b = BTreeSet::new();
b.insert(Foo::A("\'"));
b.insert(Foo::A("/="));
b.insert(Foo::A("#"));
b.insert(Foo::A("0o"));
assert!(b.remove(&Foo::A("/=")));
assert!(!b.remove(&Foo::A("/=")));

// Also test a lower-alignment type, where the NodeHeader overlaps with
// the keys.
let mut b = BTreeSet::new();
b.insert(1024);
b.insert(7);

let mut b = BTreeMap::new();
b.insert("bar", 1024);
b.insert("baz", 7);
for _val in b.iter_mut() {}
}

0 comments on commit edd9e5b

Please sign in to comment.