From a557386dec65099c7ae3c9a5694fb42baf9b354d Mon Sep 17 00:00:00 2001 From: "Sergey \"Shnatsel\" Davidoff" Date: Sun, 1 Dec 2024 08:31:49 +0000 Subject: [PATCH] Add an equivalence test for the Paeth implementations --- src/filter.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/filter.rs b/src/filter.rs index 856008ec..c56ff84a 100644 --- a/src/filter.rs +++ b/src/filter.rs @@ -1157,6 +1157,18 @@ mod test { } } + #[test] + fn paeth_impls_are_equivalent() { + use super::{filter_paeth, filter_paeth_decode}; + for a in 0..=255 { + for b in 0..=255 { + for c in 0..=255 { + assert_eq!(filter_paeth(a, b, c), filter_paeth_decode(a, b, c)); + } + } + } + } + #[test] fn roundtrip_ascending_previous_line() { // A multiple of 8, 6, 4, 3, 2, 1