summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorJohn (J5) Palmieri <johnp@redhat.com>2011-09-15 14:49:13 -0400
committerJohn (J5) Palmieri <johnp@redhat.com>2011-09-15 14:51:23 -0400
commit1e26aa4158d8e42a3cd2bed7d9fbf385e81e5fc8 (patch)
tree8dfbcc2369c7fec01845e9e8a0cfdf63b97130e7 /tests
parentde5401b5c5760c5384f24161373e80bc50fdd442 (diff)
downloadgobject-introspection-1e26aa4158d8e42a3cd2bed7d9fbf385e81e5fc8.tar.gz
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.
Diffstat (limited to 'tests')
-rw-r--r--tests/gimarshallingtests.c31
-rw-r--r--tests/gimarshallingtests.h2
2 files changed, 33 insertions, 0 deletions
diff --git a/tests/gimarshallingtests.c b/tests/gimarshallingtests.c
index 8ba33084..637c7d50 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 d48c64a0..81c3a50a 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);