diff options
Diffstat (limited to 'TestAufgabeFFP6.hs')
| -rwxr-xr-x[-rw-r--r--] | TestAufgabeFFP6.hs | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/TestAufgabeFFP6.hs b/TestAufgabeFFP6.hs index 1f661e6..9849a1a 100644..100755 --- a/TestAufgabeFFP6.hs +++ b/TestAufgabeFFP6.hs | |||
| @@ -1,7 +1,10 @@ | |||
| 1 | #!/usr/bin/runhugs -X-98 +o +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 AufgabeFFP6 | 8 | import AufgabeFFP6 |
| 6 | import Data.Array | 9 | import Data.Array |
| 7 | 10 | ||
| @@ -81,6 +84,14 @@ cases4 = TestLabel "yield" $ TestList [ | |||
| 81 | tests :: [Test] | 84 | tests :: [Test] |
| 82 | tests = [cases1, cases2, cases3, cases4] | 85 | tests = [cases1, cases2, cases3, cases4] |
| 83 | 86 | ||
| 87 | isSuccess :: Counts -> Bool | ||
| 88 | isSuccess Counts{ cases = _, tried = _, errors = 0, failures = 0 } = True | ||
| 89 | isSuccess Counts{ cases = _, tried = _, errors = _, failures = _ } = False | ||
| 90 | |||
| 91 | runTest :: Test -> IO () | ||
| 92 | runTest test = do | ||
| 93 | result <- runTestTT test | ||
| 94 | unless (isSuccess result) exitFailure | ||
| 95 | |||
| 84 | main = do | 96 | main = do |
| 85 | forM tests $ \test -> | 97 | forM tests $ (\test -> runTest test) |
| 86 | runTestTT test | ||
