From c53a5ab11ad25c41d3d20e887245c021307a0cc7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Xavier=20G=C3=B3ngora?= Date: Mon, 3 Aug 2026 13:32:12 -0600 Subject: [PATCH 1/2] Fix division by zero error in `prop_ppDiffR` --- test/Test.hs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test/Test.hs b/test/Test.hs index aafd26b..5e753f6 100644 --- a/test/Test.hs +++ b/test/Test.hs @@ -164,7 +164,8 @@ prop_ppDiffR (DiffInput le ri) = let haskDiff=ppDiff $ getGroupedDiff le ri utilDiff= unsafePerformIO (runDiff (unlines le) (unlines ri)) in cover 90 (haskDiff == utilDiff) "exact match" $ - classify (haskDiff == utilDiff) "exact match" + classify (haskDiff == utilDiff) "exact match" $ + not (null utilDiff) ==> (div ((length (lines haskDiff))*100) (length (lines utilDiff)) < 110) -- less than 10% bigger where runDiff left right = From 9787bdfdb84bd3c9a0382c2fb3930b1b4bea2464 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Xavier=20G=C3=B3ngora?= Date: Mon, 3 Aug 2026 16:58:29 -0600 Subject: [PATCH 2/2] Avoid discarding edge cases by using 1 as lower bound MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Facundo Domínguez --- test/Test.hs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/test/Test.hs b/test/Test.hs index 5e753f6..6492943 100644 --- a/test/Test.hs +++ b/test/Test.hs @@ -165,8 +165,10 @@ prop_ppDiffR (DiffInput le ri) = utilDiff= unsafePerformIO (runDiff (unlines le) (unlines ri)) in cover 90 (haskDiff == utilDiff) "exact match" $ classify (haskDiff == utilDiff) "exact match" $ - not (null utilDiff) ==> - (div ((length (lines haskDiff))*100) (length (lines utilDiff)) < 110) -- less than 10% bigger + div + (length (lines haskDiff)*100) + (max 1 $ length $ lines utilDiff) + < 110 -- less than 10% bigger where runDiff left right = do leftFile <- writeTemp left