summaryrefslogtreecommitdiffstats
path: root/TestAufgabeFFP5.hs
diff options
context:
space:
mode:
Diffstat (limited to 'TestAufgabeFFP5.hs')
-rw-r--r--TestAufgabeFFP5.hs71
1 files changed, 66 insertions, 5 deletions
diff --git a/TestAufgabeFFP5.hs b/TestAufgabeFFP5.hs
index 03cd00b..256c1ea 100644
--- a/TestAufgabeFFP5.hs
+++ b/TestAufgabeFFP5.hs
@@ -5,17 +5,78 @@ import Control.Monad
5import Data.Array 5import Data.Array
6import AufgabeFFP5 6import AufgabeFFP5
7 7
8a :: Array Int Int
9a = array (1,9) [(1,3),(2,(-5)),(3,0),(4,9),(5,2),(6,(-1)),(7,2),(8,(-5)),(9,1)]
10
11b :: Array Int Int
12b = array (1,9) [(1,3),(2,(-1)),(3,(-2)),(4,9),(5,2),(6,(-1)),(7,2),(8,0),(9,(-1))]
13
14c :: Array Int Int
15c = array (1,5) [(1,2),(2,3),(3,(-10)),(4,1),(5,4)]
16
17d :: Array Int Int
18d = array (1,6) [(1, (-3)), (2, 1), (3, 10), (4, (-5)), (5, 8), (6, 7)]
19
20minA :: Array Int Int
21minA = array (0,0) [(0,0)]
22
8cases1 = TestLabel "mas" $ TestList [ 23cases1 = TestLabel "mas" $ TestList [
9 TestCase $ assertEqual "exercise example" 24 TestCase $ assertEqual "mas a"
10 12 25 12
11 (mas $ array (1,9) [(1,3),(2,(-5)),(3,0),(4,9),(5,2),(6,(-1)),(7,2),(8,(-5)),(9,1)]), 26 (mas a),
12 TestCase $ assertEqual "short list" 27 TestCase $ assertEqual "mas b"
28 12
29 (mas b),
30 TestCase $ assertEqual "mas c"
31 5
32 (mas c),
33 TestCase $ assertEqual "mas d"
13 21 34 21
14 (mas $ array (1,6) [(1, (-3)), (2, 1), (3, 10), (4, (-5)), (5, 8), (6, 7)]) 35 (mas d),
36 TestCase $ assertEqual "mas minA"
37 0
38 (mas minA)
39 ]
40
41cases2 = TestLabel "amas" $ TestList [
42 TestCase $ assertEqual "amas a"
43 [(3,7), (4,7)]
44 (amas a),
45 TestCase $ assertEqual "amas b"
46 [(1,7),(1,8),(4,7),(4,8)]
47 (amas b),
48 TestCase $ assertEqual "amas c"
49 [(1,2),(4,5)]
50 (amas c),
51 TestCase $ assertEqual "amas d"
52 [(2,6)]
53 (amas d),
54 TestCase $ assertEqual "amas minA"
55 [(0,0)]
56 (amas minA)
15 ] 57 ]
58
59cases3 = TestLabel "lmas" $ TestList [
60 TestCase $ assertEqual "lmas a"
61 (3,7)
62 (lmas a),
63 TestCase $ assertEqual "lmas b"
64 (1,8)
65 (lmas b),
66 TestCase $ assertEqual "lmas c"
67 (1,2)
68 (lmas c),
69 TestCase $ assertEqual "lmas d"
70 (2,6)
71 (lmas d),
72 TestCase $ assertEqual "lmas minA"
73 (0,0)
74 (lmas minA)
75 ]
76
16 77
17tests :: [Test] 78tests :: [Test]
18tests = [cases1] 79tests = [cases1, cases2, cases3]
19 80
20main = do 81main = do
21 forM tests $ \test -> 82 forM tests $ \test ->