summaryrefslogtreecommitdiffstats
path: root/TestAufgabeFFP3.hs
diff options
context:
space:
mode:
Diffstat (limited to 'TestAufgabeFFP3.hs')
-rwxr-xr-x[-rw-r--r--]TestAufgabeFFP3.hs19
1 files changed, 14 insertions, 5 deletions
diff --git a/TestAufgabeFFP3.hs b/TestAufgabeFFP3.hs
index 065401d..30a915e 100644..100755
--- a/TestAufgabeFFP3.hs
+++ b/TestAufgabeFFP3.hs
@@ -1,10 +1,13 @@
1#!/usr/bin/runhugs +l
2
1module Main where 3module Main where
2 4
3import Prelude hiding (filter) 5import Prelude hiding (filter)
4 6
5
6import Test.HUnit 7import Test.HUnit
7import Control.Monad 8import Control.Monad
9import System
10import Data.Array
8import AufgabeFFP3 11import AufgabeFFP3
9 12
10cases1 = TestLabel "foo" $ TestList [ 13cases1 = TestLabel "foo" $ TestList [
@@ -33,11 +36,17 @@ cases4 = TestLabel "bar" $ TestList [
33 TestCase $ assertEqual "a" ( [binomS (n, k) | k <- [0..50], n <- [k..50] ] ) ( [binomM (n, k) | k <- [0..50], n <- [k..50] ] ) 36 TestCase $ assertEqual "a" ( [binomS (n, k) | k <- [0..50], n <- [k..50] ] ) ( [binomM (n, k) | k <- [0..50], n <- [k..50] ] )
34 ] 37 ]
35 38
36
37tests :: [Test] 39tests :: [Test]
38tests = [cases1, cases2, cases3, cases4] 40tests = [cases1, cases2, cases3, cases4]
39 41
40main = do 42isSuccess :: Counts -> Bool
41 forM tests $ \test -> 43isSuccess Counts{ cases = _, tried = _, errors = 0, failures = 0 } = True
42 runTestTT test 44isSuccess Counts{ cases = _, tried = _, errors = _, failures = _ } = False
45
46runTest :: Test -> IO ()
47runTest test = do
48 result <- runTestTT test
49 unless (isSuccess result) exitFailure
43 50
51main = do
52 forM tests $ (\test -> runTest test)