MCPcopy Index your code
hub / github.com/carsonpo/haystackdb / test_complex_insertions

Function test_complex_insertions

tests/trees.rs:226–242  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

224
225 #[test]
226 fn test_complex_insertions() {
227 let path = PathBuf::from_str("tests/data")
228 .unwrap()
229 .join(uuid::Uuid::new_v4().to_string())
230 .join("test.bin");
231 fs::create_dir_all(&path.parent().unwrap()).expect("Failed to create directory");
232 let mut tree = Tree::new(path).expect("Failed to create tree");
233
234 for i in 0..100 {
235 tree.insert(i, format!("value_{}", i))
236 .expect(format!("Failed to insert {}", i).as_str());
237 }
238
239 for i in 0..100 {
240 assert_eq!(tree.search(i).unwrap(), Some(format!("value_{}", i)));
241 }
242 }
243
244 #[test]
245 fn test_large_scale_insert_search() {

Callers

nothing calls this directly

Calls 1

insertMethod · 0.45

Tested by

no test coverage detected