Skip to content

Commit 6094505

Browse files
committed
Use dict:dict() instead of dict()
1 parent 3ed6b16 commit 6094505

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

pages_src/Tutorials/3#PropEr_testing_of_process_interaction.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ system. As usual, it specifies:
175175
-type name() :: atom().
176176

177177
-record(state, {players = [] :: [name()],
178-
scores = dict:new() :: dict()}).
178+
scores = dict:new() :: dict:dict()}).
179179

180180
initial_state() -> #state{}.
181181

@@ -328,7 +328,7 @@ output more informative debugging information.
328328
[{pretty_state(State),Result} || {State,Result} <- History].
329329

330330
pretty_state(#state{scores = Scores} = S) ->
331-
S#state{scores = dict:to_list(Scores)}.
331+
S#state{scores = dict:to_list(Scores)}. %% temporarily breaks the opacity
332332

333333
prop_ping_pong_works() ->
334334
?FORALL(Cmds, commands(?MODULE),

resources/code/ping_pong/master_statem.erl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
-type name() :: atom().
1111

1212
-record(state, {players = [] :: [name()],
13-
scores = dict:new() :: dict()}).
13+
scores = dict:new() :: dict:dict() | [{_,_}]}).
1414

1515
-define(MASTER, ping_pong).
1616
-define(NAMES, [bob, alice, john, mary, ben]).
@@ -27,7 +27,7 @@ prop_master() ->
2727
{History,State,Result} = run_commands(?MODULE, Cmds),
2828
?MASTER:stop(),
2929
?WHENFAIL(
30-
io:format("History: ~w~nState: ~w\nResult: ~w~n",
30+
io:format("History: ~w~nState: ~w~nResult: ~w~n",
3131
[pretty_history(History), pretty_state(State), Result]),
3232
aggregate(command_names(Cmds), Result =:= ok))
3333
end)).
@@ -36,7 +36,7 @@ pretty_history(History) ->
3636
[{pretty_state(State),Result} || {State,Result} <- History].
3737

3838
pretty_state(#state{scores = Scores} = S) ->
39-
S#state{scores = dict:to_list(Scores)}.
39+
S#state{scores = dict:to_list(Scores)}. %% temporarily breaks the opacity
4040

4141
initial_state() ->
4242
#state{}.

resources/code/ping_pong/ping_pong_statem.erl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
-type name() :: atom().
1111

1212
-record(state, {players = [] :: [name()],
13-
scores = dict:new() :: dict()}).
13+
scores = dict:new() :: dict:dict() | [{_,_}]}).
1414

1515
-define(PLAYER, ping_pong).
1616
-define(MASTER, ping_pong).
@@ -37,7 +37,7 @@ pretty_history(History) ->
3737
[{pretty_state(State),Result} || {State,Result} <- History].
3838

3939
pretty_state(#state{scores = Scores} = S) ->
40-
S#state{scores = dict:to_list(Scores)}.
40+
S#state{scores = dict:to_list(Scores)}. %% temporarily breaks the opacity
4141

4242
%%% Statem Callbacks
4343

0 commit comments

Comments
 (0)