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

Function test_large_scale_insert_search

tests/trees.rs:245–264  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

243
244 #[test]
245 fn test_large_scale_insert_search() {
246 let path = PathBuf::from_str("tests/data")
247 .unwrap()
248 .join(uuid::Uuid::new_v4().to_string())
249 .join("test.bin");
250 fs::create_dir_all(&path.parent().unwrap()).expect("Failed to create directory");
251
252 fs::create_dir_all(&path.parent().unwrap()).expect("Failed to create directory");
253 let mut tree = Tree::new(path).unwrap();
254
255 let num_items = 1000;
256 for i in 0..num_items {
257 tree.insert(i, format!("value_{}", i))
258 .expect(format!("Failed to insert {}", i).as_str());
259 }
260
261 for i in 0..num_items {
262 assert_eq!(tree.search(i).unwrap(), Some(format!("value_{}", i)));
263 }
264 }
265
266 #[test]
267 fn test_repeated_insertions_same_key() {

Callers

nothing calls this directly

Calls 1

insertMethod · 0.45

Tested by

no test coverage detected