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

Function test_remove_nonexistent_key_raises_error

rust/tests/bplus_tree.rs:1096–1109  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1094
1095#[test]
1096fn test_remove_nonexistent_key_raises_error() {
1097 let mut tree = BPlusTreeMap::new(4).unwrap();
1098 tree.insert(1, "one".to_string());
1099 tree.insert(2, "two".to_string());
1100
1101 // Try to remove non-existent key
1102 let result = tree.remove_item(&3);
1103 assert_eq!(result, Err(BPlusTreeError::KeyNotFound));
1104
1105 // Tree should be unchanged
1106 assert_eq!(tree.len(), 2);
1107 assert_eq!(tree.get(&1), Some(&"one".to_string()));
1108 assert_eq!(tree.get(&2), Some(&"two".to_string()));
1109}
1110
1111// ============================================================================
1112// NEW TESTS - Iterator Support

Callers

nothing calls this directly

Calls 2

remove_itemMethod · 0.80
insertMethod · 0.45

Tested by

no test coverage detected