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
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 ++ " "
TestExausted msg ntest stamps ->
msg ++ " " ++ show ntest ++ " "
TestAborted exception ->
"aborted: " ++ show exception
TestFailed args ntest ->
"failed after " ++ show ntest ++ " tests"
++ "\n args = " ++ show args