summaryrefslogtreecommitdiffstats
path: root/TestAufgabeFFP2.hs
diff options
context:
space:
mode:
authormanuel <manuel@mausz.at>2012-05-21 20:51:41 +0200
committermanuel <manuel@mausz.at>2012-05-21 20:51:41 +0200
commit9c0650ba3f0a664800612661de2060f9ee0d213f (patch)
tree072f10c695797a80c078c9b41ef7724b6755fd09 /TestAufgabeFFP2.hs
parenta61ebc600a4fc7445787100d0c54fb633e7ee5c9 (diff)
downloadffp-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.hs16
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
1module Main where 3module Main where
2 4
3import Test.HUnit 5import Test.HUnit
4import Control.Monad 6import Control.Monad
7import System
8import Data.Array
5import AufgabeFFP2 9import AufgabeFFP2
6 10
7cases1 = TestLabel "pps" $ TestList [ 11cases1 = TestLabel "pps" $ TestList [
@@ -39,6 +43,14 @@ cases4 = TestLabel "gz/gzs" $ TestList [
39tests :: [Test] 43tests :: [Test]
40tests = [cases1, cases2, cases3, cases4] 44tests = [cases1, cases2, cases3, cases4]
41 45
46isSuccess :: Counts -> Bool
47isSuccess Counts{ cases = _, tried = _, errors = 0, failures = 0 } = True
48isSuccess Counts{ cases = _, tried = _, errors = _, failures = _ } = False
49
50runTest :: Test -> IO ()
51runTest test = do
52 result <- runTestTT test
53 unless (isSuccess result) exitFailure
54
42main = do 55main = do
43 forM tests $ \test -> 56 forM tests $ (\test -> runTest test)
44 runTestTT test