X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;f=libtest%2Fcomparison.hpp;h=09106d9f62134faf7f04e2a1babc40ce8fe0652f;hb=969fea8e7bed82c109685ec3976cf7b0ec514ae9;hp=5c687fc3a6500b5d153b00802b73ca51934f7cbc;hpb=0fe409a0db64fc9d24a44ac363c502ea9e98857e;p=m6w6%2Flibmemcached diff --git a/libtest/comparison.hpp b/libtest/comparison.hpp index 5c687fc3..09106d9f 100644 --- a/libtest/comparison.hpp +++ b/libtest/comparison.hpp @@ -62,7 +62,7 @@ bool _compare(const char *file, int line, const char *func, const T_comparable _ << got_str << "\""; } -#if (defined(HAVE_LIBMEMCACHED) && HAVE_LIBMEMCACHED) +#if defined(HAVE_LIBMEMCACHED) && HAVE_LIBMEMCACHED else if (typeid(__expected) == typeid(memcached_return_t)) { libtest::stream::make_cerr(file, line, func) << "Expected \"" @@ -107,8 +107,43 @@ bool _compare_hint(const char *file, int line, const char *func, T_comparable __ { if (__expected != __actual) { - libtest::stream::make_cerr(file, line, func) << "Expected \"" << __expected << "\" got \"" << __actual << "\" Additionally: \"" << __hint << "\""; + if (typeid(__expected) == typeid(test_return_t)) + { + const char *expected_str= test_strerror(test_return_t(__expected)); + const char *got_str= test_strerror(test_return_t(__actual)); + libtest::stream::make_cerr(file, line, func) << "Expected \"" + << expected_str + << "\" got \"" + << got_str + << "\"" + << " Additionally: \"" << __hint << "\""; + } +#if defined(HAVE_LIBMEMCACHED) && HAVE_LIBMEMCACHED + else if (typeid(__expected) == typeid(memcached_return_t)) + { + libtest::stream::make_cerr(file, line, func) << "Expected \"" + << memcached_strerror(NULL, memcached_return_t(__expected)) + << "\" got \"" + << memcached_strerror(NULL, memcached_return_t(__actual)) << "\"" + << " Additionally: \"" << __hint << "\""; + } +#endif +#if defined(HAVE_LIBGEARMAN) && HAVE_LIBGEARMAN + else if (typeid(__expected) == typeid(gearman_return_t)) + { + libtest::stream::make_cerr(file, line, func) << "Expected \"" + << gearman_strerror(gearman_return_t(__expected)) + << "\" got \"" + << gearman_strerror(gearman_return_t(__actual)) << "\"" + << " Additionally: \"" << __hint << "\""; + } +#endif + else + { + libtest::stream::make_cerr(file, line, func) << "Expected \"" << __expected << "\" got \"" << __actual << "\"" + << " Additionally: \"" << __hint << "\""; + } return false; }