summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVitor Sousa <vitorsousasilva@gmail.com>2017-06-30 19:24:14 -0300
committerFelipe Magno de Almeida <felipe@expertisesolutions.com.br>2017-07-13 18:34:56 -0300
commit71b326346b4217fa5cf05ebd4e41ddee67fab4f7 (patch)
tree53a0528981ff3239c6e97aee41e29de09b9f40ae
parentfc1be934627ee4ff6b67a020c69f18d063a0a6d8 (diff)
eina_mono eolian_mono: tests for eina.Iterator in eolian binding generation
-rw-r--r--src/tests/efl_mono/Eina.cs511
-rw-r--r--src/tests/efl_mono/libefl_mono_native_test.c482
-rw-r--r--src/tests/efl_mono/test_testing.eo141
3 files changed, 1053 insertions, 81 deletions
diff --git a/src/tests/efl_mono/Eina.cs b/src/tests/efl_mono/Eina.cs
index dba58d64b0..4d9ee03603 100644
--- a/src/tests/efl_mono/Eina.cs
+++ b/src/tests/efl_mono/Eina.cs
@@ -3832,87 +3832,436 @@ class TestEinaIterator
3832 hsh.Dispose(); 3832 hsh.Dispose();
3833 } 3833 }
3834 3834
3835// // // 3835 // //
3836// // Code Generation 3836 // Code Generation
3837// // 3837 //
3838// 3838
3839// // Integer // 3839 // Integer //
3840// 3840
3841// public static void test_eina_iterator_int_in() 3841 public static void test_eina_iterator_int_in()
3842// { 3842 {
3843// } 3843 test.Testing t = new test.TestingConcrete();
3844// 3844 var arr = new eina.Array<int>();
3845// public static void test_eina_iterator_int_in_own() 3845 arr.Append(base_seq_int);
3846// { 3846 var itr = arr.GetIterator();
3847// } 3847
3848// 3848 Test.Assert(itr.Own);
3849// public static void test_eina_iterator_int_out() 3849 Test.Assert(!itr.OwnContent);
3850// { 3850 Test.Assert(arr.Own);
3851// } 3851 Test.Assert(arr.OwnContent);
3852// 3852
3853// public static void test_eina_iterator_int_out_own() 3853 Test.Assert(t.eina_iterator_int_in(itr));
3854// { 3854
3855// } 3855 Test.Assert(itr.Own);
3856// 3856 Test.Assert(!itr.OwnContent);
3857// public static void test_eina_iterator_int_return() 3857 Test.Assert(arr.Own);
3858// { 3858 Test.Assert(arr.OwnContent);
3859// } 3859
3860// 3860 itr.Dispose();
3861// public static void test_eina_iterator_int_return_own() 3861 arr.Dispose();
3862// { 3862 }
3863// } 3863
3864// 3864 public static void test_eina_iterator_int_in_own()
3865// // String // 3865 {
3866// 3866 test.Testing t = new test.TestingConcrete();
3867// public static void test_eina_iterator_str_in() 3867 var arr = new eina.Array<int>();
3868// { 3868 arr.Append(base_seq_int);
3869// } 3869 var itr = arr.GetIterator();
3870// 3870 arr.OwnContent = false;
3871// public static void test_eina_iterator_str_in_own() 3871 itr.OwnContent = true;
3872// { 3872
3873// } 3873 Test.Assert(itr.Own);
3874// 3874 Test.Assert(itr.OwnContent);
3875// public static void test_eina_iterator_str_out() 3875 Test.Assert(arr.Own);
3876// { 3876 Test.Assert(!arr.OwnContent);
3877// } 3877
3878// 3878 Test.Assert(t.eina_iterator_int_in_own(itr));
3879// public static void test_eina_iterator_str_out_own() 3879
3880// { 3880 Test.Assert(!itr.Own);
3881// } 3881 Test.Assert(!itr.OwnContent);
3882// 3882 Test.Assert(arr.Own);
3883// public static void test_eina_iterator_str_return() 3883 Test.Assert(!arr.OwnContent);
3884// { 3884
3885// } 3885 itr.Dispose();
3886// 3886 arr.Dispose();
3887// public static void test_eina_iterator_str_return_own() 3887
3888// { 3888 Test.Assert(t.check_eina_iterator_int_in_own());
3889// } 3889 }
3890// 3890
3891// // Object // 3891 public static void test_eina_iterator_int_out()
3892// 3892 {
3893// public static void test_eina_iterator_obj_in() 3893 test.Testing t = new test.TestingConcrete();
3894// { 3894 eina.Iterator<int> itr;
3895// } 3895
3896// 3896 Test.Assert(t.eina_iterator_int_out(out itr));
3897// public static void test_eina_iterator_obj_in_own() 3897
3898// { 3898
3899// } 3899 Test.Assert(!itr.Own);
3900// 3900 Test.Assert(!itr.OwnContent);
3901// public static void test_eina_iterator_obj_out() 3901
3902// { 3902 int idx = 0;
3903// } 3903 foreach (int e in itr)
3904// 3904 {
3905// public static void test_eina_iterator_obj_out_own() 3905 Test.AssertEquals(e, base_seq_int[idx]);
3906// { 3906 ++idx;
3907// } 3907 }
3908// 3908 Test.AssertEquals(idx, base_seq_int.Length);
3909// public static void test_eina_iterator_obj_return() 3909
3910// { 3910 itr.Dispose();
3911// } 3911
3912// 3912 Test.Assert(t.check_eina_iterator_int_out());
3913// public static void test_eina_iterator_obj_return_own() 3913 }
3914// { 3914
3915// } 3915 public static void test_eina_iterator_int_out_own()
3916 {
3917 test.Testing t = new test.TestingConcrete();
3918 eina.Iterator<int> itr;
3919
3920 Test.Assert(t.eina_iterator_int_out_own(out itr));
3921
3922 Test.Assert(itr.Own);
3923 Test.Assert(itr.OwnContent);
3924
3925 int idx = 0;
3926 foreach (int e in itr)
3927 {
3928 Test.AssertEquals(e, base_seq_int[idx]);
3929 ++idx;
3930 }
3931 Test.AssertEquals(idx, base_seq_int.Length);
3932
3933 itr.Dispose();
3934 }
3935
3936 public static void test_eina_iterator_int_return()
3937 {
3938 test.Testing t = new test.TestingConcrete();
3939
3940 var itr = t.eina_iterator_int_return();
3941
3942 Test.Assert(!itr.Own);
3943 Test.Assert(!itr.OwnContent);
3944
3945 int idx = 0;
3946 foreach (int e in itr)
3947 {
3948 Test.AssertEquals(e, base_seq_int[idx]);
3949 ++idx;
3950 }
3951 Test.AssertEquals(idx, base_seq_int.Length);
3952
3953 itr.Dispose();
3954
3955 Test.Assert(t.check_eina_iterator_int_return());
3956 }
3957
3958 public static void test_eina_iterator_int_return_own()
3959 {
3960 test.Testing t = new test.TestingConcrete();
3961
3962 var itr = t.eina_iterator_int_return_own();
3963
3964 Test.Assert(itr.Own);
3965 Test.Assert(itr.OwnContent);
3966
3967 int idx = 0;
3968 foreach (int e in itr)
3969 {
3970 Test.AssertEquals(e, base_seq_int[idx]);
3971 ++idx;
3972 }
3973 Test.AssertEquals(idx, base_seq_int.Length);
3974
3975 itr.Dispose();
3976 }
3977
3978 // String //
3979
3980 public static void test_eina_iterator_str_in()
3981 {
3982 test.Testing t = new test.TestingConcrete();
3983 var arr = new eina.Array<string>();
3984 arr.Append(base_seq_str);
3985 var itr = arr.GetIterator();
3986
3987 Test.Assert(itr.Own);
3988 Test.Assert(!itr.OwnContent);
3989 Test.Assert(arr.Own);
3990 Test.Assert(arr.OwnContent);
3991
3992 Test.Assert(t.eina_iterator_str_in(itr));
3993
3994 Test.Assert(itr.Own);
3995 Test.Assert(!itr.OwnContent);
3996 Test.Assert(arr.Own);
3997 Test.Assert(arr.OwnContent);
3998
3999 itr.Dispose();
4000 arr.Dispose();
4001 }
4002
4003 public static void test_eina_iterator_str_in_own()
4004 {
4005 test.Testing t = new test.TestingConcrete();
4006 var arr = new eina.Array<string>();
4007 arr.Append(base_seq_str);
4008 var itr = arr.GetIterator();
4009 arr.OwnContent = false;
4010 itr.OwnContent = true;
4011
4012 Test.Assert(itr.Own);
4013 Test.Assert(itr.OwnContent);
4014 Test.Assert(arr.Own);
4015 Test.Assert(!arr.OwnContent);
4016
4017 Test.Assert(t.eina_iterator_str_in_own(itr));
4018
4019 Test.Assert(!itr.Own);
4020 Test.Assert(!itr.OwnContent);
4021 Test.Assert(!itr.Own);
4022 Test.Assert(!itr.OwnContent);
4023 Test.Assert(arr.Own);
4024 Test.Assert(!arr.OwnContent);
4025 Test.Assert(arr.Own);
4026 Test.Assert(!arr.OwnContent);
4027
4028 itr.Dispose();
4029 arr.Dispose();
4030
4031 Test.Assert(t.check_eina_iterator_str_in_own());
4032 }
4033
4034 public static void test_eina_iterator_str_out()
4035 {
4036 test.Testing t = new test.TestingConcrete();
4037 eina.Iterator<string> itr;
4038
4039 Test.Assert(t.eina_iterator_str_out(out itr));
4040
4041 Test.Assert(!itr.Own);
4042 Test.Assert(!itr.OwnContent);
4043
4044 int idx = 0;
4045 foreach (string e in itr)
4046 {
4047 Test.AssertEquals(e, base_seq_str[idx]);
4048 ++idx;
4049 }
4050 Test.AssertEquals(idx, base_seq_str.Length);
4051
4052 itr.Dispose();
4053
4054 Test.Assert(t.check_eina_iterator_str_out());
4055 }
4056
4057 public static void test_eina_iterator_str_out_own()
4058 {
4059 test.Testing t = new test.TestingConcrete();
4060 eina.Iterator<string> itr;
4061
4062 Test.Assert(t.eina_iterator_str_out_own(out itr));
4063
4064 Test.Assert(itr.Own);
4065 Test.Assert(itr.OwnContent);
4066
4067 int idx = 0;
4068 foreach (string e in itr)
4069 {
4070 Test.AssertEquals(e, base_seq_str[idx]);
4071 ++idx;
4072 }
4073 Test.AssertEquals(idx, base_seq_str.Length);
4074
4075 itr.Dispose();
4076 }
4077
4078 public static void test_eina_iterator_str_return()
4079 {
4080 test.Testing t = new test.TestingConcrete();
4081
4082 var itr = t.eina_iterator_str_return();
4083
4084 Test.Assert(!itr.Own);
4085 Test.Assert(!itr.OwnContent);
4086
4087 int idx = 0;
4088 foreach (string e in itr)
4089 {
4090 Test.AssertEquals(e, base_seq_str[idx]);
4091 ++idx;
4092 }
4093 Test.AssertEquals(idx, base_seq_str.Length);
4094
4095 itr.Dispose();
4096
4097 Test.Assert(t.check_eina_iterator_str_return());
4098 }
4099
4100 public static void test_eina_iterator_str_return_own()
4101 {
4102 test.Testing t = new test.TestingConcrete();
4103
4104 var itr = t.eina_iterator_str_return_own();
4105
4106 Test.Assert(itr.Own);
4107 Test.Assert(itr.OwnContent);
4108
4109 int idx = 0;
4110 foreach (string e in itr)
4111 {
4112 Test.AssertEquals(e, base_seq_str[idx]);
4113 ++idx;
4114 }
4115 Test.AssertEquals(idx, base_seq_str.Length);
4116
4117 itr.Dispose();
4118 }
4119
4120 // Object //
4121
4122 public static void test_eina_iterator_obj_in()
4123 {
4124 test.Testing t = new test.TestingConcrete();
4125 var arr = new eina.Array<test.Numberwrapper>();
4126 arr.Append(BaseSeqObj());
4127 var itr = arr.GetIterator();
4128
4129 Test.Assert(itr.Own);
4130 Test.Assert(!itr.OwnContent);
4131 Test.Assert(arr.Own);
4132 Test.Assert(arr.OwnContent);
4133
4134 Test.Assert(t.eina_iterator_obj_in(itr));
4135
4136 Test.Assert(itr.Own);
4137 Test.Assert(!itr.OwnContent);
4138 Test.Assert(arr.Own);
4139 Test.Assert(arr.OwnContent);
4140
4141 itr.Dispose();
4142 arr.Dispose();
4143 }
4144
4145 public static void test_eina_iterator_obj_in_own()
4146 {
4147 test.Testing t = new test.TestingConcrete();
4148 var arr = new eina.Array<test.Numberwrapper>();
4149 arr.Append(BaseSeqObj());
4150 var itr = arr.GetIterator();
4151 arr.OwnContent = false;
4152 itr.OwnContent = true;
4153
4154 Test.Assert(itr.Own);
4155 Test.Assert(itr.OwnContent);
4156 Test.Assert(arr.Own);
4157 Test.Assert(!arr.OwnContent);
4158
4159 Test.Assert(t.eina_iterator_obj_in_own(itr));
4160
4161 Test.Assert(!itr.Own);
4162 Test.Assert(!itr.OwnContent);
4163 Test.Assert(arr.Own);
4164 Test.Assert(!arr.OwnContent);
4165
4166 itr.Dispose();
4167 arr.Dispose();
4168
4169 Test.Assert(t.check_eina_iterator_obj_in_own());
4170 }
4171
4172 public static void test_eina_iterator_obj_out()
4173 {
4174 test.Testing t = new test.TestingConcrete();
4175 eina.Iterator<test.Numberwrapper> itr;
4176
4177 Test.Assert(t.eina_iterator_obj_out(out itr));
4178
4179 Test.Assert(!itr.Own);
4180 Test.Assert(!itr.OwnContent);
4181
4182 var base_seq_obj = BaseSeqObj();
4183
4184 int idx = 0;
4185 foreach (test.Numberwrapper e in itr)
4186 {
4187 Test.AssertEquals(e.number_get(), base_seq_obj[idx].number_get());
4188 ++idx;
4189 }
4190 Test.AssertEquals(idx, base_seq_obj.Length);
4191
4192 itr.Dispose();
4193
4194 Test.Assert(t.check_eina_iterator_obj_out());
4195 }
4196
4197 public static void test_eina_iterator_obj_out_own()
4198 {
4199 test.Testing t = new test.TestingConcrete();
4200 eina.Iterator<test.Numberwrapper> itr;
4201
4202 Test.Assert(t.eina_iterator_obj_out_own(out itr));
4203
4204 Test.Assert(itr.Own);
4205 Test.Assert(itr.OwnContent);
4206
4207 var base_seq_obj = BaseSeqObj();
4208
4209 int idx = 0;
4210 foreach (test.Numberwrapper e in itr)
4211 {
4212 Test.AssertEquals(e.number_get(), base_seq_obj[idx].number_get());
4213 ++idx;
4214 }
4215 Test.AssertEquals(idx, base_seq_obj.Length);
4216
4217 itr.Dispose();
4218 }
4219
4220 public static void test_eina_iterator_obj_return()
4221 {
4222 test.Testing t = new test.TestingConcrete();
4223
4224 var itr = t.eina_iterator_obj_return();
4225
4226 Test.Assert(!itr.Own);
4227 Test.Assert(!itr.OwnContent);
4228
4229 var base_seq_obj = BaseSeqObj();
4230
4231 int idx = 0;
4232 foreach (test.Numberwrapper e in itr)
4233 {
4234 Test.AssertEquals(e.number_get(), base_seq_obj[idx].number_get());
4235 ++idx;
4236 }
4237 Test.AssertEquals(idx, base_seq_obj.Length);
4238
4239 itr.Dispose();
4240
4241 Test.Assert(t.check_eina_iterator_obj_return());
4242 }
4243
4244 public static void test_eina_iterator_obj_return_own()
4245 {
4246 test.Testing t = new test.TestingConcrete();
4247
4248 var itr = t.eina_iterator_obj_return_own();
4249
4250 Test.Assert(itr.Own);
4251 Test.Assert(itr.OwnContent);
4252
4253 var base_seq_obj = BaseSeqObj();
4254
4255 int idx = 0;
4256 foreach (test.Numberwrapper e in itr)
4257 {
4258 Test.AssertEquals(e.number_get(), base_seq_obj[idx].number_get());
4259 ++idx;
4260 }
4261 Test.AssertEquals(idx, base_seq_obj.Length);
4262
4263 itr.Dispose();
4264 }
3916} // < TestEinaIterator 4265} // < TestEinaIterator
3917 4266
3918} 4267}
diff --git a/src/tests/efl_mono/libefl_mono_native_test.c b/src/tests/efl_mono/libefl_mono_native_test.c
index 0fed3b43e6..cc34499d3a 100644
--- a/src/tests/efl_mono/libefl_mono_native_test.c
+++ b/src/tests/efl_mono/libefl_mono_native_test.c
@@ -2555,6 +2555,488 @@ Eina_Bool _test_testing_check_eina_hash_obj_return_own(EINA_UNUSED Eo *obj, EINA
2555} 2555}
2556 2556
2557 2557
2558// //
2559// Iterator //
2560// //
2561
2562// Integer //
2563
2564Eina_Bool _iterator_int_equal(Eina_Iterator *itr, const int base[], unsigned int len, Eina_Bool release)
2565{
2566 int *data;
2567 unsigned i = 0;
2568 EINA_ITERATOR_FOREACH(itr, data)
2569 {
2570 if (*data != base[i])
2571 return EINA_FALSE;
2572 if (release)
2573 free(data);
2574 ++i;
2575 }
2576
2577 if (i != len)
2578 return EINA_FALSE;
2579
2580 return EINA_TRUE;
2581}
2582
2583Eina_Array *_iterator_int_eina_array_new()
2584{
2585 Eina_Array *arr = eina_array_new(32);
2586 for (unsigned i = 0; i < base_seq_int_size; ++i)
2587 {
2588 eina_array_push(arr, _new_int(base_seq_int[i]));
2589 }
2590 return arr;
2591}
2592
2593Eina_Bool _iterator_int_test_array(Eina_Array *arr)
2594{
2595 if (eina_array_count(arr) != base_seq_int_size)
2596 return EINA_FALSE;
2597
2598 for (unsigned i = 0; i < base_seq_int_size; ++i)
2599 {
2600 int *data = eina_array_data_get(arr, i);
2601 if (*data != base_seq_int[i])
2602 return EINA_FALSE;
2603 free(data);
2604 }
2605
2606 eina_array_free(arr);
2607
2608 return EINA_TRUE;
2609}
2610
2611// <int> in
2612
2613Eina_Bool _test_testing_eina_iterator_int_in(EINA_UNUSED Eo *obj, EINA_UNUSED Test_Testing_Data *pd, Eina_Iterator *itr)
2614{
2615 Eina_Bool r = _iterator_int_equal(itr, base_seq_int, base_seq_int_size, EINA_FALSE);
2616 return r;
2617}
2618
2619// <int> in own
2620
2621static Eina_Iterator *_iterator_int_in_own_to_check = NULL;
2622
2623Eina_Bool _test_testing_eina_iterator_int_in_own(EINA_UNUSED Eo *obj, EINA_UNUSED Test_Testing_Data *pd, Eina_Iterator *itr)
2624{
2625 Eina_Bool r = _iterator_int_equal(itr, base_seq_int, base_seq_int_size, EINA_TRUE);
2626 _iterator_int_in_own_to_check = itr;
2627 return r;
2628}
2629Eina_Bool _test_testing_check_eina_iterator_int_in_own(EINA_UNUSED Eo *obj, EINA_UNUSED Test_Testing_Data *pd)
2630{
2631 eina_iterator_free(_iterator_int_in_own_to_check);
2632 _iterator_int_in_own_to_check = NULL;
2633 return EINA_TRUE;
2634}
2635
2636// <int> out
2637
2638Eina_Iterator *_iterator_int_out_to_check = NULL;
2639Eina_Array *_iterator_int_out_array = NULL;
2640
2641Eina_Bool _test_testing_eina_iterator_int_out(EINA_UNUSED Eo *obj, EINA_UNUSED Test_Testing_Data *pd, Eina_Iterator **itr)
2642{
2643 if (!itr) return EINA_FALSE;
2644
2645 _iterator_int_out_array = _iterator_int_eina_array_new();
2646
2647 *itr = eina_array_iterator_new(_iterator_int_out_array);
2648 _iterator_int_out_to_check = *itr;
2649
2650 return EINA_TRUE;
2651}
2652Eina_Bool _test_testing_check_eina_iterator_int_out(EINA_UNUSED Eo *obj, EINA_UNUSED Test_Testing_Data *pd)
2653{
2654 Eina_Iterator *itr = _iterator_int_out_to_check;
2655 if (!itr) return EINA_FALSE;
2656 _iterator_int_out_to_check = NULL;
2657
2658 Eina_Array *arr = _iterator_int_out_array;
2659 if (!arr) return EINA_FALSE;
2660 _iterator_int_out_array = NULL;
2661
2662 Eina_Bool r = _iterator_int_test_array(arr);
2663 if (!r) return r;
2664
2665 eina_iterator_free(itr);
2666
2667 return r;
2668}
2669
2670// <int> out own
2671
2672Eina_Bool _test_testing_eina_iterator_int_out_own(EINA_UNUSED Eo *obj, EINA_UNUSED Test_Testing_Data *pd, Eina_Iterator **itr)
2673{
2674 if (!itr) return EINA_FALSE;
2675
2676 Eina_Array *arr = _iterator_int_eina_array_new();
2677
2678 *itr = eina_array_iterator_new(arr);
2679
2680 return EINA_TRUE;
2681}
2682
2683// <int> return
2684
2685Eina_Iterator *_iterator_int_return_to_check = NULL;
2686Eina_Array *_iterator_int_return_array = NULL;
2687
2688Eina_Iterator *_test_testing_eina_iterator_int_return(EINA_UNUSED Eo *obj, EINA_UNUSED Test_Testing_Data *pd)
2689{
2690 _iterator_int_return_array = _iterator_int_eina_array_new();
2691 _iterator_int_return_to_check = eina_array_iterator_new(_iterator_int_return_array);
2692 return _iterator_int_return_to_check;
2693}
2694Eina_Bool _test_testing_check_eina_iterator_int_return(EINA_UNUSED Eo *obj, EINA_UNUSED Test_Testing_Data *pd)
2695{
2696 Eina_Iterator *itr = _iterator_int_return_to_check;
2697 if (!itr) return EINA_FALSE;
2698 _iterator_int_return_to_check = NULL;
2699
2700 Eina_Array *arr = _iterator_int_return_array;
2701 if (!arr) return EINA_FALSE;
2702 _iterator_int_return_array = NULL;
2703
2704 Eina_Bool r = _iterator_int_test_array(arr);
2705 if (!r) return r;
2706
2707 eina_iterator_free(itr);
2708
2709 return r;
2710}
2711
2712// <int> return own
2713
2714Eina_Iterator *_test_testing_eina_iterator_int_return_own(EINA_UNUSED Eo *obj, EINA_UNUSED Test_Testing_Data *pd)
2715{
2716 Eina_Array *arr = _iterator_int_eina_array_new();
2717 return eina_array_iterator_new(arr);
2718}
2719
2720// String //
2721
2722Eina_Bool _iterator_str_equal(Eina_Iterator *itr, const char * const base[], unsigned int len, Eina_Bool release)
2723{
2724 const char *data;
2725 unsigned i = 0;
2726 EINA_ITERATOR_FOREACH(itr, data)
2727 {
2728 if (0 != strcmp(data, base[i]))
2729 return EINA_FALSE;
2730 if (release)
2731 free((void*)data);
2732 ++i;
2733 }
2734
2735 if (i != len)
2736 return EINA_FALSE;
2737
2738 return EINA_TRUE;
2739}
2740
2741Eina_Array *_iterator_str_eina_array_new()
2742{
2743 Eina_Array *arr = eina_array_new(32);
2744 for (unsigned i = 0; i < base_seq_str_size; ++i)
2745 {
2746 eina_array_push(arr, strdup(base_seq_str[i]));
2747 }
2748 return arr;
2749}
2750
2751Eina_Bool _iterator_str_test_array(Eina_Array *arr)
2752{
2753 if (eina_array_count(arr) != base_seq_str_size)
2754 return EINA_FALSE;
2755
2756 for (unsigned i = 0; i < base_seq_str_size; ++i)
2757 {
2758 const char *data = eina_array_data_get(arr, i);
2759 if (0 != strcmp(data, base_seq_str[i]))
2760 return EINA_FALSE;
2761 free((void*)data);
2762 }
2763
2764 eina_array_free(arr);
2765
2766 return EINA_TRUE;
2767}
2768
2769// <str> in
2770
2771Eina_Bool _test_testing_eina_iterator_str_in(EINA_UNUSED Eo *obj, EINA_UNUSED Test_Testing_Data *pd, Eina_Iterator *itr)
2772{
2773 Eina_Bool r = _iterator_str_equal(itr, base_seq_str, base_seq_str_size, EINA_FALSE);
2774 return r;
2775}
2776
2777// <str> in own
2778
2779static Eina_Iterator *_iterator_str_in_own_to_check = NULL;
2780
2781Eina_Bool _test_testing_eina_iterator_str_in_own(EINA_UNUSED Eo *obj, EINA_UNUSED Test_Testing_Data *pd, Eina_Iterator *itr)
2782{
2783 Eina_Bool r = _iterator_str_equal(itr, base_seq_str, base_seq_str_size, EINA_TRUE);
2784 _iterator_str_in_own_to_check = itr;
2785 return r;
2786}
2787Eina_Bool _test_testing_check_eina_iterator_str_in_own(EINA_UNUSED Eo *obj, EINA_UNUSED Test_Testing_Data *pd)
2788{
2789 eina_iterator_free(_iterator_str_in_own_to_check);
2790 _iterator_str_in_own_to_check = NULL;
2791 return EINA_TRUE;
2792}
2793
2794// <str> out
2795
2796Eina_Iterator *_iterator_str_out_to_check = NULL;
2797Eina_Array *_iterator_str_out_array = NULL;
2798
2799Eina_Bool _test_testing_eina_iterator_str_out(EINA_UNUSED Eo *obj, EINA_UNUSED Test_Testing_Data *pd, Eina_Iterator **itr)
2800{
2801 if (!itr) return EINA_FALSE;
2802
2803 _iterator_str_out_array = _iterator_str_eina_array_new();
2804
2805 *itr = eina_array_iterator_new(_iterator_str_out_array);
2806 _iterator_str_out_to_check = *itr;
2807
2808 return EINA_TRUE;
2809}
2810Eina_Bool _test_testing_check_eina_iterator_str_out(EINA_UNUSED Eo *obj, EINA_UNUSED Test_Testing_Data *pd)
2811{
2812 Eina_Iterator *itr = _iterator_str_out_to_check;
2813 if (!itr) return EINA_FALSE;
2814 _iterator_str_out_to_check = NULL;
2815
2816 Eina_Array *arr = _iterator_str_out_array;
2817 if (!arr) return EINA_FALSE;
2818 _iterator_str_out_array = NULL;
2819
2820 Eina_Bool r = _iterator_str_test_array(arr);
2821 if (!r) return r;
2822
2823 eina_iterator_free(itr);
2824
2825 return r;
2826}
2827
2828// <str> out own
2829
2830Eina_Bool _test_testing_eina_iterator_str_out_own(EINA_UNUSED Eo *obj, EINA_UNUSED Test_Testing_Data *pd, Eina_Iterator **itr)
2831{
2832 if (!itr) return EINA_FALSE;
2833
2834 Eina_Array *arr = _iterator_str_eina_array_new();
2835
2836 *itr = eina_array_iterator_new(arr);
2837
2838 return EINA_TRUE;
2839}
2840
2841// <str> return
2842
2843Eina_Iterator *_iterator_str_return_to_check = NULL;
2844Eina_Array *_iterator_str_return_array = NULL;
2845
2846Eina_Iterator *_test_testing_eina_iterator_str_return(EINA_UNUSED Eo *obj, EINA_UNUSED Test_Testing_Data *pd)
2847{
2848 _iterator_str_return_array = _iterator_str_eina_array_new();
2849 _iterator_str_return_to_check = eina_array_iterator_new(_iterator_str_return_array);
2850 return _iterator_str_return_to_check;
2851}
2852Eina_Bool _test_testing_check_eina_iterator_str_return(EINA_UNUSED Eo *obj, EINA_UNUSED Test_Testing_Data *pd)
2853{
2854 Eina_Iterator *itr = _iterator_str_return_to_check;
2855 if (!itr) return EINA_FALSE;
2856 _iterator_str_return_to_check = NULL;
2857
2858 Eina_Array *arr = _iterator_str_return_array;
2859 if (!arr) return EINA_FALSE;
2860 _iterator_str_return_array = NULL;
2861
2862 Eina_Bool r = _iterator_str_test_array(arr);
2863 if (!r) return r;
2864
2865 eina_iterator_free(itr);
2866
2867 return r;
2868}
2869
2870// <str> return own
2871
2872Eina_Iterator *_test_testing_eina_iterator_str_return_own(EINA_UNUSED Eo *obj, EINA_UNUSED Test_Testing_Data *pd)
2873{
2874 Eina_Array *arr = _iterator_str_eina_array_new();
2875 return eina_array_iterator_new(arr);
2876}
2877
2878// Object //
2879
2880Eina_Bool _iterator_obj_equal(Eina_Iterator *itr, const Test_Numberwrapper * const base[], unsigned int len, Eina_Bool release)
2881{
2882 Test_Numberwrapper *data;
2883 unsigned i = 0;
2884 EINA_ITERATOR_FOREACH(itr, data)
2885 {
2886 int a = test_numberwrapper_number_get(data);
2887 int b = test_numberwrapper_number_get(base[i]);
2888 if (a != b)
2889 return EINA_FALSE;
2890 if (release)
2891 efl_unref(data);
2892 ++i;
2893 }
2894
2895 if (i != len)
2896 return EINA_FALSE;
2897
2898 return EINA_TRUE;
2899}
2900
2901Eina_Array *_iterator_obj_eina_array_new()
2902{
2903 Eina_Array *arr = eina_array_new(32);
2904 for (unsigned i = 0; i < base_seq_obj_size; ++i)
2905 {
2906 eina_array_push(arr, _new_obj(test_numberwrapper_number_get(base_seq_obj[i])));
2907 }
2908 return arr;
2909}
2910
2911Eina_Bool _iterator_obj_test_array(Eina_Array *arr)
2912{
2913 if (eina_array_count(arr) != base_seq_obj_size)
2914 return EINA_FALSE;
2915
2916 for (unsigned i = 0; i < base_seq_obj_size; ++i)
2917 {
2918 Test_Numberwrapper *data = eina_array_data_get(arr, i);
2919 int a = test_numberwrapper_number_get(data);
2920 int b = test_numberwrapper_number_get(base_seq_obj[i]);
2921 if (a != b)
2922 return EINA_FALSE;
2923 efl_unref(data);
2924 }
2925
2926 eina_array_free(arr);
2927
2928 return EINA_TRUE;
2929}
2930
2931// <obj> in
2932
2933Eina_Bool _test_testing_eina_iterator_obj_in(EINA_UNUSED Eo *obj, EINA_UNUSED Test_Testing_Data *pd, Eina_Iterator *itr)
2934{
2935 Eina_Bool r = _iterator_obj_equal(itr, base_seq_obj, base_seq_obj_size, EINA_FALSE);
2936 return r;
2937}
2938
2939// <obj> in own
2940
2941static Eina_Iterator *_iterator_obj_in_own_to_check = NULL;
2942
2943Eina_Bool _test_testing_eina_iterator_obj_in_own(EINA_UNUSED Eo *obj, EINA_UNUSED Test_Testing_Data *pd, Eina_Iterator *itr)
2944{
2945 Eina_Bool r = _iterator_obj_equal(itr, base_seq_obj, base_seq_obj_size, EINA_TRUE);
2946 _iterator_obj_in_own_to_check = itr;
2947 return r;
2948}
2949Eina_Bool _test_testing_check_eina_iterator_obj_in_own(EINA_UNUSED Eo *obj, EINA_UNUSED Test_Testing_Data *pd)
2950{
2951 eina_iterator_free(_iterator_obj_in_own_to_check);
2952 _iterator_obj_in_own_to_check = NULL;
2953 return EINA_TRUE;
2954}
2955
2956// <obj> out
2957
2958Eina_Iterator *_iterator_obj_out_to_check = NULL;
2959Eina_Array *_iterator_obj_out_array = NULL;
2960
2961Eina_Bool _test_testing_eina_iterator_obj_out(EINA_UNUSED Eo *obj, EINA_UNUSED Test_Testing_Data *pd, Eina_Iterator **itr)
2962{
2963 if (!itr) return EINA_FALSE;
2964
2965 _iterator_obj_out_array = _iterator_obj_eina_array_new();
2966
2967 *itr = eina_array_iterator_new(_iterator_obj_out_array);
2968 _iterator_obj_out_to_check = *itr;
2969
2970 return EINA_TRUE;
2971}
2972Eina_Bool _test_testing_check_eina_iterator_obj_out(EINA_UNUSED Eo *obj, EINA_UNUSED Test_Testing_Data *pd)
2973{
2974 Eina_Iterator *itr = _iterator_obj_out_to_check;
2975 if (!itr) return EINA_FALSE;
2976 _iterator_obj_out_to_check = NULL;
2977
2978 Eina_Array *arr = _iterator_obj_out_array;
2979 if (!arr) return EINA_FALSE;
2980 _iterator_obj_out_array = NULL;
2981
2982 Eina_Bool r = _iterator_obj_test_array(arr);
2983 if (!r) return r;
2984
2985 eina_iterator_free(itr);
2986
2987 return r;
2988}
2989
2990// <obj> out own
2991
2992Eina_Bool _test_testing_eina_iterator_obj_out_own(EINA_UNUSED Eo *obj, EINA_UNUSED Test_Testing_Data *pd, Eina_Iterator **itr)
2993{
2994 if (!itr) return EINA_FALSE;
2995
2996 Eina_Array *arr = _iterator_obj_eina_array_new();
2997
2998 *itr = eina_array_iterator_new(arr);
2999
3000 return EINA_TRUE;
3001}
3002
3003// <obj> return
3004
3005Eina_Iterator *_iterator_obj_return_to_check = NULL;
3006Eina_Array *_iterator_obj_return_array = NULL;
3007
3008Eina_Iterator *_test_testing_eina_iterator_obj_return(EINA_UNUSED Eo *obj, EINA_UNUSED Test_Testing_Data *pd)
3009{
3010 _iterator_obj_return_array = _iterator_obj_eina_array_new();
3011 _iterator_obj_return_to_check = eina_array_iterator_new(_iterator_obj_return_array);
3012 return _iterator_obj_return_to_check;
3013}
3014Eina_Bool _test_testing_check_eina_iterator_obj_return(EINA_UNUSED Eo *obj, EINA_UNUSED Test_Testing_Data *pd)
3015{
3016 Eina_Iterator *itr = _iterator_obj_return_to_check;
3017 if (!itr) return EINA_FALSE;
3018 _iterator_obj_return_to_check = NULL;
3019
3020 Eina_Array *arr = _iterator_obj_return_array;
3021 if (!arr) return EINA_FALSE;
3022 _iterator_obj_return_array = NULL;
3023
3024 Eina_Bool r = _iterator_obj_test_array(arr);
3025 if (!r) return r;
3026
3027 eina_iterator_free(itr);
3028
3029 return r;
3030}
3031
3032// <obj> return own
3033
3034Eina_Iterator *_test_testing_eina_iterator_obj_return_own(EINA_UNUSED Eo *obj, EINA_UNUSED Test_Testing_Data *pd)
3035{
3036 Eina_Array *arr = _iterator_obj_eina_array_new();
3037 return eina_array_iterator_new(arr);
3038}
3039
2558// // 3040// //
2559// Class constructor 3041// Class constructor
2560// // 3042// //
diff --git a/src/tests/efl_mono/test_testing.eo b/src/tests/efl_mono/test_testing.eo
index 05bb77c72f..60e2e5d757 100644
--- a/src/tests/efl_mono/test_testing.eo
+++ b/src/tests/efl_mono/test_testing.eo
@@ -1003,6 +1003,147 @@ class Test.Testing (Efl.Object) {
1003 return: bool; 1003 return: bool;
1004 } 1004 }
1005 1005
1006 /* Eina Iterator */
1007
1008 /* Integer */
1009 eina_iterator_int_in {
1010 params {
1011 @in itr: iterator<int>;
1012 }
1013 return: bool;
1014 }
1015
1016 eina_iterator_int_in_own {
1017 params {
1018 @in itr: own(iterator<own(ref(int))>);
1019 }
1020 return: bool;
1021 }
1022 check_eina_iterator_int_in_own {
1023 return: bool;
1024 }
1025
1026 eina_iterator_int_out {
1027 params {
1028 @out itr: iterator<int>;
1029 }
1030 return: bool;
1031 }
1032 check_eina_iterator_int_out {
1033 return: bool;
1034 }
1035
1036 eina_iterator_int_out_own {
1037 params {
1038 @out itr: own(iterator<own(ref(int))>);
1039 }
1040 return: bool;
1041 }
1042
1043 eina_iterator_int_return {
1044 return: iterator<int>;
1045 }
1046 check_eina_iterator_int_return {
1047 return: bool;
1048 }
1049
1050 eina_iterator_int_return_own {
1051 return: own(iterator<own(ref(int))>);
1052 }
1053
1054 /* String */
1055 eina_iterator_str_in {
1056 params {
1057 @in itr: iterator<string>;
1058 }
1059 return: bool;
1060 }
1061
1062 eina_iterator_str_in_own {
1063 params {
1064 @in itr: own(iterator<own(string)>);
1065 }
1066 return: bool;
1067 }
1068 check_eina_iterator_str_in_own {
1069 return: bool;
1070 }
1071
1072 eina_iterator_str_out {
1073 params {
1074 @out itr: iterator<string>;
1075 }
1076 return: bool;
1077 }
1078 check_eina_iterator_str_out {
1079 return: bool;
1080 }
1081
1082 eina_iterator_str_out_own {
1083 params {
1084 @out itr: own(iterator<own(string)>);
1085 }
1086 return: bool;
1087 }
1088
1089 eina_iterator_str_return {
1090 return: iterator<string>;
1091 }
1092 check_eina_iterator_str_return {
1093 return: bool;
1094 }
1095
1096 eina_iterator_str_return_own {
1097 return: own(iterator<own(string)>);
1098 }
1099
1100 /* Object */
1101 eina_iterator_obj_in {
1102 params {
1103 @in itr: iterator<Test.Numberwrapper>;
1104 }
1105 return: bool;
1106 }
1107
1108 eina_iterator_obj_in_own {
1109 params {
1110 @in itr: own(iterator<own(Test.Numberwrapper)>);
1111 }
1112 return: bool;
1113 }
1114 check_eina_iterator_obj_in_own {
1115 return: bool;
1116 }
1117
1118 eina_iterator_obj_out {
1119 params {
1120 @out itr: iterator<Test.Numberwrapper>;
1121 }
1122 return: bool;
1123 }
1124 check_eina_iterator_obj_out {
1125 return: bool;
1126 }
1127
1128 eina_iterator_obj_out_own {
1129 params {
1130 @out itr: own(iterator<own(Test.Numberwrapper)>);
1131 }
1132 return: bool;
1133 }
1134
1135 eina_iterator_obj_return {
1136 return: iterator<Test.Numberwrapper>;
1137 }
1138 check_eina_iterator_obj_return {
1139 return: bool;
1140 }
1141
1142 eina_iterator_obj_return_own {
1143 return: own(iterator<own(Test.Numberwrapper)>);
1144 }
1145
1146 /* Function Pointer */
1006 1147
1007 set_callback { 1148 set_callback {
1008 params { 1149 params {