INNER CODE UNIT · Rust

remove_returns_removed_value

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

    fn remove_returns_removed_value() {
        let mut hash: HashMapId<i32> = HashMapId::new();
        let value = 10;
        let id = hash.add(value);
        let removed_value = hash.remove(id);
        assert_eq!(removed_value, Some(value));
    }

    #[test]
    fn remove_removes_id() {
        let mut hash: HashMapId<i32> = HashMapId::new();
        let id = hash.add(10);
        hash.remove(id);
        assert_eq!(hash.get(id), None);
    }

    #[test]
    fn remove_does_not_affect_other_items() {

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…