diff options
| author | manuel <manuel@mausz.at> | 2012-04-14 18:52:18 +0200 |
|---|---|---|
| committer | manuel <manuel@mausz.at> | 2012-04-14 18:52:18 +0200 |
| commit | 9545fb945e42151afe04a384cb7acf43c1ab9350 (patch) | |
| tree | 50da8a07ced88ba39ac515e6ff9d6508bee1b2e5 /TestAufgabeFFP2.hs | |
| parent | 9a0159cc0ff165f33527c9a4fe1a8ac0a2afc15b (diff) | |
| download | ffp-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.hs | 70 |
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 | |||
| 4 | import Control.Monad | 4 | import Control.Monad |
| 5 | import AufgabeFFP2 | 5 | import AufgabeFFP2 |
| 6 | 6 | ||
| 7 | 7 | cases1 = TestLabel "pps" $ TestList [ | |
| 8 | cases1 = 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 | 16 | cases2 = TestLabel "powFast" $ TestList [ | |
| 17 | cases2 = 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 | 23 | cases3 = TestLabel "fMT/f" $ TestList [ | |
| 24 | 24 | TestCase $ assertEqual "fMT/f 10 10" (fMT 10 10) (f 10 10), | |
| 25 | cases3 = 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 | ] | 29 | cases4 = TestLabel "gz/gzs" $ TestList [ |
| 30 | 30 | TestCase $ assertEqual "gz 42" 144 (gz 42), | |
| 31 | 31 | TestCase $ assertEqual "gz 402" 400 (gz 402), | |
| 32 | cases4 = 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) | 36 | tests :: [Test] |
| 37 | ] | 37 | tests = [cases1, cases2, cases3, cases4] |
| 38 | 38 | ||
| 39 | 39 | main = do | |
| 40 | 40 | forM tests $ \test -> | |
| 41 | main = runTestTT $ TestList [cases1, cases2, cases3, cases4] | 41 | runTestTT test |
