diff options
Diffstat (limited to 'TestAufgabeFFP7.hs')
| -rwxr-xr-x[-rw-r--r--] | TestAufgabeFFP7.hs | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/TestAufgabeFFP7.hs b/TestAufgabeFFP7.hs index 116a445..f83952b 100644..100755 --- a/TestAufgabeFFP7.hs +++ b/TestAufgabeFFP7.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 AufgabeFFP7 | 8 | import AufgabeFFP7 |
| 6 | import Test.QuickCheck | 9 | import Test.QuickCheck |
| 7 | import System.IO.Unsafe | 10 | import System.IO.Unsafe |
| @@ -34,6 +37,14 @@ cases2 = TestLabel "ssfn/minfree" $ TestList [ | |||
| 34 | tests :: [Test] | 37 | tests :: [Test] |
| 35 | tests = [cases2] | 38 | tests = [cases2] |
| 36 | 39 | ||
| 40 | isSuccess :: Counts -> Bool | ||
| 41 | isSuccess Counts{ cases = _, tried = _, errors = 0, failures = 0 } = True | ||
| 42 | isSuccess Counts{ cases = _, tried = _, errors = _, failures = _ } = False | ||
| 43 | |||
| 44 | runTest :: Test -> IO () | ||
| 45 | runTest test = do | ||
| 46 | result <- runTestTT test | ||
| 47 | unless (isSuccess result) exitFailure | ||
| 48 | |||
| 37 | main = do | 49 | main = do |
| 38 | forM tests $ \test -> | 50 | forM tests $ (\test -> runTest test) |
| 39 | runTestTT test | ||
