File tree Expand file tree Collapse file tree 2 files changed +14
-1
lines changed
Expand file tree Collapse file tree 2 files changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -706,7 +706,9 @@ instance StateModel state => Arbitrary (ParallelActions state) where
706706 arbitrary = genParActions
707707
708708 shrink (ParallelActions actions as bs) =
709- filter checkParallelActions [ ParallelActions actions as bs | actions <- QC. shrink actions ]
709+ filter checkParallelActions $ [ ParallelActions actions as bs | actions <- QC. shrink actions ] ++
710+ [ ParallelActions actions (tail as) bs | not $ null as ] ++
711+ [ ParallelActions actions as (tail bs) | not $ null bs ]
710712
711713checkParallelActions :: StateModel state => ParallelActions state -> Bool
712714checkParallelActions pas = checkWellTypedness commonCtx threadA && checkWellTypedness commonCtx threadB
Original file line number Diff line number Diff line change @@ -105,6 +105,17 @@ instance RunModel Counter (ReaderT (IORef Int) IO) where
105105
106106
107107instance RunModelPar Counter (ReaderT (IORef Int ) IO ) where
108+ performPar Inc _ = do
109+ ref <- ask
110+ lift $ atomicModifyIORef ref (\ c -> (c+ 1 , () ))
111+ -- lift $ do
112+ -- n <- readIORef ref
113+ -- threadDelay 50000
114+ -- writeIORef ref (n + 1)
115+ performPar Reset _ = do
116+ ref <- ask
117+ lift $ atomicModifyIORef ref (\ c -> (0 , c))
118+
108119 postconditionPar (Counter n, _) Reset _ res = pure $ n == res
109120 postconditionPar _ _ _ _ = pure True
110121
You can’t perform that action at this time.
0 commit comments