37 #if defined(NOCTAssert)
40 #define CTAssert(c) IpplCTAssert<(c)>::test()
57 assertion(
const char *cond,
const char *file,
int line );
62 #if defined(__clang__)
63 #pragma clang diagnostic push
64 #pragma clang diagnostic ignored "-Woverloaded-virtual"
67 #if defined(__clang__)
68 #pragma clang diagnostic pop
81 void toss_cookies(
const char *cond,
const char *file,
int line );
82 template <
class S,
class T>
83 void toss_cookies(
const char *cond,
const char *astr,
const char *bstr, S a,
T b,
const char *file,
int line) {
87 std::string what =
"Assertion '" + std::string(cond) +
"' failed. \n";
88 what += std::string(astr) +
" = " + std::to_string(a) +
", ";
89 what += std::string(bstr) +
" = " + std::to_string(b) +
"\n";
91 what += std::string(file) +
", line " + std::to_string(line);
93 throw std::runtime_error(what);
97 void insist(
const char *cond,
const char *msg,
const char *file,
int line );
110 #define PAssert_EQ(a, b)
111 #define PAssert_NE(a, b)
112 #define PAssert_LT(a, b)
113 #define PAssert_LE(a, b)
114 #define PAssert_GT(a, b)
115 #define PAssert_GE(a, b)
117 #define PAssert(c) if (!(c)) toss_cookies( #c, __FILE__, __LINE__ );
118 #define PAssert_CMP(cmp, a, b) if (!(cmp)) toss_cookies(#cmp, #a, #b, a, b, __FILE__, __LINE__);
119 #define PAssert_EQ(a, b) PAssert_CMP(a == b, a, b)
120 #define PAssert_NE(a, b) PAssert_CMP(a != b, a, b)
121 #define PAssert_LT(a, b) PAssert_CMP(a < b, a, b)
122 #define PAssert_LE(a, b) PAssert_CMP(a <= b, a, b)
123 #define PAssert_GT(a, b) PAssert_CMP(a > b, a, b)
124 #define PAssert_GE(a, b) PAssert_CMP(a >= b, a, b)
135 #define PInsist(c,m) if (!(c)) insist( #c, m, __FILE__, __LINE__ );
assertion(const char *cond, const char *file, int line)
void insist(const char *cond, const char *msg, const char *file, int line)
assertion & operator=(const assertion &a)
void toss_cookies(const char *cond, const char *file, int line)