1
/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
5
* Copyright (C) 2011 Data Differential, http://datadifferential.com/
7
* This library is free software; you can redistribute it and/or
8
* modify it under the terms of the GNU Lesser General Public
9
* License as published by the Free Software Foundation; either
10
* version 3 of the License, or (at your option) any later version.
12
* This library is distributed in the hope that it will be useful,
13
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15
* Lesser General Public License for more details.
17
* You should have received a copy of the GNU Lesser General Public
18
* License along with this library; if not, write to the Free Software
19
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
26
#if defined(HAVE_LIBMEMCACHED) && HAVE_LIBMEMCACHED
27
#include <libmemcached-1.0/memcached.h>
28
#include <libmemcachedutil-1.0/ostream.hpp>
31
#if defined(HAVE_LIBGEARMAN) && HAVE_LIBGEARMAN
32
#include <libgearman-1.0/ostream.hpp>
37
bool _in_valgrind(const char *file, int line, const char *func);
39
template <class T_comparable, class T_hint>
40
bool _compare_truth_hint(const char *file, int line, const char *func, T_comparable __expected, const char *assertation_label, T_hint __hint)
42
if (__expected == false)
44
libtest::stream::make_cerr(file, line, func) << "Assertation \"" << assertation_label << "\" failed, hint: " << __hint;
51
template <class T1_comparable, class T2_comparable>
52
bool _compare(const char *file, int line, const char *func, const T1_comparable& __expected, const T2_comparable& __actual, bool use_io)
54
if (__expected != __actual)
58
libtest::stream::make_cerr(file, line, func) << "Expected \"" << __expected << "\" got \"" << __actual << "\"";
67
template <class T_comparable>
68
bool _compare_zero(const char *file, int line, const char *func, T_comparable __actual)
70
if (T_comparable(0) != __actual)
72
libtest::stream::make_cerr(file, line, func) << "Expected 0 got \"" << __actual << "\"";
79
template <class T_comparable>
80
bool _truth(const char *file, int line, const char *func, T_comparable __truth)
84
libtest::stream::make_cerr(file, line, func) << "Assertion failed for " << func << "() with \"" << __truth << "\"";
91
template <class T1_comparable, class T2_comparable, class T_hint>
92
bool _compare_hint(const char *file, int line, const char *func, T1_comparable __expected, T2_comparable __actual, T_hint __hint, bool io_error= true)
94
if (__expected != __actual)
98
libtest::stream::make_cerr(file, line, func) << "Expected \"" << __expected << "\" got \"" << __actual << "\"" << " Additionally: \"" << __hint << "\"";
107
} // namespace libtest