61 typename std::enable_if<std::is_arithmetic<V>::value,
bool>::type
62 test_verify(
bool res,
const char* expr,
const V& value1,
const V& value2,
bool verbose)
68 typename std::enable_if<!std::is_same<V, String>::value && !std::is_arithmetic<V>::value,
bool>::type
69 test_verify(
bool res,
const char* expr,
const V& value1,
const V& value2,
bool verbose)
74 virtual void fail(
const char* func)
85 #define INTERNAL_CHECK(expr, verbose) INTERNAL_CHECK2(expr, expr, verbose)
87 #define INTERNAL_CHECK2(res, expr, verbose) \
89 PSTR_ARRAY(tmpExprStr, #expr); \
90 if(!testVerify(bool(res), TestParam{tmpExprStr, nullptr, nullptr, verbose})) { \
95 #define INTERNAL_CHECK_EQ(a, b, verbose) \
97 PSTR_ARRAY(tmpExprStr, #a " == " #b); \
98 const auto value_a = a; \
99 const decltype(value_a) value_b = b; \
100 if(!test_verify(value_a == value_b, tmpExprStr, value_a, value_b, verbose)) { \
101 TEST_ASSERT(false); \
105 #define INTERNAL_CHECK_NEQ(a, b, verbose) \
107 PSTR_ARRAY(tmpExprStr, #a " != " #b); \
108 const auto value_a = a; \
109 const decltype(value_a) value_b = b; \
110 if(!test_verify(value_a != value_b, tmpExprStr, value_a, value_b, verbose)) { \
111 TEST_ASSERT(false); \
126 #define CHECK(expr) INTERNAL_CHECK(expr, false)
133 #define CHECK2(res, expr) INTERNAL_CHECK2(res, expr, false)
140 #define CHECK_EQ(a, b) INTERNAL_CHECK_EQ(a, b, false)
147 #define CHECK_NEQ(a, b) INTERNAL_CHECK_NEQ(a, b, false)
160 #define REQUIRE(expr) INTERNAL_CHECK(expr, true)
167 #define REQUIRE2(res, expr) INTERNAL_CHECK2(res, expr, true)
174 #define REQUIRE_EQ(a, b) INTERNAL_CHECK_EQ(a, b, true)
181 #define REQUIRE_NEQ(a, b) INTERNAL_CHECK_NEQ(a, b, true)
190 #define TEST_ASSERT(result) \
192 fail(__PRETTY_FUNCTION__); \
std::enable_if< std::is_integral< T >::value, String >::type toString(T value)
Definition: BitSet.h:481
The String class.
Definition: WString.h:137
Base class supporting verification for test assertions.
Definition: TestBase.h:31
virtual ~TestBase()
Definition: TestBase.h:43
std::enable_if< std::is_arithmetic< V >::value, bool >::type test_verify(bool res, const char *expr, const V &value1, const V &value2, bool verbose)
Definition: TestBase.h:62
std::enable_if<!std::is_same< V, String >::value &&!std::is_arithmetic< V >::value, bool >::type test_verify(bool res, const char *expr, const V &value1, const V &value2, bool verbose)
Definition: TestBase.h:69
bool test_verify(bool res, const char *expr, const String &value1, const String &value2, bool verbose)
Definition: TestBase.h:55
virtual bool testVerify(bool res, const TestParam ¶m)
Print result of a test.
virtual void fail(const char *func)
Definition: TestBase.h:74
#define _F(str)
Definition: FakePgmSpace.h:97
int m_printf(char const *,...)
Contains details for test verification.
Definition: TestBase.h:36
bool verbose
true to always emit message, false only for errors
Definition: TestBase.h:40
String value2
Second value in comparison (optional)
Definition: TestBase.h:39
const char * expr
Text of expression generated by the macro.
Definition: TestBase.h:37
String value1
First value in comparison, or expected result.
Definition: TestBase.h:38