[gobject-introspection] add tests for arrays of simple structs and arrays of gvalue



commit 1e26aa4158d8e42a3cd2bed7d9fbf385e81e5fc8
Author: John (J5) Palmieri <johnp redhat com>
Date:   Thu Sep 15 14:49:13 2011 -0400

    add tests for arrays of simple structs and arrays of gvalue
    
     * for now we assume simple struct arrays and gvalue arrays are flat
       until gi gets support for annotating the level of indirection
       of an array.

 tests/gimarshallingtests.c |   31 +++++++++++++++++++++++++++++++
 tests/gimarshallingtests.h |    2 ++
 2 files changed, 33 insertions(+), 0 deletions(-)
---
diff --git a/tests/gimarshallingtests.c b/tests/gimarshallingtests.c
index 8ba3308..637c7d5 100644
--- a/tests/gimarshallingtests.c
+++ b/tests/gimarshallingtests.c
@@ -1337,6 +1337,37 @@ gi_marshalling_tests_array_struct_in (GIMarshallingTestsBoxedStruct **structs, g
 }
 
 /**
+ * gi_marshalling_tests_array_simple_struct_in:
+ * @structs: (array length=length):
+ */
+void
+gi_marshalling_tests_array_simple_struct_in (GIMarshallingTestsSimpleStruct *structs, gint length)
+{
+    g_assert(length == 3);
+    g_assert(structs[0].long_ == 1);
+    g_assert(structs[1].long_ == 2);
+    g_assert(structs[2].long_ == 3);
+}
+
+/**
+ * gi_marshalling_tests_multi_array_key_value_in:
+ * @keys: (array length=length):
+ * @values: (array length=length):
+ */
+void
+gi_marshalling_tests_multi_array_key_value_in (gint length, const gchar **keys, const GValue *values)
+{
+    g_assert(length == 3);
+    g_assert(g_strcmp0("one", keys[0]) == 0);
+    g_assert(g_value_get_int(&values[0]) == 1);
+    g_assert(g_strcmp0("two", keys[1]) == 0);
+    g_assert(g_value_get_int(&values[1]) == 2);
+    g_assert(g_strcmp0("three", keys[2]) == 0);
+    g_assert(g_value_get_int(&values[2]) == 3);
+
+}
+
+/**
  * gi_marshalling_tests_array_struct_take_in:
  * @structs: (array length=length) (transfer full):
  */
diff --git a/tests/gimarshallingtests.h b/tests/gimarshallingtests.h
index d48c64a..81c3a50 100644
--- a/tests/gimarshallingtests.h
+++ b/tests/gimarshallingtests.h
@@ -380,6 +380,8 @@ void gi_marshalling_tests_array_string_in (const gchar **strings, gint length);
 void gi_marshalling_tests_array_uint8_in (const guint8 *chars, gint length);
 void gi_marshalling_tests_array_struct_in (GIMarshallingTestsBoxedStruct **structs, gint length);
 void gi_marshalling_tests_array_struct_take_in (GIMarshallingTestsBoxedStruct **structs, gint length);
+void gi_marshalling_tests_array_simple_struct_in (GIMarshallingTestsSimpleStruct *structs, gint length);
+void gi_marshalling_tests_multi_array_key_value_in (gint length, const gchar **keys, const GValue *values);
 void gi_marshalling_tests_array_enum_in (GIMarshallingTestsEnum *_enum, gint length);
 void gi_marshalling_tests_array_in_guint64_len (const gint *ints, guint64 length);
 void gi_marshalling_tests_array_in_guint8_len (const gint *ints, guint8 length);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]