INNER CODE UNIT · Rust

add_panics_on_integer_overflow

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

    fn add_panics_on_integer_overflow() {
        let mut hash: HashMapId<i32> = HashMapId::new();
        let item = 10;
        hash.id_seed = std::u64::MAX;
        hash.add(item);
    }

    // remove

    #[test]
    fn remove_handles_non_existent_id() {
        let mut hash: HashMapId<i32> = HashMapId::new();
        let result = hash.remove(1);
        assert!(result.is_none());
    }

    #[test]
    fn remove_returns_removed_value() {

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…