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_suite_failed;
19 /* globals for managing test cases */
20 const char* mutest_case_name;
21 int mutest_failed_cases;
22 int mutest_passed_cases;
23 int mutest_case_failed;
26 /* globals for managing checks */
27 int mutest_failed_checks;
28 int mutest_passed_checks;
31 /* verbosity level, see mutest.h */
32 int mutest_verbose_level = 1; /* exported for use in test suites */
37 * only -v is supported right now, both "-v -v" and "-vv" are accepted for
38 * increasing the verbosity by 2.
40 void parse_args(int argc, char* argv[]) {
42 if (strncmp(*argv, "-v", 2) == 0) {
43 ++mutest_verbose_level;
44 char* c = (*argv) + 1;
48 ++mutest_verbose_level;
55 int main(int argc, char* argv[]) {
57 parse_args(argc, argv);
61 mu_print(MU_SUMMARY, "\n"
63 "\t%d test suite(s) passed, %d failed.\n"
64 "\t%d test case(s) passed, %d failed.\n"
65 "\t%d check(s) passed, %d failed.\n"
67 mutest_passed_suites, mutest_failed_suites,
68 mutest_passed_cases, mutest_failed_cases,
69 mutest_passed_checks, mutest_failed_checks);
71 return mutest_failed_checks ? 1 : 0;