| 253 | |
| 254 | #[test] |
| 255 | fn large_data_roundtrip() { |
| 256 | let line = "2024-01-15 ERROR database connection timeout host=db-prod-01 retry=3\n"; |
| 257 | let data: Vec<u8> = line.as_bytes().repeat(1000); |
| 258 | let encoded = encode(&data).unwrap(); |
| 259 | let decoded = decode(&encoded).unwrap(); |
| 260 | assert_eq!(decoded, data); |
| 261 | |
| 262 | let ratio = data.len() as f64 / encoded.len() as f64; |
| 263 | assert!( |
| 264 | ratio > 5.0, |
| 265 | "repetitive logs should compress >5x with zstd, got {ratio:.1}x" |
| 266 | ); |
| 267 | } |
| 268 | |
| 269 | #[test] |
| 270 | fn high_compression_level() { |