From ec81f81ab3a035a04367430dc3f4c37afe8481e3 Mon Sep 17 00:00:00 2001 From: Bodigrim Date: Tue, 17 Oct 2023 22:56:03 +0100 Subject: [PATCH 1/2] ppDiff: add a test case --- test/Test.hs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/test/Test.hs b/test/Test.hs index e725805..ada891c 100644 --- a/test/Test.hs +++ b/test/Test.hs @@ -38,6 +38,11 @@ main = defaultMain [ testGroup "sub props" [ testProperty "self generates empty" $ forAll shortLists prop_ppDiffEqual, --testProperty "compare our lists with diff" $ forAll2 shortLists prop_ppDiffShort, testProperty "compare random with diff" prop_ppDiffR, + testProperty "compare with diff, issue #5" $ prop_ppDiffR + (DiffInput + { diLeft = ["1","2","3","4","","5","6","7"] + , diRight = ["1","2","3","q","b","u","l","","XXX6",""] + }), testProperty "test parse" prop_parse, testProperty "test context" prop_context_diff ] From af7b3b867d1598aea498841bcd8de0bfa1e958b0 Mon Sep 17 00:00:00 2001 From: Bodigrim Date: Tue, 17 Oct 2023 23:07:13 +0100 Subject: [PATCH 2/2] Make prop_ppDiffR more robust --- test/Test.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/Test.hs b/test/Test.hs index ada891c..1fa2126 100644 --- a/test/Test.hs +++ b/test/Test.hs @@ -143,7 +143,7 @@ prop_ppDiffR (DiffInput le ri) = utilDiff= unsafePerformIO (runDiff (unlines le) (unlines ri)) in cover 90 (haskDiff == utilDiff) "exact match" $ classify (haskDiff == utilDiff) "exact match" - (div ((length haskDiff)*100) (length utilDiff) < 110) -- less than 10% bigger + (div ((length (lines haskDiff))*100) (length (lines utilDiff)) < 110) -- less than 10% bigger where runDiff left right = do leftFile <- writeTemp left