forked from enlightenment/efl
Test rework #17: Eo
I've only touched the suite/ subdir. Maybe we should merege the others into the test suite in suite/
This commit is contained in:
parent
41e626c190
commit
d525034ec8
|
@ -2,21 +2,10 @@
|
||||||
# include <config.h>
|
# include <config.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
|
|
||||||
#include "Eo.h"
|
|
||||||
#include "eo_suite.h"
|
#include "eo_suite.h"
|
||||||
|
#include "../../efl_check.h"
|
||||||
|
|
||||||
typedef struct _Eo_Test_Case Eo_Test_Case;
|
static const Efl_Test_Case etc[] = {
|
||||||
|
|
||||||
struct _Eo_Test_Case
|
|
||||||
{
|
|
||||||
const char *test_case;
|
|
||||||
void (*build)(TCase *tc);
|
|
||||||
};
|
|
||||||
|
|
||||||
static const Eo_Test_Case etc[] = {
|
|
||||||
{ "Eo init", eo_test_init },
|
{ "Eo init", eo_test_init },
|
||||||
{ "Eo general", eo_test_general },
|
{ "Eo general", eo_test_general },
|
||||||
{ "Eo class errors", eo_test_class_errors },
|
{ "Eo class errors", eo_test_class_errors },
|
||||||
|
@ -27,86 +16,18 @@ static const Eo_Test_Case etc[] = {
|
||||||
{ NULL, NULL }
|
{ NULL, NULL }
|
||||||
};
|
};
|
||||||
|
|
||||||
static void
|
|
||||||
_list_tests(void)
|
|
||||||
{
|
|
||||||
const Eo_Test_Case *itr;
|
|
||||||
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
static Suite *
|
|
||||||
eo_suite_build(int argc, const char **argv)
|
|
||||||
{
|
|
||||||
TCase *tc;
|
|
||||||
Suite *s;
|
|
||||||
int i;
|
|
||||||
|
|
||||||
s = suite_create("Eo");
|
|
||||||
|
|
||||||
for (i = 0; etc[i].test_case; ++i)
|
|
||||||
{
|
|
||||||
if (!_use_test(argc, argv, etc[i].test_case)) continue;
|
|
||||||
tc = tcase_create(etc[i].test_case);
|
|
||||||
|
|
||||||
etc[i].build(tc);
|
|
||||||
|
|
||||||
suite_add_tcase(s, tc);
|
|
||||||
#ifndef _WIN32
|
|
||||||
tcase_set_timeout(tc, 0);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
return s;
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
int
|
||||||
main(int argc, char **argv)
|
main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
Suite *s;
|
int failed_count;
|
||||||
SRunner *sr;
|
|
||||||
int i, failed_count;
|
|
||||||
|
|
||||||
for (i = 1; i < argc; i++)
|
if (!_efl_test_option_disp(argc, argv, etc))
|
||||||
if ((strcmp(argv[i], "-h") == 0) ||
|
return 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;
|
|
||||||
}
|
|
||||||
|
|
||||||
putenv("EFL_RUN_IN_TREE=1");
|
putenv("EFL_RUN_IN_TREE=1");
|
||||||
|
|
||||||
s = eo_suite_build(argc - 1, (const char **)argv + 1);
|
failed_count = _efl_suite_build_and_run(argc - 1, (const char **)argv + 1,
|
||||||
sr = srunner_create(s);
|
"Eo", etc);
|
||||||
|
|
||||||
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);
|
|
||||||
|
|
||||||
return (failed_count == 0) ? 0 : 255;
|
return (failed_count == 0) ? 0 : 255;
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,8 @@
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
#include "Eo.h"
|
#include <Eo.h>
|
||||||
|
|
||||||
#include "eo_suite.h"
|
#include "eo_suite.h"
|
||||||
#include "eo_error_msgs.h"
|
#include "eo_error_msgs.h"
|
||||||
#include "eo_test_class_simple.h"
|
#include "eo_test_class_simple.h"
|
||||||
|
|
|
@ -4,7 +4,8 @@
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
#include "Eo.h"
|
#include <Eo.h>
|
||||||
|
|
||||||
#include "eo_suite.h"
|
#include "eo_suite.h"
|
||||||
#include "eo_error_msgs.h"
|
#include "eo_error_msgs.h"
|
||||||
#include "eo_test_class_simple.h"
|
#include "eo_test_class_simple.h"
|
||||||
|
|
|
@ -4,7 +4,8 @@
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
#include "Eo.h"
|
#include <Eo.h>
|
||||||
|
|
||||||
#include "eo_suite.h"
|
#include "eo_suite.h"
|
||||||
#include "eo_error_msgs.h"
|
#include "eo_error_msgs.h"
|
||||||
#include "eo_test_class_simple.h"
|
#include "eo_test_class_simple.h"
|
||||||
|
|
|
@ -6,7 +6,8 @@
|
||||||
|
|
||||||
#define EO_BASE_BETA
|
#define EO_BASE_BETA
|
||||||
|
|
||||||
#include "Eo.h"
|
#include <Eo.h>
|
||||||
|
|
||||||
#include "eo_suite.h"
|
#include "eo_suite.h"
|
||||||
#include "eo_test_class_simple.h"
|
#include "eo_test_class_simple.h"
|
||||||
|
|
||||||
|
|
|
@ -2,12 +2,11 @@
|
||||||
# include "config.h"
|
# include "config.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <Eo.h>
|
||||||
|
|
||||||
#include "Eo.h"
|
|
||||||
#include "eo_suite.h"
|
#include "eo_suite.h"
|
||||||
|
|
||||||
START_TEST(eo_simple)
|
START_TEST(eo_test_simple)
|
||||||
{
|
{
|
||||||
fail_if(!eo_init()); /* one init by test suite */
|
fail_if(!eo_init()); /* one init by test suite */
|
||||||
fail_if(!eo_init());
|
fail_if(!eo_init());
|
||||||
|
@ -16,7 +15,7 @@ START_TEST(eo_simple)
|
||||||
}
|
}
|
||||||
END_TEST
|
END_TEST
|
||||||
|
|
||||||
START_TEST(eo_init_shutdown)
|
START_TEST(eo_test_init_shutdown)
|
||||||
{
|
{
|
||||||
fail_if(!eo_init());
|
fail_if(!eo_init());
|
||||||
ck_assert_str_eq("Eo_Base", eo_class_name_get(EO_BASE_CLASS));
|
ck_assert_str_eq("Eo_Base", eo_class_name_get(EO_BASE_CLASS));
|
||||||
|
@ -30,6 +29,6 @@ END_TEST
|
||||||
|
|
||||||
void eo_test_init(TCase *tc)
|
void eo_test_init(TCase *tc)
|
||||||
{
|
{
|
||||||
tcase_add_test(tc, eo_simple);
|
tcase_add_test(tc, eo_test_simple);
|
||||||
tcase_add_test(tc, eo_init_shutdown);
|
tcase_add_test(tc, eo_test_init_shutdown);
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,8 @@
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
#include "Eo.h"
|
#include <Eo.h>
|
||||||
|
|
||||||
#include "eo_suite.h"
|
#include "eo_suite.h"
|
||||||
|
|
||||||
static Eina_Barrier barrier;
|
static Eina_Barrier barrier;
|
||||||
|
|
|
@ -4,7 +4,8 @@
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
#include "Eo.h"
|
#include <Eo.h>
|
||||||
|
|
||||||
#include "eo_suite.h"
|
#include "eo_suite.h"
|
||||||
#include "eo_test_class_simple.h"
|
#include "eo_test_class_simple.h"
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue