Skip to content

Commit

Permalink
trying things out from PR comments...
Browse files Browse the repository at this point in the history
  • Loading branch information
fenollp committed May 17, 2018
1 parent 35ea333 commit d6495b9
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 5 deletions.
4 changes: 4 additions & 0 deletions include/proper_common.hrl
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@
%%% @author Manolis Papadakis
%%% @doc Common parts of user and internal header files

-ifndef(PROPER_COMMON_HRL).
-define(PROPER_COMMON_HRL, true).

%%------------------------------------------------------------------------------
%% Test generation macros
Expand Down Expand Up @@ -82,3 +84,5 @@
end, Prop)).
-define(FORALL_SA(X, RawType, Prop),
?STRATEGY(proper_sa, proper:forall(RawType,fun(X) -> Prop end))).

-endif.
2 changes: 1 addition & 1 deletion src/proper.erl
Original file line number Diff line number Diff line change
Expand Up @@ -934,7 +934,7 @@ parse_opt(UserOpt, Opts) ->
{search_steps, N} -> Opts#opts{search_steps = N};
{search_strategy, S} -> Opts#opts{search_strategy = S};
N when is_integer(N) -> Opts#opts{numtests = N};
{seed,Seed} -> Opts#opts{seed = Seed};
{seed,Seed} -> proper_arith:rand_start(Seed),Opts#opts{seed = Seed};
{start_size,Size} -> Opts#opts{start_size = Size};
{max_size,Size} -> Opts#opts{max_size = Size};
{max_shrinks,N} -> Opts#opts{max_shrinks = N};
Expand Down
22 changes: 18 additions & 4 deletions test/proper_tests.erl
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@

-module(proper_tests).

-include("compile_flags.hrl").
-include("proper_internal.hrl").
-include("proper.hrl").

-include_lib("eunit/include/eunit.hrl").
Expand Down Expand Up @@ -1038,9 +1038,23 @@ options_test_() ->
[{constraint_tries,0}], true),
?_failsWith([12],
?FORALL(_,?SIZED(Size,integer(Size,Size)),false),
[{start_size,12}]),
?_failsWith([2762], ?FORALL(_,integer(),false),
[{seed,{1526,530081,919799}},noshrink,{start_size,65536}])].
[{start_size,12}])].

seeded_test_() ->
Seed = {1526,530081,919799},
SomeInt = case ?RANDOM_MOD of
rand -> 2762;
random -> 156399
end,
F = fun () ->
%% proper_arith:rand_start(Seed),
%% io:format(user, "\n>>> ~p\n", [get(?SEED_NAME)]),
%% put(my_seed,get(?SEED_NAME)),
fun() -> ok end
end,
Opts = [{seed,Seed}, noshrink, {start_size,65536}],
[?_failsWith([SomeInt], ?SETUP(F,?FORALL(_,integer(),false)), Opts)
].%%,?_assertEqual(Seed, erase(my_seed))].

setup_prop() ->
?SETUP(fun () ->
Expand Down

0 comments on commit d6495b9

Please sign in to comment.