Skip to content

Commit

Permalink
failing test
Browse files Browse the repository at this point in the history
  • Loading branch information
v0idpwn committed Jun 1, 2022
1 parent 29bb039 commit b63e446
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
8 changes: 5 additions & 3 deletions apps/antidote_crdt/src/antidote_crdt_map_go.erl
Original file line number Diff line number Diff line change
Expand Up @@ -178,12 +178,14 @@ update2_test() ->
{ok, Map2} = update(Effect1, Map1),
?assertEqual([{{a, antidote_crdt_set_aw}, [a]}], value(Map2)),
Op = {update, [
{{a, antidote_crdt_set_aw}, {remove, a}},
{{a, antidote_crdt_set_aw}, {add, b}}
{{a, antidote_crdt_set_aw}, {add, a}},
{{a, antidote_crdt_set_aw}, {add, b}},
{{a, antidote_crdt_set_aw}, {add, c}},
{{a, antidote_crdt_set_aw}, {remove, a}}
]},
?assert(is_operation(Op)),
{ok, Effect2} = downstream(Op, Map2),
{ok, Map3} = update(Effect2, Map2),
?assertEqual([{{a, antidote_crdt_set_aw}, [b]}], value(Map3)).
?assertEqual([{{a, antidote_crdt_set_aw}, [ b, c]}], value(Map3)).

-endif.
13 changes: 8 additions & 5 deletions apps/antidote_crdt/src/antidote_crdt_map_rr.erl
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ generate_downstream_update({{Key, Type}, Op}, CurrentMap) ->
false -> antidote_crdt:new(Type)
end,
{ok, DownstreamEffect} = antidote_crdt:downstream(Type, Op, CurrentState),
io:format("effect: ~p~n", [DownstreamEffect]),
{{Key, Type}, {ok, DownstreamEffect}}.

-spec generate_downstream_remove(typedKey(), state()) -> nested_downstream().
Expand Down Expand Up @@ -386,14 +387,16 @@ upd(Update, State) ->

multiple_ops_on_same_key_test() ->
M1 = new(),
M2 = upd({update, {{a, antidote_crdt_set_rw}, {add, <<"a">>}}}, M1),
Op = {update, [
{{a, antidote_crdt_set_rw}, {remove, <<"a">>}},
{{a, antidote_crdt_set_rw}, {add, <<"b">>}}
{{a, antidote_crdt_set_rw}, {remove, <<"c">>}},
{{a, antidote_crdt_set_rw}, {add, <<"c">>}}
]},
?assert(is_operation(Op)),
M3 = upd(Op, M2),
?assertEqual([{{a, antidote_crdt_set_rw}, [<<"b">>]}], value(M3)).
M2 = upd(Op, M1),
Op2 = {update, {{a, antidote_crdt_set_rw}, {remove, <<"c">>}}},
Op3 = {update, {{a, antidote_crdt_set_rw}, {add, <<"c">>}}},
M3 = upd(Op3, upd(Op2, M1)),
?assertEqual(value(M3), value(M2)).

remove_test() ->
M1 = new(),
Expand Down

0 comments on commit b63e446

Please sign in to comment.