X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;ds=sidebyside;f=tests%2Flibmemcached-1.0%2Fmem_functions.cc;h=0256588dcba108750bbe76fcb8aa1666cd9fdebf;hb=7ccbfda85fd7004ac0b3ef24283a7027fe2651cd;hp=74efe135d3b2ead65a9de4678623539abce9b00f;hpb=fb4cba571702210fb165cc1fd3f4a212aa682abe;p=awesomized%2Flibmemcached diff --git a/tests/libmemcached-1.0/mem_functions.cc b/tests/libmemcached-1.0/mem_functions.cc index 74efe135..0256588d 100644 --- a/tests/libmemcached-1.0/mem_functions.cc +++ b/tests/libmemcached-1.0/mem_functions.cc @@ -79,6 +79,7 @@ #include "tests/namespace.h" #include "tests/parser.h" #include "tests/libmemcached-1.0/dump.h" +#include "tests/libmemcached-1.0/stat.h" #include "tests/touch.h" #include "tests/callbacks.h" #include "tests/pool.h" @@ -486,7 +487,7 @@ static test_return_t memcached_return_t_TEST(memcached_st *memc) { uint32_t values[] = { 851992627U, 2337886783U, 4109241422U, 4001849190U, 982370485U, 1263635348U, 4242906218U, 3829656100U, - 1891735253U, 334139633U, 2257084983U, 3088286104U, + 1891735253U, 334139633U, 2257084983U, 3351789013U, 13199785U, 2542027183U, 1097051614U, 199566778U, 2748246961U, 2465192557U, 1664094137U, 2405439045U, 1842224848U, 692413798U, 3479807801U, 919913813U, @@ -881,7 +882,7 @@ static test_return_t bad_key_test(memcached_st *memc) test_compare(query_id, memcached_query_id(memc_clone)); // We should not increase the query_id for memcached_behavior_set() /* All keys are valid in the binary protocol (except for length) */ - if (not memcached_behavior_get(memc_clone, MEMCACHED_BEHAVIOR_BINARY_PROTOCOL)) + if (memcached_behavior_get(memc_clone, MEMCACHED_BEHAVIOR_BINARY_PROTOCOL) == false) { uint64_t before_query_id= memcached_query_id(memc_clone); { @@ -4089,8 +4090,8 @@ static test_return_t noreply_test(memcached_st *memc) static test_return_t analyzer_test(memcached_st *memc) { - memcached_return_t rc; memcached_analysis_st *report; + memcached_return_t rc; memcached_stat_st *memc_stat= memcached_stat(memc, NULL, &rc); test_compare(MEMCACHED_SUCCESS, rc); @@ -4106,24 +4107,6 @@ static test_return_t analyzer_test(memcached_st *memc) return TEST_SUCCESS; } -/* Count the objects */ - -static test_return_t dump_test(memcached_st *memc) -{ - /* No support for Binary protocol yet */ - test_skip(false, memc->flags.binary_protocol); - - test_compare(TEST_SUCCESS, set_test3(memc)); - - // confirm_key_count() call dump - size_t counter= confirm_key_count(memc); - - /* We may have more then 32 if our previous flush has not completed */ - test_true(counter >= 32); - - return TEST_SUCCESS; -} - static test_return_t util_version_test(memcached_st *memc) { test_compare_hint(MEMCACHED_SUCCESS, memcached_version(memc), memcached_last_error_message(memc)); @@ -4791,8 +4774,7 @@ static test_return_t regression_bug_442914(memcached_st *memc) test_true(rc == MEMCACHED_SUCCESS || rc == MEMCACHED_BUFFERED); } - (void)snprintf(k, sizeof(k), "%037u", 251U); - len= strlen(k); + len= snprintf(k, sizeof(k), "%037u", 251U); memcached_return_t rc= memcached_delete(memc, k, len, 0); test_true(rc == MEMCACHED_SUCCESS || rc == MEMCACHED_BUFFERED); @@ -4929,6 +4911,10 @@ static test_return_t regression_bug_447342(memcached_st *memc) static test_return_t regression_bug_463297(memcached_st *memc) { + test_compare(MEMCACHED_INVALID_ARGUMENTS, memcached_delete(memc, "foo", 3, 1)); + + // Since we blocked timed delete, this test is no longer valid. +#if 0 memcached_st *memc_clone= memcached_clone(NULL, memc); test_true(memc_clone); test_true(memcached_version(memc_clone) == MEMCACHED_SUCCESS); @@ -4984,6 +4970,8 @@ static test_return_t regression_bug_463297(memcached_st *memc) } memcached_free(memc_clone); +#endif + return TEST_SUCCESS; } @@ -5451,7 +5439,7 @@ static test_return_t regression_bug_490520(memcached_st *memc) test_true(keys[x]); memcached_return rc= memcached_set(memc, keys[x], key_length[x], blob, sizeof(blob), 0, 0); - test_true(rc == MEMCACHED_SUCCESS or rc == MEMCACHED_BUFFERED); + test_true_got(rc == MEMCACHED_SUCCESS or rc == MEMCACHED_BUFFERED, memcached_last_error_message(memc)); } for (uint32_t x= 0; x < regression_bug_490520_COUNT; ++x) @@ -5608,10 +5596,9 @@ test_st tests[] ={ {"connection_test", false, (test_callback_fn*)connection_test}, {"callback_test", false, (test_callback_fn*)callback_test}, {"userdata_test", false, (test_callback_fn*)userdata_test}, - {"set", false, (test_callback_fn*)set_test }, - {"set2", false, (test_callback_fn*)set_test2 }, - {"set3", false, (test_callback_fn*)set_test3 }, - {"dump", true, (test_callback_fn*)dump_test}, + {"memcached_set()", false, (test_callback_fn*)set_test }, + {"memcached_set() 2", false, (test_callback_fn*)set_test2 }, + {"memcached_set() 3", false, (test_callback_fn*)set_test3 }, {"add", true, (test_callback_fn*)add_test }, {"memcached_fetch_result(MEMCACHED_NOTFOUND)", true, (test_callback_fn*)memcached_fetch_result_NOT_FOUND }, {"replace", true, (test_callback_fn*)replace_test }, @@ -5664,7 +5651,10 @@ test_st tests[] ={ {"memcached_exist_by_key(MEMCACHED_SUCCESS)", true, (test_callback_fn*)memcached_exist_by_key_SUCCESS }, {"memcached_touch", 0, (test_callback_fn*)test_memcached_touch}, {"memcached_touch_with_prefix", 0, (test_callback_fn*)test_memcached_touch_by_key}, - {"memcached_dump()", 0, (test_callback_fn*)memcached_dump_TEST }, +#if 0 + {"memcached_dump() no data", true, (test_callback_fn*)memcached_dump_TEST }, +#endif + {"memcached_dump() with data", true, (test_callback_fn*)memcached_dump_TEST2 }, {0, 0, 0} }; @@ -5674,6 +5664,12 @@ test_st touch_tests[] ={ {0, 0, 0} }; +test_st memcached_stat_tests[] ={ + {"memcached_stat() INVALID ARG", 0, (test_callback_fn*)memcached_stat_TEST}, + {"memcached_stat()", 0, (test_callback_fn*)memcached_stat_TEST2}, + {0, 0, 0} +}; + test_st behavior_tests[] ={ {"libmemcached_string_behavior()", false, (test_callback_fn*)libmemcached_string_behavior_test}, {"libmemcached_string_distribution()", false, (test_callback_fn*)libmemcached_string_distribution_test}, @@ -6011,6 +6007,7 @@ collection_st collection[] ={ {"memcached_server_get_last_disconnect", 0, 0, memcached_server_get_last_disconnect_tests}, {"touch", 0, 0, touch_tests}, {"touch", (test_callback_fn*)pre_binary, 0, touch_tests}, + {"memcached_stat()", 0, 0, memcached_stat_tests}, {0, 0, 0, 0} };