From 9545fb945e42151afe04a384cb7acf43c1ab9350 Mon Sep 17 00:00:00 2001 From: manuel Date: Sat, 14 Apr 2012 18:52:18 +0200 Subject: * 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 --- TestAufgabeFFP2.hs | 70 +++++++++++++++++++++++++++--------------------------- 1 file changed, 35 insertions(+), 35 deletions(-) (limited to 'TestAufgabeFFP2.hs') 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 import Control.Monad import AufgabeFFP2 - -cases1 = TestLabel "2.1" $ TestList [ - TestCase $ - [(3,5),(5,7),(11,13),(17,19),(29,31),(41,43), (59,61),(71,73),(101,103),(107,109)] - @=? (take 10 pps), - TestCase $ (347,349) @=? (pps!!20), - TestCase $ (809,811) @=? (head (drop 30 pps)) - ] - - -cases2 = TestLabel "2.2" $ TestList [ - TestCase $ 1024 @=? (powFast 10), - TestCase $ (pow 10) @=? (powFast 10), - TestCase $ 1048576 @=? (powFast 20), - TestCase $ (pow 20) @=? (powFast 20) - ] - - -cases3 = TestLabel "2.3" $ TestList [ - TestCase $ (fMT 10 10) @=? (f 10 10), - TestCase $ (fMT 50 10) @=? (f 50 10), - TestCase $ (fMT 1000 10) @=? (f 1000 10) - ] - - -cases4 = TestLabel "2.4" $ TestList [ - TestCase $ 144 @=? (gz 42), - TestCase $ 400 @=? (gz 402), - TestCase $ 144 @=? (gzs!!42), - TestCase $ 400 @=? (gzs!!402) - ] - - - -main = runTestTT $ TestList [cases1, cases2, cases3, cases4] +cases1 = TestLabel "pps" $ TestList [ + TestCase $ assertEqual "take 10 pps" + [(3,5),(5,7),(11,13),(17,19),(29,31),(41,43), (59,61),(71,73),(101,103),(107,109)] + (take 10 pps), + TestCase $ assertEqual "pps!!20" (347,349) (pps!!20), + TestCase $ assertEqual "head (drop 30 pps)" (809,811) (head (drop 30 pps)) + ] + + +cases2 = TestLabel "powFast" $ TestList [ + TestCase $ assertEqual "powFast 10" 1024 (powFast 10), + TestCase $ assertEqual "powFast 10" (pow 10) (powFast 10), + TestCase $ assertEqual "powFast 20" 1048576 (powFast 20), + TestCase $ assertEqual "powFast 20" (pow 20) (powFast 20) + ] + +cases3 = TestLabel "fMT/f" $ TestList [ + TestCase $ assertEqual "fMT/f 10 10" (fMT 10 10) (f 10 10), + TestCase $ assertEqual "fMT/f 50 10" (fMT 50 10) (f 50 10), + TestCase $ assertEqual "fMT/f 1000 10" (fMT 1000 10) (f 1000 10) + ] + +cases4 = TestLabel "gz/gzs" $ TestList [ + TestCase $ assertEqual "gz 42" 144 (gz 42), + TestCase $ assertEqual "gz 402" 400 (gz 402), + TestCase $ assertEqual "gzs!!42" 144 (gzs!!42), + TestCase $ assertEqual "gzs!!402" 400 (gzs!!402) + ] + +tests :: [Test] +tests = [cases1, cases2, cases3, cases4] + +main = do + forM tests $ \test -> + runTestTT test -- cgit v1.2.3