Fixed some typing relating to QuickCheck and the TestMonad to avoid type ambiguities in future

This commit is contained in:
Neil Brown 2008-03-05 16:04:30 +00:00
parent 2ea7c37abe
commit 03eab6c142
3 changed files with 9 additions and 8 deletions

View File

@ -740,7 +740,7 @@ generateEquationInput
-- but got: [(y1 * (((y2 * y2) + x1) REM x3)),(y4 * y4),x10,x2,x3,x6,x7,x8,x9,((y4 * y4) + 8*x3 / 2)]
qcTestMakeEquations :: [LabelledQuickCheckTest]
qcTestMakeEquations = [("Turning Code Into Equations", scaleQC (20,100,400,1000) prop)]
qcTestMakeEquations = [("Turning Code Into Equations", scaleQC (20,100,400,1000) (runQCTest . prop))]
where
prop :: MakeEquationInput -> QCProp
prop (MEI mei) = testMakeEquation mei
@ -1056,7 +1056,7 @@ instance Arbitrary OmegaTestInput where
arbitrary = generateProblem >>* OMI
qcOmegaEquality :: [LabelledQuickCheckTest]
qcOmegaEquality = [("Omega Test Equality Solving", scaleQC (40,200,2000,10000) prop)]
qcOmegaEquality = [("Omega Test Equality Solving", scaleQC (40,200,2000,10000) (runQCTest . prop))]
where
prop :: OmegaTestInput -> QCProp
prop (OMI (ans,(eq,ineq))) = omegaCheck actAnswer

View File

@ -55,11 +55,12 @@ compareForResult msg showFunc cmpFunc exp act
(*&&*) :: TestMonad m r => m () -> m () -> m ()
(*&&*) = (>>)
instance (TestMonad m r, Testable r) => Testable (m ()) where
property = property . runTest
type QCProp = Either Result ()
-- | A type-constrained version of runTest for QuickCheck Testable things:
runQCTest :: QCProp -> Result
runQCTest = runTest
testEqual :: (Show a, Eq a, TestMonad m r) => String -> a -> a -> m ()
testEqual msg = compareForResult msg show (==)

View File

@ -759,9 +759,9 @@ deepCheck test level = (flip check) test $ configForSize $
testModify :: [LabelledQuickCheckTest]
testModify =
[
("Control-Flow Graph Identity Transformations", deepCheck prop_Id)
,("Control-Flow Graph Replacement Transformations", deepCheck prop_Rep)
,("Random List Generation", deepCheck prop_gennums)
("Control-Flow Graph Identity Transformations", deepCheck (runTest . prop_Id))
,("Control-Flow Graph Replacement Transformations", deepCheck (runTest . prop_Rep))
,("Random List Generation", deepCheck (runTest . prop_gennums))
]
where
-- | Checks that applying any set (from the powerset of identity functions) of identity functions