Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge branch 'jdb-faster-slide-eunit-fixes-squashed'

  • Loading branch information...
commit eaa81c8a21e9ca9ebac8f0fc8df414594057ba4f 2 parents cbe909a + 60106b9
@slfritchie slfritchie authored
Showing with 11 additions and 7 deletions.
  1. +2 −2 test/folsom_sample_slide_test.erl
  2. +9 −5 test/slide_statem_eqc.erl
View
4 test/folsom_sample_slide_test.erl
@@ -100,6 +100,6 @@ check_table(Slide, Moments) ->
Tab = lists:sort(ets:tab2list(Slide#slide.reservoir)),
{Ks, Vs} = lists:unzip(Tab),
ExpectedVs = lists:sort(lists:flatten([lists:duplicate(10, N) || N <- Moments])),
- Keys = lists:usort(Ks),
- ?assertEqual(Moments, Keys),
+ StrippedKeys = lists:usort([X || {X, _} <- Ks]),
+ ?assertEqual(Moments, StrippedKeys),
?assertEqual(ExpectedVs, lists:sort(Vs)).
View
14 test/slide_statem_eqc.erl
@@ -36,7 +36,6 @@
--define(NUMTESTS, 200).
-define(QC_OUT(P),
eqc:on_output(fun(Str, Args) ->
io:format(user, Str, Args) end, P)).
@@ -95,7 +94,8 @@ postcondition(#state{values=Values0, moment=Moment}, {call, ?MODULE, get_values,
end;
postcondition(#state{values=Values, sample=Sample, moment=Moment}, {call, ?MODULE, trim, _}, _TrimCnt) ->
%% check that values and the actual table contents are the same after a trim
- Table = ets:tab2list(Sample#slide.reservoir),
+ Table0 = ets:tab2list(Sample#slide.reservoir),
+ Table = [{X, Y} || {{X, _}, Y} <- Table0],
Model = lists:sort(trim(Values, Moment, ?WINDOW)),
case Model == lists:sort(Table) of
true ->
@@ -107,9 +107,13 @@ postcondition(_S, {call, ?MODULE, _, _}, _Res) ->
true.
prop_window_test_() ->
- {setup, fun() -> ok end, fun(_X) -> (catch meck:unload(folsom_utils)), folsom:stop() end,
- fun(_X) ->
- ?_assert(eqc:quickcheck(eqc:numtests(?NUMTESTS, ?QC_OUT(prop_window())))) end}.
+ Seconds = 10,
+ {setup,
+ fun() -> ok end,
+ fun(_X) -> (catch meck:unload(folsom_utils)), folsom:stop() end,
+ [{"QuickCheck Test",
+ {timeout, Seconds*2, fun() -> true = eqc:quickcheck(eqc:testing_time(Seconds, ?QC_OUT(prop_window()))) end
+ }}]}.
prop_window() ->
folsom:start(),
Please sign in to comment.
Something went wrong with that request. Please try again.