From 41cb7d2abcb144ca20e5134b9474af122a3aabf3 Mon Sep 17 00:00:00 2001 From: Steffen Jost Date: Wed, 18 Oct 2023 15:02:20 +0000 Subject: [PATCH] chore(sap): more test for compileBlocks --- test/Handler/SAPSpec.hs | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/test/Handler/SAPSpec.hs b/test/Handler/SAPSpec.hs index a7e7798a0..ffa84ff18 100644 --- a/test/Handler/SAPSpec.hs +++ b/test/Handler/SAPSpec.hs @@ -96,7 +96,7 @@ spec = do compileBlocks wA wE [(w0,True),(w1,True),(w1,False),(w1,True),(w1,False),(w2,True),(w3,True)] `shouldBe` [(wA,w1),(w2,wE)] compileBlocks wA wE [(w0,False),(w1,False),(w2,True),(w3,False),(w4,True)] `shouldBe` [(wA,w1),(w2,w3),(w4,wE)] compileBlocks wA wE [(w1,False),(w2,True),(wF,True ),(w3,False)] `shouldBe` [(wA,w1),(w2,w3)] - compileBlocks wA wE [(w1,True),(w2,False),(wF,False),(w3,True)] `shouldBe` [(wA,w2),(w3,wE)] + compileBlocks wA wE [(w1,True),(w2,False),(wF,False),(w3,True)] `shouldBe` [(wA,w2),(w3,wE)] compileBlocks wA wE [(w2,False),(wF,False),(w3,True)] `shouldBe` [(wA,w2),(w3,wE)] compileBlocks wA wE [(w2,False),(wF,False)] `shouldBe` [(wA,w2) ] @@ -117,9 +117,11 @@ spec = do d3 <- arbitrary `suchThat` (d1 <) d4 <- arbitrary `suchThat` (d3 <) return (d1,d2,d3,d4) - b <- generate arbitrary - let test = compileBlocks d1 d2 [(d3,b),(d4,not b)] - result | b = [(d1, min d2 d4)] - | d2 > d4 = [(d1,d3),(d4,d2)] - | otherwise = [(d1, min d2 d3)] + b3 <- generate arbitrary + b4 <- generate arbitrary + let test = compileBlocks d1 d2 [(d3,b3),(d4,b4)] + result | b3, b4 = [(d1, d2)] + | b3 = [(d1, min d2 d4)] + | b4, d2 > d4 = [(d1,d3),(d4,d2)] + | otherwise = [(d1, min d2 d3)] test `shouldBe` result