X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;f=tests%2Fmem_functions.cc;h=d691cbc57dd5f6186c686d3bb211c776d152bb33;hb=79e0a4c923bdcfbd11060975811e058dae92e404;hp=6845074b96e3637a9e7e6d0d163e696f5cd4a838;hpb=b77f874c7d7ff386d01eeedb44c14d3003354bae;p=m6w6%2Flibmemcached diff --git a/tests/mem_functions.cc b/tests/mem_functions.cc index 6845074b..d691cbc5 100644 --- a/tests/mem_functions.cc +++ b/tests/mem_functions.cc @@ -68,16 +68,18 @@ #define SMALL_STRING_LEN 1024 #include + +#include "tests/basic.h" +#include "tests/debug.h" #include "tests/deprecated.h" -#include "tests/parser.h" +#include "tests/error_conditions.h" #include "tests/ketama.h" -#include "tests/pool.h" #include "tests/namespace.h" -#include "tests/replication.h" -#include "tests/debug.h" -#include "tests/basic.h" -#include "tests/error_conditions.h" +#include "tests/parser.h" +#include "tests/pool.h" #include "tests/print.h" +#include "tests/replication.h" +#include "tests/server_add.h" #include "tests/virtual_buckets.h" using namespace libtest; @@ -1495,6 +1497,34 @@ static test_return_t decrement_with_initial_by_key_test(memcached_st *memc) return TEST_SUCCESS; } +static test_return_t binary_increment_with_prefix_test(memcached_st *orig_memc) +{ + memcached_st *memc= memcached_clone(NULL, orig_memc); + + test_skip(TEST_SUCCESS, pre_binary(memc)); + + test_compare(MEMCACHED_SUCCESS, memcached_callback_set(memc, MEMCACHED_CALLBACK_PREFIX_KEY, (void *)"namespace:")); + + memcached_return_t rc; + rc= memcached_set(memc, + test_literal_param("number"), + test_literal_param("0"), + (time_t)0, (uint32_t)0); + test_true(rc == MEMCACHED_SUCCESS || rc == MEMCACHED_BUFFERED); + + uint64_t new_number; + test_compare(MEMCACHED_SUCCESS, memcached_increment(memc, + test_literal_param("number"), + 1, &new_number)); + test_compare(uint64_t(1), new_number); + + test_compare(MEMCACHED_SUCCESS, memcached_increment(memc, + test_literal_param("number"), + 1, &new_number)); + test_compare(uint64_t(2), new_number); + + return TEST_SUCCESS; +} static test_return_t quit_test(memcached_st *memc) { @@ -3875,7 +3905,7 @@ static test_return_t deprecated_set_memory_alloc(memcached_st *memc) static test_return_t set_memory_alloc(memcached_st *memc) { - test_compare(MEMCACHED_FAILURE, + test_compare(MEMCACHED_INVALID_ARGUMENTS, memcached_set_memory_allocators(memc, NULL, my_free, my_realloc, my_calloc, NULL)); @@ -5851,6 +5881,7 @@ test_st tests[] ={ {"increment_with_initial_by_key", true, (test_callback_fn*)increment_with_initial_by_key_test }, {"decrement_by_key", false, (test_callback_fn*)decrement_by_key_test }, {"decrement_with_initial_by_key", true, (test_callback_fn*)decrement_with_initial_by_key_test }, + {"binary_increment_with_prefix", 1, (test_callback_fn*)binary_increment_with_prefix_test }, {"quit", false, (test_callback_fn*)quit_test }, {"mget", true, (test_callback_fn*)mget_test }, {"mget_result", true, (test_callback_fn*)mget_result_test }, @@ -6131,6 +6162,12 @@ test_st virtual_bucket_tests[] ={ {0, 0, (test_callback_fn*)0} }; +test_st memcached_server_add_tests[] ={ + {"memcached_server_add(\"\")", false, (test_callback_fn*)memcached_server_add_empty_test }, + {"memcached_server_add(NULL)", false, (test_callback_fn*)memcached_server_add_null_test }, + {0, 0, (test_callback_fn*)0} +}; + test_st namespace_tests[] ={ {"basic tests", true, (test_callback_fn*)selection_of_namespace_tests }, {"increment", true, (test_callback_fn*)memcached_increment_namespace }, @@ -6145,6 +6182,7 @@ collection_st collection[] ={ {"basic", 0, 0, basic_tests}, {"hsieh_availability", 0, 0, hsieh_availability}, {"murmur_availability", 0, 0, murmur_availability}, + {"memcached_server_add", 0, 0, memcached_server_add_tests}, {"block", 0, 0, tests}, {"binary", (test_callback_fn*)pre_binary, 0, tests}, {"nonblock", (test_callback_fn*)pre_nonblock, 0, tests},