fune/third_party/rust/linked-hash-map/tests/heapsize.rs
David Teller 7160366b8c Bug 1437004 - Vendored Rust dependencies;r=froydnj
MozReview-Commit-ID: Grf1bKIx2iT

--HG--
extra : rebase_source : 8013a66263a3a014944b0815ff9bc7d8ac0ad9a3
2018-04-04 14:14:26 +02:00

23 lines
574 B
Rust

#![cfg(feature = "heapsize_impl")]
extern crate heapsize;
extern crate linked_hash_map;
use linked_hash_map::LinkedHashMap;
use heapsize::HeapSizeOf;
#[test]
fn empty() {
assert_eq!(LinkedHashMap::<String, String>::new().heap_size_of_children(), 0);
}
#[test]
fn nonempty() {
let mut map = LinkedHashMap::new();
map.insert("hello".to_string(), "world".to_string());
map.insert("hola".to_string(), "mundo".to_string());
map.insert("bonjour".to_string(), "monde".to_string());
map.remove("hello");
assert!(map.heap_size_of_children() != 0);
}