INNER CODE UNIT · Rust

get_mut_returns_none_for_non_existent_item

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

    fn get_mut_returns_none_for_non_existent_item() {
        let mut hash: HashMapId<i32> = HashMapId::new();
        let item = hash.get_mut(0);
        assert!(item.is_none());
    }

    // add

    #[test]
    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() {

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…