diff options
| author | sanine <sanine.not@pm.me> | 2021-09-23 23:11:23 -0500 | 
|---|---|---|
| committer | sanine <sanine.not@pm.me> | 2021-09-23 23:11:23 -0500 | 
| commit | 1ca109e1770b56095bdf4c664f3b99b7ac93776d (patch) | |
| tree | 15d6d7812a9c921c87eede2c451a96af6b13cdf2 /src/test/minunit.h | |
| parent | 6f92e9da2f6b0223c34728da34be65d76d5db485 (diff) | |
add honey_log_level_str_()
Diffstat (limited to 'src/test/minunit.h')
| -rw-r--r-- | src/test/minunit.h | 17 | 
1 files changed, 10 insertions, 7 deletions
| diff --git a/src/test/minunit.h b/src/test/minunit.h index b1bfda7..ed5e57d 100644 --- a/src/test/minunit.h +++ b/src/test/minunit.h @@ -2,6 +2,7 @@  #define MINUNIT_H  #include <stdio.h> +#include <string.h>  #define STR_IMPL(x) #x  #define STR(x) STR_IMPL(x) @@ -9,7 +10,7 @@  #define MU_INDENT "   "  /* minunit testing macros from /www.jera.com/techinfo/jtns/jtn002.html */ -#define mu_assert(test, message) do { if (!(test)) return message "\n" MU_INDENT "[" __FILE__ ":" STR(__LINE__) "]"; } while (0) +#define mu_assert(test, message) do { if (!(test)) return message "\n" MU_INDENT " [" __FILE__ ":" STR(__LINE__) "]"; } while (0)  #define mu_assert_equal(a, b) mu_assert(a == b, "'" #a "' is not equal to '" #b "'")  #define mu_assert_unequal(a, b) mu_assert(a != b, "'" #a "' is equal to '" #b "'")  #define mu_assert_streq(a, b) mu_assert(strcmp(a, b) == 0, "'" #a "' is not equal to '" #b "'") @@ -22,12 +23,14 @@  	 tests_failed++;						\        }									\     } while (0) -#define mu_run_suite(suite) do {		\ -      int tests_run_old = tests_run;		\ -      printf("suite: " #suite "\n");		\ -      suite();					\ -      printf(MU_INDENT "ran %d tests\n\n",	\ -	     tests_run - tests_run_old);	\ +#define mu_run_suite(suite) do {					\ +      int run_old = tests_run;						\ +      int failed_old = tests_failed;					\ +      printf("suite: " #suite "\n");					\ +      suite();								\ +      printf(MU_INDENT "ran %d tests, %d failed\n\n",			\ +	     tests_run - run_old,					\ +	     tests_failed - failed_old);				\     } while(0)  #define mu_tests_finished() do {					\        printf("ran %d tests, %d failed\n", tests_run, tests_failed);	\ | 
