#include <typeinfo>
#include <libtest/strerror.h>
+
+#if defined(HAVE_LIBMEMCACHED) && HAVE_LIBMEMCACHED
#include <libmemcached/memcached.h>
+#endif
+
+#if defined(HAVE_LIBGEARMAN) && HAVE_LIBGEARMAN
+#include <libgearman/gearman.h>
+#endif
namespace libtest {
}
template <class T_comparable>
-bool _compare(const char *file, int line, const char *func, T_comparable __expected, T_comparable __actual)
+bool _compare(const char *file, int line, const char *func, const T_comparable __expected, const T_comparable __actual)
{
if (__expected != __actual)
{
- if (typeid(__expected) == typeid(memcached_return_t))
+ 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
+ << "\"";
+ }
+#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)) << "\"";
}
- else if (typeid(__expected) == typeid(test_return_t))
+#endif
+#if defined(HAVE_LIBGEARMAN) && HAVE_LIBGEARMAN
+ else if (typeid(__expected) == typeid(gearman_return_t))
{
libtest::stream::make_cerr(file, line, func) << "Expected \""
- << test_strerror(test_return_t(__expected))
+ << gearman_strerror(gearman_return_t(__expected))
<< "\" got \""
- << test_strerror(test_return_t(__actual)) << "\"";
+ << gearman_strerror(gearman_return_t(__actual)) << "\"";
}
+#endif
else
{
libtest::stream::make_cerr(file, line, func) << "Expected \"" << __expected << "\" got \"" << __actual << "\"";