Skip to content

Commit 3d594fe

Browse files
Remove more of the negative.* names
1 parent dadb133 commit 3d594fe

File tree

3 files changed

+13
-13
lines changed

3 files changed

+13
-13
lines changed

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
module Test.QuickCheck.DynamicLogic (
1010
DL,
1111
action,
12-
negativeAction,
12+
failingAction,
1313
anyAction,
1414
anyActions,
1515
anyActions_,
@@ -63,8 +63,8 @@ instance MonadFail (DL s) where
6363
action :: (Typeable a, Eq (Action s a), Show (Action s a)) => Action s a -> DL s (Var a)
6464
action cmd = DL $ \_ k -> DL.after cmd k
6565

66-
negativeAction :: (Typeable a, Eq (Action s a), Show (Action s a)) => Action s a -> DL s ()
67-
negativeAction cmd = DL $ \_ k -> DL.afterNegative cmd (k ())
66+
failingAction :: (Typeable a, Eq (Action s a), Show (Action s a)) => Action s a -> DL s ()
67+
failingAction cmd = DL $ \_ k -> DL.afterNegative cmd (k ())
6868

6969
anyAction :: DL s ()
7070
anyAction = DL $ \_ k -> DL.afterAny $ k ()

quickcheck-dynamic/src/Test/QuickCheck/DynamicLogic/Internal.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,7 @@ instance StateModel s => Show (DynLogicTest s) where
306306
where
307307
f
308308
| p == PosPolarity = "action"
309-
| otherwise = "negativeAction"
309+
| otherwise = "failingAction"
310310
show (Looping ss) = prettyTestSequence (usedVariables ss) ss ++ "\n pure ()\n -- Looping"
311311
show (Stuck ss s) = prettyTestSequence (usedVariables ss) ss ++ "\n pure ()\n -- Stuck in state " ++ show s
312312
show (DLScript ss) = prettyTestSequence (usedVariables ss) ss ++ "\n pure ()\n"

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

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ module Test.QuickCheck.StateModel (
3636
computePrecondition,
3737
computeArbitraryAction,
3838
computeShrinkAction,
39-
negativeTest,
39+
failureResult,
4040
) where
4141

4242
import 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.
8282
class
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

220220
computePostcondition :: forall m state a. RunModel state m => (state, state) -> ActionWithPolarity state a -> LookUp m -> Realized m a -> PostconditionM m Bool
221221
computePostcondition ss (ActionWithPolarity a p) l r
@@ -287,7 +287,7 @@ instance (forall a. HasVariables (Action state a)) => HasVariables (Step state)
287287

288288
funName :: Polarity -> String
289289
funName PosPolarity = "action"
290-
funName _ = "negativeAction"
290+
funName _ = "failingAction"
291291

292292
instance Show (Step state) where
293293
show (var := act) = show var ++ " <- " ++ funName (polarity act) ++ " $ " ++ show (polarAction act)
@@ -418,7 +418,7 @@ computeNextState
418418
-> Annotated state
419419
computeNextState 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

423423
computeArbitraryAction
424424
:: StateModel state

0 commit comments

Comments
 (0)