+ mu_print(MU_CHECK, "\t\t* Checking " name "(" #exp ")...\n"); \
+ mutest_try \
+ if (exp) mutest_count_suc \
+ else { \
+ mutest_count_err \
+ mu_printerr(name "(" #exp ")", action); \
+ final; \
+ } \
+ mutest_catch(name, action, final) \
+ } while (0)
+
+/* check that an expression evaluates to true, continue if the check fails */
+#define mu_check(exp) mu_check_base(exp, "mu_check", "resuming", continue)
+
+/*
+ * ensure that an expression evaluates to true, abort the current test
+ * case if the check fails
+ */
+#define mu_ensure(exp) mu_check_base(exp, "mu_ensure", "aborting", return)
+
+#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 */
+
+#ifndef MUTEST_PY /* we are using the C implementation */
+
+/*
+ * this function implements the test suites execution, you should generate
+ * a module with this function using mkmutest, or take a look to that script
+ * if you want to implement your own customized version */
+void mu_run_suites();
+
+/* macro for running a single initialization function */
+#ifndef mu_run_init
+#define mu_run_init(name) \
+ { \
+ int name(); \
+ int r; \
+ mu_print(MU_CASE, "\t+ Executing initialization function " \
+ "'" #name "'...\n"); \
+ if ((r = name())) { \
+ mu_print(MU_ERROR, "%s:" #name ": initialization " \
+ "function failed (returned %d), " \
+ "skipping test suite...\n", \
+ mutest_suite_name, r); \
+ ++mutest_skipped_suites; \
+ break; \