diff options
Diffstat (limited to 'TestAufgabeFFP5.hs')
| -rwxr-xr-x[-rw-r--r--] | TestAufgabeFFP5.hs | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/TestAufgabeFFP5.hs b/TestAufgabeFFP5.hs index 865f503..cbdd05b 100644..100755 --- a/TestAufgabeFFP5.hs +++ b/TestAufgabeFFP5.hs | |||
| @@ -1,7 +1,10 @@ | |||
| 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 | ||
| 5 | import Data.Array | 8 | import Data.Array |
| 6 | import AufgabeFFP5 | 9 | import AufgabeFFP5 |
| 7 | 10 | ||
| @@ -65,6 +68,14 @@ cases4 = TestLabel "minIndex" $ TestList [ | |||
| 65 | tests :: [Test] | 68 | tests :: [Test] |
| 66 | tests = [cases1, cases2, cases3, cases4] | 69 | tests = [cases1, cases2, cases3, cases4] |
| 67 | 70 | ||
| 71 | isSuccess :: Counts -> Bool | ||
| 72 | isSuccess Counts{ cases = _, tried = _, errors = 0, failures = 0 } = True | ||
| 73 | isSuccess Counts{ cases = _, tried = _, errors = _, failures = _ } = False | ||
| 74 | |||
| 75 | runTest :: Test -> IO () | ||
| 76 | runTest test = do | ||
| 77 | result <- runTestTT test | ||
| 78 | unless (isSuccess result) exitFailure | ||
| 79 | |||
| 68 | main = do | 80 | main = do |
| 69 | forM tests $ \test -> | 81 | forM tests $ (\test -> runTest test) |
| 70 | runTestTT test | ||
