Skip to content

Commit d6495b9

Browse files
committed
trying things out from PR comments...
1 parent 35ea333 commit d6495b9

File tree

3 files changed

+23
-5
lines changed

3 files changed

+23
-5
lines changed

include/proper_common.hrl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@
2626
%%% @author Manolis Papadakis
2727
%%% @doc Common parts of user and internal header files
2828

29+
-ifndef(PROPER_COMMON_HRL).
30+
-define(PROPER_COMMON_HRL, true).
2931

3032
%%------------------------------------------------------------------------------
3133
%% Test generation macros
@@ -82,3 +84,5 @@
8284
end, Prop)).
8385
-define(FORALL_SA(X, RawType, Prop),
8486
?STRATEGY(proper_sa, proper:forall(RawType,fun(X) -> Prop end))).
87+
88+
-endif.

src/proper.erl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -934,7 +934,7 @@ parse_opt(UserOpt, Opts) ->
934934
{search_steps, N} -> Opts#opts{search_steps = N};
935935
{search_strategy, S} -> Opts#opts{search_strategy = S};
936936
N when is_integer(N) -> Opts#opts{numtests = N};
937-
{seed,Seed} -> Opts#opts{seed = Seed};
937+
{seed,Seed} -> proper_arith:rand_start(Seed),Opts#opts{seed = Seed};
938938
{start_size,Size} -> Opts#opts{start_size = Size};
939939
{max_size,Size} -> Opts#opts{max_size = Size};
940940
{max_shrinks,N} -> Opts#opts{max_shrinks = N};

test/proper_tests.erl

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828

2929
-module(proper_tests).
3030

31-
-include("compile_flags.hrl").
31+
-include("proper_internal.hrl").
3232
-include("proper.hrl").
3333

3434
-include_lib("eunit/include/eunit.hrl").
@@ -1038,9 +1038,23 @@ options_test_() ->
10381038
[{constraint_tries,0}], true),
10391039
?_failsWith([12],
10401040
?FORALL(_,?SIZED(Size,integer(Size,Size)),false),
1041-
[{start_size,12}]),
1042-
?_failsWith([2762], ?FORALL(_,integer(),false),
1043-
[{seed,{1526,530081,919799}},noshrink,{start_size,65536}])].
1041+
[{start_size,12}])].
1042+
1043+
seeded_test_() ->
1044+
Seed = {1526,530081,919799},
1045+
SomeInt = case ?RANDOM_MOD of
1046+
rand -> 2762;
1047+
random -> 156399
1048+
end,
1049+
F = fun () ->
1050+
%% proper_arith:rand_start(Seed),
1051+
%% io:format(user, "\n>>> ~p\n", [get(?SEED_NAME)]),
1052+
%% put(my_seed,get(?SEED_NAME)),
1053+
fun() -> ok end
1054+
end,
1055+
Opts = [{seed,Seed}, noshrink, {start_size,65536}],
1056+
[?_failsWith([SomeInt], ?SETUP(F,?FORALL(_,integer(),false)), Opts)
1057+
].%%,?_assertEqual(Seed, erase(my_seed))].
10441058

10451059
setup_prop() ->
10461060
?SETUP(fun () ->

0 commit comments

Comments
 (0)