diff options
Diffstat (limited to 'TestAufgabeFFP2.hs')
| -rwxr-xr-x[-rw-r--r--] | TestAufgabeFFP2.hs | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/TestAufgabeFFP2.hs b/TestAufgabeFFP2.hs index 1131e04..6399c45 100644..100755 --- a/TestAufgabeFFP2.hs +++ b/TestAufgabeFFP2.hs | |||
| @@ -1,7 +1,11 @@ | |||
| 1 | #!/usr/bin/runhugs +l | ||
| 2 | |||
| 1 | module Main where | 3 | module Main where |
| 2 | 4 | ||
| 3 | import Test.HUnit | 5 | import Test.HUnit |
| 4 | import Control.Monad | 6 | import Control.Monad |
| 7 | import System | ||
| 8 | import Data.Array | ||
| 5 | import AufgabeFFP2 | 9 | import AufgabeFFP2 |
| 6 | 10 | ||
| 7 | cases1 = TestLabel "pps" $ TestList [ | 11 | cases1 = TestLabel "pps" $ TestList [ |
| @@ -39,6 +43,14 @@ cases4 = TestLabel "gz/gzs" $ TestList [ | |||
| 39 | tests :: [Test] | 43 | tests :: [Test] |
| 40 | tests = [cases1, cases2, cases3, cases4] | 44 | tests = [cases1, cases2, cases3, cases4] |
| 41 | 45 | ||
| 46 | isSuccess :: Counts -> Bool | ||
| 47 | isSuccess Counts{ cases = _, tried = _, errors = 0, failures = 0 } = True | ||
| 48 | isSuccess Counts{ cases = _, tried = _, errors = _, failures = _ } = False | ||
| 49 | |||
| 50 | runTest :: Test -> IO () | ||
| 51 | runTest test = do | ||
| 52 | result <- runTestTT test | ||
| 53 | unless (isSuccess result) exitFailure | ||
| 54 | |||
| 42 | main = do | 55 | main = do |
| 43 | forM tests $ \test -> | 56 | forM tests $ (\test -> runTest test) |
| 44 | runTestTT test | ||
