add tests for arrays of simple structs and arrays of gvalue
authorJohn (J5) Palmieri <johnp@redhat.com>
Thu, 15 Sep 2011 18:49:13 +0000 (14:49 -0400)
committerJohn (J5) Palmieri <johnp@redhat.com>
Thu, 15 Sep 2011 18:51:23 +0000 (14:51 -0400)
 * 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
tests/gimarshallingtests.h

index 8ba3308..637c7d5 100644 (file)
@@ -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):
  */
index d48c64a..81c3a50 100644 (file)
@@ -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);