diff options
author | Vitor Sousa <vitorsousasilva@gmail.com> | 2014-11-11 13:03:59 -0200 |
---|---|---|
committer | Vitor Sousa <vitorsousasilva@gmail.com> | 2015-01-05 15:52:27 -0200 |
commit | ed8ce801cb56644c12b395797c3f9e22a508811f (patch) | |
tree | c45260a52076155c2698b59afe3bb3625d1ffa12 /src/tests/eolian_cxx | |
parent | 1cbbb9a577eb2dbbfebb441702635b2245840d1c (diff) | |
download | efl-ed8ce801cb56644c12b395797c3f9e22a508811f.tar.gz |
eolian_cxx: Assertions to ensure C++ wrapper compatibility with Eo*
Added static assertion in the generated header to ensure that the wrapper
have the same size of Eo*, thus grating compatibility between these types.
Added static assertion in the generated header to ensure that the wrapper
have standard layout. This should ensure correct type sizes when dealing
with inheritance.
Created a test to ensure that eo::base and the eolian wrappers have the
same size of a Eo*.
Added eolian_cxx_test_wrapper.cc to the list of test source files in
Makefile_Eolian_Cxx.am.
Diffstat (limited to 'src/tests/eolian_cxx')
-rw-r--r-- | src/tests/eolian_cxx/eolian_cxx_suite.cc | 2 | ||||
-rw-r--r-- | src/tests/eolian_cxx/eolian_cxx_test_wrapper.cc | 29 |
2 files changed, 31 insertions, 0 deletions
diff --git a/src/tests/eolian_cxx/eolian_cxx_suite.cc b/src/tests/eolian_cxx/eolian_cxx_suite.cc index bd08e9b8aa..20a8c34a15 100644 --- a/src/tests/eolian_cxx/eolian_cxx_suite.cc +++ b/src/tests/eolian_cxx/eolian_cxx_suite.cc @@ -4,6 +4,7 @@ #include <cassert> 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); @@ -16,6 +17,7 @@ struct _Eolian_Cxx_Test_Case static const Eolian_Cxx_Test_Case etc[] = { { "Eolian-Cxx Parsing", eolian_cxx_test_parse }, + { "Eolian-Cxx Wrapper", eolian_cxx_test_wrapper }, { "Eolian-Cxx Generation", eolian_cxx_test_generate }, { "Eolian-Cxx Callback", eolian_cxx_test_callback }, { NULL, NULL } diff --git a/src/tests/eolian_cxx/eolian_cxx_test_wrapper.cc b/src/tests/eolian_cxx/eolian_cxx_test_wrapper.cc index fb680a59c1..123b508734 100644 --- a/src/tests/eolian_cxx/eolian_cxx_test_wrapper.cc +++ b/src/tests/eolian_cxx/eolian_cxx_test_wrapper.cc @@ -1,2 +1,31 @@ // Test Eolian-Cxx wrappers + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#include <Eo.h> +#include <Ecore.h> + +#include <callback.eo.hh> + +#include <check.h> + +START_TEST(eolian_cxx_test_wrapper_size) +{ + efl::eo::eo_init init; + + ::efl::eo::base b(nullptr); + ::callback c; + + fail_if(sizeof(b) != sizeof(Eo*)); + fail_if(sizeof(b) != sizeof(c)); +} +END_TEST + +void +eolian_cxx_test_wrapper(TCase* tc) +{ + tcase_add_test(tc, eolian_cxx_test_wrapper_size); +} |