From 4f0bce5fca2eb654fedbe31d064ac53db2a6bd97 Mon Sep 17 00:00:00 2001 From: Ivan Smirnov Date: Mon, 3 Jan 2022 17:43:28 +0300 Subject: [PATCH] qoi-bench: only abort on r/t fail if it's qoi-fast --- qoi-bench/src/main.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/qoi-bench/src/main.rs b/qoi-bench/src/main.rs index 277079a..9c0c60c 100644 --- a/qoi-bench/src/main.rs +++ b/qoi-bench/src/main.rs @@ -250,12 +250,12 @@ impl ImageBench { let encoded = encoded?; let (decoded, t_decode) = timeit(|| C::decode(&encoded, img)); let decoded = decoded?; - assert_eq!( - decoded.as_slice(), - img.data.as_slice(), - "{}: decoded data doesn't roundtrip", - C::name() - ); + let roundtrip = decoded.as_slice() == img.data.as_slice(); + if C::name() == "qoi-fast" { + assert!(roundtrip, "{}: decoded data doesn't roundtrip", C::name()); + } else { + ensure!(roundtrip, "{}: decoded data doesn't roundtrip", C::name()); + } let n_encode = (sec_allowed / 2. / t_encode.as_secs_f64()).max(2.).ceil() as usize; let mut encode_tm = Vec::with_capacity(n_encode);