Permalink
Browse files

Bug: fixed arguments to iterateArb.

  • Loading branch information...
1 parent 88a78e7 commit cc518c4cff8ec07b9308ee16b3ca787b442f7146 @leepike committed Apr 11, 2012
Showing with 5 additions and 4 deletions.
  1. +3 −3 src/Test/SmartCheck/Common.hs
  2. +2 −1 src/Test/SmartCheck/Reduce.hs
@@ -37,8 +37,8 @@ samples _ i maxSz = do
-- | Replace the hole in d indexed by idx with a bunch of random values, and
-- test the new d against the property. Returns the first new d that succeeds.
iterateArb :: (Data a, SubTypes a)
- => SmartArgs -> a -> Idx -> Int -> (a -> Bool) -> IO (Maybe a)
-iterateArb args d idx sz prop =
+ => a -> Idx -> Int -> Int -> (a -> Bool) -> IO (Maybe a)
+iterateArb d idx tries sz prop =
case getAtIdx d idx of
Nothing -> return Nothing
Just v -> do rnds <- mkVals v
@@ -48,7 +48,7 @@ iterateArb args d idx sz prop =
return (find prop res)
where
mkVals SubT { unSubT = v } = do
- rnds <- samples v (grows args) sz -- XXX should be a smartArgs parameter?
+ rnds <- samples v tries sz
return $ map subT rnds
repl SubT { unSubT = v } = replaceAtIdx d idx v
@@ -62,7 +62,8 @@ smartShrink args d prop = iter d (Idx 0 0)
else mkTry
where
- mkTry = do try <- iterateArb args d' idx (fromJust maxSize) notProp
+ mkTry = do try <- iterateArb d' idx (shrinks args)
+ (fromJust maxSize) notProp
-- first failing try
if isJust try
-- Found a try fails prop. We'll now test try, and start trying

0 comments on commit cc518c4

Please sign in to comment.