| 1 | #ifndef CGREEN_CPP_ASSERTIONS_H |
| 2 | #define CGREEN_CPP_ASSERTIONS_H |
| 3 | |
| 4 | #include "internal/stringify_token.h" |
| 5 | |
| 6 | #define assert_throws(exceptionType, expr) \ |
| 7 | try { \ |
| 8 | expr; \ |
| 9 | fail_test("Expected [" STRINGIFY_TOKEN(expr) "] " \ |
| 10 | "to throw [" STRINGIFY_TOKEN(exceptionType) "]"); \ |
| 11 | } catch (const exceptionType& ex) { \ |
| 12 | pass_test(); \ |
| 13 | } catch (const exceptionType* ex) { \ |
| 14 | pass_test(); \ |
| 15 | } |
| 16 | |
| 17 | #endif |