chore(sap): more test for compileBlocks

This commit is contained in:
Steffen Jost 2023-10-18 15:02:20 +00:00
parent fde97b048a
commit 41cb7d2abc

View File

@ -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