Skip to content

Commit cc8bae3

Browse files
Add boolean, max_int and orset join-decompositions property tests
1 parent 01af5ed commit cc8bae3

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

test/prop_join_decompositions.erl

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@
3131
-define(ACTOR, oneof([a, b, c])).
3232
-define(L(T), list({T, ?ACTOR})).
3333

34+
%% primitives
35+
-define(TRUE, true).
36+
3437
%% counters
3538
-define(INC, increment).
3639
-define(DEC, decrement).
@@ -43,6 +46,23 @@
4346
-define(ADDRMV, oneof([?ADD, ?RMV])).
4447

4548

49+
%% primitives
50+
prop_boolean_decomposition() ->
51+
?FORALL(L, ?L(?TRUE),
52+
check_decomposition(create(?BOOLEAN_TYPE, L))).
53+
prop_boolean_redundant() ->
54+
?FORALL(L, ?L(?TRUE),
55+
check_redundant(create(?BOOLEAN_TYPE, L))).
56+
57+
prop_max_int_decomposition() ->
58+
?FORALL(L, ?L(?INC),
59+
check_decomposition(create(?MAX_INT_TYPE, L))).
60+
prop_max_int_redundant() ->
61+
?FORALL(L, ?L(?INC),
62+
check_redundant(create(?MAX_INT_TYPE, L))).
63+
64+
65+
%% counters
4666
prop_gcounter_decomposition() ->
4767
?FORALL(L, ?L(?INC),
4868
check_decomposition(create(?GCOUNTER_TYPE, L))).
@@ -57,6 +77,7 @@ prop_pncounter_redundant() ->
5777
?FORALL(L, ?L(?INCDEC),
5878
check_redundant(create(?PNCOUNTER_TYPE, L))).
5979

80+
%% sets
6081
prop_gset_decomposition() ->
6182
?FORALL(L, ?L(?ADD),
6283
check_decomposition(create(?GSET_TYPE, L))).
@@ -78,6 +99,13 @@ prop_awset_redundant() ->
7899
?FORALL(L, ?L(?ADDRMV),
79100
check_redundant(create(?AWSET_TYPE, L))).
80101

102+
prop_orset_decomposition() ->
103+
?FORALL(L, ?L(?ADDRMV),
104+
check_decomposition(create(?ORSET_TYPE, L))).
105+
prop_orset_redundant() ->
106+
?FORALL(L, ?L(?ADDRMV),
107+
check_redundant(create(?ORSET_TYPE, L))).
108+
81109
%% @private
82110
check_decomposition({Type, _}=CRDT) ->
83111
Bottom = state_type:new(CRDT),

0 commit comments

Comments
 (0)