Skip to content

Commit a2e3084

Browse files
add sometimes and always
1 parent 0484319 commit a2e3084

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

quickcheck-dynamic/src/Test/QuickCheck/Extras.hs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ module Test.QuickCheck.Extras where
22

33
import Control.Monad.Reader
44
import Control.Monad.State
5+
import Test.QuickCheck
56
import Test.QuickCheck.Monadic
67

78
runPropertyStateT :: Monad m => PropertyM (StateT s m) a -> s -> PropertyM m (a, s)
@@ -13,3 +14,9 @@ runPropertyReaderT :: Monad m => PropertyM (ReaderT e m) a -> e -> PropertyM m a
1314
runPropertyReaderT p e = MkPropertyM $ \k -> do
1415
m <- unPropertyM p $ fmap lift . k
1516
return $ runReaderT m e
17+
18+
sometimes :: Testable p => Int -> p -> Property
19+
sometimes i = disjoin . replicate i
20+
21+
always :: Testable p => Int -> p -> Property
22+
always i = conjoin . replicate i

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,6 @@ instance RunModelPar Counter (ReaderT (IORef Int) IO) where
120120
postconditionPar _ _ _ _ = pure True
121121

122122
prop_counter_par :: ParallelActions Counter -> Property
123-
prop_counter_par as = monadicIO $ do
123+
prop_counter_par as = always 10 $ monadicIO $ do
124124
ref <- lift $ newIORef (0 :: Int)
125125
runPropertyReaderT (runParActions as) ref

0 commit comments

Comments
 (0)