diff options
| author | manuel <manuel@mausz.at> | 2012-05-21 20:51:41 +0200 |
|---|---|---|
| committer | manuel <manuel@mausz.at> | 2012-05-21 20:51:41 +0200 |
| commit | 9c0650ba3f0a664800612661de2060f9ee0d213f (patch) | |
| tree | 072f10c695797a80c078c9b41ef7724b6755fd09 /TestAufgabeFFP2.hs | |
| parent | a61ebc600a4fc7445787100d0c54fb633e7ee5c9 (diff) | |
| download | ffp-9c0650ba3f0a664800612661de2060f9ee0d213f.tar.gz ffp-9c0650ba3f0a664800612661de2060f9ee0d213f.tar.bz2 ffp-9c0650ba3f0a664800612661de2060f9ee0d213f.zip | |
make all tests executable and exit on error
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 | ||
