Test rework #4: Ector

This commit is contained in:
Vincent Torri 2016-02-04 14:20:04 +01:00 committed by Tom Hacohen
parent 563f616b7c
commit 401eba1b53
2 changed files with 10 additions and 78 deletions

View File

@ -18,96 +18,28 @@
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif /* ifdef HAVE_CONFIG_H */
#include <stdio.h>
#include <string.h>
#include <check.h>
#include "Eina.h"
#endif
#include "ector_suite.h"
#include "../efl_check.h"
typedef struct _Ector_Test_Case Ector_Test_Case;
struct _Ector_Test_Case
{
const char *test_case;
void (*build)(TCase *tc);
};
static const Ector_Test_Case etc[] = {
static const Efl_Test_Case etc[] = {
{ "init", ector_test_init },
{ NULL, NULL }
};
static void
_list_tests(void)
{
const Ector_Test_Case *itr = etc;
fputs("Available Test Cases:\n", stderr);
for (; itr->test_case; itr++)
fprintf(stderr, "\t%s\n", itr->test_case);
}
static Eina_Bool
_use_test(int argc, const char **argv, const char *test_case)
{
if (argc < 1)
return 1;
for (; argc > 0; argc--, argv++)
if (strcmp(test_case, *argv) == 0)
return 1;
return 0;
}
int
main(int argc, char *argv[])
{
TCase *tc;
Suite *s;
SRunner *sr;
int failed_count, i;
int failed_count;
for (i = 1; i < argc; i++)
if ((strcmp(argv[i], "-h") == 0) ||
(strcmp(argv[i], "--help") == 0))
{
fprintf(stderr, "Usage:\n\t%s [test_case1 .. [test_caseN]]\n",
argv[0]);
_list_tests();
return 0;
}
else if ((strcmp(argv[i], "-l") == 0) ||
(strcmp(argv[i], "--list") == 0))
{
_list_tests();
return 0;
}
if (!_efl_test_option_disp(argc, argv, etc))
return 0;
putenv("EFL_RUN_IN_TREE=1");
s = suite_create("Ector");
for (i = 0; etc[i].test_case; ++i)
{
if (!_use_test(argc - 1, (const char **) argv + 1, etc[i].test_case))
continue;
tc = tcase_create(etc[i].test_case);
tcase_set_timeout(tc, 0);
etc[i].build(tc);
suite_add_tcase(s, tc);
}
sr = srunner_create(s);
srunner_set_xml(sr, TESTS_BUILD_DIR "/check-results.xml");
srunner_run_all(sr, CK_ENV);
failed_count = srunner_ntests_failed(sr);
srunner_free(sr);
failed_count = _efl_suite_build_and_run(argc - 1, (const char **)argv + 1,
"Ector", etc);
return (failed_count == 0) ? EXIT_SUCCESS : EXIT_FAILURE;
}

View File

@ -20,9 +20,9 @@
# include "config.h"
#endif
#include "ector_suite.h"
#include <Ector.h>
#include "Ector.h"
#include "ector_suite.h"
START_TEST(ector_init_simple)
{