diff options
author | Brad Anderson <brad@cloudant.com> | 2010-03-31 09:24:34 -0400 |
---|---|---|
committer | Brad Anderson <brad@cloudant.com> | 2010-05-09 22:56:23 -0400 |
commit | 23c494acf0967770a08ba9d72085887dedbc8ccd (patch) | |
tree | 5026432c273529881b8075f74b395f263c2fbcc9 /test | |
parent | 411f5f4925e210f281fb0ddb62b5bfe3525cbe9b (diff) |
add some api calls to mem3, and test hints for first join
Diffstat (limited to 'test')
-rw-r--r-- | test/mem3_test.erl | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/test/mem3_test.erl b/test/mem3_test.erl index 8747cf02..d5420ba3 100644 --- a/test/mem3_test.erl +++ b/test/mem3_test.erl @@ -4,6 +4,9 @@ -include("../include/config.hrl"). -include_lib("eunit/include/eunit.hrl"). +-define(HINT_C1, 365375409332725729550921208179070754913983135744). +-define(HINT_C2, 1096126227998177188652763624537212264741949407232). + %% TEST SETUP all_tests_test_() -> @@ -17,7 +20,8 @@ all_tests_test_() -> [ fun init/1, fun clock/1, - fun join_first/1 + fun join_first/1, + fun join_first_with_hints/1 ]} end} ] @@ -56,3 +60,19 @@ join_first(_Pid) -> Pmap = mem3:partitions(), ?assertEqual(8, length(Pmap)), ok. + + +join_first_with_hints(_Pid) -> + mem3:join(first, [{1, a, []}, + {2, b, []}, + {3, c, [{hints, [?HINT_C1, ?HINT_C2]}]}, + {4, d, []}, + {5, e, []}]), + Fullmap = mem3:fullmap(), + ?assertEqual(24, length(Fullmap)), + Pmap = mem3:partitions(), + ?assertEqual(8, length(Pmap)), + %?debugFmt("~nFullmap: ~p~n", [Fullmap]), + ?assertEqual([c,d,e], mem3:nodes_for_part(?HINT_C1)), + ?assertEqual([c,d,e], mem3:nodes_for_part(?HINT_C2)), + ok. |