()
| 370 | |
| 371 | #[test] |
| 372 | fn exact_results() { |
| 373 | let mut idx = FlatIndex::new(2, DistanceMetric::Cosine); |
| 374 | idx.insert(vec![1.0, 0.0]); |
| 375 | idx.insert(vec![0.0, 1.0]); |
| 376 | idx.insert(vec![1.0, 1.0]); |
| 377 | |
| 378 | let results = idx.search(&[1.0, 0.0], 1); |
| 379 | assert_eq!(results.len(), 1); |
| 380 | assert_eq!(results[0].id, 0); |
| 381 | } |
| 382 | |
| 383 | #[test] |
| 384 | fn empty_search() { |