collections.rs 630 B
use std::collections::HashMap;
use weirdboi_utils::hashmap;
#[test]
fn it_creates_empty_hashmap() {
let empty: HashMap<(), ()> = hashmap!();
assert!(empty.is_empty());
assert_eq!(empty.capacity(), 0);
}
#[test]
fn it_infers_hashmap_types() {
let map = hashmap! {
"ffoo" => 123usize,
};
assert_eq!(map.len(), 1);
assert_eq!(map.get("ffoo"), Some(&123));
}
#[test]
fn it_creates_hashmap_with_capacity() {
let map = hashmap! {
"foo" => 123,
"bar" => 456,
"baz" => 789;
capacity: 32
};
assert_eq!(map.len(), 3);
assert!(map.capacity() >= 32);
}