From: Brian Aker Date: Wed, 17 Aug 2011 21:02:50 +0000 (-0700) Subject: Add in binary namespace test. X-Git-Tag: 0.52~17 X-Git-Url: https://git.m6w6.name/?a=commitdiff_plain;h=79e0a4c923bdcfbd11060975811e058dae92e404;hp=-c;p=m6w6%2Flibmemcached Add in binary namespace test. --- 79e0a4c923bdcfbd11060975811e058dae92e404 diff --git a/tests/mem_functions.cc b/tests/mem_functions.cc index ab850f50..d691cbc5 100644 --- a/tests/mem_functions.cc +++ b/tests/mem_functions.cc @@ -1497,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) { @@ -5853,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 },