| 192 | |
| 193 | #[test] |
| 194 | fn test_insert_duplicate_keys() { |
| 195 | let path = PathBuf::from_str("tests/data") |
| 196 | .unwrap() |
| 197 | .join(uuid::Uuid::new_v4().to_string()) |
| 198 | .join("test.bin"); |
| 199 | fs::create_dir_all(&path.parent().unwrap()).expect("Failed to create directory"); |
| 200 | |
| 201 | fs::create_dir_all(&path.parent().unwrap()).expect("Failed to create directory"); |
| 202 | let mut tree = Tree::new(path).expect("Failed to create tree"); |
| 203 | |
| 204 | tree.insert(1, "one".to_string()).unwrap(); |
| 205 | tree.insert(1, "one_duplicate".to_string()).unwrap(); // Assuming overwrite behavior |
| 206 | |
| 207 | assert_eq!(tree.search(1).unwrap(), Some("one_duplicate".to_string())); |
| 208 | } |
| 209 | |
| 210 | #[test] |
| 211 | fn test_search_non_existent_key() { |