csharp: update and disable tests that use deprecated eolian type notations
authorVitor Sousa <vitorsousa@expertisesolutions.com.br>
Tue, 9 Jul 2019 08:05:23 +0000 (10:05 +0200)
committerShinwoo Kim <cinoo.kim@samsung.com>
Wed, 10 Jul 2019 02:28:26 +0000 (11:28 +0900)
Summary:
Avoid the usage of deprecated Eolian type notations like `ptr()` in C# unit
tests.

In places where an alternative type could be used, tests were changed to use
a valid type, e.g. containers that stored `ptr(int)` were changed to store
`string`.

Tests for types that require a pointer notation were commented out and
disabled. They can be re-enabled when a new notation to the type is defined.

Depends on D9238

Test Plan: `meson test`

Reviewers: lauromoura, felipealmeida, q66, segfaultxavi

Reviewed By: lauromoura

Subscribers: cedric, #reviewers, bu5hm4n, #committers

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D9247

src/tests/efl_mono/BasicDirection.cs
src/tests/efl_mono/Eina.cs
src/tests/efl_mono/EinaTestData.cs
src/tests/efl_mono/StructHelpers.cs
src/tests/efl_mono/Structs.cs
src/tests/efl_mono/dummy_test_object.c
src/tests/efl_mono/dummy_test_object.eo

index 546d7e2..2c5995c 100644 (file)
@@ -18,6 +18,7 @@ class TestIntDirections
         Test.AssertEquals(-original, received);
     }
 
+    /*
     public static void simple_ptr_out()
     {
         int original = 1984;
@@ -28,6 +29,7 @@ class TestIntDirections
 
         Test.AssertEquals(original*2, received);
     }
+    */
 }
 
 }
index ace7fd9..2c22cdb 100644 (file)
@@ -12,6 +12,7 @@ namespace TestSuite
 
 #if EFL_BETA
 
+/*
 class TestEinaBinbuf
 {
     private static readonly byte[] test_string = System.Text.Encoding.UTF8.GetBytes("0123456789ABCDEF");
@@ -308,6 +309,7 @@ class TestEinaBinbuf
         Test.Assert(t.binbuf_return_own_no_longer_own());
     }
 }
+*/
 
 #endif
 
@@ -826,6 +828,7 @@ class TestEinaArray
 
     // Integer //
 
+    /*
     public static void test_eina_array_int_in()
     {
         var t = new Dummy.TestObject();
@@ -898,6 +901,7 @@ class TestEinaArray
         arr.Dispose();
         Test.Assert(arr.Handle == IntPtr.Zero);
     }
+    */
 
     // String //
     public static void test_eina_array_str_in()
@@ -1884,6 +1888,7 @@ class TestEinaList
 
     // Integer //
 
+    /*
     public static void test_eina_list_int_in()
     {
         var t = new Dummy.TestObject();
@@ -1953,6 +1958,7 @@ class TestEinaList
         lst.Dispose();
         Test.Assert(lst.Handle == IntPtr.Zero);
     }
+    */
 
     // String //
     public static void test_eina_list_str_in()
@@ -2662,6 +2668,7 @@ class TestEinaHash
 
     // Integer //
 
+    /*
     public static void test_eina_hash_int_in()
     {
         var t = new Dummy.TestObject();
@@ -2743,6 +2750,7 @@ class TestEinaHash
         Test.Assert(hsh.Handle == IntPtr.Zero);
         Test.Assert(t.CheckEinaHashIntReturnOwn());
     }
+    */
 
     // String //
 
index 81b318f..0e5d4bb 100644 (file)
@@ -153,6 +153,7 @@ class NativeInheritImpl : Dummy.TestObject
     // //
     //
 #if EFL_BETA
+/*
     override public bool EinaBinbufIn(Eina.Binbuf binbuf)
     {
         binbuf_in_flag = true;
@@ -281,6 +282,7 @@ class NativeInheritImpl : Dummy.TestObject
         binbuf_return_own_binbuf = null;
         return r;
     }
+*/
 #endif
 }
 
index 73554f2..088e613 100644 (file)
@@ -125,10 +125,10 @@ internal class StructHelpers
     {
         var complex = new Dummy.StructComplex();
 
-        complex.Farray = new Eina.Array<int>();
-        complex.Farray.Push(0x0);
-        complex.Farray.Push(0x2A);
-        complex.Farray.Push(0x42);
+        complex.Farray = new Eina.Array<string>();
+        complex.Farray.Push("0x0");
+        complex.Farray.Push("0x2A");
+        complex.Farray.Push("0x42");
 
         complex.Flist = new Eina.List<string>();
         complex.Flist.Append("0x0");
@@ -148,8 +148,8 @@ internal class StructHelpers
         complex.Fany_value_ptr = new Eina.Value(Eina.ValueType.String);
         complex.Fany_value_ptr.Set("abc");
 
-        complex.Fbinbuf = new Eina.Binbuf();
-        complex.Fbinbuf.Append(126);
+        //complex.Fbinbuf = new Eina.Binbuf();
+        //complex.Fbinbuf.Append(126);
 
         complex.Fslice.Length = 1;
         complex.Fslice.Mem = Eina.MemoryNative.Alloc(1);
@@ -163,7 +163,7 @@ internal class StructHelpers
 
     internal static void checkStructComplex(Dummy.StructComplex complex)
     {
-        Test.Assert(complex.Farray.ToArray().SequenceEqual(base_seq_int));
+        Test.Assert(complex.Farray.ToArray().SequenceEqual(base_seq_str));
 
         Test.Assert(complex.Flist.ToArray().SequenceEqual(base_seq_str));
 
@@ -172,11 +172,12 @@ internal class StructHelpers
         Test.Assert(complex.Fhash["cc"] == "ccc");
 
         int idx = 0;
-        foreach (int e in complex.Fiterator)
+        foreach (string e in complex.Fiterator)
         {
-            Test.Assert(e == base_seq_int[idx]);
+            Test.Assert(e == base_seq_str[idx]);
             ++idx;
         }
+        Test.AssertEquals(idx, base_seq_str.Length);
 
         double double_val = 0;
         Test.Assert(complex.Fany_value.Get(out double_val));
@@ -186,8 +187,8 @@ internal class StructHelpers
         Test.Assert(complex.Fany_value_ptr.Get(out str_val));
         Test.Assert(str_val == "abc");
 
-        Test.Assert(complex.Fbinbuf.Length == 1);
-        Test.Assert(complex.Fbinbuf.GetBytes()[0] == 126);
+        //Test.Assert(complex.Fbinbuf.Length == 1);
+        //Test.Assert(complex.Fbinbuf.GetBytes()[0] == 126);
 
         Test.Assert(complex.Fslice.Length == 1);
         Test.Assert(complex.Fslice.GetBytes()[0] == 125);
@@ -205,7 +206,7 @@ internal class StructHelpers
         Test.Assert(complex.Fiterator == null);
         Test.Assert(complex.Fany_value == null);
         Test.Assert(complex.Fany_value_ptr == null);
-        Test.Assert(complex.Fbinbuf == null);
+        //Test.Assert(complex.Fbinbuf == null);
 
         Test.Assert(complex.Fslice.Length == 0);
         Test.Assert(complex.Fslice.Mem == IntPtr.Zero);
index d632e7a..96728ad 100644 (file)
@@ -49,6 +49,7 @@ internal class TestStructs
         Test.Assert(r, "Function returned false");
     }
 
+    /*
     public static void simple_ptr_in()
     {
         var simple = structSimpleWithValues();
@@ -70,6 +71,7 @@ internal class TestStructs
         Test.AssertEquals(-original, result.Fint);
         Test.AssertEquals("nwO nI rtP tcurtS", result.Fmstring);
     }
+    */
 
     public static void simple_out()
     {
@@ -80,6 +82,7 @@ internal class TestStructs
         checkStructSimple(simple);
     }
 
+    /*
     public static void simple_ptr_out()
     {
         Dummy.StructSimple simple;
@@ -97,6 +100,7 @@ internal class TestStructs
         Test.AssertEquals(result.Fint, simple.Fint);
         Test.AssertEquals(simple.Fstring, "Ptr Out Own");
     }
+    */
 
     public static void simple_return()
     {
@@ -105,6 +109,7 @@ internal class TestStructs
         checkStructSimple(simple);
     }
 
+    /*
     public static void simple_ptr_return()
     {
         var t = new Dummy.TestObject();
@@ -118,6 +123,7 @@ internal class TestStructs
         var simple = t.StructSimplePtrReturnOwn();
         Test.AssertEquals(simple.Fstring, "Ret Ptr Own");
     }
+    */
 
     public class StructReturner : Dummy.TestObject
     {
@@ -138,6 +144,7 @@ internal class TestStructs
             return true;
         }
 
+        /*
         public override bool StructSimplePtrIn(ref Dummy.StructSimple simple)
         {
             called = true;
@@ -151,6 +158,7 @@ internal class TestStructs
             received = simple;
             return received;
         }
+        */
 
         public override bool StructSimpleOut(out Dummy.StructSimple simple) {
             called = true;
@@ -159,6 +167,7 @@ internal class TestStructs
             return true;
         }
 
+        /*
         public override Dummy.StructSimple StructSimplePtrOut(out Dummy.StructSimple simple) {
             called = true;
             // No way to explicitly define the ownership of the parameter.
@@ -174,6 +183,7 @@ internal class TestStructs
             simple.Fstring = "Virtual Struct Ptr Out Own";
             return simple;
         }
+        */
 
         public override Dummy.StructSimple StructSimpleReturn()
         {
@@ -183,6 +193,7 @@ internal class TestStructs
             return simple;
         }
 
+        /*
         public override Dummy.StructSimple StructSimplePtrReturn()
         {
             called = true;
@@ -198,6 +209,7 @@ internal class TestStructs
             simple.Fstring = "Virtual Struct Ptr Return Own";
             return simple;
         }
+        */
     }
 
     public static void simple_in_virtual()
@@ -211,6 +223,7 @@ internal class TestStructs
         Test.AssertEquals(simple.Fstring, t.received.Fstring);
     }
 
+    /*
     public static void simple_ptr_in_virtual()
     {
         StructReturner t = new StructReturner();
@@ -232,6 +245,7 @@ internal class TestStructs
         Test.Assert(t.called);
         Test.AssertEquals(t.received.Fstring, simple.Fstring);
     }
+    */
 
     public static void simple_out_virtual()
     {
@@ -242,6 +256,7 @@ internal class TestStructs
         Test.AssertEquals("Virtual Struct Out", simple.Fstring);
     }
 
+    /*
     public static void simple_ptr_out_virtual()
     {
         StructReturner t = new StructReturner();
@@ -259,6 +274,7 @@ internal class TestStructs
         Test.Assert(t.called, "override was not called");
         Test.AssertEquals("Virtual Struct Ptr Out Own", simple.Fstring);
     }
+    */
 
     public static void simple_return_virtual()
     {
@@ -268,6 +284,7 @@ internal class TestStructs
         Test.AssertEquals("Virtual Struct Return", simple.Fstring);
     }
 
+    /*
     public static void simple_ptr_return_virtual()
     {
         StructReturner t = new StructReturner();
@@ -283,6 +300,7 @@ internal class TestStructs
         Test.Assert(t.called, "override was not called");
         Test.AssertEquals("Virtual Struct Ptr Return Own", simple.Fstring);
     }
+    */
 
     // Complex Structs
 #if EFL_BETA
index 93eaeb0..1a1def6 100644 (file)
@@ -347,6 +347,7 @@ Eina_Rw_Slice _dummy_test_object_eina_rw_slice_return(EINA_UNUSED Eo *obj, EINA_
   return slc;
 }
 
+#if 0
 Eina_Bool _dummy_test_object_eina_binbuf_in(EINA_UNUSED Eo *obj, EINA_UNUSED Dummy_Test_Object_Data *pd, Eina_Binbuf *binbuf)
 {
   Eina_Bool r = (0 == memcmp(eina_binbuf_string_get(binbuf), base_seq, eina_binbuf_length_get(binbuf)));
@@ -458,6 +459,7 @@ Eina_Binbuf *_dummy_test_object_call_eina_binbuf_return_own(Eo *obj, EINA_UNUSED
 {
   return dummy_test_object_eina_binbuf_return_own(obj);
 }
+#endif
 
 
 static const int base_seq_int[] = {0x0,0x2A,0x42};
@@ -4095,9 +4097,9 @@ static
 void struct_complex_with_values(Dummy_StructComplex *complex)
 {
    complex->farray = eina_array_new(4);
-   eina_array_push(complex->farray, _new_int(0x0));
-   eina_array_push(complex->farray, _new_int(0x2A));
-   eina_array_push(complex->farray, _new_int(0x42));
+   eina_array_push(complex->farray, strdup("0x0"));
+   eina_array_push(complex->farray, strdup("0x2A"));
+   eina_array_push(complex->farray, strdup("0x42"));
 
    complex->flist = eina_list_append(complex->flist, strdup("0x0"));
    complex->flist = eina_list_append(complex->flist, strdup("0x2A"));
@@ -4116,8 +4118,8 @@ void struct_complex_with_values(Dummy_StructComplex *complex)
    complex->fany_value_ptr = eina_value_new(EINA_VALUE_TYPE_STRING);
    eina_value_set(complex->fany_value_ptr, "abc");
 
-   complex->fbinbuf = eina_binbuf_new();
-   eina_binbuf_append_char(complex->fbinbuf, 126);
+   //complex->fbinbuf = eina_binbuf_new();
+   //eina_binbuf_append_char(complex->fbinbuf, 126);
 
    complex->fslice.len = 1;
    complex->fslice.mem = malloc(1);
@@ -4129,7 +4131,7 @@ void struct_complex_with_values(Dummy_StructComplex *complex)
 static
 Eina_Bool check_and_modify_struct_complex(Dummy_StructComplex *complex)
 {
-   if (!_array_int_equal(complex->farray, base_seq_int, base_seq_int_size))
+   if (!_array_str_equal(complex->farray, base_seq_str, base_seq_str_size))
      return EINA_FALSE;
 
    if (!_list_str_equal(complex->flist, base_seq_str, base_seq_str_size))
@@ -4140,7 +4142,7 @@ Eina_Bool check_and_modify_struct_complex(Dummy_StructComplex *complex)
        || !_hash_str_check(complex->fhash, "cc", "ccc"))
      return EINA_FALSE;
 
-   if (!_iterator_int_equal(complex->fiterator, base_seq_int, base_seq_int_size, EINA_FALSE))
+   if (!_iterator_str_equal(complex->fiterator, base_seq_str, base_seq_str_size, EINA_FALSE))
      return EINA_FALSE;
 
    double double_val = 0;
@@ -4151,8 +4153,10 @@ Eina_Bool check_and_modify_struct_complex(Dummy_StructComplex *complex)
    if (!eina_value_get(complex->fany_value_ptr, &str_val) || strcmp(str_val, "abc") != 0)
      return EINA_FALSE;
 
+   /*
    if (eina_binbuf_length_get(complex->fbinbuf) != 1 || eina_binbuf_string_get(complex->fbinbuf)[0] != 126)
      return EINA_FALSE;
+   */
 
    if (complex->fslice.len != 1 || *(char*)complex->fslice.mem != 125)
      return EINA_FALSE;
@@ -4263,6 +4267,7 @@ void _dummy_test_object_call_struct_simple_in(Eo *obj, EINA_UNUSED Dummy_Test_Ob
     dummy_test_object_struct_simple_in(obj, simple);
 }
 
+/*
 EOLIAN
 void _dummy_test_object_call_struct_simple_ptr_in(Eo *obj, EINA_UNUSED Dummy_Test_Object_Data *pd, Dummy_StructSimple *simple)
 {
@@ -4274,6 +4279,7 @@ void _dummy_test_object_call_struct_simple_ptr_in_own(Eo *obj, EINA_UNUSED Dummy
 {
     dummy_test_object_struct_simple_ptr_in_own(obj, simple);
 }
+*/
 
 EOLIAN
 void _dummy_test_object_call_struct_simple_out(Eo *obj, EINA_UNUSED Dummy_Test_Object_Data *pd, Dummy_StructSimple *simple)
@@ -4281,6 +4287,7 @@ void _dummy_test_object_call_struct_simple_out(Eo *obj, EINA_UNUSED Dummy_Test_O
     dummy_test_object_struct_simple_out(obj, simple);
 }
 
+/*
 EOLIAN
 void _dummy_test_object_call_struct_simple_ptr_out(Eo *obj, EINA_UNUSED Dummy_Test_Object_Data *pd, Dummy_StructSimple **simple)
 {
@@ -4292,6 +4299,7 @@ void _dummy_test_object_call_struct_simple_ptr_out_own(Eo *obj, EINA_UNUSED Dumm
 {
     dummy_test_object_struct_simple_ptr_out_own(obj, simple);
 }
+*/
 
 EOLIAN
 Dummy_StructSimple _dummy_test_object_call_struct_simple_return(Eo *obj, EINA_UNUSED Dummy_Test_Object_Data *pd)
@@ -4299,6 +4307,7 @@ Dummy_StructSimple _dummy_test_object_call_struct_simple_return(Eo *obj, EINA_UN
     return dummy_test_object_struct_simple_return(obj);
 }
 
+/*
 EOLIAN
 Dummy_StructSimple *_dummy_test_object_call_struct_simple_ptr_return(Eo *obj, EINA_UNUSED Dummy_Test_Object_Data *pd)
 {
@@ -4310,6 +4319,7 @@ Dummy_StructSimple *_dummy_test_object_call_struct_simple_ptr_return_own(Eo *obj
 {
     return dummy_test_object_struct_simple_ptr_return_own(obj);
 }
+*/
 
 // with complex types
 
index 6aab6ed..005431d 100644 (file)
@@ -75,13 +75,13 @@ struct @free(free) Dummy.StructSimple
 }
 
 struct @beta @free(free) Dummy.StructComplex {
-   farray: array<ptr(int)>;
+   farray: array<string>;
    flist: list<string>;
    fhash: hash<string, string>;
-   fiterator: iterator<ptr(int)>;
+   fiterator: iterator<string>;
    fany_value: any_value;
    fany_value_ptr: any_value_ptr;
-   fbinbuf: ptr(Eina.Binbuf);
+   // fbinbuf: ptr(Eina.Binbuf);
    fslice: slice<ubyte>;
    // fslice: ptr(Eina.Slice); // TODO
    fobj: Dummy.Numberwrapper;
@@ -122,12 +122,14 @@ class Dummy.Test_Object extends Efl.Object implements Dummy.Test_Iface {
          }
       }
 
+      /*
       int_ptr_out {
          params {
             @in x: int;
             @out y: ptr(int);
          }
       }
+      */
 
       in_stringshare {
          params {
@@ -296,6 +298,7 @@ class Dummy.Test_Object extends Efl.Object implements Dummy.Test_Iface {
       }
       */
 
+      /*
       eina_binbuf_in @beta {
          params {
             @in binbuf: ptr(Eina.Binbuf);
@@ -373,10 +376,12 @@ class Dummy.Test_Object extends Efl.Object implements Dummy.Test_Iface {
       call_eina_binbuf_return_own @beta {
          return: ptr(Eina.Binbuf) @owned;
       }
+      */
 
       /* Eina Array */
 
       /* Integer */
+      /*
       eina_array_int_in {
          params {
             @in arr: array<ptr(int)>;
@@ -421,6 +426,7 @@ class Dummy.Test_Object extends Efl.Object implements Dummy.Test_Iface {
       eina_array_int_return_own {
          return: array<free(ptr(int),free) @owned> @owned;
       }
+      */
 
       /* String */
       eina_array_str_in {
@@ -570,6 +576,7 @@ class Dummy.Test_Object extends Efl.Object implements Dummy.Test_Iface {
       /* Eina List */
 
       /* Integer */
+      /*
       eina_list_int_in {
          params {
             @in lst: list<ptr(int)>;
@@ -614,6 +621,7 @@ class Dummy.Test_Object extends Efl.Object implements Dummy.Test_Iface {
       eina_list_int_return_own {
          return: list<free(ptr(int),free) @owned> @owned;
       }
+      */
 
       /* String */
       eina_list_str_in {
@@ -763,6 +771,7 @@ class Dummy.Test_Object extends Efl.Object implements Dummy.Test_Iface {
       // Eina Hash //
 
       // Integer //
+      /*
       eina_hash_int_in {
          params {
             @in hsh: hash<ptr(int), ptr(int)>;
@@ -813,6 +822,7 @@ class Dummy.Test_Object extends Efl.Object implements Dummy.Test_Iface {
       check_eina_hash_int_return_own {
          return: bool;
       }
+      */
 
       // String //
       eina_hash_str_in {
@@ -1305,6 +1315,7 @@ class Dummy.Test_Object extends Efl.Object implements Dummy.Test_Iface {
          return: bool;
       }
 
+      /*
       struct_simple_ptr_in {
          params {
             @in simple: ptr(Dummy.StructSimple);
@@ -1318,6 +1329,7 @@ class Dummy.Test_Object extends Efl.Object implements Dummy.Test_Iface {
          }
          return: Dummy.StructSimple;
       }
+      */
 
       struct_simple_out {
          params {
@@ -1326,6 +1338,7 @@ class Dummy.Test_Object extends Efl.Object implements Dummy.Test_Iface {
          return: bool;
       }
 
+      /*
       struct_simple_ptr_out {
          params {
             @out simple: ptr(Dummy.StructSimple);
@@ -1339,11 +1352,13 @@ class Dummy.Test_Object extends Efl.Object implements Dummy.Test_Iface {
          }
          return: Dummy.StructSimple;
       }
+      */
 
       struct_simple_return {
          return: Dummy.StructSimple;
       }
 
+      /*
       struct_simple_ptr_return {
          return: ptr(Dummy.StructSimple);
       }
@@ -1351,6 +1366,7 @@ class Dummy.Test_Object extends Efl.Object implements Dummy.Test_Iface {
       struct_simple_ptr_return_own {
          return: ptr(Dummy.StructSimple) @owned;
       }
+      */
 
       call_struct_simple_in {
          params {
@@ -1358,6 +1374,7 @@ class Dummy.Test_Object extends Efl.Object implements Dummy.Test_Iface {
          }
       }
 
+      /*
       call_struct_simple_ptr_in {
          params {
             @in simple: ptr(Dummy.StructSimple);
@@ -1369,6 +1386,7 @@ class Dummy.Test_Object extends Efl.Object implements Dummy.Test_Iface {
             @in simple: ptr(Dummy.StructSimple) @owned;
          }
       }
+      */
 
       call_struct_simple_out {
          params {
@@ -1376,6 +1394,7 @@ class Dummy.Test_Object extends Efl.Object implements Dummy.Test_Iface {
          }
       }
 
+      /*
       call_struct_simple_ptr_out {
          params {
             @out simple: ptr(Dummy.StructSimple);
@@ -1387,11 +1406,13 @@ class Dummy.Test_Object extends Efl.Object implements Dummy.Test_Iface {
             @out simple: ptr(Dummy.StructSimple) @owned;
          }
       }
+      */
 
       call_struct_simple_return {
          return: Dummy.StructSimple;
       }
 
+      /*
       call_struct_simple_ptr_return {
          return: ptr(Dummy.StructSimple);
       }
@@ -1399,6 +1420,7 @@ class Dummy.Test_Object extends Efl.Object implements Dummy.Test_Iface {
       call_struct_simple_ptr_return_own {
          return: ptr(Dummy.StructSimple) @owned;
       }
+      */
 
       struct_complex_in @beta {
          params {
@@ -1407,6 +1429,7 @@ class Dummy.Test_Object extends Efl.Object implements Dummy.Test_Iface {
          return: bool;
       }
 
+      /*
       struct_complex_ptr_in @beta {
          params {
             @in complex: ptr(Dummy.StructComplex);
@@ -1420,6 +1443,7 @@ class Dummy.Test_Object extends Efl.Object implements Dummy.Test_Iface {
          }
          return: bool;
       }
+      */
 
       struct_complex_out @beta {
          params {