@@ -4,7 +4,8 @@ import Control.Applicative
44import Control.Arrow (second )
55import Control.Monad
66import Data.Typeable
7- import Test.QuickCheck hiding (generate )
7+ import Test.QuickCheck (Gen , Property , Testable )
8+ import Test.QuickCheck qualified as QC
89import Test.QuickCheck.DynamicLogic.CanGenerate
910import Test.QuickCheck.DynamicLogic.Quantify
1011import Test.QuickCheck.DynamicLogic.SmartShrinking
@@ -359,8 +360,8 @@ forAllUniqueScripts s f k =
359360 let d = unDynFormula f sz
360361 n = unsafeNextVarIndex $ vars s
361362 in case generate chooseUniqueNextStep d n s 500 of
362- Nothing -> counterexample " Generating Non-unique script in forAllUniqueScripts" False
363- Just test -> validDLTest test . applyMonitoring d test . property $ k (scriptFromDL test)
363+ Nothing -> QC. counterexample " Generating Non-unique script in forAllUniqueScripts" False
364+ Just test -> validDLTest test . applyMonitoring d test . QC. property $ k (scriptFromDL test)
364365
365366-- | Creates a `Property` from `DynFormula` with some specialised isomorphism for shrinking purpose.
366367forAllMappedScripts
@@ -373,22 +374,22 @@ forAllMappedScripts
373374forAllMappedScripts to from f k =
374375 QC. withSize $ \ n ->
375376 let d = unDynFormula f n
376- in forAllShrinkBlind
377- (Smart 0 <$> sized ((from <$> ) . generateDLTest d))
377+ in QC. forAllShrinkBlind
378+ (QC. Smart 0 <$> QC. sized ((from <$> ) . generateDLTest d))
378379 (shrinkSmart ((from <$> ) . shrinkDLTest d . to))
379- $ \ (Smart _ script) ->
380+ $ \ (QC. Smart _ script) ->
380381 withDLScript d k (to script)
381382
382383withDLScript :: (DynLogicModel s , Testable a ) => DynLogic s -> (Actions s -> a ) -> DynLogicTest s -> Property
383384withDLScript d k test =
384- validDLTest test . applyMonitoring d test . property $ k (scriptFromDL test)
385+ validDLTest test . applyMonitoring d test . QC. property $ k (scriptFromDL test)
385386
386387withDLScriptPrefix :: (DynLogicModel s , Testable a ) => DynFormula s -> (Actions s -> a ) -> DynLogicTest s -> Property
387388withDLScriptPrefix f k test =
388389 QC. withSize $ \ n ->
389390 let d = unDynFormula f n
390391 test' = unfailDLTest d test
391- in validDLTest test' . applyMonitoring d test' . property $ k (scriptFromDL test')
392+ in validDLTest test' . applyMonitoring d test' . QC. property $ k (scriptFromDL test')
392393
393394-- | Validate generated test case.
394395--
@@ -401,9 +402,9 @@ withDLScriptPrefix f k test =
401402validDLTest :: StateModel s => DynLogicTest s -> Property -> Property
402403validDLTest test prop =
403404 case test of
404- DLScript {} -> counterexample (show test) prop
405- Stuck {} -> property Discard
406- _other -> counterexample (show test) False
405+ DLScript {} -> QC. counterexample (show test) prop
406+ Stuck {} -> QC. property QC. Discard
407+ _other -> QC. counterexample (show test) False
407408
408409generateDLTest :: DynLogicModel s => DynLogic s -> Int -> Gen (DynLogicTest s )
409410generateDLTest d size = generate chooseNextStep d 0 (initialStateFor d) size
@@ -516,7 +517,7 @@ nextSteps' gen (ForAll q f) = do
516517nextSteps' gen (Monitor _f d) = nextSteps' gen d
517518
518519chooseOneOf :: [(Double , a )] -> Gen a
519- chooseOneOf steps = frequency [(round (w / never), return s) | (w, s) <- steps]
520+ chooseOneOf steps = QC. frequency [(round (w / never), return s) | (w, s) <- steps]
520521
521522never :: Double
522523never = 1.0e-9
@@ -586,7 +587,7 @@ keepTryingUntil :: Int -> Gen a -> (a -> Bool) -> Gen (Maybe a)
586587keepTryingUntil 0 _ _ = return Nothing
587588keepTryingUntil n g p = do
588589 x <- g
589- if p x then return $ Just x else scale (+ 1 ) $ keepTryingUntil (n - 1 ) g p
590+ if p x then return $ Just x else QC. scale (+ 1 ) $ keepTryingUntil (n - 1 ) g p
590591
591592shrinkDLTest :: DynLogicModel s => DynLogic s -> DynLogicTest s -> [DynLogicTest s ]
592593shrinkDLTest _ (Looping _) = []
@@ -710,7 +711,7 @@ demonicAlt ds = foldr1 (Alt Demonic) ds
710711
711712propPruningGeneratedScriptIsNoop :: DynLogicModel s => DynLogic s -> Property
712713propPruningGeneratedScriptIsNoop d =
713- forAll (sized $ \ n -> choose (1 , max 1 n) >>= generateDLTest d) $ \ test ->
714+ QC. forAll (QC. sized $ \ n -> QC. choose (1 , max 1 n) >>= generateDLTest d) $ \ test ->
714715 let script = case test of
715716 BadPrecondition s _ _ -> s
716717 Looping s -> s
0 commit comments