Skip to content

Commit cc4c721

Browse files
split things out a little bit
1 parent 4ef1b8c commit cc4c721

File tree

2 files changed

+14
-10
lines changed

2 files changed

+14
-10
lines changed

quickcheck-dynamic/src/Test/QuickCheck/StateModel/Variables.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ import Test.QuickCheck (Gen, Smart (..), elements)
3939

4040
-- | A symbolic variable for a value of type `a`
4141
newtype Var a = Var Int
42-
deriving (Eq, Ord, Typeable, Data)
42+
deriving (Eq, Ord, Data)
4343

4444
-- | Create a fresh symbolic variable with given identifier. While 'Var's are
4545
-- usually created by action generators, this function can be used for example

quickcheck-dynamic/test/Spec/DynamicLogic/RegistryModel.hs

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -256,21 +256,25 @@ prop_parRegistryIOSim (IOSimActions as) = monadicIOSim_ prop
256256
pure ()
257257

258258
prop_parRegistryIOSimPor :: IOSimActions -> Property
259-
prop_parRegistryIOSimPor (IOSimActions as) = forAllBlind prop' $ \ p -> exploreSimTrace id p $ \ _ tr ->
260-
either (flip counterexample False . show) id $ traceResult False tr
259+
prop_parRegistryIOSimPor (IOSimActions as) =
260+
monadicIOSimPOR_ prop
261261
where
262-
prop' :: Gen (forall s. IOSim s Property)
263-
prop' = do
264-
Capture eval <- capture
265-
pure (eval prop)
266-
267-
prop :: forall s. Gen (IOSim s Property)
268-
prop = monadic' $ do
262+
prop :: forall s. PropertyM (IOSim s) ()
263+
prop = do
269264
reg <- lift setupRegistry
270265
lift exploreRaces
271266
runPropertyReaderT (runParActions $ as @s) reg
272267
pure ()
273268

269+
monadicIOSimPOR_ :: Testable a => (forall s. PropertyM (IOSim s) a) -> Property
270+
monadicIOSimPOR_ prop = forAllBlind prop' $ \ p -> exploreSimTrace id p $ \ _ tr ->
271+
either (flip counterexample False . show) id $ traceResult False tr
272+
where
273+
prop' :: Gen (forall s. IOSim s Property)
274+
prop' = do
275+
Capture eval <- capture
276+
pure $ eval $ monadic' prop
277+
274278
propDL :: DL (RegState IO) () -> Property
275279
propDL d = forAllDL d prop_Registry
276280

0 commit comments

Comments
 (0)