()
| 286 | |
| 287 | #[test] |
| 288 | fn test_streaming_topk_basic() { |
| 289 | let mut topk = StreamingTopK::new(3); |
| 290 | |
| 291 | // Add rows with different scores |
| 292 | topk.add(create_test_row(1, 10.0), 10.0); |
| 293 | topk.add(create_test_row(2, 20.0), 20.0); |
| 294 | topk.add(create_test_row(3, 5.0), 5.0); |
| 295 | topk.add(create_test_row(4, 15.0), 15.0); |
| 296 | |
| 297 | let results = topk.into_results(); |
| 298 | |
| 299 | assert_eq!(results.len(), 3); |
| 300 | |
| 301 | // Should keep top 3: 20.0, 15.0, 10.0 |
| 302 | let scores: Vec<f64> = results |
| 303 | .iter() |
| 304 | .map(|r| r.get_text_score().unwrap()) |
| 305 | .collect(); |
| 306 | |
| 307 | assert_eq!(scores[0], 20.0); |
| 308 | assert_eq!(scores[1], 15.0); |
| 309 | assert_eq!(scores[2], 10.0); |
| 310 | } |
| 311 | |
| 312 | #[test] |
| 313 | fn test_streaming_topk_with_many_rows() { |
nothing calls this directly
no test coverage detected