#[allow(dead_code)]
pub const LOSSLESS_E7_BASELINES: &[(&str, usize)] = &[
("10.png", 390472),
("11.png", 417203),
("12.png", 358848),
("13.png", 554402),
("14.png", 457154),
];
#[allow(dead_code)]
pub const LOSSY_D1_E7_BASELINES: &[(&str, usize, f64)] = &[
("10.png", 77453, 0.00049502),
("11.png", 98927, 0.00065629),
("12.png", 70127, 0.00056687),
("13.png", 148333, 0.00082476),
("14.png", 117385, 0.00068464),
];
#[allow(dead_code)]
pub const LOSSY_D2_E7_BASELINES: &[(&str, usize, f64)] = &[
("10.png", 43487, 0.00121446),
("11.png", 57664, 0.00206973),
("12.png", 38595, 0.00161241),
("13.png", 92961, 0.00281940),
("14.png", 71073, 0.00211092),
];
pub const SIZE_TOLERANCE_PERCENT: f64 = 5.0;
pub fn size_within_tolerance(actual: usize, expected: usize) -> bool {
let tolerance = (expected as f64 * SIZE_TOLERANCE_PERCENT / 100.0) as usize;
actual <= expected + tolerance
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn test_tolerance_calculation() {
assert!(size_within_tolerance(390472, 390472)); assert!(size_within_tolerance(400000, 390472)); assert!(!size_within_tolerance(450000, 390472)); }
}