INNER CODE UNIT · Rust

get_returns_none_for_non_existent_item

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

    fn get_returns_none_for_non_existent_item() {
        let hash: HashMapId<i32> = HashMapId::new();
        let item = hash.get(10);
        assert!(item.is_none());
    }

    #[test]
    fn get_returns_reference_to_item() {
        let mut hash: HashMapId<i32> = HashMapId::new();
        let value = 10;
        let id = hash.add(value);
        let item = hash.get(id);
        assert_eq!(item, Some(&value));
    }

    // get_mut

    #[test]

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…