Go to the documentation of this file. 29 #ifndef CPPTEST_ASSERT_H 30 #define CPPTEST_ASSERT_H 56 #define TEST_FAIL(msg) \ 58 assertment(::Test::Source(__FILE__, __LINE__, (msg) != 0 ? #msg : "")); \ 59 if (!continue_after_failure()) return; \ 84 #define TEST_ASSERT(expr) \ 88 assertment(::Test::Source(__FILE__, __LINE__, #expr)); \ 89 if (!continue_after_failure()) return; \ 104 #define TEST_ASSERT_MSG(expr, msg) \ 108 assertment(::Test::Source(__FILE__, __LINE__, msg)); \ 109 if (!continue_after_failure()) return; \ 126 #define TEST_ASSERT_DELTA(a, b, delta) \ 128 if (((b) < (a) - (delta)) || ((b) > (a) + (delta))) \ 130 assertment(::Test::Source(__FILE__, __LINE__, \ 131 "delta(" #a ", " #b ", " #delta ")" )); \ 132 if (!continue_after_failure()) return; \ 150 #define TEST_ASSERT_DELTA_MSG(a, b, delta, msg) \ 152 if (((b) < (a) - (delta)) || ((b) > (a) + (delta))) \ 154 assertment(::Test::Source(__FILE__, __LINE__, msg)); \ 155 if (!continue_after_failure()) return; \ 171 #define TEST_THROWS(expr, x) \ 173 bool __expected = false; \ 175 catch (x) { __expected = true; } \ 179 assertment(::Test::Source(__FILE__, __LINE__, #expr)); \ 180 if (!continue_after_failure()) return; \ 197 #define TEST_THROWS_MSG(expr, x, msg) \ 199 bool __expected = false; \ 201 catch (x) { __expected = true; } \ 205 assertment(::Test::Source(__FILE__, __LINE__, msg)); \ 206 if (!continue_after_failure()) return; \ 221 #define TEST_THROWS_ANYTHING(expr) \ 223 bool __expected = false; \ 225 catch (...) { __expected = true; } \ 228 assertment(::Test::Source(__FILE__, __LINE__, #expr)); \ 229 if (!continue_after_failure()) return; \ 245 #define TEST_THROWS_ANYTHING_MSG(expr, msg) \ 247 bool __expected = false; \ 249 catch (...) { __expected = true; } \ 252 assertment(::Test::Source(__FILE__, __LINE__, msg)); \ 253 if (!continue_after_failure()) return; \ 268 #define TEST_THROWS_NOTHING(expr) \ 270 bool __expected = true; \ 272 catch (...) { __expected = false; } \ 275 assertment(::Test::Source(__FILE__, __LINE__, #expr)); \ 276 if (!continue_after_failure()) return; \ 292 #define TEST_THROWS_NOTHING_MSG(expr, msg) \ 294 bool __expected = true; \ 296 catch (...) { __expected = false; } \ 299 assertment(::Test::Source(__FILE__, __LINE__, msg)); \ 300 if (!continue_after_failure()) return; \ 330 #endif // #ifndef CPPTEST_ASSERT_H
Supported by: