11 typedef struct _Eo_Test_Case Eo_Test_Case;
15 const char *test_case;
16 void (*build)(TCase *tc);
19 static const Eo_Test_Case etc[] = {
20 { "Eo init", eo_test_init },
21 { "Eo general", eo_test_general },
22 { "Eo class errors", eo_test_class_errors },
29 const Eo_Test_Case *itr;
32 fputs("Available Test Cases:\n", stderr);
33 for (; itr->test_case; itr++)
34 fprintf(stderr, "\t%s\n", itr->test_case);
37 _use_test(int argc, const char **argv, const char *test_case)
42 for (; argc > 0; argc--, argv++)
43 if (strcmp(test_case, *argv) == 0)
49 eo_suite_build(int argc, const char **argv)
55 s = suite_create("Eo");
57 for (i = 0; etc[i].test_case; ++i)
59 if (!_use_test(argc, argv, etc[i].test_case)) continue;
60 tc = tcase_create(etc[i].test_case);
64 suite_add_tcase(s, tc);
65 tcase_set_timeout(tc, 0);
72 main(int argc, char **argv)
78 setenv("CK_FORK", "no", 0);
80 for (i = 1; i < argc; i++)
81 if ((strcmp(argv[i], "-h") == 0) ||
82 (strcmp(argv[i], "--help") == 0))
84 fprintf(stderr, "Usage:\n\t%s [test_case1 .. [test_caseN]]\n",
89 else if ((strcmp(argv[i], "-l") == 0) ||
90 (strcmp(argv[i], "--list") == 0))
96 s = eo_suite_build(argc - 1, (const char **)argv + 1);
97 sr = srunner_create(s);
99 srunner_run_all(sr, CK_ENV);
100 failed_count = srunner_ntests_failed(sr);
105 return (failed_count == 0) ? 0 : 255;