2 #include "mutest.h" /* MU_* constants, mu_print() */
3 #include <stdio.h> /* printf(), fprintf() */
4 #include <string.h> /* strncmp() */
7 * note that all global variables are public because they need to be accessed
8 * from other modules, like the test suites or the module implementing
12 /* globals for managing test suites */
13 const char* mutest_suite_name;
14 int mutest_failed_suites;
15 int mutest_passed_suites;
16 int mutest_skipped_suites;
17 int mutest_suite_failed;
20 /* globals for managing test cases */
21 const char* mutest_case_name;
22 int mutest_failed_cases;
23 int mutest_passed_cases;
24 int mutest_case_failed;
27 /* globals for managing checks */
28 int mutest_failed_checks;
29 int mutest_passed_checks;
32 /* verbosity level, see mutest.h */
33 int mutest_verbose_level = 1; /* exported for use in test suites */
38 * only -v is supported right now, both "-v -v" and "-vv" are accepted for
39 * increasing the verbosity by 2.
41 void parse_args(int argc, char* argv[]) {
43 if (strncmp(*argv, "-v", 2) == 0) {
44 ++mutest_verbose_level;
45 char* c = (*argv) + 1;
49 ++mutest_verbose_level;
56 int main(int argc, char* argv[]) {
58 parse_args(argc, argv);
62 mu_print(MU_SUMMARY, "\n"
64 "\t%d test suite(s) passed, %d failed, %d skipped.\n"
65 "\t%d test case(s) passed, %d failed.\n"
66 "\t%d check(s) passed, %d failed.\n"
68 mutest_passed_suites, mutest_failed_suites,
69 mutest_skipped_suites,
70 mutest_passed_cases, mutest_failed_cases,
71 mutest_passed_checks, mutest_failed_checks);
73 return (mutest_failed_suites + mutest_skipped_suites) ? 1 : 0;