Adding test case for 994772.
authorBrian Aker <brian@tangent.org>
Fri, 11 May 2012 07:09:16 +0000 (00:09 -0700)
committerBrian Aker <brian@tangent.org>
Fri, 11 May 2012 07:09:16 +0000 (00:09 -0700)
tests/libmemcached-1.0/all_tests.h
tests/libmemcached-1.0/mem_functions.cc
tests/libmemcached-1.0/mem_functions.h

index bcfc90fc0dad4b14b7cab641e309befc541ffe6c..f5ca59279d05774e7e7debcedbfaf94af659470d 100644 (file)
@@ -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}
 };
 
index e6c82a1d0eef30fa57b65273b584504b93f46ceb..2f1dff722e0cc0a5f157b56908d66aa511e42a81 100644 (file)
@@ -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];
index 55e382e60ad82469d213316afb24aa68f263f125..4dca710bbb2bfe6eede33fe42fcbec03656b305f 100644 (file)
@@ -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*);