()
| 508 | |
| 509 | #[test] |
| 510 | fn outlier_ordering_popcnt() { |
| 511 | // Outliers at dims [3, 17, 40] — bit 17 should be the second entry. |
| 512 | let bitmask: u64 = (1 << 3) | (1 << 17) | (1 << 40); |
| 513 | let header = make_header(QuantMode::Sq8, 64, bitmask); |
| 514 | let packed = vec![0u8; 64]; |
| 515 | let outliers = [(3u32, 100.0f32), (17u32, 200.0f32), (40u32, 300.0f32)]; |
| 516 | let vec = UnifiedQuantizedVector::new(header, &packed, &outliers).unwrap(); |
| 517 | |
| 518 | // outlier_at(17) should return the second entry (value 200.0). |
| 519 | let (dim, val) = vec.outlier_at(17).expect("dim 17 should be an outlier"); |
| 520 | assert_eq!(dim, 17); |
| 521 | assert!((val - 200.0).abs() < f32::EPSILON); |
| 522 | |
| 523 | let (dim0, val0) = vec.outlier_at(3).expect("dim 3 should be an outlier"); |
| 524 | assert_eq!(dim0, 3); |
| 525 | assert!((val0 - 100.0).abs() < f32::EPSILON); |
| 526 | |
| 527 | let (dim2, val2) = vec.outlier_at(40).expect("dim 40 should be an outlier"); |
| 528 | assert_eq!(dim2, 40); |
| 529 | assert!((val2 - 300.0).abs() < f32::EPSILON); |
| 530 | } |
| 531 | |
| 532 | #[test] |
| 533 | fn out_of_range_slot_returns_none() { |
nothing calls this directly
no test coverage detected