Skip to content

Commit 3fca82e

Browse files
Review comments
1 parent 8d13c68 commit 3fca82e

File tree

2 files changed

+15
-14
lines changed

2 files changed

+15
-14
lines changed

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

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,8 @@ prettyWitnesses Do{} = []
297297
instance StateModel s => Show (DynLogicTest s) where
298298
show (BadPrecondition is ss bad s) =
299299
"-- Initial state: "
300-
++ show is
300+
++ show s
301+
++ "\n"
301302
++ prettyTestSequence (usedVariables is ss <> allVariables bad) ss
302303
++ "\n -- In state: "
303304
++ show s
@@ -312,21 +313,17 @@ instance StateModel s => Show (DynLogicTest s) where
312313
| p == PosPolarity = "action"
313314
| otherwise = "failingAction"
314315
show (Looping is ss) =
315-
"-- Initial state: "
316-
++ show is
317-
++ prettyTestSequence (usedVariables is ss) ss
318-
++ "\n pure ()\n -- Looping"
316+
showTest is ss
317+
++ "\n -- Looping"
319318
show (Stuck is ss s) =
320-
"-- Initial state: "
321-
++ show is
322-
++ prettyTestSequence (usedVariables is ss) ss
323-
++ "\n pure ()\n -- Stuck in state "
319+
showTest is ss
320+
++ "\n -- Stuck in state "
324321
++ show s
325322
show (DLScript is ss) =
326-
"-- Initial state: "
327-
++ show is
328-
++ prettyTestSequence (usedVariables is ss) ss
329-
++ "\n pure ()\n"
323+
showTest is ss
324+
325+
showTest :: StateModel s => Annotated s -> TestSequence s -> String
326+
showTest is ss = "-- Initial state: " ++ show is ++ "\n" ++ prettyTestSequence (usedVariables is ss) ss ++ "\n pure ()"
330327

331328
usedVariables :: forall s. StateModel s => Annotated s -> TestSequence s -> VarContext
332329
usedVariables s = go s

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,11 @@ instance Eq (Step state) where
328328
-- We also collect a list of names of actions which were generated,
329329
-- but were then rejected by their precondition.
330330

331-
data Actions state = Actions_ [String] state (Smart [Step state])
331+
data Actions state = Actions_
332+
{ actionsRejected :: [String]
333+
, actionsInitialState :: state
334+
, actionsSteps :: Smart [Step state]
335+
}
332336
deriving (Generic)
333337

334338
pattern Actions :: state -> [Step state] -> Actions state

0 commit comments

Comments
 (0)