Browse files

Fix indentation and extend THANKS

  • Loading branch information...
1 parent 584820f commit e90343ea01a7cb0d4a18c341c7f7d9e35483d713 @kostis kostis committed Jun 26, 2016
Showing with 34 additions and 35 deletions.
  1. +1 −0 THANKS
  2. +7 −8 src/proper_symb.erl
  3. +2 −2 test/proper_tests.erl
  4. +24 −25 test/symb_statem_maps.erl
View
1 THANKS
@@ -21,6 +21,7 @@ pull requests that have been incorporated in PropEr's code base:
18. Magnus L??ng
19. Manuel Cherep
20. Matthias Kretschmer
+ 21. Pierre Fenoll
We sincerely thank them for making PropEr a better tool.
View
15 src/proper_symb.erl
@@ -306,19 +306,18 @@ symb_walk_gen(VarValues, SymbTerm,
maybe_improper_list(S,S | []).
-ifdef(AT_LEAST_17).
do_symb_walk_gen(SymbWalk, SymbTerm) when is_map(SymbTerm) ->
- maps:from_list(
- proper_arith:safe_map(SymbWalk, maps:to_list(SymbTerm)));
+ maps:from_list(proper_arith:safe_map(SymbWalk, maps:to_list(SymbTerm)));
do_symb_walk_gen(SymbWalk, SymbTerm) when is_list(SymbTerm) ->
- proper_arith:safe_map(SymbWalk, SymbTerm);
+ proper_arith:safe_map(SymbWalk, SymbTerm);
do_symb_walk_gen(SymbWalk, SymbTerm) when is_tuple(SymbTerm) ->
- proper_arith:tuple_map(SymbWalk, SymbTerm);
+ proper_arith:tuple_map(SymbWalk, SymbTerm);
do_symb_walk_gen(_, SymbTerm) ->
- SymbTerm.
+ SymbTerm.
-else.
do_symb_walk_gen(SymbWalk, SymbTerm) when is_list(SymbTerm) ->
- proper_arith:safe_map(SymbWalk, SymbTerm);
+ proper_arith:safe_map(SymbWalk, SymbTerm);
do_symb_walk_gen(SymbWalk, SymbTerm) when is_tuple(SymbTerm) ->
- proper_arith:tuple_map(SymbWalk, SymbTerm);
+ proper_arith:tuple_map(SymbWalk, SymbTerm);
do_symb_walk_gen(_, SymbTerm) ->
- SymbTerm.
+ SymbTerm.
-endif.
View
4 test/proper_tests.erl
@@ -895,8 +895,8 @@ true_props_test_() ->
-ifdef(AT_LEAST_17).
map_in_nextstate3_test_() ->
- [?_passes(symb_statem_maps:prop_simple()),
- {timeout, 20, ?_passes(symb_statem_maps:prop_parallel_simple())}].
+ [?_passes(symb_statem_maps:prop_simple()),
+ {timeout, 20, ?_passes(symb_statem_maps:prop_parallel_simple())}].
-endif.
false_props_test_() ->
View
49 test/symb_statem_maps.erl
@@ -1,4 +1,4 @@
-%%% Copyright 2010-2011 Manolis Papadakis <manopapad@gmail.com>,
+%%% Copyright 2016 Manolis Papadakis <manopapad@gmail.com>,
%%% Eirini Arvaniti <eirinibob@gmail.com>
%%% and Kostis Sagonas <kostis@cs.ntua.gr>
%%%
@@ -17,67 +17,66 @@
%%% You should have received a copy of the GNU General Public License
%%% along with PropEr. If not, see <http://www.gnu.org/licenses/>.
-%%% @copyright 2010-2011 Manolis Papadakis, Eirini Arvaniti and Kostis Sagonas
+%%% @copyright 2016 Manolis Papadakis, Eirini Arvaniti and Kostis Sagonas
%%% @version {@version}
-%%% @author Eirini Arvaniti
+%%% @author Pierre Fenoll (adapted from the code of test/symb_statem.erl)
-module(symb_statem_maps).
-include("compile_flags.hrl").
--ifdef(AT_LEAST_17).
+-ifdef(AT_LEAST_17).
-include_lib("proper/include/proper.hrl").
-export([command/1,
- initial_state/0,
- next_state/3,
- precondition/2,
- postcondition/3]).
+ initial_state/0,
+ next_state/3,
+ precondition/2,
+ postcondition/3]).
-export([qux/1]).
-record(state, {qux = #{key => []} :: map()}).
initial_state() ->
- #state{}.
+ #state{}.
command(_S) ->
- oneof([{call,?MODULE,qux,[integer()]}]).
+ oneof([{call,?MODULE,qux,[integer()]}]).
precondition(_, _) ->
- true.
+ true.
next_state(S = #state{qux=Qux}, V, {call,?MODULE,qux,[_Arg]}) ->
- Values = maps:get(key, Qux),
- NewValues = {call,maps,get,[key,V]},
- NewQux = Qux#{key => [{call,erlang,hd,[NewValues]} | Values]},
- S#state{qux = NewQux}.
+ Values = maps:get(key, Qux),
+ NewValues = {call,maps,get,[key,V]},
+ NewQux = Qux#{key => [{call,erlang,hd,[NewValues]} | Values]},
+ S#state{qux = NewQux}.
postcondition(S=#state{qux=#{key:=Values}}, {call,?MODULE,qux,[_Arg]}, Res)
when is_map(Res) ->
- lists:all(fun is_integer/1, Values);
+ lists:all(fun is_integer/1, Values);
postcondition(_, _, _) ->
- false.
+ false.
qux(I) when is_integer(I) ->
- #{key => lists:duplicate(3, I)}.
+ #{key => lists:duplicate(3, I)}.
prop_simple() ->
- ?FORALL(Cmds, commands(?MODULE),
- begin
+ ?FORALL(Cmds, commands(?MODULE),
+ begin
{H,S,Res} = run_commands(?MODULE, Cmds),
?WHENFAIL(
io:format("H: ~w\nState: ~p\n:Res: ~w\n", [H,S,Res]),
Res =:= ok)
- end).
+ end).
prop_parallel_simple() ->
- ?FORALL(Cmds, parallel_commands(?MODULE),
- begin
+ ?FORALL(Cmds, parallel_commands(?MODULE),
+ begin
{S,P,Res} = run_parallel_commands(?MODULE, Cmds),
?WHENFAIL(
io:format("Seq: ~w\nParallel: ~p\n:Res: ~w\n", [S,P,Res]),
Res =:= ok)
- end).
-
+ end).
-endif.

0 comments on commit e90343e

Please sign in to comment.