Merge pull request #631 from RalfJung/btree

test BTree a bit more
This commit is contained in:
Ralf Jung 2019-02-24 16:25:46 +01:00 committed by GitHub
commit fa4c04036f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 2 deletions

View File

@ -1 +1 @@
nightly-2019-02-15
nightly-2019-02-24

View File

@ -1,3 +1,5 @@
use std::collections::{BTreeMap, BTreeSet};
#[derive(PartialEq, Eq, PartialOrd, Ord)]
pub enum Foo {
A(&'static str),
@ -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() {}
}