Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
jorisdral committed Mar 13, 2024
1 parent 78365b2 commit 5125b45
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 6 deletions.
5 changes: 5 additions & 0 deletions cabal.project
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,8 @@ packages: .
package quickcheck-lockstep
tests: True

source-repository-package
type: git
location: https://github.com/jorisdral/quickcheck-dynamic
tag: ba17fb9ad286fef484b2992e76db76ccac79ccdc
subdir: quickcheck-dynamic
2 changes: 1 addition & 1 deletion quickcheck-lockstep.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ library
, mtl >= 2.2 && < 2.4
, containers >= 0.6 && < 0.7
, QuickCheck >= 2.14 && < 2.15
, quickcheck-dynamic >= 3.3.1 && < 3.4
, quickcheck-dynamic >= 3.4 && < 3.5
hs-source-dirs:
src

Expand Down
4 changes: 2 additions & 2 deletions src/Test/QuickCheck/StateModel/Lockstep/Defaults.hs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import Data.Typeable
import Test.QuickCheck (Gen, Property)
import Test.QuickCheck qualified as QC
import Test.QuickCheck.StateModel ( Var, Any(..), LookUp, Realized, PostconditionM
, Action, monitorPost)
, Action, monitorPost, StateModel (Error))
import Test.QuickCheck.StateModel.Variables (VarContext, HasVariables (..))

import Test.QuickCheck.StateModel.Lockstep.API
Expand Down Expand Up @@ -111,7 +111,7 @@ monitoring :: forall m state a.
-> (Lockstep state, Lockstep state)
-> LockstepAction state a
-> LookUp m
-> Realized m a
-> Either (Error (Lockstep state)) (Realized m a)
-> Property -> Property
monitoring _p (before, after) action _lookUp _realResp =
QC.counterexample ("State: " ++ show after)
Expand Down
13 changes: 10 additions & 3 deletions src/Test/QuickCheck/StateModel/Lockstep/Run.hs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{-# LANGUAGE CPP #-}
{-# LANGUAGE TypeOperators #-}

-- | Run lockstep tests
--
Expand Down Expand Up @@ -97,10 +98,13 @@ labelActions (Actions steps) =
-------------------------------------------------------------------------------}

runActions ::
RunLockstep state IO
( RunLockstep state IO
, e ~ Error (Lockstep state)
, forall a. IsPerformResult e a
)
=> Proxy state
-> Actions (Lockstep state) -> Property
runActions _ actions = monadicIO $ void $ StateModel.runActions actions
runActions _ actions = monadicIO $ void $ StateModel.runActions actions

-- | Convenience runner with support for state initialization
--
Expand All @@ -111,7 +115,10 @@ runActions _ actions = monadicIO $ void $ StateModel.runActions actions
-- @'ReaderT' r 'IO'@. In this case, using @'runReaderT'@ as the runner argument
-- is a reasonable choice.
runActionsBracket ::
RunLockstep state m
( RunLockstep state m
, e ~ Error (Lockstep state)
, forall a. IsPerformResult e a
)
=> Proxy state
-> IO st -- ^ Initialisation
-> (st -> IO ()) -- ^ Cleanup
Expand Down

0 comments on commit 5125b45

Please sign in to comment.