Skip to content

Commit

Permalink
Merge pull request #962 from Quviq/develop-3.0
Browse files Browse the repository at this point in the history
QuickCheck improvements
  • Loading branch information
martinsumner authored May 12, 2020
2 parents 4f1593f + b0b6783 commit ec58d1a
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 9 deletions.
11 changes: 8 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.PHONY: compile rel cover test dialyzer
.PHONY: compile rel cover test dialyzer eqc
REBAR=./rebar3

compile:
Expand All @@ -7,16 +7,21 @@ compile:
clean:
$(REBAR) clean

cover: test
cover:
$(REBAR) eunit --cover
$(REBAR) cover

test: compile
$(REBAR) as test do eunit
$(REBAR) eunit

dialyzer:
$(REBAR) dialyzer

xref:
$(REBAR) xref

eqc:
$(REBAR) as test eqc --testing_budget 120
$(REBAR) as eqc eunit

check: test dialyzer xref
2 changes: 0 additions & 2 deletions eqc/bg_manager_eqc.erl
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@

-module(bg_manager_eqc).

-ifdef(TEST).
-ifdef(EQC).

-include("include/riak_core_bg_manager.hrl").
Expand Down Expand Up @@ -858,4 +857,3 @@ prop_bgmgr_parallel() ->
end))).

-endif.
-endif.
2 changes: 1 addition & 1 deletion rebar.config
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,5 @@

{profiles, [
{test, [{deps, [meck]}, {erl_opts, [nowarn_export_all]}]},
{eqc, [{deps, [meck]}, {erl_opts, [nowarn_export_all]}]}
{eqc, [{deps, [meck]}, {erl_opts, [{d, 'EQC'}, nowarn_export_all]}]}
]}.
6 changes: 3 additions & 3 deletions src/hashtree.erl
Original file line number Diff line number Diff line change
Expand Up @@ -154,16 +154,14 @@
run_multiple/2,
run_remote/0,
run_remote/1]).
-endif. % TEST

-ifdef(EQC).
-export([prop_correct/0, prop_sha/0, prop_est/0]).
-include_lib("eqc/include/eqc.hrl").
-endif.

-ifdef(TEST).
-include_lib("eunit/include/eunit.hrl").
-endif.
-endif. %% TEST

-define(NUM_SEGMENTS, (1024*1024)).
-define(WIDTH, 1024).
Expand Down Expand Up @@ -1584,6 +1582,7 @@ opened_closed_test() ->
%%% EQC
%%%===================================================================

-ifdef(TEST).
-ifdef(EQC).
prop_sha() ->
%% NOTE: Generating 1MB (1024 * 1024) size binaries is incredibly slow
Expand Down Expand Up @@ -1692,3 +1691,4 @@ prop_est() ->
true
end).
-endif.
-endif.
3 changes: 3 additions & 0 deletions test/riak_core_claim_statem.erl
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,9 @@ weight(_, _, _, _) ->
-define(QC_OUT(P),
eqc:on_output(fun(Str, Args) -> io:format(user, Str, Args) end, P)).

claim_test() ->
eqc:quickcheck(?QC_OUT(prop_claim(with_ring_size(5)))).

eqc_check(File, Prop) ->
{ok, Bytes} = file:read_file(File),
CE = binary_to_term(Bytes),
Expand Down

0 comments on commit ec58d1a

Please sign in to comment.