From: Vitor Sousa Date: Mon, 8 Jul 2019 14:15:41 +0000 (+0200) Subject: eolian_cxx: update tests to no longer use forbidden eolian notations X-Git-Tag: accepted/tizen/unified/20190711.062823~34 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=786902b5039668e19f0c91676c37865269cec9e0;p=platform%2Fupstream%2Fefl.git eolian_cxx: update tests to no longer use forbidden eolian notations Summary: Update eolian_cxx tests in order to remove forbidden eolian notations. For tests with containers that support non-pointer types, change `ptr(int)` to `int`. For tests with containers that only support pointer types, change `ptr(int)` to `string`. Remove tests for features that are no longer meaningful with eolian new restrictions. Add a FIXME note to eina::range_array when used with eina::string_view. Reviewers: lauromoura, felipealmeida, q66 Reviewed By: q66 Subscribers: cedric, #reviewers, #committers, bu5hm4n, segfaultxavi Tags: #efl Differential Revision: https://phab.enlightenment.org/D9236 --- diff --git a/src/tests/eolian_cxx/callback.eo b/src/tests/eolian_cxx/callback.eo index a62ec00..6dd2c72 100644 --- a/src/tests/eolian_cxx/callback.eo +++ b/src/tests/eolian_cxx/callback.eo @@ -1,7 +1,7 @@ struct Callback_Event { field1: int; - field2: list; + field2: list; } class Callback extends Efl.Object @@ -11,7 +11,7 @@ class Callback extends Efl.Object prefix,event1: void; prefix,event2: Callback; prefix,event3: int; - prefix,event4: const(array); + prefix,event4: const(array); prefix,event5: Callback_Event; } } diff --git a/src/tests/eolian_cxx/complex.eo b/src/tests/eolian_cxx/complex.eo index 13ed1ca..16fec03 100644 --- a/src/tests/eolian_cxx/complex.eo +++ b/src/tests/eolian_cxx/complex.eo @@ -5,7 +5,7 @@ class Complex extends Efl.Object // container test inptrcont { params { - l: list; + l: list; } } inclasscont { @@ -15,22 +15,22 @@ class Complex extends Efl.Object } incontcont { params { - l: list>; + l: list>; } } incontcontown { params { - l: list> @owned; + l: list> @owned; } } incontowncontown { params { - l: list @owned> @owned; + l: list @owned> @owned; } } incontowncont { params { - l: list @owned>; + l: list @owned>; } } instringcont { @@ -50,42 +50,42 @@ class Complex extends Efl.Object } inarray { params { - l: array; + l: array; } } inarrayown { params { - l: array @owned; + l: array @owned; } } inhash { params { - l: hash; + l: hash; } } inhashown { params { - l: hash @owned; + l: hash @owned; } } initerator { params { - l: iterator; + l: iterator; } } initeratorown { params { - l: iterator @owned; + l: iterator @owned; } } inaccessor { params { - l: accessor; + l: accessor; } } inaccessorown { params { - l: accessor @owned; + l: accessor @owned; } } // out @@ -96,22 +96,22 @@ class Complex extends Efl.Object } outcontcont { params { - @out l: list>; + @out l: list>; } } outcontcontown { params { - @out l: list> @owned; + @out l: list> @owned; } } outcontowncontown { params { - @out l: list @owned> @owned; + @out l: list @owned> @owned; } } outcontowncont { params { - @out l: list @owned>; + @out l: list @owned>; } } outstringcont { @@ -131,51 +131,51 @@ class Complex extends Efl.Object } outarray { params { - @out l: array; + @out l: array; } } outarrayown { params { - @out l: array @owned; + @out l: array @owned; } } outhash { params { - @out l: hash; + @out l: hash; } } outhashown { params { - @out l: hash @owned; + @out l: hash @owned; } } outiterator { params { - @out l: iterator; + @out l: iterator; } } outiteratorown { params { - @out l: iterator @owned; + @out l: iterator @owned; } } outaccessor { params { - @out l: accessor; + @out l: accessor; } } outaccessorown { params { - @out l: accessor @owned; + @out l: accessor @owned; } } foo { params { - l: list; + l: list; } } bar { - return: array; + return: array; } wrapper_r { return: Complex; diff --git a/src/tests/eolian_cxx/complex_cxx.cc b/src/tests/eolian_cxx/complex_cxx.cc index 37e9661..3399904 100644 --- a/src/tests/eolian_cxx/complex_cxx.cc +++ b/src/tests/eolian_cxx/complex_cxx.cc @@ -38,25 +38,25 @@ struct test_param_type }; test_param_type> inclasscont; -test_param_type >> incontcont; -test_param_type >const&> incontcontown; -test_param_type >const&> incontowncontown; -test_param_type >> incontowncont; +test_param_type >> incontcont; +test_param_type >const&> incontcontown; +test_param_type >const&> incontowncontown; +test_param_type >> incontowncont; test_param_type> instringcont; test_param_type> instringowncont; test_param_typeconst&> instringcontown; test_param_type&> outclasscont; -test_param_type >&> outcontcont; -test_param_type >&> outcontcontown; -test_param_type >&> outcontowncontown; -test_param_type >&> outcontowncont; +test_param_type >&> outcontcont; +test_param_type >&> outcontcontown; +test_param_type >&> outcontowncontown; +test_param_type >&> outcontowncont; test_param_type&> outstringcont; test_param_type&> outstringowncont; test_param_type&> outstringcontown; -test_param_type > foo; -test_return_type > bar; +test_param_type > foo; +test_return_type > bar; test_return_type wrapper_r; test_param_type wrapper_in; test_param_type wrapper_inout; diff --git a/src/tests/eolian_cxx/eolian_cxx_test_binding.cc b/src/tests/eolian_cxx/eolian_cxx_test_binding.cc index faa161b..370619d 100644 --- a/src/tests/eolian_cxx/eolian_cxx_test_binding.cc +++ b/src/tests/eolian_cxx/eolian_cxx_test_binding.cc @@ -85,15 +85,8 @@ EFL_START_TEST(eolian_cxx_test_type_generation_in) name1::name2::Type_Generation g(efl::eo::instantiate); - int v = 42; - g.inrefint(v); - g.inrefintown(42); - g.inrefintownfree(42); g.invoidptr(nullptr); g.inint(42); - g.inintptr(42); - g.inintptrown(42); - g.inintptrownfree(42); g.instring("foobar"); g.instringown("foobar"); } @@ -106,10 +99,6 @@ EFL_START_TEST(eolian_cxx_test_type_generation_return) name1::name2::Type_Generation g(efl::eo::instantiate); { - int&i = g.returnrefint(); - ck_assert(i == 42); - } - { int i = g.returnint(); ck_assert(i == 42); } @@ -118,14 +107,6 @@ EFL_START_TEST(eolian_cxx_test_type_generation_return) ck_assert(*(int*)p == 42); } { - int& p = g.returnintptr(); - ck_assert(p == 42); - } - { - efl::eina::unique_malloc_ptr p = g.returnintptrown(); - ck_assert(*p == 42); - } - { efl::eina::string_view string = g.returnstring(); ck_assert_str_eq(string.c_str(), "foobar"); } @@ -152,33 +133,10 @@ EFL_START_TEST(eolian_cxx_test_type_generation_optional) g.optionalinint(nullptr); g.optionalinint(i); - g.optionalinintptr(i); - g.optionalinintptr(nullptr); - - g.optionalinintptrown(i); - g.optionalinintptrown(nullptr); - - g.optionalinintptrownfree(i); - g.optionalinintptrownfree(nullptr); - i = 0; g.optionaloutint(&i); ck_assert(i == 42); g.optionaloutint(nullptr); - - i = 0; - int* j = nullptr; - g.optionaloutintptr(&j); - ck_assert(j != nullptr); - ck_assert(*j == 42); - g.optionaloutintptr(nullptr); - - i = 0; - efl::eina::unique_malloc_ptr k = nullptr; - g.optionaloutintptrown(k); - ck_assert(!!k); - ck_assert(*k == 42); - g.optionaloutintptrown(nullptr); } EFL_END_TEST @@ -203,11 +161,12 @@ EFL_START_TEST(eolian_cxx_test_type_callback) event3 = true; ck_assert(v == 42); }); - efl::eolian::event_add(g.prefix_event4_event, g, [&] (nonamespace::Generic, efl::eina::range_array e) + efl::eolian::event_add(g.prefix_event4_event, g, [&] (nonamespace::Generic, efl::eina::range_array<::efl::eina::string_view> e) { event4 = true; ck_assert(e.size() == 1); - ck_assert(*e.begin() == 42); + // FIXME eina::range_array is incompatible with eina::string_view + //ck_assert(*e.begin() == efl::eina::string_view{"42"}); }); efl::eolian::event_add(g.prefix_event5_event, g, [&] (nonamespace::Generic, Generic_Event) { diff --git a/src/tests/eolian_cxx/generic.c b/src/tests/eolian_cxx/generic.c index 65f8025..ebc33ac 100644 --- a/src/tests/eolian_cxx/generic.c +++ b/src/tests/eolian_cxx/generic.c @@ -114,16 +114,16 @@ static void _generic_call_event3(Eo *obj, Generic_Data* pd EINA_UNUSED) } static void _generic_call_event4(Eo *obj, Generic_Data* pd EINA_UNUSED) { - int i = 42; + static const char *s = "42"; Eina_Array* p = eina_array_new(1); - ck_assert(eina_array_push(p, &i)); + ck_assert(eina_array_push(p, s)); efl_event_callback_call(obj, GENERIC_EVENT_PREFIX_EVENT4, p); eina_array_free(p); } static void _generic_call_event5(Eo *obj, Generic_Data* pd EINA_UNUSED) { - int i = 42; - Eina_List* p = eina_list_append(NULL, &i); + const char *s = "42"; + Eina_List* p = eina_list_append(NULL, s); Generic_Event e = {.field1 = 42, .field2 = p}; efl_event_callback_call(obj, GENERIC_EVENT_PREFIX_EVENT5, &e); diff --git a/src/tests/eolian_cxx/generic.eo b/src/tests/eolian_cxx/generic.eo index 192765d..5bc284f 100644 --- a/src/tests/eolian_cxx/generic.eo +++ b/src/tests/eolian_cxx/generic.eo @@ -2,7 +2,7 @@ struct Generic.Event { field1: int; - field2: list; + field2: list; } class Generic extends Efl.Object implements Generic_Interface @@ -108,7 +108,7 @@ class Generic extends Efl.Object implements Generic_Interface prefix,event1: void; prefix,event2: Generic; prefix,event3: int; - prefix,event4: const(array); + prefix,event4: const(array); prefix,event5: Generic.Event; protected,event1 @protected: void; beta,event1 @beta: void; diff --git a/src/tests/eolian_cxx/name1_name2_type_generation.c b/src/tests/eolian_cxx/name1_name2_type_generation.c index 2517bcd..9b03b36 100644 --- a/src/tests/eolian_cxx/name1_name2_type_generation.c +++ b/src/tests/eolian_cxx/name1_name2_type_generation.c @@ -16,23 +16,6 @@ typedef struct _Type_Generation_Data Type_Generation_Data; #include "name1_name2_type_generation.eo.h" -void _name1_name2_type_generation_inrefint(Eo *obj EINA_UNUSED, Type_Generation_Data *pd EINA_UNUSED, int* v EINA_UNUSED) -{ - ck_assert(*v == 42); -} - -void _name1_name2_type_generation_inrefintown(Eo *obj EINA_UNUSED, Type_Generation_Data *pd EINA_UNUSED, int* v EINA_UNUSED) -{ - ck_assert(*v == 42); - free(v); -} - -void _name1_name2_type_generation_inrefintownfree(Eo *obj EINA_UNUSED, Type_Generation_Data *pd EINA_UNUSED, int* v EINA_UNUSED) -{ - ck_assert(*v == 42); - free(v); -} - void _name1_name2_type_generation_invoidptr(Eo *obj EINA_UNUSED, Type_Generation_Data *pd EINA_UNUSED, void *v) { ck_assert(v == NULL); @@ -43,36 +26,6 @@ void _name1_name2_type_generation_inint(Eo *obj EINA_UNUSED, Type_Generation_Dat ck_assert(v == 42); } -void _name1_name2_type_generation_inintptr(Eo *obj EINA_UNUSED, Type_Generation_Data *pd EINA_UNUSED, int *v EINA_UNUSED) -{ - ck_assert(*v == 42); -} - -void _name1_name2_type_generation_inintptrown(Eo *obj EINA_UNUSED, Type_Generation_Data *pd EINA_UNUSED, int *v EINA_UNUSED) -{ - ck_assert(*v == 42); -} - -void _name1_name2_type_generation_inintptrownptr(Eo *obj EINA_UNUSED, Type_Generation_Data *pd EINA_UNUSED, int **v EINA_UNUSED) -{ - ck_assert(**v == 42); -} - -void _name1_name2_type_generation_inintptrownptrptr(Eo *obj EINA_UNUSED, Type_Generation_Data *pd EINA_UNUSED, int ***v EINA_UNUSED) -{ - ck_assert(***v == 42); -} - -void _name1_name2_type_generation_inintptrptrownptr(Eo *obj EINA_UNUSED, Type_Generation_Data *pd EINA_UNUSED, int ***v EINA_UNUSED) -{ - ck_assert(***v == 42); -} - -void _name1_name2_type_generation_inintptrownfree(Eo *obj EINA_UNUSED, Type_Generation_Data *pd EINA_UNUSED, int *v EINA_UNUSED) -{ - ck_assert(*v == 42); -} - void * _name1_name2_type_generation_returnvoidptr(Eo *obj EINA_UNUSED, Type_Generation_Data *pd EINA_UNUSED) { static int i = 42; @@ -126,48 +79,11 @@ void _name1_name2_type_generation_instringownptr(Eo *obj EINA_UNUSED, Type_Gener free(v); } -int* _name1_name2_type_generation_returnrefint(Eo *obj EINA_UNUSED, Type_Generation_Data *pd EINA_UNUSED) -{ - static int i = 42; - return &i; -} int _name1_name2_type_generation_returnint(Eo *obj EINA_UNUSED, Type_Generation_Data *pd EINA_UNUSED) { return 42; } -int * _name1_name2_type_generation_returnintptr(Eo *obj EINA_UNUSED, Type_Generation_Data *pd EINA_UNUSED) -{ - static int i = 42; - return &i; -} - -int * _name1_name2_type_generation_returnintptrown(Eo *obj EINA_UNUSED, Type_Generation_Data *pd EINA_UNUSED) -{ - int* i = malloc(sizeof(int)); - *i = 42; - return i; -} - -int ** _name1_name2_type_generation_returnintptrownptr(Eo *obj EINA_UNUSED, Type_Generation_Data *pd EINA_UNUSED) -{ - return NULL; -} - -int *** _name1_name2_type_generation_returnintptrownptrptr(Eo *obj EINA_UNUSED, Type_Generation_Data *pd EINA_UNUSED) -{ - return NULL; -} - -int *** _name1_name2_type_generation_returnintptrptrownptr(Eo *obj EINA_UNUSED, Type_Generation_Data *pd EINA_UNUSED) -{ - return NULL; -} - -void _name1_name2_type_generation_returnintptrownfree(Eo *obj EINA_UNUSED, Type_Generation_Data *pd EINA_UNUSED, int *v EINA_UNUSED) -{ -} - const char * _name1_name2_type_generation_returnstring(Eo *obj EINA_UNUSED, Type_Generation_Data *pd EINA_UNUSED) { return "foobar"; @@ -216,18 +132,6 @@ void _name1_name2_type_generation_outint(Eo *obj EINA_UNUSED, Type_Generation_Da { } -void _name1_name2_type_generation_outintptr(Eo *obj EINA_UNUSED, Type_Generation_Data *pd EINA_UNUSED, int **v EINA_UNUSED) -{ -} - -void _name1_name2_type_generation_outintptrown(Eo *obj EINA_UNUSED, Type_Generation_Data *pd EINA_UNUSED, int **v EINA_UNUSED) -{ -} - -void _name1_name2_type_generation_outintptrownfree(Eo *obj EINA_UNUSED, Type_Generation_Data *pd EINA_UNUSED, int **v EINA_UNUSED) -{ -} - void _name1_name2_type_generation_outstringshare(Eo *obj EINA_UNUSED, Type_Generation_Data *pd EINA_UNUSED, Eina_Stringshare** v) { *v = eina_stringshare_add("foobar"); @@ -258,18 +162,6 @@ void _name1_name2_type_generation_optionalinint(Eo *obj EINA_UNUSED, Type_Genera { } -void _name1_name2_type_generation_optionalinintptr(Eo *obj EINA_UNUSED, Type_Generation_Data *pd EINA_UNUSED, int *v EINA_UNUSED) -{ -} - -void _name1_name2_type_generation_optionalinintptrown(Eo *obj EINA_UNUSED, Type_Generation_Data *pd EINA_UNUSED, int *v EINA_UNUSED) -{ -} - -void _name1_name2_type_generation_optionalinintptrownfree(Eo *obj EINA_UNUSED, Type_Generation_Data *pd EINA_UNUSED, int *v EINA_UNUSED) -{ -} - void _name1_name2_type_generation_optionaloutvoidptr(Eo *obj EINA_UNUSED, Type_Generation_Data *pd EINA_UNUSED, void **v EINA_UNUSED) { } @@ -280,27 +172,6 @@ void _name1_name2_type_generation_optionaloutint(Eo *obj EINA_UNUSED, Type_Gener *v = 42; } -void _name1_name2_type_generation_optionaloutintptr(Eo *obj EINA_UNUSED, Type_Generation_Data *pd EINA_UNUSED, int **v EINA_UNUSED) -{ - static int i = 42; - if(v) - *v = &i; -} - -void _name1_name2_type_generation_optionaloutintptrown(Eo *obj EINA_UNUSED, Type_Generation_Data *pd EINA_UNUSED, int **v EINA_UNUSED) -{ - int* i = malloc(sizeof(int)); - *i = 42; - if(v) *v = i; -} - -void _name1_name2_type_generation_optionaloutintptrownfree(Eo *obj EINA_UNUSED, Type_Generation_Data *pd EINA_UNUSED, int **v EINA_UNUSED) -{ - int* i = malloc(sizeof(int)); - *i = 42; - if(v) *v = i; -} - void _name1_name2_type_generation_optionalinclassname(Eo *obj EINA_UNUSED, Type_Generation_Data *pd EINA_UNUSED, Name1_Name2_Type_Generation *v EINA_UNUSED) { } diff --git a/src/tests/eolian_cxx/name1_name2_type_generation.eo b/src/tests/eolian_cxx/name1_name2_type_generation.eo index 920c75d..dce2ff2 100644 --- a/src/tests/eolian_cxx/name1_name2_type_generation.eo +++ b/src/tests/eolian_cxx/name1_name2_type_generation.eo @@ -2,22 +2,6 @@ class Name1.Name2.Type_Generation extends Efl.Object { data: Type_Generation_Data; methods { - // inref - inrefint { - params { - @in v: ptr(int); - } - } - inrefintown { - params { - @in v: free(ptr(int),free) @owned; - } - } - inrefintownfree { - params { - @in v: free(ptr(int), free) @owned; - } - } // in void ptr invoidptr { params { @@ -29,21 +13,6 @@ class Name1.Name2.Type_Generation extends Efl.Object @in v: int; } } - inintptr { - params { - @in v: ptr(int); - } - } - inintptrown { - params { - @in v: free(ptr(int),free) @owned; - } - } - inintptrownfree { - params { - @in v: free(ptr(int), free) @owned; - } - } instring { params { @in v: string; @@ -65,26 +34,12 @@ class Name1.Name2.Type_Generation extends Efl.Object } } // return - returnrefint { - return: ptr(int); - } returnvoidptr { return: void_ptr; } returnint { return: int; } - returnintptr { - return: ptr(int); - } - returnintptrown { - return: free(ptr(int),free) @owned; - } - returnintptrownfree { - params { - @in v: free(ptr(int), free) @owned; - } - } returnstring { return: string; } @@ -108,21 +63,6 @@ class Name1.Name2.Type_Generation extends Efl.Object @out v: int; } } - outintptr { - params { - @out v: ptr(int); - } - } - outintptrown { - params { - @out v: free(ptr(int),free) @owned; - } - } - outintptrownfree { - params { - @out v: free(ptr(int), free) @owned; - } - } outstringshare { params { @out v: stringshare; @@ -159,21 +99,6 @@ class Name1.Name2.Type_Generation extends Efl.Object @in v: int @optional; } } - optionalinintptr { - params { - @in v: ptr(int) @optional; - } - } - optionalinintptrown { - params { - @in v: free(ptr(int),free) @owned @optional; - } - } - optionalinintptrownfree { - params { - @in v: free(ptr(int), free) @owned @optional; - } - } optionaloutvoidptr { params { @out v: void_ptr @optional; @@ -184,21 +109,6 @@ class Name1.Name2.Type_Generation extends Efl.Object @out v: int @optional; } } - optionaloutintptr { - params { - @out v: ptr(int) @optional; - } - } - optionaloutintptrown { - params { - @out v: free(ptr(int),free) @owned @optional; - } - } - optionaloutintptrownfree { - params { - @out v: free(ptr(int), free) @owned @optional; - } - } optionalinclassname { params { @in v: Name1.Name2.Type_Generation @optional;