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

Function test_get_mut

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

Source from the content-addressed store, hash-verified

2160
2161#[test]
2162fn test_get_mut() {
2163 let mut tree = BPlusTreeMap::new(4).unwrap();
2164 tree.insert(1, "one".to_string());
2165 tree.insert(2, "two".to_string());
2166
2167 // Get a mutable reference and modify the value
2168 if let Some(value) = tree.get_mut(&1) {
2169 *value = "ONE".to_string();
2170 }
2171
2172 assert_eq!(tree.get(&1), Some(&"ONE".to_string()));
2173 assert_eq!(tree.get(&2), Some(&"two".to_string()));
2174
2175 // Test with a non-existent key
2176 assert_eq!(tree.get_mut(&3), None);
2177}
2178
2179#[test]
2180fn test_arena_consistency() {

Callers

nothing calls this directly

Calls 2

insertMethod · 0.45
get_mutMethod · 0.45

Tested by

no test coverage detected