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

Function test_insert_search_leaf

tests/trees.rs:173–189  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

171
172 #[test]
173 fn test_insert_search_leaf() {
174 let path = PathBuf::from_str("tests/data")
175 .unwrap()
176 .join(uuid::Uuid::new_v4().to_string())
177 .join("test.bin");
178 fs::create_dir_all(&path.parent().unwrap()).expect("Failed to create directory");
179
180 fs::create_dir_all(&path.parent().unwrap()).expect("Failed to create directory");
181 let mut tree = Tree::new(path).expect("Failed to create tree");
182
183 tree.insert(1, "one".to_string()).unwrap();
184 tree.insert(2, "two".to_string()).unwrap();
185
186 assert_eq!(tree.search(1).unwrap(), Some("one".to_string()));
187 assert_eq!(tree.search(2).unwrap(), Some("two".to_string()));
188 assert_eq!(tree.search(3).unwrap(), None);
189 }
190
191 // Edge Cases
192

Callers

nothing calls this directly

Calls 1

insertMethod · 0.45

Tested by

no test coverage detected