diff options
Diffstat (limited to 'TestAufgabeFFP6.hs')
| -rw-r--r-- | TestAufgabeFFP6.hs | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/TestAufgabeFFP6.hs b/TestAufgabeFFP6.hs index 77cae92..c435045 100644 --- a/TestAufgabeFFP6.hs +++ b/TestAufgabeFFP6.hs | |||
| @@ -22,8 +22,30 @@ cases1 = TestLabel "eval" $ TestList [ | |||
| 22 | (eval (array (1,6) [(1,4), (2,2), (3,3), (4,-4), (5,5), (6,2)]) (array (1,5) [(1,(*)), (2,(-)), (3,(+)), (4,(./.)), (5,(+))])) | 22 | (eval (array (1,6) [(1,4), (2,2), (3,3), (4,-4), (5,5), (6,2)]) (array (1,5) [(1,(*)), (2,(-)), (3,(+)), (4,(./.)), (5,(+))])) |
| 23 | ] | 23 | ] |
| 24 | 24 | ||
| 25 | instance Eq (Integer -> Integer -> Integer) where | ||
| 26 | (==) op1 op2 = ((op1 3 3) - (op2 3 3)) == 0 | ||
| 27 | instance Eq (Int -> Int -> Int) where | ||
| 28 | (==) op1 op2 = ((op1 3 3) - (op2 3 3)) == 0 | ||
| 29 | |||
| 30 | cases2 = TestLabel "yield_bt" $ TestList [ | ||
| 31 | TestCase $ assertEqual "yield_bt1" (yield_bt (array (1,3) [(1,1),(2,2),(3,3)] ) 6) | ||
| 32 | [array (1,2) [(1,(+)),(2,(+))],array (1,2) [(1,(*)),(2,(*))]], | ||
| 33 | TestCase $ assertEqual "yield_bt2" (yield_bt (array (1,3) [(1,1),(2,2),(3,3)] ) 4) [], | ||
| 34 | TestCase $ assertEqual "yield_bt3" (yield_bt (array (1,3) [(1,1),(2,2),(3,3)]) 0) | ||
| 35 | [(array (1,2) [(1,(+)),(2,(-))]),(array (1,2) [(1,(*)),(2,(./.))]),(array (1,2) [(1,(./.)),(2,(*))]),(array (1,2) [(1,(./.)),(2,(./.))])] | ||
| 36 | ] | ||
| 37 | |||
| 38 | |||
| 39 | cases3 = TestLabel "yield_gtf" $ TestList [ | ||
| 40 | TestCase $ assertEqual "yield_gtf1" (yield_gtf (array (1,3) [(1,1),(2,2),(3,3)] ) 6) | ||
| 41 | [array (1,2) [(1,(+)),(2,(+))],array (1,2) [(1,(*)),(2,(*))]], | ||
| 42 | TestCase $ assertEqual "yield_gtf2" (yield_gtf (array (1,3) [(1,1),(2,2),(3,3)] ) 4) [], | ||
| 43 | TestCase $ assertEqual "yield_gtf3" (yield_gtf (array (1,3) [(1,1),(2,2),(3,3)]) 0) | ||
| 44 | [(array (1,2) [(1,(+)),(2,(-))]),(array (1,2) [(1,(*)),(2,(./.))]),(array (1,2) [(1,(./.)),(2,(*))]),(array (1,2) [(1,(./.)),(2,(./.))])] | ||
| 45 | ] | ||
| 46 | |||
| 25 | tests :: [Test] | 47 | tests :: [Test] |
| 26 | tests = [cases1] | 48 | tests = [cases1, cases2, cases3] |
| 27 | 49 | ||
| 28 | main = do | 50 | main = do |
| 29 | forM tests $ \test -> | 51 | forM tests $ \test -> |
