[Haskell-cafe] Verifying a list of properties using QuickCheck

Thomas M. DuBuisson thomas.dubuisson at gmail.com
Wed Oct 22 10:51:22 EDT 2008


Thomas van Noort wrote:
> However, I would like a single result for the complete list of 
> properties instead of a result for each property. I realize that this 
> restricts the properties to be of the same type, but that isn't a 
> problem for my application.

You're types can be different, so long as the result of quickCheck
isn't.

I've often seen (and used):

data Test = forall a. (Testable a) => T String a

testSetA :: [Test]
testSetA = [T "1+1=2" prop_onePlusOne
	,T "2+2=5" prop_twoPlusTwo
	...
	]

tests = testSetA ++ testSetB ++ ...

runTests = :: [Test] -> Bool
runTests = and $ map runTest tests

runTest :: Test -> Bool
runTest (T s a) = putStr (s ++ ": ") >> quickCheck a >> putStr "\n"



Tom



More information about the Haskell-Cafe mailing list