()
| 351 | |
| 352 | #[test] |
| 353 | fn repeated_bytes() { |
| 354 | let data = vec![0u8; 10_000]; |
| 355 | let encoded = encode(&data); |
| 356 | let decoded = decode(&encoded).unwrap(); |
| 357 | assert_eq!(decoded, data); |
| 358 | |
| 359 | // Highly repetitive → near-zero entropy → excellent compression. |
| 360 | let ratio = data.len() as f64 / encoded.len() as f64; |
| 361 | assert!( |
| 362 | ratio > 2.0, |
| 363 | "repeated bytes should compress >2x, got {ratio:.1}x" |
| 364 | ); |
| 365 | } |
| 366 | |
| 367 | #[test] |
| 368 | fn text_data() { |