} \
} while (0)
-#define ASSERT_NEQ(__expected, __actual, ...) \
+#define ASSERT_NEQ(__expected, __actual) \
do \
{ \
if ((__expected) == (__actual)) { \
#if defined(HAVE_LIBMEMCACHED) && HAVE_LIBMEMCACHED
inline bool operator== (const memcached_st& memc, const memcached_return_t rc)
{
- if (memcached_last_error(const_cast<memcached_st *>(&memc)) == rc)
+ if (memcached_last_error(&memc) == rc)
{
return true;
}
return false;
}
-inline bool operator!= (const memcached_st& memc, const memcached_return_t rc)
+inline bool operator!= (const memcached_st& memc, memcached_return_t rc)
{
if (memcached_last_error(const_cast<memcached_st *>(&memc)) != rc)
{
return false;
}
-inline bool operator!= (const memcached_return_t rc, const memcached_st& memc)
+inline bool operator== (memcached_st* const memc, memcached_return_t rc)
+{
+ if (memcached_last_error(memc) == rc)
+ {
+ return true;
+ }
+
+ return false;
+}
+
+inline bool operator!= (memcached_st* const memc, memcached_return_t rc)
+{
+ if (memcached_last_error(memc) != rc)
+ {
+ return true;
+ }
+
+ return false;
+}
+
+inline bool operator!= (memcached_return_t rc, const memcached_st& memc)
{
if (memcached_last_error(const_cast<memcached_st *>(&memc)) != rc)
{
return false;
}
+
+inline bool operator!= (memcached_return_t rc, memcached_st* const memc)
+{
+ if (memcached_last_error(memc) != rc)
+ {
+ return true;
+ }
+
+ return false;
+}
#endif
return TEST_FAILURE;
}
+static test_return_t ASSERT_NEQ_FAIL_TEST(void *)
+{
+ try {
+ ASSERT_NEQ(1,1);
+ }
+ catch (const libtest::__failure& e)
+ {
+ ASSERT_STREQ(e.what(), "Assertion '1' == '1'");
+ return TEST_SUCCESS;
+ }
+ catch (...)
+ {
+ return TEST_FAILURE;
+ }
+
+ return TEST_FAILURE;
+}
+
+static test_return_t ASSERT_NEQ_TEST(void *)
+{
+ ASSERT_NEQ(1,0);
+
+ return TEST_SUCCESS;
+}
+
static test_return_t ASSERT_FALSE_TEST(void *)
{
try {
{"FAIL", false, test_throw_fail_TEST },
{"ASSERT_FALSE_", false, ASSERT_FALSE__TEST },
{"ASSERT_FALSE", false, ASSERT_FALSE_TEST },
+ {"ASSERT_NEQ", false, ASSERT_NEQ_TEST },
+ {"ASSERT_NEQ FAIL", false, ASSERT_NEQ_FAIL_TEST },
{0, 0, 0}
};
{"reset stack clone", true, (test_callback_fn*)basic_reset_stack_clone_test},
{"reset heap clone", true, (test_callback_fn*)basic_reset_heap_clone_test},
{"memcached_return_t", false, (test_callback_fn*)memcached_return_t_TEST },
+ {"c++ memcached_st == memcached_return_t", false, (test_callback_fn*)comparison_operator_memcached_st_and__memcached_return_t_TEST },
{0, 0, 0}
};
return TEST_SUCCESS;
}
+test_return_t comparison_operator_memcached_st_and__memcached_return_t_TEST(memcached_st *)
+{
+ test::Memc memc_;
+
+ memcached_st *memc= &memc_;
+
+ ASSERT_EQ(memc, MEMCACHED_SUCCESS);
+ test_compare(memc, MEMCACHED_SUCCESS);
+
+ ASSERT_NEQ(memc, MEMCACHED_FAILURE);
+
+ return TEST_SUCCESS;
+}
+
test_return_t ketama_TEST(memcached_st *)
{
test::Memc memc("--server=10.0.1.1:11211 --server=10.0.1.2:11211");
test_false(value);
test_zero(length);
- test_compare_got(MEMCACHED_TIMEOUT, rc, memcached_error(memc));
+ test_compare(MEMCACHED_TIMEOUT, memc);
memcached_free(memc);
test_return_t regression_1009493_TEST(memcached_st*);
test_return_t regression_1048945_TEST(memcached_st*);
test_return_t regression_1067242_TEST(memcached_st*);
+test_return_t comparison_operator_memcached_st_and__memcached_return_t_TEST(memcached_st*);