File tree Expand file tree Collapse file tree 2 files changed +12
-7
lines changed
quickcheck-dynamic/src/Test/QuickCheck Expand file tree Collapse file tree 2 files changed +12
-7
lines changed Original file line number Diff line number Diff line change @@ -133,13 +133,16 @@ forAllNonVariableQ q = DL $ \s k -> DL.forAllQ (hasNoVariablesQ q) $ \(HasNoVari
133
133
runDL :: Annotated s -> DL s () -> DL. DynFormula s
134
134
runDL s dl = (unDL dl s $ \ _ _ -> DL. passTest)
135
135
136
+ -- TODO: We probably want versions of these three functions that take an `s` so that you can write DL
137
+ -- properties that are only true in a specific starting state rather than a random starting state.
138
+
136
139
forAllUniqueDL
137
140
:: (DL. DynLogicModel s , Testable a )
138
- => Annotated s
139
- -> DL s ()
141
+ => DL s ()
140
142
-> (Actions s -> a )
141
143
-> Property
142
- forAllUniqueDL initState d = DL. forAllUniqueScripts initState (runDL initState d)
144
+ forAllUniqueDL d p =
145
+ forAllBlind initialState $ \ st -> DL. forAllUniqueScripts st (runDL (Metadata mempty st) d) p
143
146
144
147
forAllDL
145
148
:: (DL. DynLogicModel s , Testable a )
Original file line number Diff line number Diff line change @@ -355,6 +355,7 @@ restrictedPolar (ActionWithPolarity a _) = restricted a
355
355
forAllScripts
356
356
:: (DynLogicModel s , Testable a )
357
357
=> s
358
+ -- ^ The initial state
358
359
-> DynFormula s
359
360
-> (Actions s -> a )
360
361
-> Property
@@ -363,15 +364,15 @@ forAllScripts s = forAllMappedScripts s id id
363
364
-- | `Property` function suitable for formulae without choice.
364
365
forAllUniqueScripts
365
366
:: (DynLogicModel s , Testable a )
366
- => Annotated s
367
+ => s
368
+ -- ^ The initial state
367
369
-> DynFormula s
368
370
-> (Actions s -> a )
369
371
-> Property
370
372
forAllUniqueScripts s f k =
371
373
QC. withSize $ \ sz ->
372
374
let d = unDynFormula f sz
373
- n = unsafeNextVarIndex $ vars s
374
- in case generate chooseUniqueNextStep d n s 500 of
375
+ in case generate chooseUniqueNextStep d 1 (Metadata mempty s) 500 of
375
376
Nothing -> counterexample " Generating Non-unique script in forAllUniqueScripts" False
376
377
Just test -> validDLTest test . applyMonitoring d test . property $ k (scriptFromDL test)
377
378
@@ -472,7 +473,8 @@ generate chooseNextStepFun d n s size =
472
473
useStep NoStep alt = alt
473
474
foldr
474
475
(\ step k -> do try <- chooseNextStepFun s n step; useStep try k)
475
- (return $ Stuck s TestSeqStop s)
476
+ (return $ Stuck s TestSeqStop s) -- NOTE: we will cons on this `TestSeqStop` so the `s` will not be the same before
477
+ -- and after state when we get out of this function.
476
478
[preferred, noAny preferred, d, noAny d]
477
479
478
480
sizeLimit :: Int -> Int
You can’t perform that action at this time.
0 commit comments