X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;f=libtest%2Fcomparison.hpp;h=967e60689a2c175b4e5c6c136c8ba1d1651137ea;hb=fe4757c512265eef4f8905b3392f19d33c436ddf;hp=98ea1c8b68f4620ba9a91e250b8351d595c66cb1;hpb=90c96090380d18b6bb7a553d6b9c7e1ce93e248c;p=m6w6%2Flibmemcached diff --git a/libtest/comparison.hpp b/libtest/comparison.hpp index 98ea1c8b..967e6068 100644 --- a/libtest/comparison.hpp +++ b/libtest/comparison.hpp @@ -34,6 +34,13 @@ namespace libtest { +LIBTEST_API +bool gdb_is_caller(void); + +LIBTEST_API +bool valgrind_is_caller(void); + +LIBTEST_API bool _in_valgrind(const char *file, int line, const char *func); template @@ -104,4 +111,20 @@ bool _compare_hint(const char *file, int line, const char *func, T1_comparable _ return true; } +template +bool _ne_compare_hint(const char *file, int line, const char *func, T1_comparable __expected, T2_comparable __actual, T_hint __hint, bool io_error= true) +{ + if (__expected == __actual) + { + if (io_error) + { + libtest::stream::make_cerr(file, line, func) << "Expected \"" << __expected << "\" got \"" << __actual << "\"" << " Additionally: \"" << __hint << "\""; + } + + return false; + } + + return true; +} + } // namespace libtest