From: Brian Aker Date: Fri, 11 May 2012 07:09:16 +0000 (-0700) Subject: Adding test case for 994772. X-Git-Tag: 1.0.8~5^2 X-Git-Url: https://git.m6w6.name/?a=commitdiff_plain;h=a11ae747b7dec5587f623e34099e7cd132c08604;p=m6w6%2Flibmemcached Adding test case for 994772. --- diff --git a/tests/libmemcached-1.0/all_tests.h b/tests/libmemcached-1.0/all_tests.h index bcfc90fc..f5ca5927 100644 --- a/tests/libmemcached-1.0/all_tests.h +++ b/tests/libmemcached-1.0/all_tests.h @@ -274,6 +274,7 @@ test_st regression_tests[]= { {"lp:490520", true, (test_callback_fn*)regression_bug_490520 }, {"lp:854604", true, (test_callback_fn*)regression_bug_854604 }, {"lp:996813", true, (test_callback_fn*)regression_996813_TEST }, + {"lp:994772", true, (test_callback_fn*)regression_994772_TEST }, {0, false, (test_callback_fn*)0} }; diff --git a/tests/libmemcached-1.0/mem_functions.cc b/tests/libmemcached-1.0/mem_functions.cc index e6c82a1d..2f1dff72 100644 --- a/tests/libmemcached-1.0/mem_functions.cc +++ b/tests/libmemcached-1.0/mem_functions.cc @@ -4590,6 +4590,46 @@ test_return_t regression_bug_490520(memcached_st *original_memc) } +test_return_t regression_994772_TEST(memcached_st* memc) +{ + test_skip(MEMCACHED_SUCCESS, memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_BINARY_PROTOCOL, 1)); + + test_compare(MEMCACHED_SUCCESS, + memcached_set(memc, + test_literal_param(__func__), // Key + test_literal_param(__func__), // Value + time_t(0), uint32_t(0))); + + const char *keys[] = { __func__ }; + size_t key_length[]= { strlen(__func__) }; + test_compare(MEMCACHED_SUCCESS, + memcached_mget(memc, keys, key_length, 1)); + + memcached_return_t rc; + memcached_result_st *results = memcached_fetch_result(memc, NULL, &rc); + test_true(results); + test_compare(MEMCACHED_SUCCESS, rc); + + test_strcmp(__func__, memcached_result_value(results)); + uint64_t cas_value= memcached_result_cas(results); + test_true(cas_value); + + // Bad cas value, sanity check + test_true(cas_value != 9999); + test_compare(MEMCACHED_END, + memcached_cas(memc, + test_literal_param(__func__), // Key + test_literal_param(__FILE__), // Value + time_t(0), uint32_t(0), 9999)); + + test_compare(MEMCACHED_SUCCESS, memcached_set(memc, + "different", strlen("different"), // Key + test_literal_param(__FILE__), // Value + time_t(0), uint32_t(0))); + + return TEST_SUCCESS; +} + test_return_t regression_bug_854604(memcached_st *) { char buffer[1024]; diff --git a/tests/libmemcached-1.0/mem_functions.h b/tests/libmemcached-1.0/mem_functions.h index 55e382e6..4dca710b 100644 --- a/tests/libmemcached-1.0/mem_functions.h +++ b/tests/libmemcached-1.0/mem_functions.h @@ -175,3 +175,4 @@ test_return_t wrong_failure_counter_test(memcached_st *memc); test_return_t wrong_failure_counter_two_test(memcached_st *memc); test_return_t kill_HUP_TEST(memcached_st *memc); test_return_t regression_996813_TEST(memcached_st*); +test_return_t regression_994772_TEST(memcached_st*);