summaryrefslogtreecommitdiff
path: root/tests/gimarshallingtests.c
diff options
context:
space:
mode:
authorSimon Feltman <sfeltman@src.gnome.org>2013-08-06 01:22:52 -0700
committerSimon Feltman <sfeltman@src.gnome.org>2013-09-26 04:22:26 -0700
commit6c9e4d5d648b5bf7ebff042f70c57e6a3d86fc88 (patch)
tree25300721d7a7a36418089947a4b96f7738e10f20 /tests/gimarshallingtests.c
parenta19bfeb4da53825ad960c9e33306b9437a22c4f6 (diff)
downloadgobject-introspection-6c9e4d5d648b5bf7ebff042f70c57e6a3d86fc88.tar.gz
gimarshalingtests: Add tests for mixed allow-none and implicit args
Add test method with an allow-none in the middle of non allow-none arguments. Add test method with an array and its length argument interleaved with allow-none arguments. https://bugzilla.gnome.org/show_bug.cgi?id=640812
Diffstat (limited to 'tests/gimarshallingtests.c')
-rw-r--r--tests/gimarshallingtests.c63
1 files changed, 61 insertions, 2 deletions
diff --git a/tests/gimarshallingtests.c b/tests/gimarshallingtests.c
index b1bce8fc..05502951 100644
--- a/tests/gimarshallingtests.c
+++ b/tests/gimarshallingtests.c
@@ -4737,8 +4737,8 @@ gi_marshalling_tests_int_return_out (gint *int_)
/**
* gi_marshalling_tests_int_two_in_utf8_two_in_with_allow_none:
-* @a: (in):
-* @b: (in):
+* @a: (in): Must be 1
+* @b: (in): Must be 2
* @c: (in) (allow-none): Must be "3" or NULL
* @d: (in) (allow-none): Must be "4" or NULL
*/
@@ -4753,6 +4753,65 @@ gi_marshalling_tests_int_two_in_utf8_two_in_with_allow_none (gint a, gint b, con
g_assert_cmpstr (d, ==, "4");
}
+/**
+* gi_marshalling_tests_int_one_in_utf8_two_in_one_allows_none:
+* @a: (in): Must be 1
+* @b: (in) (allow-none): Must be "2" or NULL
+* @c: (in): Must be "3"
+*/
+void
+gi_marshalling_tests_int_one_in_utf8_two_in_one_allows_none (gint a, const gchar *b, const gchar *c)
+{
+ g_assert_cmpint (a, ==, 1);
+ if (b != NULL)
+ g_assert_cmpstr (b, ==, "2");
+ g_assert_cmpstr (c, ==, "3");
+}
+
+/**
+ * gi_marshalling_tests_array_in_utf8_two_in:
+ * @ints: (array length=length):
+ * @length:
+ * @a: (in) (allow-none): Must be "1" or NULL
+ * @b: (in) (allow-none): Must be "2" or NULL
+ */
+void
+gi_marshalling_tests_array_in_utf8_two_in (const gint *ints, gint length, const gchar *a, const gchar *b)
+{
+ g_assert_cmpint (length, ==, 4);
+ g_assert_cmpint (ints[0], ==, -1);
+ g_assert_cmpint (ints[1], ==, 0);
+ g_assert_cmpint (ints[2], ==, 1);
+ g_assert_cmpint (ints[3], ==, 2);
+
+ if (a != NULL)
+ g_assert_cmpstr (a, ==, "1");
+ if (b != NULL)
+ g_assert_cmpstr (b, ==, "2");
+}
+
+/**
+ * gi_marshalling_tests_array_in_utf8_two_in_out_of_order:
+ * @length:
+ * @a: (in) (allow-none): Must be "1" or NULL
+ * @ints: (array length=length):
+ * @b: (in) (allow-none): Must be "2" or NULL
+ */
+void
+gi_marshalling_tests_array_in_utf8_two_in_out_of_order (gint length, const gchar *a, const gint *ints, const gchar *b)
+{
+ g_assert_cmpint (length, ==, 4);
+ g_assert_cmpint (ints[0], ==, -1);
+ g_assert_cmpint (ints[1], ==, 0);
+ g_assert_cmpint (ints[2], ==, 1);
+ g_assert_cmpint (ints[3], ==, 2);
+
+ if (a != NULL)
+ g_assert_cmpstr (a, ==, "1");
+ if (b != NULL)
+ g_assert_cmpstr (b, ==, "2");
+}
+
/* GError */
void