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 | |
| parent | a61ebc600a4fc7445787100d0c54fb633e7ee5c9 (diff) | |
| download | ffp-9c0650ba3f0a664800612661de2060f9ee0d213f.tar.gz ffp-9c0650ba3f0a664800612661de2060f9ee0d213f.tar.bz2 ffp-9c0650ba3f0a664800612661de2060f9ee0d213f.zip | |
make all tests executable and exit on error
| -rwxr-xr-x[-rw-r--r--] | TestAufgabeFFP1.hs | 16 | ||||
| -rwxr-xr-x[-rw-r--r--] | TestAufgabeFFP2.hs | 16 | ||||
| -rwxr-xr-x[-rw-r--r--] | TestAufgabeFFP3.hs | 19 | ||||
| -rwxr-xr-x[-rw-r--r--] | TestAufgabeFFP4.hs | 16 | ||||
| -rwxr-xr-x[-rw-r--r--] | TestAufgabeFFP5.hs | 15 | ||||
| -rwxr-xr-x[-rw-r--r--] | TestAufgabeFFP6.hs | 15 | ||||
| -rwxr-xr-x[-rw-r--r--] | TestAufgabeFFP7.hs | 15 |
7 files changed, 95 insertions, 17 deletions
diff --git a/TestAufgabeFFP1.hs b/TestAufgabeFFP1.hs index 4a38f3c..d1152f4 100644..100755 --- a/TestAufgabeFFP1.hs +++ b/TestAufgabeFFP1.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 AufgabeFFP1 | 9 | import AufgabeFFP1 |
| 6 | 10 | ||
| 7 | assertBoolF :: String -> Bool -> Assertion | 11 | assertBoolF :: String -> Bool -> Assertion |
| @@ -79,6 +83,14 @@ fibspdTests = TestList [fibspd1] | |||
| 79 | tests :: [Test] | 83 | tests :: [Test] |
| 80 | tests = [pof2s1, pdTests, fibdiagTests, fibdiagsTests, fibspdTests] | 84 | tests = [pof2s1, pdTests, fibdiagTests, fibdiagsTests, fibspdTests] |
| 81 | 85 | ||
| 86 | isSuccess :: Counts -> Bool | ||
| 87 | isSuccess Counts{ cases = _, tried = _, errors = 0, failures = 0 } = True | ||
| 88 | isSuccess Counts{ cases = _, tried = _, errors = _, failures = _ } = False | ||
| 89 | |||
| 90 | runTest :: Test -> IO () | ||
| 91 | runTest test = do | ||
| 92 | result <- runTestTT test | ||
| 93 | unless (isSuccess result) exitFailure | ||
| 94 | |||
| 82 | main = do | 95 | main = do |
| 83 | forM tests $ \test -> | 96 | forM tests $ (\test -> runTest test) |
| 84 | runTestTT test | ||
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 | ||
diff --git a/TestAufgabeFFP3.hs b/TestAufgabeFFP3.hs index 065401d..30a915e 100644..100755 --- a/TestAufgabeFFP3.hs +++ b/TestAufgabeFFP3.hs | |||
| @@ -1,10 +1,13 @@ | |||
| 1 | #!/usr/bin/runhugs +l | ||
| 2 | |||
| 1 | module Main where | 3 | module Main where |
| 2 | 4 | ||
| 3 | import Prelude hiding (filter) | 5 | import Prelude hiding (filter) |
| 4 | 6 | ||
| 5 | |||
| 6 | import Test.HUnit | 7 | import Test.HUnit |
| 7 | import Control.Monad | 8 | import Control.Monad |
| 9 | import System | ||
| 10 | import Data.Array | ||
| 8 | import AufgabeFFP3 | 11 | import AufgabeFFP3 |
| 9 | 12 | ||
| 10 | cases1 = TestLabel "foo" $ TestList [ | 13 | cases1 = TestLabel "foo" $ TestList [ |
| @@ -33,11 +36,17 @@ cases4 = TestLabel "bar" $ TestList [ | |||
| 33 | TestCase $ assertEqual "a" ( [binomS (n, k) | k <- [0..50], n <- [k..50] ] ) ( [binomM (n, k) | k <- [0..50], n <- [k..50] ] ) | 36 | TestCase $ assertEqual "a" ( [binomS (n, k) | k <- [0..50], n <- [k..50] ] ) ( [binomM (n, k) | k <- [0..50], n <- [k..50] ] ) |
| 34 | ] | 37 | ] |
| 35 | 38 | ||
| 36 | |||
| 37 | tests :: [Test] | 39 | tests :: [Test] |
| 38 | tests = [cases1, cases2, cases3, cases4] | 40 | tests = [cases1, cases2, cases3, cases4] |
| 39 | 41 | ||
| 40 | main = do | 42 | isSuccess :: Counts -> Bool |
| 41 | forM tests $ \test -> | 43 | isSuccess Counts{ cases = _, tried = _, errors = 0, failures = 0 } = True |
| 42 | runTestTT test | 44 | isSuccess Counts{ cases = _, tried = _, errors = _, failures = _ } = False |
| 45 | |||
| 46 | runTest :: Test -> IO () | ||
| 47 | runTest test = do | ||
| 48 | result <- runTestTT test | ||
| 49 | unless (isSuccess result) exitFailure | ||
| 43 | 50 | ||
| 51 | main = do | ||
| 52 | forM tests $ (\test -> runTest test) | ||
diff --git a/TestAufgabeFFP4.hs b/TestAufgabeFFP4.hs index ff341e5..1c20e87 100644..100755 --- a/TestAufgabeFFP4.hs +++ b/TestAufgabeFFP4.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 AufgabeFFP4 | 9 | import AufgabeFFP4 |
| 6 | 10 | ||
| 7 | ------------------------------------------------------------------------------- | 11 | ------------------------------------------------------------------------------- |
| @@ -70,6 +74,14 @@ cases2 = TestLabel "binomDyn" $ TestList [ | |||
| 70 | tests :: [Test] | 74 | tests :: [Test] |
| 71 | tests = [cases1, cases2] | 75 | tests = [cases1, cases2] |
| 72 | 76 | ||
| 77 | isSuccess :: Counts -> Bool | ||
| 78 | isSuccess Counts{ cases = _, tried = _, errors = 0, failures = 0 } = True | ||
| 79 | isSuccess Counts{ cases = _, tried = _, errors = _, failures = _ } = False | ||
| 80 | |||
| 81 | runTest :: Test -> IO () | ||
| 82 | runTest test = do | ||
| 83 | result <- runTestTT test | ||
| 84 | unless (isSuccess result) exitFailure | ||
| 85 | |||
| 73 | main = do | 86 | main = do |
| 74 | forM tests $ \test -> | 87 | forM tests $ (\test -> runTest test) |
| 75 | runTestTT test | ||
diff --git a/TestAufgabeFFP5.hs b/TestAufgabeFFP5.hs index 865f503..cbdd05b 100644..100755 --- a/TestAufgabeFFP5.hs +++ b/TestAufgabeFFP5.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 Data.Array | 8 | import Data.Array |
| 6 | import AufgabeFFP5 | 9 | import AufgabeFFP5 |
| 7 | 10 | ||
| @@ -65,6 +68,14 @@ cases4 = TestLabel "minIndex" $ TestList [ | |||
| 65 | tests :: [Test] | 68 | tests :: [Test] |
| 66 | tests = [cases1, cases2, cases3, cases4] | 69 | tests = [cases1, cases2, cases3, cases4] |
| 67 | 70 | ||
| 71 | isSuccess :: Counts -> Bool | ||
| 72 | isSuccess Counts{ cases = _, tried = _, errors = 0, failures = 0 } = True | ||
| 73 | isSuccess Counts{ cases = _, tried = _, errors = _, failures = _ } = False | ||
| 74 | |||
| 75 | runTest :: Test -> IO () | ||
| 76 | runTest test = do | ||
| 77 | result <- runTestTT test | ||
| 78 | unless (isSuccess result) exitFailure | ||
| 79 | |||
| 68 | main = do | 80 | main = do |
| 69 | forM tests $ \test -> | 81 | forM tests $ (\test -> runTest test) |
| 70 | runTestTT test | ||
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 | ||
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 | ||
