MCPcopy Create free account
hub / github.com/KentBeck/BPlusTree3 / test_remove_nonexistent_key

Function test_remove_nonexistent_key

rust/tests/remove_operations.rs:485–505  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

483
484#[test]
485fn test_remove_nonexistent_key() {
486 let mut tree = create_tree_capacity_int(4);
487
488 // Insert some test data
489 tree.insert(10, 100);
490 tree.insert(20, 200);
491 tree.insert(30, 300);
492
493 // Test removing non-existing key
494 assert_eq!(tree.remove(&99), None);
495 assert_eq!(tree.len(), 3); // Length should remain unchanged
496
497 // All original keys should still exist
498 assert_eq!(tree.get(&10), Some(&100));
499 assert_eq!(tree.get(&20), Some(&200));
500 assert_eq!(tree.get(&30), Some(&300));
501
502 // Validate tree invariants
503 tree.validate()
504 .expect("Tree should maintain invariants after failed remove");
505}

Callers

nothing calls this directly

Calls 3

create_tree_capacity_intFunction · 0.85
validateMethod · 0.80
insertMethod · 0.45

Tested by

no test coverage detected