@@ -36,7 +36,7 @@ module Test.QuickCheck.StateModel (
3636 computePrecondition ,
3737 computeArbitraryAction ,
3838 computeShrinkAction ,
39- negativeTest ,
39+ failureResult ,
4040) where
4141
4242import Control.Monad
@@ -77,7 +77,7 @@ import Test.QuickCheck.StateModel.Variables
7777-- called a _negative_ action. This means that the action is (1) expected to fail and (2) not expected to
7878-- change the model state. This is very useful for testing the checks and failure conditions in the SUT
7979-- are implemented correctly. Should it be necessary to update the model state with e.g. book-keeping for
80- -- a negative action one can define `negativeNextState ` - but it is generally recommended to let this be
80+ -- a negative action one can define `failureNextState ` - but it is generally recommended to let this be
8181-- as simple an action as possible.
8282class
8383 ( forall a . Show (Action state a )
@@ -135,8 +135,8 @@ class
135135
136136 -- | Transition function for negative actions. Note that most negative testing applications
137137 -- should not require an implementation of this function!
138- negativeNextState :: Typeable a => state -> Action state a -> state
139- negativeNextState s _ = s
138+ failureNextState :: Typeable a => state -> Action state a -> state
139+ failureNextState s _ = s
140140
141141 -- | Precondition for filtering generated `Action`.
142142 -- This function is applied before the action is performed, it is useful to refine generators that
@@ -147,7 +147,7 @@ class
147147 -- | Precondition for filtering an `Action` that can meaningfully run but is supposed to fail.
148148 -- An action will run as a _negative_ action if the `precondition` fails and `validFailingAction` succeeds.
149149 -- A negative action should have _no effect_ on the model state. This may not be desierable in all
150- -- situations - in which case one can override this semantics for book-keeping in `negativeNextState `.
150+ -- situations - in which case one can override this semantics for book-keeping in `failureNextState `.
151151 validFailingAction :: state -> Action state a -> Bool
152152 validFailingAction _ _ = False
153153
@@ -214,8 +214,8 @@ class Monad m => RunModel state m where
214214-- for an `Action` like `SomeAct :: Action SomeState SomeType`
215215-- instead of `SomeAct :: Action SomeState (Either SomeError SomeType)`
216216-- but still need to return something in `perform` in the failure case.
217- negativeTest :: HasCallStack => a
218- negativeTest = error " A result of a negative test has been erronesouly inspected"
217+ failureResult :: HasCallStack => a
218+ failureResult = error " A result of a failing action has been erronesouly inspected"
219219
220220computePostcondition :: forall m state a . RunModel state m => (state , state ) -> ActionWithPolarity state a -> LookUp m -> Realized m a -> PostconditionM m Bool
221221computePostcondition ss (ActionWithPolarity a p) l r
@@ -287,7 +287,7 @@ instance (forall a. HasVariables (Action state a)) => HasVariables (Step state)
287287
288288funName :: Polarity -> String
289289funName PosPolarity = " action"
290- funName _ = " negativeAction "
290+ funName _ = " failingAction "
291291
292292instance Show (Step state ) where
293293 show (var := act) = show var ++ " <- " ++ funName (polarity act) ++ " $ " ++ show (polarAction act)
@@ -418,7 +418,7 @@ computeNextState
418418 -> Annotated state
419419computeNextState s a v
420420 | polarity a == PosPolarity = Metadata (extendContext (vars s) v) (nextState (underlyingState s) (polarAction a) v)
421- | otherwise = Metadata (vars s) (negativeNextState (underlyingState s) (polarAction a))
421+ | otherwise = Metadata (vars s) (failureNextState (underlyingState s) (polarAction a))
422422
423423computeArbitraryAction
424424 :: StateModel state
0 commit comments