Update test cases.
authorBrian Aker <brian@tangent.org>
Fri, 20 Jan 2012 01:08:16 +0000 (17:08 -0800)
committerBrian Aker <brian@tangent.org>
Fri, 20 Jan 2012 01:08:16 +0000 (17:08 -0800)
tests/libmemcached-1.0/include.am
tests/libmemcached-1.0/mem_functions.cc
tests/libmemcached-1.0/touch.cc

index 88bdeb1d8224f126d678bcb653265b74d2841564..fe7f347941446001abe15d0138ff327a4d68510a 100644 (file)
@@ -12,6 +12,7 @@ noinst_HEADERS+= \
                 tests/basic.h \
                 tests/callbacks.h \
                 tests/debug.h \
+                tests/deprecated.h \
                 tests/error_conditions.h \
                 tests/exist.h \
                 tests/ketama.h \
@@ -20,13 +21,12 @@ noinst_HEADERS+= \
                 tests/libmemcached-1.0/dump.h \
                 tests/namespace.h \
                 tests/parser.h \
-                tests/touch.h \
-                tests/deprecated.h \
                 tests/pool.h \
                 tests/print.h \
                 tests/replication.h \
                 tests/server_add.h \
                 tests/string.h \
+                tests/touch.h \
                 tests/virtual_buckets.h
 
 # Test internals
@@ -45,6 +45,9 @@ noinst_PROGRAMS+= tests/libmemcached-1.0/internals
 tests_libmemcached_1_0_testapp_CXXFLAGS =  $(AM_CXXFLAGS) ${PTHREAD_CFLAGS}
 tests_libmemcached_1_0_testapp_CFLAGS= $(AM_CFLAGS) $(NO_CONVERSION) $(NO_STRICT_ALIASING)
 tests_libmemcached_1_0_testapp_SOURCES= \
+                                       tests/libmemcached-1.0/pool.cc \
+                                       tests/libmemcached-1.0/print.cc \
+                                       tests/libmemcached-1.0/replication.cc \
                                         tests/libmemcached-1.0/basic.cc \
                                         tests/libmemcached-1.0/callbacks.cc \
                                         tests/libmemcached-1.0/debug.cc \
@@ -55,9 +58,6 @@ tests_libmemcached_1_0_testapp_SOURCES= \
                                         tests/libmemcached-1.0/ketama.cc \
                                         tests/libmemcached-1.0/mem_functions.cc \
                                         tests/libmemcached-1.0/namespace.cc \
-                                       tests/libmemcached-1.0/pool.cc \
-                                       tests/libmemcached-1.0/print.cc \
-                                       tests/libmemcached-1.0/replication.cc \
                                         tests/libmemcached-1.0/parser.cc \
                                         tests/libmemcached-1.0/server_add.cc \
                                         tests/libmemcached-1.0/touch.cc \
index ac88ee50fbde9a10d3e7adc89439af93d59b67d3..74efe135d3b2ead65a9de4678623539abce9b00f 100644 (file)
@@ -1537,11 +1537,9 @@ 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)
+static test_return_t binary_increment_with_prefix_test(memcached_st *memc)
 {
-  memcached_st *memc= memcached_clone(NULL, orig_memc);
-
-  test_skip(TEST_SUCCESS, pre_binary(memc));
+  test_skip(true, memcached_behavior_get(memc, MEMCACHED_BEHAVIOR_BINARY_PROTOCOL));
 
   test_compare(MEMCACHED_SUCCESS, memcached_callback_set(memc, MEMCACHED_CALLBACK_PREFIX_KEY, (void *)"namespace:"));
 
@@ -1561,7 +1559,6 @@ static test_return_t binary_increment_with_prefix_test(memcached_st *orig_memc)
                                                       test_literal_param("number"),
                                                       1, &new_number));
   test_compare(uint64_t(2), new_number);
-  memcached_free(memc);
 
   return TEST_SUCCESS;
 }
@@ -3968,7 +3965,7 @@ static test_return_t noreply_test(memcached_st *memc)
   {
     for (size_t x= 0; x < 100; ++x)
     {
-      char key[10];
+      char key[MEMCACHED_MAXIMUM_INTEGER_DISPLAY_LENGTH +1];
       int check_length= (size_t)snprintf(key, sizeof(key), "%lu", (unsigned long)x);
       test_false((size_t)check_length >= sizeof(key) || check_length < 0);
 
@@ -4682,6 +4679,8 @@ static test_return_t regression_bug_434843(memcached_st *original_memc)
     test_compare(MEMCACHED_SUCCESS,
                  memcached_mget(memc, (const char**)keys, key_length, max_keys));
 
+    // One the first run we should get a NOT_FOUND, but on the second some data
+    // should be returned.
     test_compare(y ?  MEMCACHED_SUCCESS : MEMCACHED_NOTFOUND, 
                  memcached_fetch_execute(memc, callbacks, (void *)&counter, 1));
 
@@ -6011,6 +6010,7 @@ collection_st collection[] ={
   {"virtual buckets", 0, 0, virtual_bucket_tests},
   {"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},
   {0, 0, 0, 0}
 };
 
index 50e6a3599b0924ab4896af582d5aa2a55cdd2fd1..425e308cc3a7593849e2b1b018a7918d0fac384b 100644 (file)
@@ -63,20 +63,20 @@ test_return_t test_memcached_touch(memcached_st *memc)
   memcached_return rc;
 
   test_null(memcached_get(memc, 
-                          test_literal_param("touchkey"),
+                          test_literal_param(__func__),
                           &len, &flags, &rc));
   test_zero(len);
   test_compare(MEMCACHED_NOTFOUND, rc);
 
   test_compare(MEMCACHED_SUCCESS, 
                memcached_set(memc,
-                             test_literal_param("touchkey"),
+                             test_literal_param(__func__),
                              test_literal_param("touchval"),
                              2, 0));
 
   {
     char *value= memcached_get(memc, 
-                               test_literal_param("touchkey"),
+                               test_literal_param(__func__),
                                &len, &flags, &rc);
     test_compare(8U, test_literal_param_size("touchval"));
     test_true(value);
@@ -86,15 +86,15 @@ test_return_t test_memcached_touch(memcached_st *memc)
   }
 
   test_compare(MEMCACHED_SUCCESS,
-               memcached_touch(memc, test_literal_param("touchkey"), 60 *60));
+               memcached_touch(memc, test_literal_param(__func__), 60 *60));
 
   test_skip(false ,memcached_behavior_get(memc, MEMCACHED_BEHAVIOR_BINARY_PROTOCOL));
 
-  rc= memcached_touch(memc, test_literal_param("touchkey"), 60 *60 *24 *60);
+  rc= memcached_touch(memc, test_literal_param(__func__), 60 *60 *24 *60);
   test_compare_hint(MEMCACHED_SUCCESS, rc, memcached_last_error_message(memc));
 
   test_compare(MEMCACHED_NOTFOUND,
-               memcached_exist(memc, test_literal_param("touchkey")));
+               memcached_exist(memc, test_literal_param(__func__)));
 
   return TEST_SUCCESS;
 }
@@ -110,7 +110,7 @@ test_return_t test_memcached_touch_by_key(memcached_st *memc)
 
   test_null(memcached_get_by_key(memc, 
                                  test_literal_param("grouping_key"),
-                                 test_literal_param("touchkey"),
+                                 test_literal_param(__func__),
                                  &len, &flags, &rc));
   test_zero(len);
   test_compare(MEMCACHED_NOTFOUND, rc);
@@ -118,14 +118,14 @@ test_return_t test_memcached_touch_by_key(memcached_st *memc)
   test_compare(MEMCACHED_SUCCESS, 
                memcached_set_by_key(memc,
                                     test_literal_param("grouping_key"),
-                                    test_literal_param("touchkey"),
+                                    test_literal_param(__func__),
                                     test_literal_param("touchval"),
                                     2, 0));
 
   {
     char *value= memcached_get_by_key(memc, 
                                       test_literal_param("grouping_key"),
-                                      test_literal_param("touchkey"),
+                                      test_literal_param(__func__),
                                       &len, &flags, &rc);
     test_compare(8U, test_literal_param_size("touchval"));
     test_true(value);
@@ -137,17 +137,17 @@ test_return_t test_memcached_touch_by_key(memcached_st *memc)
   test_compare(MEMCACHED_SUCCESS,
                memcached_touch_by_key(memc,
                                       test_literal_param("grouping_key"),
-                                      test_literal_param("touchkey"),
+                                      test_literal_param(__func__),
                                       60 *60));
 
   test_skip(false ,memcached_behavior_get(memc, MEMCACHED_BEHAVIOR_BINARY_PROTOCOL));
   test_compare(MEMCACHED_SUCCESS,
                memcached_touch_by_key(memc,
                                       test_literal_param("grouping_key"),
-                                      test_literal_param("touchkey"),
+                                      test_literal_param(__func__),
                                       60 *60 *24 *60));
   test_compare(MEMCACHED_NOTFOUND,
-               memcached_exist_by_key(memc, test_literal_param("grouping_key"),test_literal_param("touchkey")));
+               memcached_exist_by_key(memc, test_literal_param("grouping_key"),test_literal_param(__func__)));
 
   return TEST_SUCCESS;
 }