+#ifdef __cplusplus
+
+#define mu_echeck_base(ex, exp, name, action, final) \
+ do { \
+ mu_print(MU_CHECK, "\t\t* Checking " name "(" #ex ", " #exp \
+ ")...\n"); \
+ try { \
+ exp; \
+ mutest_count_err \
+ mu_printerr(name "(" #ex ", " #exp ")", \
+ "no exception thrown, " action); \
+ final; \
+ } catch (const ex& e) { \
+ mutest_count_suc \
+ } catch (const std::exception& e) { \
+ mutest_count_err \
+ mu_printex(name "(" #ex ", " #exp ")", action, \
+ e.what()); \
+ final; \
+ } catch (...) { \
+ mutest_count_err \
+ mu_printex(name "(" #ex ", " #exp ")", action, \
+ "[unknown]"); \
+ final; \
+ } \
+ } while (0)
+
+/*
+ * check that an expression throws a particular exception, continue if the
+ * check fails
+ */
+#define mu_echeck(ex, exp) \
+ mu_echeck_base(ex, exp, "mu_echeck", "resuming", continue)
+
+/*
+ * ensure that an expression throws a particular exception, abort the current
+ * test case if the check fails
+ */
+#define mu_eensure(ex, exp) \
+ mu_echeck_base(ex, exp, "mu_eensure", "aborting", return)
+
+#endif /* __cplusplus */
+