|
@ -10,24 +10,23 @@ |
|
|
#include "PityPerspective.hh" |
|
|
#include "PityPerspective.hh" |
|
|
|
|
|
|
|
|
#ifndef PITYASSERT |
|
|
#ifndef PITYASSERT |
|
|
#define PITYASSERT(condition, msg) \ |
|
|
#define PITYASSERT(condition, msg) \ |
|
|
do { \ |
|
|
do { \ |
|
|
if (!(condition)) { \ |
|
|
if (!(condition)) { \ |
|
|
throw PityAssertException(msg); \ |
|
|
throw PityAssertException(msg); \ |
|
|
} \ |
|
|
} \ |
|
|
} while (0) |
|
|
} while (0); |
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
#ifndef PITYASSERT_THROWS |
|
|
|
|
|
#define PITYASSERT_THROWS(func, msg) \ |
|
|
|
|
|
do { \ |
|
|
|
|
|
try { \ |
|
|
|
|
|
(func); \ |
|
|
|
|
|
PITYASSERT(false, msg); \ |
|
|
|
|
|
} catch (const std::exception& e) { \ |
|
|
|
|
|
} catch (...) { \ |
|
|
|
|
|
} \ |
|
|
|
|
|
} while (0) |
|
|
|
|
|
#endif |
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
#define PITYASSERT_THROWS(func, msg) \ |
|
|
|
|
|
do { \ |
|
|
|
|
|
try { \ |
|
|
|
|
|
(func); \ |
|
|
|
|
|
PITYASSERT(false, msg); \ |
|
|
|
|
|
} catch (const PityAssertException& pae) { \ |
|
|
|
|
|
throw(pae); \ |
|
|
|
|
|
} catch (const std::exception& e) { \ |
|
|
|
|
|
} catch (...) { \ |
|
|
|
|
|
} \ |
|
|
|
|
|
} while (0); |
|
|
#endif |
|
|
#endif |