summaryrefslogtreecommitdiffstats
path: root/TestAufgabeFFP2.hs
diff options
context:
space:
mode:
authormanuel <manuel@mausz.at>2012-04-14 18:52:18 +0200
committermanuel <manuel@mausz.at>2012-04-14 18:52:18 +0200
commit9545fb945e42151afe04a384cb7acf43c1ab9350 (patch)
tree50da8a07ced88ba39ac515e6ff9d6508bee1b2e5 /TestAufgabeFFP2.hs
parent9a0159cc0ff165f33527c9a4fe1a8ac0a2afc15b (diff)
downloadffp-9545fb945e42151afe04a384cb7acf43c1ab9350.tar.gz
ffp-9545fb945e42151afe04a384cb7acf43c1ab9350.tar.bz2
ffp-9545fb945e42151afe04a384cb7acf43c1ab9350.zip
* remove trailing whitespaces
* fix wrong indention (no tabs, use 2 spaces, don't mix) * name testcaselists by their methods * add (more or less) individual testname per testcase * call testcase lists in a do-loop so that every testcase list generates a seperate output
Diffstat (limited to 'TestAufgabeFFP2.hs')
-rw-r--r--TestAufgabeFFP2.hs70
1 files changed, 35 insertions, 35 deletions
diff --git a/TestAufgabeFFP2.hs b/TestAufgabeFFP2.hs
index 61fdb51..ef6d48a 100644
--- a/TestAufgabeFFP2.hs
+++ b/TestAufgabeFFP2.hs
@@ -4,38 +4,38 @@ import Test.HUnit
4import Control.Monad 4import Control.Monad
5import AufgabeFFP2 5import AufgabeFFP2
6 6
7 7cases1 = TestLabel "pps" $ TestList [
8cases1 = TestLabel "2.1" $ TestList [ 8 TestCase $ assertEqual "take 10 pps"
9 TestCase $ 9 [(3,5),(5,7),(11,13),(17,19),(29,31),(41,43), (59,61),(71,73),(101,103),(107,109)]
10 [(3,5),(5,7),(11,13),(17,19),(29,31),(41,43), (59,61),(71,73),(101,103),(107,109)] 10 (take 10 pps),
11 @=? (take 10 pps), 11 TestCase $ assertEqual "pps!!20" (347,349) (pps!!20),
12 TestCase $ (347,349) @=? (pps!!20), 12 TestCase $ assertEqual "head (drop 30 pps)" (809,811) (head (drop 30 pps))
13 TestCase $ (809,811) @=? (head (drop 30 pps)) 13 ]
14 ] 14
15 15
16 16cases2 = TestLabel "powFast" $ TestList [
17cases2 = TestLabel "2.2" $ TestList [ 17 TestCase $ assertEqual "powFast 10" 1024 (powFast 10),
18 TestCase $ 1024 @=? (powFast 10), 18 TestCase $ assertEqual "powFast 10" (pow 10) (powFast 10),
19 TestCase $ (pow 10) @=? (powFast 10), 19 TestCase $ assertEqual "powFast 20" 1048576 (powFast 20),
20 TestCase $ 1048576 @=? (powFast 20), 20 TestCase $ assertEqual "powFast 20" (pow 20) (powFast 20)
21 TestCase $ (pow 20) @=? (powFast 20) 21 ]
22 ] 22
23 23cases3 = TestLabel "fMT/f" $ TestList [
24 24 TestCase $ assertEqual "fMT/f 10 10" (fMT 10 10) (f 10 10),
25cases3 = TestLabel "2.3" $ TestList [ 25 TestCase $ assertEqual "fMT/f 50 10" (fMT 50 10) (f 50 10),
26 TestCase $ (fMT 10 10) @=? (f 10 10), 26 TestCase $ assertEqual "fMT/f 1000 10" (fMT 1000 10) (f 1000 10)
27 TestCase $ (fMT 50 10) @=? (f 50 10), 27 ]
28 TestCase $ (fMT 1000 10) @=? (f 1000 10) 28
29 ] 29cases4 = TestLabel "gz/gzs" $ TestList [
30 30 TestCase $ assertEqual "gz 42" 144 (gz 42),
31 31 TestCase $ assertEqual "gz 402" 400 (gz 402),
32cases4 = TestLabel "2.4" $ TestList [ 32 TestCase $ assertEqual "gzs!!42" 144 (gzs!!42),
33 TestCase $ 144 @=? (gz 42), 33 TestCase $ assertEqual "gzs!!402" 400 (gzs!!402)
34 TestCase $ 400 @=? (gz 402), 34 ]
35 TestCase $ 144 @=? (gzs!!42), 35
36 TestCase $ 400 @=? (gzs!!402) 36tests :: [Test]
37 ] 37tests = [cases1, cases2, cases3, cases4]
38 38
39 39main = do
40 40 forM tests $ \test ->
41main = runTestTT $ TestList [cases1, cases2, cases3, cases4] 41 runTestTT test