X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;f=tests%2Flibmemcached-1.0%2Fmem_functions.cc;h=a6c38c5b1a8c6a5b6ff7b6cd740fddf3889046c6;hb=95bb4cd1ce48756ca12e5cc1bb6bd6ff8f457908;hp=6e6f4a7bce9e45d638c8c486de3e78281f9b388d;hpb=0e40facad567ea11474b62f597c34faeea5c86fe;p=m6w6%2Flibmemcached diff --git a/tests/libmemcached-1.0/mem_functions.cc b/tests/libmemcached-1.0/mem_functions.cc index 6e6f4a7b..a6c38c5b 100644 --- a/tests/libmemcached-1.0/mem_functions.cc +++ b/tests/libmemcached-1.0/mem_functions.cc @@ -993,6 +993,7 @@ test_return_t bad_key_test(memcached_st *memc) test_compare(MEMCACHED_SUCCESS, memcached_behavior_set(memc_clone, MEMCACHED_BEHAVIOR_VERIFY_KEY, true)); test_compare(query_id, memcached_query_id(memc_clone)); // We should not increase the query_id for memcached_behavior_set() + ASSERT_TRUE(memcached_behavior_get(memc_clone, MEMCACHED_BEHAVIOR_VERIFY_KEY)); /* All keys are valid in the binary protocol (except for length) */ if (memcached_behavior_get(memc_clone, MEMCACHED_BEHAVIOR_BINARY_PROTOCOL) == false) @@ -3081,7 +3082,7 @@ test_return_t selection_of_namespace_tests(memcached_st *memc) const char *key= "mine"; char *value; - /* Make sure be default none exists */ + /* Make sure by default none exists */ value= (char*)memcached_callback_get(memc, MEMCACHED_CALLBACK_NAMESPACE, &rc); test_null(value); test_compare_got(MEMCACHED_SUCCESS, rc, memcached_strerror(NULL, rc)); @@ -3092,7 +3093,7 @@ test_return_t selection_of_namespace_tests(memcached_st *memc) value= (char*)memcached_callback_get(memc, MEMCACHED_CALLBACK_NAMESPACE, &rc); test_true(value); - test_memcmp(value, key, 4); + test_memcmp(value, key, strlen(key)); test_compare_got(MEMCACHED_SUCCESS, rc, memcached_strerror(NULL, rc)); /* Test that we can turn it off */ @@ -3110,7 +3111,7 @@ test_return_t selection_of_namespace_tests(memcached_st *memc) value= (char *)memcached_callback_get(memc, MEMCACHED_CALLBACK_NAMESPACE, &rc); test_true(value); test_compare_got(MEMCACHED_SUCCESS, rc, memcached_strerror(NULL, rc)); - test_memcmp(value, key, 4); + test_memcmp(value, key, strlen(key)); /* Set to Zero, and then Set to something too large */ { @@ -3120,9 +3121,7 @@ test_return_t selection_of_namespace_tests(memcached_st *memc) test_compare(MEMCACHED_SUCCESS, memcached_callback_set(memc, MEMCACHED_CALLBACK_NAMESPACE, NULL)); - value= (char*)memcached_callback_get(memc, MEMCACHED_CALLBACK_NAMESPACE, &rc); - test_null(value); - test_compare(MEMCACHED_SUCCESS, rc); + ASSERT_NULL_(memcached_callback_get(memc, MEMCACHED_CALLBACK_NAMESPACE, &rc), "Setting namespace to NULL did not work"); /* Test a long key for failure */ /* TODO, extend test to determine based on setting, what result should be */ @@ -3150,11 +3149,10 @@ test_return_t set_namespace(memcached_st *memc) { memcached_return_t rc; const char *key= "mine"; - char *value; // Make sure we default to a null namespace - value= (char*)memcached_callback_get(memc, MEMCACHED_CALLBACK_NAMESPACE, &rc); - test_null(value); + char* value= (char*)memcached_callback_get(memc, MEMCACHED_CALLBACK_NAMESPACE, &rc); + ASSERT_NULL_(value, "memc had a value for namespace when none should exist"); test_compare_got(MEMCACHED_SUCCESS, rc, memcached_strerror(NULL, rc)); /* Test a clean set */ @@ -3162,8 +3160,8 @@ test_return_t set_namespace(memcached_st *memc) memcached_callback_set(memc, MEMCACHED_CALLBACK_NAMESPACE, (void *)key)); value= (char*)memcached_callback_get(memc, MEMCACHED_CALLBACK_NAMESPACE, &rc); - test_true(value); - test_memcmp(value, key, 4); + ASSERT_TRUE(value); + test_memcmp(value, key, strlen(key)); test_compare_got(MEMCACHED_SUCCESS, rc, memcached_strerror(NULL, rc)); return TEST_SUCCESS;