From 9c0650ba3f0a664800612661de2060f9ee0d213f Mon Sep 17 00:00:00 2001 From: manuel Date: Mon, 21 May 2012 20:51:41 +0200 Subject: make all tests executable and exit on error --- TestAufgabeFFP2.hs | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) mode change 100644 => 100755 TestAufgabeFFP2.hs (limited to 'TestAufgabeFFP2.hs') diff --git a/TestAufgabeFFP2.hs b/TestAufgabeFFP2.hs old mode 100644 new mode 100755 index 1131e04..6399c45 --- a/TestAufgabeFFP2.hs +++ b/TestAufgabeFFP2.hs @@ -1,7 +1,11 @@ +#!/usr/bin/runhugs +l + module Main where import Test.HUnit import Control.Monad +import System +import Data.Array import AufgabeFFP2 cases1 = TestLabel "pps" $ TestList [ @@ -39,6 +43,14 @@ cases4 = TestLabel "gz/gzs" $ TestList [ tests :: [Test] tests = [cases1, cases2, cases3, cases4] +isSuccess :: Counts -> Bool +isSuccess Counts{ cases = _, tried = _, errors = 0, failures = 0 } = True +isSuccess Counts{ cases = _, tried = _, errors = _, failures = _ } = False + +runTest :: Test -> IO () +runTest test = do + result <- runTestTT test + unless (isSuccess result) exitFailure + main = do - forM tests $ \test -> - runTestTT test + forM tests $ (\test -> runTest test) -- cgit v1.2.3