mod common;
use mutcrab::collection::map::Map;
#[test]
fn std_map_test() {
use std::collections::HashMap;
let mut map = HashMap::<i32, i32>::new();
map.insert(1, 2);
let entry = map.entry(2);
entry.or_insert(3);
let v: &i32 = map.get(&1).unwrap();
println!("key 1 value is {}", v);
println!("{:?}", map);
}
#[test]
fn my_map_test() {
let mut map = common::BoxHashMap::<i32, i32>::new();
map.put(1, 1);
map.put(1, 2);
map.put(2, 3);
assert_eq!(map.get(&1), Some(&2));
println!("key 1 value is {}", *map.get(&1).unwrap());
map.foreach(|k, v| {
println!("boxmap foreach key {} value is {}", *k, *v);
});
}