MCPcopy Create free account
hub / github.com/carsonpo/haystackdb / test_repeated_insertions_same_key

Function test_repeated_insertions_same_key

tests/trees.rs:267–281  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

265
266 #[test]
267 fn test_repeated_insertions_same_key() {
268 let path = PathBuf::from_str("tests/data")
269 .unwrap()
270 .join(uuid::Uuid::new_v4().to_string())
271 .join("test.bin");
272 fs::create_dir_all(&path.parent().unwrap()).expect("Failed to create directory");
273
274 let mut tree = Tree::new(path).unwrap();
275
276 tree.insert(1, "one".to_string()).unwrap();
277 tree.insert(1, "still_one".to_string()).unwrap(); // Try inserting the same key
278
279 // Check that the value has not been replaced if replacing isn't supported
280 assert_eq!(tree.search(1).unwrap(), Some("still_one".to_string()));
281 }
282
283 // #[test]
284 // fn test_insertion_order_independence() {

Callers

nothing calls this directly

Calls 1

insertMethod · 0.45

Tested by

no test coverage detected