summaryrefslogtreecommitdiffstats
path: root/TestAufgabeFFP5.hs
diff options
context:
space:
mode:
Diffstat (limited to 'TestAufgabeFFP5.hs')
-rw-r--r--TestAufgabeFFP5.hs102
1 files changed, 26 insertions, 76 deletions
diff --git a/TestAufgabeFFP5.hs b/TestAufgabeFFP5.hs
index eaace62..7e0b731 100644
--- a/TestAufgabeFFP5.hs
+++ b/TestAufgabeFFP5.hs
@@ -25,91 +25,41 @@ data Week = Mon | Tue | Wed | Thu | Fri | Sat | Sun deriving (Eq, Ord, Ix, Show)
25w :: Array Week String 25w :: Array Week String
26w = array (Tue, Sat) [(Wed, "work"), (Thu, "study"), (Tue, "study"), (Fri, "chill"), (Sat, "relax")] 26w = array (Tue, Sat) [(Wed, "work"), (Thu, "study"), (Tue, "study"), (Fri, "chill"), (Sat, "relax")]
27 27
28cases1 = TestLabel "mas" $ TestList [ 28cases1 = "mas" ~: TestList [
29 TestCase $ assertEqual "mas a" 29 "mas a" ~: 12 ~=? (mas a),
30 12 30 "mas b" ~: 12 ~=? (mas b),
31 (mas a), 31 "mas c" ~: 5 ~=? (mas c),
32 TestCase $ assertEqual "mas b" 32 "mas d" ~: 21 ~=? (mas d),
33 12 33 "mas minA" ~: 0 ~=? (mas minA)
34 (mas b),
35 TestCase $ assertEqual "mas c"
36 5
37 (mas c),
38 TestCase $ assertEqual "mas d"
39 21
40 (mas d),
41 TestCase $ assertEqual "mas minA"
42 0
43 (mas minA)
44 ] 34 ]
45 35
46cases2 = TestLabel "amas" $ TestList [ 36cases2 = TestLabel "amas" $ TestList [
47 TestCase $ assertEqual "amas a" 37 "amas a" ~: [(3,7), (4,7)] ~=? (amas a),
48 [(3,7), (4,7)] 38 "amas b" ~: [(1,7),(1,8),(4,7),(4,8)] ~=? (amas b),
49 (amas a), 39 "amas c" ~: [(1,2),(4,5)] ~=? (amas c),
50 TestCase $ assertEqual "amas b" 40 "amas d" ~: [(2,6)] ~=? (amas d),
51 [(1,7),(1,8),(4,7),(4,8)] 41 "amas minA" ~: [(0,0)] ~=? (amas minA)
52 (amas b),
53 TestCase $ assertEqual "amas c"
54 [(1,2),(4,5)]
55 (amas c),
56 TestCase $ assertEqual "amas d"
57 [(2,6)]
58 (amas d),
59 TestCase $ assertEqual "amas minA"
60 [(0,0)]
61 (amas minA)
62 ] 42 ]
63 43
64cases3 = TestLabel "lmas" $ TestList [ 44cases3 = TestLabel "lmas" $ TestList [
65 TestCase $ assertEqual "lmas a" 45 "lmas a" ~: (3,7) ~=? (lmas a),
66 (3,7) 46 "lmas b" ~: (1,8) ~=? (lmas b),
67 (lmas a), 47 "lmas c" ~: (1,2) ~=? (lmas c),
68 TestCase $ assertEqual "lmas b" 48 "lmas d" ~: (2,6) ~=? (lmas d),
69 (1,8) 49 "lmas minA" ~: (0,0) ~=? (lmas minA)
70 (lmas b),
71 TestCase $ assertEqual "lmas c"
72 (1,2)
73 (lmas c),
74 TestCase $ assertEqual "lmas d"
75 (2,6)
76 (lmas d),
77 TestCase $ assertEqual "lmas minA"
78 (0,0)
79 (lmas minA)
80 ] 50 ]
81 51
82cases4 = TestLabel "minIndex" $ TestList [ 52cases4 = TestLabel "minIndex" $ TestList [
83 TestCase $ assertEqual "minIndex a (>5)" 53 "minIndex a (>5)" ~: 4 ~=? (minIndex a (>5)),
84 4 54 "minIndex a (<0)" ~: 2 ~=? (minIndex a (<0)),
85 (minIndex a (>5)), 55 "minIndex a (even)" ~: 3 ~=? (minIndex a (even)),
86 TestCase $ assertEqual "minIndex a (<0)" 56 "minIndex b (odd)" ~: 1 ~=? (minIndex b (odd)),
87 2 57 -- "minIndex b (>100)" ~: error "No matching index" ~=? (minIndex b (>100)),
88 (minIndex a (<0)), 58 "minIndex w (=='relax')" ~: Sat ~=? (minIndex w (=="relax")),
89 TestCase $ assertEqual "minIndex a (even)" 59 "minIndex w (=='work')" ~: Wed ~=? (minIndex w (=="work")),
90 3 60 "minIndex w (=='chill')" ~: Fri ~=? (minIndex w (=="chill")),
91 (minIndex a (even)), 61 "minIndex w (/='chill')" ~: Tue ~=? (minIndex w (/="chill"))
92 TestCase $ assertEqual "minIndex b (odd)" 62 -- "minIndex w (=='swim')" ~: error "No matching index" ~=? (minIndex w (=="swim"))
93 1
94 (minIndex b (odd)),
95 -- TestCase $ assertEqual "minIndex b (>100)"
96 -- error "No matching index"
97 -- (minIndex b (>100)),
98 TestCase $ assertEqual "minIndex w (=='relax')"
99 Sat
100 (minIndex w (=="relax")),
101 TestCase $ assertEqual "minIndex w (=='work')"
102 Wed
103 (minIndex w (=="work")),
104 TestCase $ assertEqual "minIndex w (=='chill')"
105 Fri
106 (minIndex w (=="chill")),
107 TestCase $ assertEqual "minIndex w (/='chill')"
108 Tue
109 (minIndex w (/="chill"))
110 -- TestCase $ assertEqual "minIndex w (=='swim')"
111 -- error "No matching index"
112 -- (minIndex w (=="swim"))
113 ] 63 ]
114 64
115 65