forked from enlightenment/efl
Test rework #19: Eolian_Cxx
This commit is contained in:
parent
6e6a0b59ed
commit
ee8ff34d7b
|
@ -74,7 +74,8 @@ tests/eolian_cxx/eolian_cxx_test_wrapper.cc \
|
||||||
tests/eolian_cxx/simple.c \
|
tests/eolian_cxx/simple.c \
|
||||||
tests/eolian_cxx/generic.c \
|
tests/eolian_cxx/generic.c \
|
||||||
tests/eolian_cxx/eolian_cxx_test_inheritance.cc \
|
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_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
|
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
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
#ifdef HAVE_CONFIG_H
|
#ifdef HAVE_CONFIG_H
|
||||||
# include <config.h>
|
# include <config.h>
|
||||||
#endif
|
#endif
|
||||||
|
@ -21,4 +20,3 @@ static Eo *_a_eo_base_constructor(Eo *obj EINA_UNUSED, A_Data *pd EINA_UNUSED)
|
||||||
}
|
}
|
||||||
|
|
||||||
#include "a.eo.c"
|
#include "a.eo.c"
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
#ifdef HAVE_CONFIG_H
|
#ifdef HAVE_CONFIG_H
|
||||||
# include <config.h>
|
# include <config.h>
|
||||||
#endif
|
#endif
|
||||||
|
@ -22,4 +21,3 @@ static Eo *_b_eo_base_constructor(Eo *obj EINA_UNUSED, B_Data *pd EINA_UNUSED)
|
||||||
}
|
}
|
||||||
|
|
||||||
#include "b.eo.c"
|
#include "b.eo.c"
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
#ifdef HAVE_CONFIG_H
|
#ifdef HAVE_CONFIG_H
|
||||||
# include <config.h>
|
# include <config.h>
|
||||||
#endif
|
#endif
|
||||||
|
@ -22,4 +21,3 @@ static Eo *_c_eo_base_constructor(Eo *obj EINA_UNUSED, C_Data *pd EINA_UNUSED)
|
||||||
}
|
}
|
||||||
|
|
||||||
#include "c.eo.c"
|
#include "c.eo.c"
|
||||||
|
|
||||||
|
|
|
@ -1,13 +1,12 @@
|
||||||
|
|
||||||
#ifdef HAVE_CONFIG_H
|
#ifdef HAVE_CONFIG_H
|
||||||
# include <config.h>
|
# include <config.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
#include <Eo.h>
|
#include <Eo.h>
|
||||||
#include <Ecore.h>
|
#include <Ecore.h>
|
||||||
|
|
||||||
#include <stdlib.h>
|
|
||||||
|
|
||||||
#include "callback.eo.h"
|
#include "callback.eo.h"
|
||||||
|
|
||||||
struct _Callback_Data
|
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"
|
#include "callback.eo.c"
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
#ifdef HAVE_CONFIG_H
|
#ifdef HAVE_CONFIG_H
|
||||||
# include <config.h>
|
# include <config.h>
|
||||||
#endif
|
#endif
|
||||||
|
@ -24,4 +23,3 @@ static Eo *_d_eo_base_constructor(Eo *obj EINA_UNUSED, D_Data *pd EINA_UNUSED)
|
||||||
}
|
}
|
||||||
|
|
||||||
#include "d.eo.c"
|
#include "d.eo.c"
|
||||||
|
|
||||||
|
|
|
@ -1,24 +1,11 @@
|
||||||
#include <stdio.h>
|
#ifdef HAVE_CONFIG_H
|
||||||
#include <stdlib.h>
|
# include <config.h>
|
||||||
#include <check.h>
|
#endif
|
||||||
#include <cassert>
|
|
||||||
|
|
||||||
void eolian_cxx_test_parse(TCase* tc);
|
#include "eolian_cxx_suite.h"
|
||||||
void eolian_cxx_test_wrapper(TCase* tc);
|
#include "../efl_check.h"
|
||||||
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);
|
|
||||||
|
|
||||||
typedef struct _Eolian_Cxx_Test_Case Eolian_Cxx_Test_Case;
|
static const Efl_Test_Case etc[] = {
|
||||||
struct _Eolian_Cxx_Test_Case
|
|
||||||
{
|
|
||||||
const char *test_case;
|
|
||||||
void (*build)(TCase *tc);
|
|
||||||
};
|
|
||||||
|
|
||||||
static const Eolian_Cxx_Test_Case etc[] = {
|
|
||||||
{ "Eolian-Cxx Parsing", eolian_cxx_test_parse },
|
{ "Eolian-Cxx Parsing", eolian_cxx_test_parse },
|
||||||
{ "Eolian-Cxx Wrapper", eolian_cxx_test_wrapper },
|
{ "Eolian-Cxx Wrapper", eolian_cxx_test_wrapper },
|
||||||
{ "Eolian-Cxx Generation", eolian_cxx_test_generate },
|
{ "Eolian-Cxx Generation", eolian_cxx_test_generate },
|
||||||
|
@ -29,87 +16,18 @@ static const Eolian_Cxx_Test_Case etc[] = {
|
||||||
{ NULL, NULL }
|
{ NULL, NULL }
|
||||||
};
|
};
|
||||||
|
|
||||||
static void
|
int
|
||||||
_list_tests(void)
|
main(int argc, char* argv[])
|
||||||
{
|
{
|
||||||
const Eolian_Cxx_Test_Case *itr;
|
int failed_count;
|
||||||
|
|
||||||
itr = etc;
|
if (!_efl_test_option_disp(argc, argv, etc))
|
||||||
fputs("Available Test Cases:\n", stderr);
|
return 0;
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
putenv(const_cast<char*>("EFL_RUN_IN_TREE=1"));
|
putenv(const_cast<char*>("EFL_RUN_IN_TREE=1"));
|
||||||
|
|
||||||
s = eolian_cxx_build_suite(argc - 1, (const char **)argv + 1);
|
failed_count = _efl_suite_build_and_run(argc - 1, (const char **)argv + 1,
|
||||||
sr = srunner_create(s);
|
"Eolian C++", 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;
|
||||||
}
|
}
|
||||||
|
|
|
@ -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 */
|
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
#ifdef HAVE_CONFIG_H
|
#ifdef HAVE_CONFIG_H
|
||||||
# include <config.h>
|
# include <config.h>
|
||||||
#endif
|
#endif
|
||||||
|
@ -8,7 +7,7 @@
|
||||||
#include <c.eo.hh>
|
#include <c.eo.hh>
|
||||||
#include <d.eo.hh>
|
#include <d.eo.hh>
|
||||||
|
|
||||||
#include <check.h>
|
#include "eolian_cxx_suite.h"
|
||||||
|
|
||||||
START_TEST(eolian_cxx_test_addess_of_conversions)
|
START_TEST(eolian_cxx_test_addess_of_conversions)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,13 +1,10 @@
|
||||||
|
|
||||||
// test EFL++ generated bindings
|
|
||||||
|
|
||||||
#ifdef HAVE_CONFIG_H
|
#ifdef HAVE_CONFIG_H
|
||||||
# include <config.h>
|
# include <config.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <generic.eo.hh>
|
#include <generic.eo.hh>
|
||||||
|
|
||||||
#include <check.h>
|
#include "eolian_cxx_suite.h"
|
||||||
|
|
||||||
START_TEST(eolian_cxx_test_binding_constructor_only_required)
|
START_TEST(eolian_cxx_test_binding_constructor_only_required)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,19 +1,18 @@
|
||||||
|
|
||||||
#ifdef HAVE_CONFIG_H
|
#ifdef HAVE_CONFIG_H
|
||||||
# include <config.h>
|
# include <config.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include <iostream>
|
||||||
|
#include <vector>
|
||||||
|
#include <algorithm>
|
||||||
|
#include <functional>
|
||||||
|
|
||||||
#include <Eo.h>
|
#include <Eo.h>
|
||||||
#include <Ecore.h>
|
#include <Ecore.h>
|
||||||
|
|
||||||
#include <callback.eo.hh>
|
#include <callback.eo.hh>
|
||||||
|
|
||||||
#include <check.h>
|
#include "eolian_cxx_suite.h"
|
||||||
|
|
||||||
#include <iostream>
|
|
||||||
#include <vector>
|
|
||||||
#include <algorithm>
|
|
||||||
#include <functional>
|
|
||||||
|
|
||||||
void foo(void*) {}
|
void foo(void*) {}
|
||||||
|
|
||||||
|
@ -106,7 +105,7 @@ START_TEST(eolian_cxx_test_callback_event_del)
|
||||||
));
|
));
|
||||||
++called4;
|
++called4;
|
||||||
}));
|
}));
|
||||||
|
|
||||||
fail_if(called1 != 2);
|
fail_if(called1 != 2);
|
||||||
fail_if(called2 != 2);
|
fail_if(called2 != 2);
|
||||||
fail_if(called3 != 2);
|
fail_if(called3 != 2);
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
|
|
||||||
#ifdef HAVE_CONFIG_H
|
#ifdef HAVE_CONFIG_H
|
||||||
# include <config.h>
|
# include <config.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include <cassert>
|
||||||
|
|
||||||
#include <Eolian_Cxx.hh>
|
#include <Eolian_Cxx.hh>
|
||||||
|
|
||||||
#include <check.h>
|
#include "eolian_cxx_suite.h"
|
||||||
#include <cassert>
|
|
||||||
|
|
||||||
START_TEST(eolian_cxx_test_generate_complex_types)
|
START_TEST(eolian_cxx_test_generate_complex_types)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
#ifdef HAVE_CONFIG_H
|
#ifdef HAVE_CONFIG_H
|
||||||
# include <config.h>
|
# include <config.h>
|
||||||
#endif
|
#endif
|
||||||
|
@ -8,7 +7,7 @@
|
||||||
|
|
||||||
#include <simple.eo.hh>
|
#include <simple.eo.hh>
|
||||||
|
|
||||||
#include <check.h>
|
#include "eolian_cxx_suite.h"
|
||||||
|
|
||||||
struct bar
|
struct bar
|
||||||
: efl::eo::inherit<bar, simple>
|
: efl::eo::inherit<bar, simple>
|
||||||
|
|
|
@ -1,9 +1,13 @@
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
# include <config.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <cassert>
|
||||||
|
#include <tuple>
|
||||||
|
|
||||||
#include <Eolian_Cxx.hh>
|
#include <Eolian_Cxx.hh>
|
||||||
|
|
||||||
#include <cassert>
|
#include "eolian_cxx_suite.h"
|
||||||
#include <check.h>
|
|
||||||
#include <tuple>
|
|
||||||
|
|
||||||
START_TEST(eolian_cxx_test_parse_complex_types)
|
START_TEST(eolian_cxx_test_parse_complex_types)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,6 +1,3 @@
|
||||||
|
|
||||||
// Test Eolian-Cxx wrappers
|
|
||||||
|
|
||||||
#ifdef HAVE_CONFIG_H
|
#ifdef HAVE_CONFIG_H
|
||||||
# include <config.h>
|
# include <config.h>
|
||||||
#endif
|
#endif
|
||||||
|
@ -10,7 +7,7 @@
|
||||||
|
|
||||||
#include <callback.eo.hh>
|
#include <callback.eo.hh>
|
||||||
|
|
||||||
#include <check.h>
|
#include "eolian_cxx_suite.h"
|
||||||
|
|
||||||
START_TEST(eolian_cxx_test_wrapper_size)
|
START_TEST(eolian_cxx_test_wrapper_size)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
#ifdef HAVE_CONFIG_H
|
#ifdef HAVE_CONFIG_H
|
||||||
# include <config.h>
|
# include <config.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -1,13 +1,12 @@
|
||||||
|
|
||||||
#ifdef HAVE_CONFIG_H
|
#ifdef HAVE_CONFIG_H
|
||||||
# include <config.h>
|
# include <config.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
#include <Eo.h>
|
#include <Eo.h>
|
||||||
#include <Ecore.h>
|
#include <Ecore.h>
|
||||||
|
|
||||||
#include <stdlib.h>
|
|
||||||
|
|
||||||
#include "simple.eo.h"
|
#include "simple.eo.h"
|
||||||
|
|
||||||
#define MY_CLASS SIMPLE_CLASS
|
#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"
|
#include "simple.eo.c"
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue