()
| 366 | |
| 367 | #[test] |
| 368 | fn text_data() { |
| 369 | let text = b"the quick brown fox jumps over the lazy dog. "; |
| 370 | let data: Vec<u8> = text.iter().copied().cycle().take(10_000).collect(); |
| 371 | let encoded = encode(&data); |
| 372 | let decoded = decode(&encoded).unwrap(); |
| 373 | assert_eq!(decoded, data); |
| 374 | |
| 375 | let ratio = data.len() as f64 / encoded.len() as f64; |
| 376 | assert!(ratio > 1.5, "text should compress >1.5x, got {ratio:.1}x"); |
| 377 | } |
| 378 | |
| 379 | #[test] |
| 380 | fn uniform_random_data() { |