aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLauro Moura <lauromoura@expertisesolutions.com.br>2019-03-28 19:00:27 -0300
committerLauro Moura <lauromoura@expertisesolutions.com.br>2019-03-28 19:00:27 -0300
commit9f5c2600cacecb4f1637e2ed553f9bea7b3d8d94 (patch)
tree1c5bef7e4ad9dad2b79505187eaaefd7dbf14c36
parentcsharp: Raise exception when Array is null. (diff)
downloadefl-devs/lauromoura/stringshare_containers.tar.gz
-rw-r--r--src/tests/efl_mono/Eina.cs74
-rw-r--r--src/tests/efl_mono/dummy_test_object.eo17
-rw-r--r--src/tests/efl_mono/libefl_mono_native_test.c19
3 files changed, 109 insertions, 1 deletions
diff --git a/src/tests/efl_mono/Eina.cs b/src/tests/efl_mono/Eina.cs
index 6a07e2f288..359ec91842 100644
--- a/src/tests/efl_mono/Eina.cs
+++ b/src/tests/efl_mono/Eina.cs
@@ -878,6 +878,80 @@ class TestEinaArray
Test.Assert(arr.Handle == IntPtr.Zero);
}
+ // Stringshare //
+ public static void test_eina_array_stringshare_in()
+ {
+ var t = new Dummy.TestObject();
+ var arr = new Eina.Array<string>();
+ arr.Append(base_seq_str);
+ Test.Assert(t.EinaArrayStringshareIn(arr));
+ Test.Assert(arr.Own);
+ Test.Assert(arr.ToArray().SequenceEqual(modified_seq_str));
+ arr.Dispose();
+ Test.Assert(arr.Handle == IntPtr.Zero);
+ }
+
+ public static void test_eina_array_stringshare_in_own()
+ {
+ var t = new Dummy.TestObject();
+ var arr = new Eina.Array<string>();
+ arr.Append(base_seq_str);
+ Test.Assert(t.EinaArrayStringshareInOwn(arr));
+ Test.Assert(!arr.Own);
+ Test.Assert(arr.ToArray().SequenceEqual(modified_seq_str));
+ arr.Dispose();
+ Test.Assert(arr.Handle == IntPtr.Zero);
+ Test.Assert(t.CheckEinaArrayStringshareInOwn());
+ }
+
+ public static void test_eina_array_stringshare_out()
+ {
+ var t = new Dummy.TestObject();
+ Eina.Array<string> arr;
+ Test.Assert(t.EinaArrayStringshareOut(out arr));
+ Test.Assert(!arr.Own);
+ Test.Assert(arr.ToArray().SequenceEqual(base_seq_str));
+ Test.Assert(arr.Append(append_seq_str));
+ arr.Dispose();
+ Test.Assert(arr.Handle == IntPtr.Zero);
+ Test.Assert(t.CheckEinaArrayStringshareOut());
+ }
+
+ public static void test_eina_array_stringshare_out_own()
+ {
+ var t = new Dummy.TestObject();
+ Eina.Array<string> arr;
+ Test.Assert(t.EinaArrayStringshareOutOwn(out arr));
+ Test.Assert(arr.Own);
+ Test.Assert(arr.ToArray().SequenceEqual(base_seq_str));
+ Test.Assert(arr.Append(append_seq_str));
+ arr.Dispose();
+ Test.Assert(arr.Handle == IntPtr.Zero);
+ }
+
+ public static void test_eina_array_stringshare_return()
+ {
+ var t = new Dummy.TestObject();
+ var arr = t.EinaArrayStringshareReturn();
+ Test.Assert(!arr.Own);
+ Test.Assert(arr.ToArray().SequenceEqual(base_seq_str));
+ Test.Assert(arr.Append(append_seq_str));
+ arr.Dispose();
+ Test.Assert(arr.Handle == IntPtr.Zero);
+ Test.Assert(t.CheckEinaArrayStringshareReturn());
+ }
+
+ public static void test_eina_array_stringshare_return_own()
+ {
+ var t = new Dummy.TestObject();
+ var arr = t.EinaArrayStringshareReturnOwn();
+ Test.Assert(arr.Own);
+ Test.Assert(arr.ToArray().SequenceEqual(base_seq_str));
+ Test.Assert(arr.Append(append_seq_str));
+ arr.Dispose();
+ Test.Assert(arr.Handle == IntPtr.Zero);
+ }
+
// Object //
public static void test_eina_array_obj_in()
diff --git a/src/tests/efl_mono/dummy_test_object.eo b/src/tests/efl_mono/dummy_test_object.eo
index ccc55289c5..a6640e822f 100644
--- a/src/tests/efl_mono/dummy_test_object.eo
+++ b/src/tests/efl_mono/dummy_test_object.eo
@@ -472,6 +472,12 @@ class Dummy.Test_Object extends Efl.Object implements Dummy.Test_Iface {
return: bool;
}
+ eina_array_stringshare_in_own {
+ params {
+ @in arr: array<stringshare @owned> @owned;
+ }
+ return: bool;
+ }
check_eina_array_stringshare_in_own {
return: bool;
}
@@ -486,6 +492,13 @@ class Dummy.Test_Object extends Efl.Object implements Dummy.Test_Iface {
return: bool;
}
+ eina_array_stringshare_out_own {
+ params {
+ @out arr: array<stringshare @owned> @owned;
+ }
+ return: bool;
+ }
+
eina_array_stringshare_return {
return: array<stringshare>;
}
@@ -493,7 +506,9 @@ class Dummy.Test_Object extends Efl.Object implements Dummy.Test_Iface {
return: bool;
}
-
+ eina_array_stringshare_return_own {
+ return: array<mstring @owned> @owned;
+ }
/* Object */
eina_array_obj_in {
diff --git a/src/tests/efl_mono/libefl_mono_native_test.c b/src/tests/efl_mono/libefl_mono_native_test.c
index 0a0f496d1f..0f3f9bb032 100644
--- a/src/tests/efl_mono/libefl_mono_native_test.c
+++ b/src/tests/efl_mono/libefl_mono_native_test.c
@@ -782,6 +782,15 @@ Eina_Array *_dummy_test_object_eina_array_str_return_own(EINA_UNUSED Eo *obj, EI
// Stringshare
Eina_Bool _dummy_test_object_eina_array_stringshare_in(Eo *obj, Dummy_Test_Object_Data *pd, Eina_Array *arr)
{
+ Eina_Bool r = _array_str_equal(arr, base_seq_str, base_seq_str_size);
+ eina_array_push(arr, strdup("42"));
+ eina_array_push(arr, strdup("43"));
+ eina_array_push(arr, strdup("33"));
+ return r;
+}
+
+Eina_Bool _dummy_test_object_eina_array_stringshare_in_own(Eo *obj, Dummy_Test_Object_Data *pd, Eina_Array *arr)
+{
return EINA_FALSE;
}
@@ -795,6 +804,11 @@ Eina_Bool _dummy_test_object_eina_array_stringshare_out(Eo *obj, Dummy_Test_Obje
return EINA_FALSE;
}
+Eina_Bool _dummy_test_object_eina_array_stringshare_out_own(Eo *obj, Dummy_Test_Object_Data *pd, Eina_Array **arr)
+{
+ return EINA_FALSE;
+}
+
Eina_Bool _dummy_test_object_check_eina_array_stringshare_out(Eo *obj, Dummy_Test_Object_Data *pd)
{
return EINA_FALSE;
@@ -810,6 +824,11 @@ Eina_Bool _dummy_test_object_check_eina_array_stringshare_return(Eo *obj, Dummy_
return EINA_FALSE;
}
+Eina_Array *_dummy_test_object_eina_array_stringshare_return_own(Eo *obj, Dummy_Test_Object_Data *pd)
+{
+ return NULL;
+}
+
// Object
Eina_Bool _array_obj_equal(const Eina_Array *arr, const Dummy_Numberwrapper * const base[], unsigned int len)