From da9f6c9b1dba9c2e104725e13f3e1ab713b6965b Mon Sep 17 00:00:00 2001 From: Philipp Fehre Date: Thu, 2 Oct 2014 10:58:53 +0100 Subject: [PATCH 1/2] added a test for sanity checking mgets This is added to work towards fixing #43 --- test/cberl_tests.erl | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/test/cberl_tests.erl b/test/cberl_tests.erl index 62340cc..1cfdf71 100644 --- a/test/cberl_tests.erl +++ b/test/cberl_tests.erl @@ -6,6 +6,7 @@ cberl_test_() -> [{foreach, fun setup/0, fun clean_up/1, [fun test_set_and_get/1, fun test_replace_add/1, + fun test_multi_get/1, fun test_get_and_touch/1, fun test_append_prepend/1, fun test_remove/1, @@ -47,6 +48,16 @@ test_set_and_get(_) -> ?_assertMatch({Key, _, Value}, Get3) ]. +test_multi_get(_) -> + Value = "testval", + Keys = [<<"testkeymget1">>, + <<"testkeymget2">>, + <<"testkeymget3">>, + <<"testkeymget4">>, + <<"testkeymget5">>], + lists:map(fun(Key) -> ok = cberl:set(?POOLNAME, Key, 0, Value) end, Keys), + [?_assertMatch({<<"testkeymget1">>,_, "testval"}, lists:nth(1, cberl:mget(?POOLNAME, Keys)))]. + test_replace_add(_) -> Key = <<"testkey">>, Value = "testval", From 23bb22d95854b9e9e3b363b897cfa01700a1af02 Mon Sep 17 00:00:00 2001 From: Philipp Fehre Date: Thu, 2 Oct 2014 11:05:06 +0100 Subject: [PATCH 2/2] test with mget with 1000 keys --- test/cberl_tests.erl | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/test/cberl_tests.erl b/test/cberl_tests.erl index 1cfdf71..a9ec080 100644 --- a/test/cberl_tests.erl +++ b/test/cberl_tests.erl @@ -50,13 +50,9 @@ test_set_and_get(_) -> test_multi_get(_) -> Value = "testval", - Keys = [<<"testkeymget1">>, - <<"testkeymget2">>, - <<"testkeymget3">>, - <<"testkeymget4">>, - <<"testkeymget5">>], + Keys = lists:map(fun(N) -> list_to_binary(integer_to_list(N)) end, lists:seq(1, 1000)), lists:map(fun(Key) -> ok = cberl:set(?POOLNAME, Key, 0, Value) end, Keys), - [?_assertMatch({<<"testkeymget1">>,_, "testval"}, lists:nth(1, cberl:mget(?POOLNAME, Keys)))]. + [?_assertMatch({<<"1">>,_, "testval"}, lists:nth(1, cberl:mget(?POOLNAME, Keys)))]. test_replace_add(_) -> Key = <<"testkey">>,