Skip to content
Browse files

Added extra unit tests for vclock.

  • Loading branch information...
1 parent bc17d41 commit b58266db0985136c23a88e895b3fa26250cee0eb @jonmeredith jonmeredith committed Aug 30, 2011
Showing with 20 additions and 0 deletions.
  1. +20 −0 src/vclock.erl
View
20 src/vclock.erl
@@ -293,4 +293,24 @@ merge_test() ->
?assertEqual([{<<"1">>,{1,1}},{<<"2">>,{2,2}},{<<"3">>,{3,3}},{<<"4">>,{4,4}}],
merge([VC1, VC2])).
+merge_less_left_test() ->
+ VC1 = [{<<"5">>, {5, 5}}],
+ VC2 = [{<<"6">>, {6, 6}}, {<<"7">>, {7, 7}}],
+ ?assertEqual([{<<"5">>, {5, 5}},{<<"6">>, {6, 6}}, {<<"7">>, {7, 7}}],
+ vclock:merge([VC1, VC2])).
+
+merge_less_right_test() ->
+ VC1 = [{<<"6">>, {6, 6}}, {<<"7">>, {7, 7}}],
+ VC2 = [{<<"5">>, {5, 5}}],
+ ?assertEqual([{<<"5">>, {5, 5}},{<<"6">>, {6, 6}}, {<<"7">>, {7, 7}}],
+ vclock:merge([VC1, VC2])).
+
+
+
+merge_same_id_test() ->
+ VC1 = [{<<"1">>, {1, 2}},{<<"2">>,{1,4}}],
+ VC2 = [{<<"1">>, {1, 3}},{<<"3">>,{1,5}}],
+ ?assertEqual([{<<"1">>, {1, 3}},{<<"2">>,{1,4}},{<<"3">>,{1,5}}],
+ vclock:merge([VC1, VC2])).
+
-endif.

0 comments on commit b58266d

Please sign in to comment.
Something went wrong with that request. Please try again.