Test rework #19: Eolian_Cxx

This commit is contained in:
Vincent Torri 2016-02-04 15:10:11 +01:00 committed by Tom Hacohen
parent 6e6a0b59ed
commit ee8ff34d7b
17 changed files with 54 additions and 139 deletions

View File

@ -74,7 +74,8 @@ tests/eolian_cxx/eolian_cxx_test_wrapper.cc \
tests/eolian_cxx/simple.c \
tests/eolian_cxx/generic.c \
tests/eolian_cxx/eolian_cxx_test_inheritance.cc \
tests/eolian_cxx/eolian_cxx_test_generate.cc
tests/eolian_cxx/eolian_cxx_test_generate.cc \
tests/eolian_cxx/eolian_cxx_suite.h
tests/eolian_cxx/tests_eolian_cxx_eolian_cxx_suite-eolian_cxx_test_wrapper.$(OBJEXT): tests/eolian_cxx/callback.eo.hh tests/eolian_cxx/callback.eo.h
tests/eolian_cxx/tests_eolian_cxx_eolian_cxx_suite-eolian_cxx_test_callback.$(OBJEXT): tests/eolian_cxx/callback.eo.hh tests/eolian_cxx/callback.eo.h

View File

@ -1,4 +1,3 @@
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
@ -21,4 +20,3 @@ static Eo *_a_eo_base_constructor(Eo *obj EINA_UNUSED, A_Data *pd EINA_UNUSED)
}
#include "a.eo.c"

View File

@ -1,4 +1,3 @@
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
@ -22,4 +21,3 @@ static Eo *_b_eo_base_constructor(Eo *obj EINA_UNUSED, B_Data *pd EINA_UNUSED)
}
#include "b.eo.c"

View File

@ -1,4 +1,3 @@
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
@ -22,4 +21,3 @@ static Eo *_c_eo_base_constructor(Eo *obj EINA_UNUSED, C_Data *pd EINA_UNUSED)
}
#include "c.eo.c"

View File

@ -1,13 +1,12 @@
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include <stdlib.h>
#include <Eo.h>
#include <Ecore.h>
#include <stdlib.h>
#include "callback.eo.h"
struct _Callback_Data
@ -57,4 +56,3 @@ static void _callback_test_global_callbacks(Eo *obj EINA_UNUSED, void *pd EINA_U
}
#include "callback.eo.c"

View File

@ -1,4 +1,3 @@
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
@ -24,4 +23,3 @@ static Eo *_d_eo_base_constructor(Eo *obj EINA_UNUSED, D_Data *pd EINA_UNUSED)
}
#include "d.eo.c"

View File

@ -1,24 +1,11 @@
#include <stdio.h>
#include <stdlib.h>
#include <check.h>
#include <cassert>
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
void eolian_cxx_test_parse(TCase* tc);
void eolian_cxx_test_wrapper(TCase* tc);
void eolian_cxx_test_generate(TCase* tc);
void eolian_cxx_test_callback(TCase* tc);
void eolian_cxx_test_address_of(TCase* tc);
void eolian_cxx_test_inheritance(TCase* tc);
void eolian_cxx_test_binding(TCase* tc);
#include "eolian_cxx_suite.h"
#include "../efl_check.h"
typedef struct _Eolian_Cxx_Test_Case Eolian_Cxx_Test_Case;
struct _Eolian_Cxx_Test_Case
{
const char *test_case;
void (*build)(TCase *tc);
};
static const Eolian_Cxx_Test_Case etc[] = {
static const Efl_Test_Case etc[] = {
{ "Eolian-Cxx Parsing", eolian_cxx_test_parse },
{ "Eolian-Cxx Wrapper", eolian_cxx_test_wrapper },
{ "Eolian-Cxx Generation", eolian_cxx_test_generate },
@ -29,87 +16,18 @@ static const Eolian_Cxx_Test_Case etc[] = {
{ NULL, NULL }
};
static void
_list_tests(void)
int
main(int argc, char* argv[])
{
const Eolian_Cxx_Test_Case *itr;
int failed_count;
itr = etc;
fputs("Available Test Cases:\n", stderr);
for (; itr->test_case; itr++)
fprintf(stderr, "\t%s\n", itr->test_case);
}
static 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;
}
Suite *
eolian_cxx_build_suite(int argc, const char **argv)
{
TCase *tc;
Suite *s;
int i;
s = suite_create("Eolian C++");
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);
#ifndef _WIN32
tcase_set_timeout(tc, 0);
#endif
etc[i].build(tc);
suite_add_tcase(s, tc);
}
return s;
}
int main(int argc, char* argv[])
{
Suite *s;
SRunner *sr;
int i, 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(const_cast<char*>("EFL_RUN_IN_TREE=1"));
s = eolian_cxx_build_suite(argc - 1, (const char **)argv + 1);
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,
"Eolian C++", etc);
return (failed_count == 0) ? 0 : 255;
}

View File

@ -0,0 +1,14 @@
#ifndef _EOLIAN_CXX_SUITE_H
#define _EOLIAN_CXX_SUITE_H
#include <check.h>
void eolian_cxx_test_parse(TCase* tc);
void eolian_cxx_test_wrapper(TCase* tc);
void eolian_cxx_test_generate(TCase* tc);
void eolian_cxx_test_callback(TCase* tc);
void eolian_cxx_test_address_of(TCase* tc);
void eolian_cxx_test_inheritance(TCase* tc);
void eolian_cxx_test_binding(TCase* tc);
#endif /* _EOLIAN_CXX_SUITE_H */

View File

@ -1,4 +1,3 @@
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
@ -8,7 +7,7 @@
#include <c.eo.hh>
#include <d.eo.hh>
#include <check.h>
#include "eolian_cxx_suite.h"
START_TEST(eolian_cxx_test_addess_of_conversions)
{

View File

@ -1,13 +1,10 @@
// test EFL++ generated bindings
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include <generic.eo.hh>
#include <check.h>
#include "eolian_cxx_suite.h"
START_TEST(eolian_cxx_test_binding_constructor_only_required)
{

View File

@ -1,19 +1,18 @@
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>
#include <Eo.h>
#include <Ecore.h>
#include <callback.eo.hh>
#include <check.h>
#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>
#include "eolian_cxx_suite.h"
void foo(void*) {}
@ -106,7 +105,7 @@ START_TEST(eolian_cxx_test_callback_event_del)
));
++called4;
}));
fail_if(called1 != 2);
fail_if(called2 != 2);
fail_if(called3 != 2);

View File

@ -1,12 +1,12 @@
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include <cassert>
#include <Eolian_Cxx.hh>
#include <check.h>
#include <cassert>
#include "eolian_cxx_suite.h"
START_TEST(eolian_cxx_test_generate_complex_types)
{

View File

@ -1,4 +1,3 @@
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
@ -8,7 +7,7 @@
#include <simple.eo.hh>
#include <check.h>
#include "eolian_cxx_suite.h"
struct bar
: efl::eo::inherit<bar, simple>

View File

@ -1,9 +1,13 @@
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include <cassert>
#include <tuple>
#include <Eolian_Cxx.hh>
#include <cassert>
#include <check.h>
#include <tuple>
#include "eolian_cxx_suite.h"
START_TEST(eolian_cxx_test_parse_complex_types)
{

View File

@ -1,6 +1,3 @@
// Test Eolian-Cxx wrappers
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
@ -10,7 +7,7 @@
#include <callback.eo.hh>
#include <check.h>
#include "eolian_cxx_suite.h"
START_TEST(eolian_cxx_test_wrapper_size)
{

View File

@ -1,4 +1,3 @@
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif

View File

@ -1,13 +1,12 @@
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include <stdlib.h>
#include <Eo.h>
#include <Ecore.h>
#include <stdlib.h>
#include "simple.eo.h"
#define MY_CLASS SIMPLE_CLASS
@ -35,4 +34,3 @@ static Eina_Bool _simple_name_get(Eo *obj EINA_UNUSED, void *pd EINA_UNUSED, con
}
#include "simple.eo.c"