use hashbrown::HashMap;
use idbag::{ArcIdU32, IdBagU32, IdU32};
#[test]
fn access() {
let mut m: HashMap<IdU32, String> = HashMap::new();
let idbag = IdBagU32::new();
let id = idbag.alloc();
let idval = id.get();
m.insert(id, String::from("hello"));
if let Some(v) = m.get(&idval) {
assert_eq!(v, &String::from("hello"));
} else {
panic!("Unable to find entry");
}
}
#[test]
fn arced() {
let mut m: HashMap<ArcIdU32, String> = HashMap::new();
let idbag = IdBagU32::new();
let id = idbag.alloc().into_arcid();
let idval = id.val();
#[allow(clippy::redundant_clone)]
m.insert(id.clone(), String::from("hello"));
if let Some(v) = m.get(&idval) {
assert_eq!(v, &String::from("hello"));
} else {
panic!("Unable to find entry");
}
}