AERN-Real-0.10.0: src/Data/Number/ER/Misc/Tests.hs
{-|
Module : Data.Number.ER.Misc.Tests
Description : some QuickCheck extras
Copyright : (c) Michal Konecny
License : BSD3
Maintainer : mik@konecny.aow.cz
Stability : experimental
Portability : portable
Miscelaneous utilities related to testing.
-}
module Data.Number.ER.Misc.Tests
where
import Data.Number.ER.Misc
import Test.QuickCheck
import Test.QuickCheck.Batch
import System.IO
erRunTests testsetName options initialise tests =
do
mapM (mkRunTest $ length tests) $ zip [1..] tests
return ()
where
mkRunTest testCount (n, (testName, test)) =
do
initialise
putStr testDescr
result <- test options
putStrLn $ " result: " ++ show result
-- runTests testDescr options [test]
hFlush stdout
where
testDescr =
"(" ++ show n ++ "/" ++ show testCount ++ ") " ++ testsetName ++ ": " ++ testName ++ "\n"
instance Show TestResult
where
show result =
case result of
TestOk msg ntest stamps ->
msg ++ " " ++ show ntest ++ " " -- ++ show stamps
TestExausted msg ntest stamps ->
msg ++ " " ++ show ntest ++ " " -- ++ show stamps
TestAborted exception ->
"aborted: " ++ show exception
TestFailed args ntest ->
"failed after " ++ show ntest ++ " tests"
++ "\n args = " ++ show args