packages feed

quickcheck-dynamic 3.2.0 → 3.3.0

raw patch · 3 files changed

+22/−4 lines, 3 filesdep ~base

Dependency ranges changed: base

Files

CHANGELOG.md view
@@ -9,6 +9,12 @@  ## UNRELEASED +* Added some lightweight negative-shrinking based on a simple dependency analysis.++## 3.3.0++* Added suppport for GHC 9.6.2 compiler+ ## 3.2.0  * Added support for negative testing via `validFailingAction` and `postconditionOnFailure`
quickcheck-dynamic.cabal view
@@ -1,6 +1,6 @@ cabal-version:      2.2 name:               quickcheck-dynamic-version:            3.2.0+version:            3.3.0 license:            Apache-2.0 license-files:   LICENSE@@ -94,7 +94,7 @@    ghc-options:    -rtsopts   build-depends:-    , base                 >=4.7 && <5+    , base     , containers     , mtl     , QuickCheck
src/Test/QuickCheck/StateModel.hs view
@@ -341,7 +341,7 @@         <> allVariables (underlyingState aState)         <> go (computeNextState aState act var) steps -instance StateModel state => Arbitrary (Actions state) where+instance forall state. StateModel state => Arbitrary (Actions state) where   arbitrary = do     (as, rejected) <- arbActions initialAnnotatedState 1     return $ Actions_ rejected (Smart 0 as)@@ -377,9 +377,21 @@                       else go (m + 1) n (actionName (polarAction act) : rej)    shrink (Actions_ rs as) =-    map (Actions_ rs) (shrinkSmart (map (prune . map fst) . shrinkList shrinker . withStates) as)+    map (Actions_ rs) (shrinkSmart (map (prune . map fst) . concatMap customActionsShrinker . shrinkList shrinker . withStates) as)     where+      shrinker :: (Step state, Annotated state) -> [(Step state, Annotated state)]       shrinker (v := act, s) = [(unsafeCoerceVar v := act', s) | Some act'@ActionWithPolarity{} <- computeShrinkAction s act]++      customActionsShrinker :: [(Step state, Annotated state)] -> [[(Step state, Annotated state)]]+      customActionsShrinker acts =+        let usedVars = mconcat [getAllVariables a <> getAllVariables (underlyingState s) | (_ := a, s) <- acts]+            binding (v := _, _) = Some v `Set.member` usedVars+            -- Remove at most one non-binding action+            go [] = [[]]+            go (p : ps)+              | binding p = map (p :) (go ps)+              | otherwise = ps : map (p :) (go ps)+         in go acts  -- Running state models