32#if defined(NOCTAssert)
35#define CTAssert(c) IpplCTAssert<(c)>::test()
52 assertion(
const char *cond,
const char *file,
int line );
58 using std::runtime_error::what;
59 virtual const char*
what() {
return msg; };
69void toss_cookies(
const char *cond,
const char *file,
int line );
70template <
class S,
class T>
71void toss_cookies(
const char *cond,
const char *astr,
const char *bstr, S
a,
T b,
const char *file,
int line) {
73 std::string what =
"Assertion '" + std::string(cond) +
"' failed. \n";
74 what += std::string(astr) +
" = " + std::to_string(
a) +
", ";
75 what += std::string(bstr) +
" = " + std::to_string(b) +
"\n";
77 what += std::string(file) +
", line " + std::to_string(line);
79 throw std::runtime_error(what);
82void insist(
const char *cond,
const char *msg,
const char *file,
int line );
95#define PAssert_EQ(a, b)
96#define PAssert_NE(a, b)
97#define PAssert_LT(a, b)
98#define PAssert_LE(a, b)
99#define PAssert_GT(a, b)
100#define PAssert_GE(a, b)
102#define PAssert(c) if (!(c)) toss_cookies( #c, __FILE__, __LINE__ );
103#define PAssert_CMP(cmp, a, b) if (!(cmp)) toss_cookies(#cmp, #a, #b, a, b, __FILE__, __LINE__);
104#define PAssert_EQ(a, b) PAssert_CMP(a == b, a, b)
105#define PAssert_NE(a, b) PAssert_CMP(a != b, a, b)
106#define PAssert_LT(a, b) PAssert_CMP(a < b, a, b)
107#define PAssert_LE(a, b) PAssert_CMP(a <= b, a, b)
108#define PAssert_GT(a, b) PAssert_CMP(a > b, a, b)
109#define PAssert_GE(a, b) PAssert_CMP(a >= b, a, b)
120#define PInsist(c,m) if (!(c)) insist( #c, m, __FILE__, __LINE__ );
void insist(const char *cond, const char *msg, const char *file, int line)
void toss_cookies(const char *cond, const char *file, int line)
assertion & operator=(const assertion &a)
assertion(const char *cond, const char *file, int line)
virtual const char * what()