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

Function test_complex_tree_operations

tests/trees.rs:129–145  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

127
128 #[test]
129 fn test_complex_tree_operations() {
130 let path = PathBuf::from_str("tests/data")
131 .unwrap()
132 .join(uuid::Uuid::new_v4().to_string())
133 .join("test.bin");
134 fs::create_dir_all(&path.parent().unwrap()).expect("Failed to create directory");
135
136 fs::create_dir_all(&path.parent().unwrap()).expect("Failed to create directory");
137
138 let mut tree = Tree::new(path).expect("Failed to create tree");
139 for i in 0..10 {
140 tree.insert(i, format!("value_{}", i)).unwrap();
141 }
142 assert_eq!(tree.search(5).unwrap(), Some("value_5".to_string()));
143 assert_eq!(tree.search(9).unwrap(), Some("value_9".to_string()));
144 assert_eq!(tree.search(10).unwrap(), None);
145 }
146
147 #[test]
148 fn test_serialization_and_deserialization() {

Callers

nothing calls this directly

Calls 1

insertMethod · 0.45

Tested by

no test coverage detected