diff options
Diffstat (limited to 'packages/tests/src/Numeric')
-rw-r--r-- | packages/tests/src/Numeric/LinearAlgebra/Tests.hs | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/packages/tests/src/Numeric/LinearAlgebra/Tests.hs b/packages/tests/src/Numeric/LinearAlgebra/Tests.hs index 69ef1b3..8d402d0 100644 --- a/packages/tests/src/Numeric/LinearAlgebra/Tests.hs +++ b/packages/tests/src/Numeric/LinearAlgebra/Tests.hs | |||
@@ -36,16 +36,22 @@ import Numeric.GSL | |||
36 | import Prelude hiding ((^)) | 36 | import Prelude hiding ((^)) |
37 | import qualified Prelude | 37 | import qualified Prelude |
38 | import System.CPUTime | 38 | import System.CPUTime |
39 | import System.Exit | ||
39 | import Text.Printf | 40 | import Text.Printf |
40 | import Data.Packed.Development(unsafeFromForeignPtr,unsafeToForeignPtr) | 41 | import Data.Packed.Development(unsafeFromForeignPtr,unsafeToForeignPtr) |
41 | import Control.Arrow((***)) | 42 | import Control.Arrow((***)) |
42 | import Debug.Trace | 43 | import Debug.Trace |
44 | import Control.Monad(when) | ||
43 | 45 | ||
44 | import Test.QuickCheck(Arbitrary,arbitrary,coarbitrary,choose,vector | 46 | import Test.QuickCheck(Arbitrary,arbitrary,coarbitrary,choose,vector |
45 | ,sized,classify,Testable,Property | 47 | ,sized,classify,Testable,Property |
46 | ,quickCheckWith,maxSize,stdArgs,shrink) | 48 | ,quickCheckWithResult,maxSize,stdArgs,shrink) |
47 | 49 | ||
48 | qCheck n = quickCheckWith stdArgs {maxSize = n} | 50 | import Test.QuickCheck.Test(isSuccess) |
51 | |||
52 | qCheck n x = do | ||
53 | r <- quickCheckWithResult stdArgs {maxSize = n} x | ||
54 | when (not $ isSuccess r) (exitFailure) | ||
49 | 55 | ||
50 | a ^ b = a Prelude.^ (b :: Int) | 56 | a ^ b = a Prelude.^ (b :: Int) |
51 | 57 | ||
@@ -546,7 +552,7 @@ runTests n = do | |||
546 | test (\m -> toRows (m::FM) == read (show (toRows m))) | 552 | test (\m -> toRows (m::FM) == read (show (toRows m))) |
547 | test (\m -> toRows (m::ZM) == read (show (toRows m))) | 553 | test (\m -> toRows (m::ZM) == read (show (toRows m))) |
548 | putStrLn "------ some unit tests" | 554 | putStrLn "------ some unit tests" |
549 | _ <- runTestTT $ TestList | 555 | c <- runTestTT $ TestList |
550 | [ utest "1E5 rots" rotTest | 556 | [ utest "1E5 rots" rotTest |
551 | , utest "det1" detTest1 | 557 | , utest "det1" detTest1 |
552 | , utest "invlndet" detTest2 | 558 | , utest "invlndet" detTest2 |
@@ -586,6 +592,7 @@ runTests n = do | |||
586 | , conformTest | 592 | , conformTest |
587 | , accumTest | 593 | , accumTest |
588 | ] | 594 | ] |
595 | when (errors c + failures c > 0) exitFailure | ||
589 | return () | 596 | return () |
590 | 597 | ||
591 | 598 | ||