| 591 | |
| 592 | #[test] |
| 593 | fn large_dataset() { |
| 594 | let mut values = Vec::with_capacity(100_000); |
| 595 | let mut rng: u64 = 12345; |
| 596 | for _ in 0..100_000 { |
| 597 | rng = rng.wrapping_mul(6364136223846793005).wrapping_add(1); |
| 598 | let val = ((rng >> 33) as f64 / (u32::MAX as f64)) * 1000.0; |
| 599 | let val = (val * 100.0).round() / 100.0; // 2 decimal places |
| 600 | values.push(val); |
| 601 | } |
| 602 | let encoded = encode(&values); |
| 603 | let decoded = decode(&encoded).unwrap(); |
| 604 | assert_eq!(decoded.len(), values.len()); |
| 605 | for (i, (a, b)) in values.iter().zip(decoded.iter()).enumerate() { |
| 606 | assert_eq!(a.to_bits(), b.to_bits(), "mismatch at {i}"); |
| 607 | } |
| 608 | } |
| 609 | } |