Skip to content

Commit 4ef1b8c

Browse files
committed
use IOSimPor
1 parent f027501 commit 4ef1b8c

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

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

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
{-# LANGUAGE UndecidableInstances #-}
2+
{-# LANGUAGE ImpredicativeTypes #-}
23
{-# OPTIONS_GHC -Wno-orphans #-}
34
module Spec.DynamicLogic.RegistryModel where
45

56
import Control.Concurrent.Class.MonadSTM
67
import Control.Monad.Class.MonadFork
78
import Control.Monad.Class.MonadThrow
89
import Control.Monad.Class.MonadTimer
10+
import Control.Monad.Class.MonadTest
911
import Control.Monad.IOSim
1012

1113
import GHC.Generics
@@ -253,6 +255,22 @@ prop_parRegistryIOSim (IOSimActions as) = monadicIOSim_ prop
253255
runPropertyReaderT (runParActions $ as @s) reg
254256
pure ()
255257

258+
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
261+
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
269+
reg <- lift setupRegistry
270+
lift exploreRaces
271+
runPropertyReaderT (runParActions $ as @s) reg
272+
pure ()
273+
256274
propDL :: DL (RegState IO) () -> Property
257275
propDL d = forAllDL d prop_Registry
258276

0 commit comments

Comments
 (0)