felipealmeida pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=058f07e7596ae04a3594bb1b941298e9a22e45aa
commit 058f07e7596ae04a3594bb1b941298e9a22e45aa Author: Felipe Magno de Almeida <[email protected]> Date: Thu May 26 16:47:20 2016 -0300 eolian-cxx: Added tests for wrapper conversion in C++ API --- src/tests/eolian_cxx/complex.eo | 18 +++++++++++++++++ src/tests/eolian_cxx/complex_cxx.cc | 40 ++++++++++++++++++++++++------------- 2 files changed, 44 insertions(+), 14 deletions(-) diff --git a/src/tests/eolian_cxx/complex.eo b/src/tests/eolian_cxx/complex.eo index 6e71527..b84cd09 100644 --- a/src/tests/eolian_cxx/complex.eo +++ b/src/tests/eolian_cxx/complex.eo @@ -10,6 +10,24 @@ class Complex (Eo.Base) bar { return: array<int*>; } + wrapper_r { + return: Complex; + } + wrapper_in { + params { + @in a1: Complex; + } + } + wrapper_inout { + params { + @inout a1: Complex; + } + } + wrapper_out { + params { + @out a1: Complex; + } + } } } diff --git a/src/tests/eolian_cxx/complex_cxx.cc b/src/tests/eolian_cxx/complex_cxx.cc index 8b8d5e6..b43e8be 100644 --- a/src/tests/eolian_cxx/complex_cxx.cc +++ b/src/tests/eolian_cxx/complex_cxx.cc @@ -4,25 +4,37 @@ #include "complex.eo.h" #include "complex.eo.hh" -template <typename T> -struct test1; - template <typename T, typename U> -struct test1<void(T::*)(U) const> +struct test_return_type; + +template <typename T, typename R, typename U> +struct test_return_type<R(T::*)(), U> { - static_assert(std::is_same<efl::eina::range_list<int>, U>::value, "Wrong type"); + static_assert(std::is_same<R, U>::value, "Wrong type"); +}; +template <typename T, typename R, typename U> +struct test_return_type<R(T::*)() const, U> +{ + static_assert(std::is_same<R, U>::value, "Wrong type"); }; - -template <typename T> -struct test2; template <typename T, typename U> -struct test2<U(T::*)() const> +struct test_param_type; + +template <typename T, typename P, typename U> +struct test_param_type<void(T::*)(P) const, U> { - static_assert(std::is_same<efl::eina::range_array<int>, U>::value, "Wrong type"); + static_assert(std::is_same<P, U>::value, "Wrong type"); +}; +template <typename T, typename P, typename U> +struct test_param_type<void(T::*)(P), U> +{ + static_assert(std::is_same<P, U>::value, "Wrong type"); }; -test1<typeof( & nonamespace::Complex::foo )> foo; -test2<typeof( & nonamespace::Complex::bar )> bar; - - +test_param_type<typeof( & nonamespace::Complex::foo ), efl::eina::range_list<int>> foo; +test_return_type<typeof( & nonamespace::Complex::bar ), efl::eina::range_array<int>> bar; +test_return_type<typeof( & nonamespace::Complex::wrapper_r ), nonamespace::Complex> wrapper_r; +test_param_type<typeof( & nonamespace::Complex::wrapper_in ), nonamespace::Complex> wrapper_in; +test_param_type<typeof( & nonamespace::Complex::wrapper_inout ), nonamespace::Complex*> wrapper_inout; +test_param_type<typeof( & nonamespace::Complex::wrapper_out ), nonamespace::Complex*> wrapper_out; --
