diff --git a/constrained-generators.cabal b/constrained-generators.cabal index 1b487af..a60c53b 100644 --- a/constrained-generators.cabal +++ b/constrained-generators.cabal @@ -15,7 +15,7 @@ source-repository head type: git location: https://github.com/input-output-hk/constrained-generators -flag devel +flag dev description: Enable development mode default: False manual: True @@ -52,7 +52,7 @@ library hs-source-dirs: src - if flag(devel) + if flag(dev) exposed-modules: Constrained.Examples Constrained.Examples.Basic diff --git a/src/Constrained/Spec/SumProd.hs b/src/Constrained/Spec/SumProd.hs index 647d03e..a295ea1 100644 --- a/src/Constrained/Spec/SumProd.hs +++ b/src/Constrained/Spec/SumProd.hs @@ -590,10 +590,17 @@ chooseSpec :: chooseSpec (w, s) (w', s') = constrained $ \x -> exists (\eval -> pure $ if eval x `conformsToSpec` s then PickFirst else PickSecond) $ \p -> - caseOn - p - (branchW w' $ \_ -> (x `satisfies` s)) - (branchW w $ \_ -> (x `satisfies` s')) + [ caseOn + p + (branch $ \_ -> (x `satisfies` s)) + (branch $ \_ -> (x `satisfies` s')) + -- This is a bit ugly :( + , caseOn + p + (branchW w $ \_ -> True) + (branchW w' $ \_ -> True) + , x `dependsOn` p + ] data Picky = PickFirst | PickSecond deriving (Ord, Eq, Show, Generic) diff --git a/test/Constrained/Tests.hs b/test/Constrained/Tests.hs index 9edbc96..685c035 100644 --- a/test/Constrained/Tests.hs +++ b/test/Constrained/Tests.hs @@ -154,6 +154,7 @@ tests nightly = testSpecNoShrink "threeSpecific" threeSpecific testSpecNoShrink "threeSpecific'" threeSpecific' testSpecNoShrink "trueSpecUniform" trueSpecUniform + testSpec "posNegDistr" posNegDistr testSpec "ifElseMany" ifElseMany testSpecNoShrink "propBack" propBack testSpecNoShrink "propBack'" propBack'