Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

SC: rename some SmartCheck arguments.

  • Loading branch information...
commit 3a6af9d4ebde17a7e6e4d2467606c5247dde8f53 1 parent fe8c8b9
Lee Pike authored
2  src/Test/SmartCheck/ConstructorGen.hs
View
@@ -85,7 +85,7 @@ arbSubset :: (SubTypes a, Generic a, ConNames (Rep a))
-> S.Set String -> IO (Result a)
arbSubset args a idx prop constrs =
liftM snd $ iterateArbIdx a (idx, scMaxDepth args)
- (scMaxSuccess args) (scMaxSize args) prop'
+ (scConstrMax args) (scMaxSize args) prop'
where
prop' b = newConstr b Q.==> prop b
-- Make sure b's constructor is a new one.
2  src/Test/SmartCheck/Extrapolate.hs
View
@@ -49,7 +49,7 @@ extrapolate args d origProp ds = do
-- least one test passes a precondition, and for every test in which the
-- precondition is passed, it fails. We test values of all possible sizes, up
-- to Q.maxSize.
- test _ idx = iterateArbIdx d (idx, scMaxDepth args) (scMaxSuccess args)
+ test _ idx = iterateArbIdx d (idx, scMaxDepth args) (scMaxExtrap args)
(scMaxSize args) origProp
-- Control-flow.
2  src/Test/SmartCheck/Reduce.hs
View
@@ -75,7 +75,7 @@ smartShrink args d prop =
Just v -> do
hole <- testHole v
if isJust hole then return hole
- else do (_, r) <- iterateArb x v idx (scMaxFailure args)
+ else do (_, r) <- iterateArb x v idx (scMaxReduce args)
-- Maximum size of values to generate; the minimum
-- of the value at the current index and the
-- maxSize parameter.
46 src/Test/SmartCheck/Types.hs
View
@@ -58,18 +58,6 @@ data ScArgs =
-- you are expected to pass in data to
-- analyze.)
--------------
- , extrap :: Bool -- ^ Should we extrapolate?
- --------------
- , constrGen :: Bool -- ^ Should we try to generalize
- -- constructors?
- --------------
- , scMaxSuccess :: Int -- ^ How hard (number of rounds) to look
- -- for failures during the extrapolation
- -- and constructor generalization stages.
- --------------
- , scMaxFailure :: Int -- ^ How hard (number of rounds) to look
- -- for failure in the reduction stage.
- --------------
, scMaxSize :: Int -- ^ Maximum size of data to generate, in
-- terms of the size parameter of
-- QuickCheck's Arbitrary instance for
@@ -81,25 +69,47 @@ data ScArgs =
-- Nothing means we go down to base
-- types.
--------------
+ -- Reduction
+ , scMaxReduce :: Int -- ^ How hard (number of rounds) to look
+ -- for failure in the reduction stage.
+ --------------
+ -- Extrapolation
+ , extrap :: Bool -- ^ Should we extrapolate?
+ --------------
+ , scMaxExtrap :: Int -- ^ How hard (number of rounds) to look
+ -- for failures during the extrapolation
+ -- and constructor generalization stages.
+ --------------
, scMinExtrap :: Int -- ^ Minimum number of times a property's
-- precondition must be passed to
-- generalize it.
--------------
+ -- Constructor generalization
+ , constrGen :: Bool -- ^ Should we try to generalize
+ -- constructors?
+ --------------
+ , scConstrMax :: Int -- ^ How hard (number of rounds) to look
+ -- for failing values with each
+ -- constructor. For "wide" sum types, this
+ -- value should be increased.
+ --------------
} deriving (Show, Read)
scStdArgs :: ScArgs
scStdArgs = ScArgs { format = PrintTree
, qcArgs = Q.stdArgs
- --------------
, qc = True
- , extrap = True
- , constrGen = True
- --------------
- , scMaxSuccess = 100
- , scMaxFailure = 100
, scMaxSize = 10
, scMaxDepth = Nothing
+ ---------------------
+ , scMaxReduce = 100
+ ---------------------
+ , extrap = True
+ , scMaxExtrap = 100
, scMinExtrap = 10
+ ---------------------
+ , constrGen = True
+ , scConstrMax = 100
}
--------------------------------------------------------------------------------
Please sign in to comment.
Something went wrong with that request. Please try again.