INNER CODE UNIT · Rust

add_adds_item_to_store

lunatic-solutions/lunatic · crates/hash-map-id/src/lib.rs:101

    fn add_adds_item_to_store() {
        let mut hash: HashMapId<i32> = HashMapId::new();
        let item = 10;
        let id = hash.add(item);
        assert_eq!(hash.get(id), Some(&item));
    }

    #[test]
    fn add_can_add_multiple_items() {
        let mut hash: HashMapId<i32> = HashMapId::new();
        let item1 = 10;
        let item2 = 20;
        let id1 = hash.add(item1);
        let id2 = hash.add(item2);
        assert_ne!(id1, id2);
        assert_eq!(hash.get(id1), Some(&item1));
        assert_eq!(hash.get(id2), Some(&item2));
    }

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…