Browse Source

Test: PityTest - fix PITYASSERT_THROWS()

master
heck 4 years ago
parent
commit
e5d0d10430
  1. 27
      src/PityTest.hh

27
src/PityTest.hh

@ -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
Loading…
Cancel
Save