Skip to content

Commit

Permalink
Merge pull request #139 from basho/develo-3.0-fix-eqc-macros
Browse files Browse the repository at this point in the history
fix eqc macros
  • Loading branch information
martinsumner authored May 11, 2020
2 parents a7fae63 + 2e6a001 commit d0de469
Show file tree
Hide file tree
Showing 11 changed files with 16 additions and 15 deletions.
6 changes: 5 additions & 1 deletion 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 @@ -19,4 +19,8 @@ dialyzer:
xref:
$(REBAR) xref

eqc:
$(REBAR) eqc


check: test dialyzer xref
2 changes: 1 addition & 1 deletion src/riak_dt_emcntr.erl
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,6 @@ to_version(_Version, Cntr) ->
%% ===================================================================
%% EUnit tests
%% ===================================================================
-ifdef(TEST).

-ifdef(EQC).
%% EQC generator
Expand Down Expand Up @@ -304,6 +303,7 @@ eqc_state_value(S) ->
S.
-endif.

-ifdef(TEST).
new_test() ->
?assertEqual(0, value(new())).

Expand Down
2 changes: 1 addition & 1 deletion src/riak_dt_enable_flag.erl
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,6 @@ flag_or(off, off) ->
%% ===================================================================
%% EUnit tests
%% ===================================================================
-ifdef(TEST).

-ifdef(EQC).
prop_crdt_converge() ->
Expand All @@ -144,6 +143,7 @@ eqc_state_value(S) ->
S.
-endif.

-ifdef(TEST).
new_test() ->
?assertEqual(off, new()).

Expand Down
2 changes: 1 addition & 1 deletion src/riak_dt_gcounter.erl
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,6 @@ to_version(_Version, C) ->
%% ===================================================================
%% EUnit tests
%% ===================================================================
-ifdef(TEST).

-ifdef(EQC).
prop_crdt_converge() ->
Expand Down Expand Up @@ -197,6 +196,7 @@ eqc_state_value(S) ->
S.
-endif.

-ifdef(TEST).
new_test() ->
?assertEqual([], new()).

Expand Down
3 changes: 1 addition & 2 deletions src/riak_dt_gset.erl
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,7 @@ to_binary_test() ->
GSet = update({add, <<"foo">>}, undefined_actor, riak_dt_gset:new()),
Bin = riak_dt_gset:to_binary(GSet),
?assertMatch( <<82:8/integer, ?V2_VERS:8/integer, _/binary>> , Bin).
-endif.

-ifdef(EQC).
prop_crdt_converge() ->
Expand Down Expand Up @@ -216,5 +217,3 @@ eqc_state_value(Dict) ->
sets:to_list(S).

-endif.

-endif.
2 changes: 1 addition & 1 deletion src/riak_dt_lwwreg.erl
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,6 @@ to_version(_Version, LWW) ->
%% ===================================================================
%% EUnit tests
%% ===================================================================
-ifdef(TEST).

-ifdef(EQC).
prop_crdt_converge() ->
Expand Down Expand Up @@ -204,6 +203,7 @@ eqc_state_value({Val, _TS}) ->
Val.
-endif.

-ifdef(TEST).
new_test() ->
?assertEqual({<<>>, 0}, new()).

Expand Down
3 changes: 2 additions & 1 deletion src/riak_dt_od_flag.erl
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,6 @@ to_version(_Version, Flag) ->
%% ===================================================================
%% EUnit tests
%% ===================================================================
-ifdef(TEST).

-ifdef(EQC).
prop_crdt_converge() ->
Expand Down Expand Up @@ -256,6 +255,8 @@ eqc_state_value(Dict) ->
orddict:fold(fun(_K, V, Acc) -> V or Acc end, false, Dict).
-endif.

-ifdef(TEST).

disable_test() ->
{ok, A} = update(enable, a, new()),
{ok, B} = update(enable, b, new()),
Expand Down
2 changes: 1 addition & 1 deletion src/riak_dt_oe_flag.erl
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,6 @@ to_version(_Version, Flag) ->
%% ===================================================================
%% EUnit tests
%% ===================================================================
-ifdef(TEST).

-ifdef(EQC).
prop_crdt_converge() ->
Expand Down Expand Up @@ -197,6 +196,7 @@ eqc_state_value(Dict) ->
end, true, Dict).
-endif.

-ifdef(TEST).
new_test() ->
?assertEqual(true, value(new())).

Expand Down
3 changes: 1 addition & 2 deletions src/riak_dt_orset.erl
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,7 @@ stat_test() ->
?assertEqual(1, stat(adds_count, Set4)),
?assertEqual(2, stat(removes_count, Set4)),
?assertEqual(67, stat(waste_pct, Set4)).
-endif.

-ifdef(EQC).
prop_crdt_converge() ->
Expand Down Expand Up @@ -374,5 +375,3 @@ eqc_state_value({_Cnt, Dict}) ->
lists:usort(Values).

-endif.

-endif.
3 changes: 1 addition & 2 deletions src/riak_dt_orswot.erl
Original file line number Diff line number Diff line change
Expand Up @@ -620,6 +620,7 @@ batch_order_test() ->
{ok, Set4} = update({remove, <<"baz">>}, a, Set),
{ok, Set5} = update({add, <<"baz">>}, a, Set4),
?assertEqual([<<"bar">>, <<"baz">>], value(Set5)).
-endif.

-ifdef(EQC).
prop_crdt_converge() ->
Expand Down Expand Up @@ -751,5 +752,3 @@ is_sub_bag2([Elem | Rest], SuperBag) ->
end.

-endif.

-endif.
3 changes: 1 addition & 2 deletions src/riak_dt_pncounter.erl
Original file line number Diff line number Diff line change
Expand Up @@ -260,8 +260,6 @@ decrement_by(Decrement, Actor, PNCnt) ->
%% ===================================================================
%% EUnit tests
%% ===================================================================
-ifdef(TEST).

-ifdef(EQC).
prop_crdt_converge() ->
crdt_statem_eqc:prop_converge(?MODULE).
Expand Down Expand Up @@ -305,6 +303,7 @@ eqc_state_value(S) ->
S.
-endif.

-ifdef(TEST).
new_test() ->
?assertEqual([], new()).

Expand Down

0 comments on commit d0de469

Please sign in to comment.