#[cfg(all(target_arch = "wasm32", target_os = "unknown"))]
use wasm_bindgen_test::wasm_bindgen_test as test;
use kovan_map::{HashMap, HopscotchMap};
#[test]
fn hashmap_force_remove_basic() {
let map: HashMap<String, u64> = HashMap::new();
assert_eq!(map.force_remove("missing"), None);
map.insert("k".to_string(), 1);
map.insert("k".to_string(), 2);
assert_eq!(map.force_remove("k"), Some(2), "returns the latest version");
assert!(!map.contains_key("k"));
assert_eq!(map.force_remove("k"), None, "idempotent once evicted");
}
#[test]
fn hopscotch_force_remove_basic() {
let map: HopscotchMap<String, u64> = HopscotchMap::new();
assert_eq!(map.force_remove("missing"), None);
map.insert("k".to_string(), 1);
map.insert("k".to_string(), 2);
assert_eq!(map.force_remove("k"), Some(2));
assert!(map.get("k").is_none());
assert_eq!(map.force_remove("k"), None);
}