()
| 119 | |
| 120 | #[test] |
| 121 | fn hamming_fast_matches_simple() { |
| 122 | // 128 dimensions = 16 bytes = 2 u64 chunks. |
| 123 | let a_vec: Vec<f32> = (0..128) |
| 124 | .map(|i| if i % 3 == 0 { 1.0 } else { -1.0 }) |
| 125 | .collect(); |
| 126 | let b_vec: Vec<f32> = (0..128) |
| 127 | .map(|i| if i % 5 == 0 { 1.0 } else { -1.0 }) |
| 128 | .collect(); |
| 129 | let a = encode(&a_vec); |
| 130 | let b = encode(&b_vec); |
| 131 | |
| 132 | let slow = hamming_distance(&a, &b); |
| 133 | let fast = hamming_distance_fast(&a, &b); |
| 134 | assert_eq!(slow, fast); |
| 135 | } |
| 136 | |
| 137 | #[test] |
| 138 | fn high_dimensional_encoding() { |
nothing calls this directly
no test coverage detected