Skip to content

Commit 989ffe8

Browse files
committed
seed: test with no seed & with another seed
1 parent fc82915 commit 989ffe8

File tree

1 file changed

+20
-9
lines changed

1 file changed

+20
-9
lines changed

test/proper_tests.erl

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1043,19 +1043,30 @@ options_test_() ->
10431043

10441044
seeded_test_() ->
10451045
Seed = os:timestamp(),
1046-
Opts = [{seed,Seed}, noshrink, {start_size,65536}],
1046+
BaseOpts = [noshrink, {start_size,65536}],
10471047
QC = fun (Prop) ->
1048-
R = proper:counterexample(Prop, Opts),
1048+
R = proper:counterexample(Prop, [{seed,Seed}|BaseOpts]),
10491049
proper:clean_garbage(),
10501050
R
10511051
end,
1052-
[[?_state_is_clean(), ?_assertEqual(QC(Prop),Check)]
1053-
|| Prop <- [?FORALL(_, integer(), false)
1054-
,?FORALL(_, integer(), ?TRAPEXIT(false))
1055-
,?FORALL_TARGETED(I, integer(), begin ?MAXIMIZE(I),false end)
1056-
],
1057-
Check <- [QC(Prop)]
1058-
].
1052+
NC = fun (Prop) ->
1053+
R = proper:counterexample(Prop, BaseOpts),
1054+
proper:clean_garbage(),
1055+
R
1056+
end,
1057+
OC = fun (Prop) ->
1058+
OtherSeed = os:timestamp(),
1059+
R = proper:counterexample(Prop, [{seed,OtherSeed}|BaseOpts]),
1060+
proper:clean_garbage(),
1061+
R
1062+
end,
1063+
[[?_state_is_clean(), ?_assertEqual(QC(Prop),Check),
1064+
?_state_is_clean(), ?_assertNotEqual(NC(Prop),Check),
1065+
?_state_is_clean(), ?_assertNotEqual(OC(Prop),Check)]
1066+
|| Prop <- [?FORALL(_, integer(), false),
1067+
?FORALL(_, integer(), ?TRAPEXIT(false)),
1068+
?FORALL_TARGETED(I, integer(), begin ?MAXIMIZE(I),false end)],
1069+
Check <- [QC(Prop)]].
10591070

10601071
setup_prop() ->
10611072
?SETUP(fun () ->

0 commit comments

Comments
 (0)