()
| 165 | |
| 166 | #[test] |
| 167 | fn f64_compression_ratio() { |
| 168 | // Pcodec should compress numerical data better than raw. |
| 169 | let mut values = Vec::with_capacity(10_000); |
| 170 | let mut rng: u64 = 42; |
| 171 | for _ in 0..10_000 { |
| 172 | rng = rng.wrapping_mul(6364136223846793005).wrapping_add(1); |
| 173 | values.push(((rng >> 33) as f64 / (u32::MAX as f64)) * 1000.0); |
| 174 | } |
| 175 | let encoded = encode_f64(&values).unwrap(); |
| 176 | let raw_size = values.len() * 8; |
| 177 | let ratio = raw_size as f64 / encoded.len() as f64; |
| 178 | assert!( |
| 179 | ratio > 1.1, |
| 180 | "pcodec should compress random-ish floats >1.1x, got {ratio:.2}x" |
| 181 | ); |
| 182 | } |
| 183 | |
| 184 | #[test] |
| 185 | fn i64_empty() { |
nothing calls this directly
no test coverage detected