From d0f9a32dd1442ba083972642d6fed5cd59bce583 Mon Sep 17 00:00:00 2001 From: Brian Aker Date: Fri, 15 Jun 2012 12:56:59 -0700 Subject: [PATCH] Fix for test case failure. --- libtest/memcached.h | 21 +++++++++++++++++++++ tests/libmemcached-1.0/mem_functions.cc | 4 +++- 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/libtest/memcached.h b/libtest/memcached.h index 405f275f..8a0b1795 100644 --- a/libtest/memcached.h +++ b/libtest/memcached.h @@ -50,3 +50,24 @@ libtest::Server *build_memcached_sasl_socket(const std::string& socket_file, con } +#if defined(LIBMEMCACHED) && LIBMEMCACHED +bool operator== (const memcached_st&c memc, const memcached_return_t rc) +{ + if (memcached_last_error(&memc) == rc) + { + return true; + } + + return false; +} + +bool operator!= (const memcached_st&c memc, const memcached_return_t rc) +{ + if (memcached_last_error(&memc) != rc) + { + return true; + } + + return false; +} +#endif diff --git a/tests/libmemcached-1.0/mem_functions.cc b/tests/libmemcached-1.0/mem_functions.cc index 34d5e4b0..78a3c013 100644 --- a/tests/libmemcached-1.0/mem_functions.cc +++ b/tests/libmemcached-1.0/mem_functions.cc @@ -1750,7 +1750,9 @@ test_return_t block_add_regression(memcached_st *memc) global_pairs[x].key, global_pairs[x].key_length, &blob[0], blob.size(), time_t(0), uint32_t(0)); - test_true_got(rc == MEMCACHED_SUCCESS or rc == MEMCACHED_SERVER_MEMORY_ALLOCATION_FAILURE, memcached_strerror(NULL, rc)); + test_true_got(rc == MEMCACHED_SUCCESS + or rc == MEMCACHED_SERVER_MEMORY_ALLOCATION_FAILURE + or rc == MEMCACHED_MEMORY_ALLOCATION_FAILURE, memcached_strerror(NULL, rc)); } return TEST_SUCCESS; -- 2.30.2