Skip to content

Commit

Permalink
seed: test with no seed & with another seed
Browse files Browse the repository at this point in the history
  • Loading branch information
fenollp committed Oct 3, 2018
1 parent bb720a9 commit c5f2d8c
Showing 1 changed file with 20 additions and 9 deletions.
29 changes: 20 additions & 9 deletions test/proper_tests.erl
Original file line number Diff line number Diff line change
Expand Up @@ -1043,19 +1043,30 @@ options_test_() ->

seeded_test_() ->
Seed = os:timestamp(),
Opts = [{seed,Seed}, noshrink, {start_size,65536}],
BaseOpts = [noshrink, {start_size,65536}],
QC = fun (Prop) ->
R = proper:counterexample(Prop, Opts),
R = proper:counterexample(Prop, [{seed,Seed}|BaseOpts]),
proper:clean_garbage(),
R
end,
[[?_state_is_clean(), ?_assertEqual(QC(Prop),Check)]
|| Prop <- [?FORALL(_, integer(), false)
,?FORALL(_, integer(), ?TRAPEXIT(false))
,?FORALL_TARGETED(I, integer(), begin ?MAXIMIZE(I),false end)
],
Check <- [QC(Prop)]
].
NC = fun (Prop) ->
R = proper:counterexample(Prop, BaseOpts),
proper:clean_garbage(),
R
end,
OC = fun (Prop) ->
OtherSeed = os:timestamp(),
R = proper:counterexample(Prop, [{seed,OtherSeed}|BaseOpts]),
proper:clean_garbage(),
R
end,
[[?_state_is_clean(), ?_assertEqual(QC(Prop),Check),
?_state_is_clean(), ?_assertNotEqual(NC(Prop),Check),
?_state_is_clean(), ?_assertNotEqual(OC(Prop),Check)]
|| Prop <- [?FORALL(_, integer(), false),
?FORALL(_, integer(), ?TRAPEXIT(false)),
?FORALL_TARGETED(I, integer(), begin ?MAXIMIZE(I),false end)],
Check <- [QC(Prop)]].

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

0 comments on commit c5f2d8c

Please sign in to comment.