X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;f=libtest%2Fcomparison.hpp;h=86661a283d07c68243c8c8db02022910c1dea42f;hb=a4f7c3b9413014291d0ca549f32455b3be10a6c0;hp=f02e8d887dc8a15d64e8c18b75d92c051ef51a98;hpb=acf69ff8d9954846854b1a9dbd8b3e11a83bad4c;p=m6w6%2Flibmemcached diff --git a/libtest/comparison.hpp b/libtest/comparison.hpp index f02e8d88..86661a28 100644 --- a/libtest/comparison.hpp +++ b/libtest/comparison.hpp @@ -36,6 +36,10 @@ #pragma once +#include +#include +#include + namespace libtest { template @@ -55,7 +59,24 @@ bool _compare(const char *file, int line, const char *func, T_comparable __expec { if (__expected != __actual) { - libtest::stream::make_cerr(file, line, func) << "Expected \"" << __expected << "\" got \"" << __actual << "\""; + 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)) + { + libtest::stream::make_cerr(file, line, func) << "Expected \"" + << test_strerror(test_return_t(__expected)) + << "\" got \"" + << test_strerror(test_return_t(__actual)) << "\""; + } + else + { + libtest::stream::make_cerr(file, line, func) << "Expected \"" << __expected << "\" got \"" << __actual << "\""; + } return false; }