[gobject-introspection] gimarshalingtests: Add tests for mixed allow-none and implicit args
- From: Simon Feltman <sfeltman src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gobject-introspection] gimarshalingtests: Add tests for mixed allow-none and implicit args
- Date: Thu, 26 Sep 2013 11:42:25 +0000 (UTC)
commit 6c9e4d5d648b5bf7ebff042f70c57e6a3d86fc88
Author: Simon Feltman <sfeltman src gnome org>
Date: Tue Aug 6 01:22:52 2013 -0700
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
tests/gimarshallingtests.c | 63 ++++++++++++++++++++++++++++++++++++++++++-
tests/gimarshallingtests.h | 3 ++
2 files changed, 64 insertions(+), 2 deletions(-)
---
diff --git a/tests/gimarshallingtests.c b/tests/gimarshallingtests.c
index b1bce8f..0550295 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
diff --git a/tests/gimarshallingtests.h b/tests/gimarshallingtests.h
index e308db6..e57f92e 100644
--- a/tests/gimarshallingtests.h
+++ b/tests/gimarshallingtests.h
@@ -1049,6 +1049,9 @@ gint gi_marshalling_tests_int_return_out (gint *int_);
/* Default arguments */
void gi_marshalling_tests_int_two_in_utf8_two_in_with_allow_none (gint a, gint b, const gchar *c, const
gchar *d);
+void gi_marshalling_tests_int_one_in_utf8_two_in_one_allows_none (gint a, const gchar *b, const gchar *c);
+void gi_marshalling_tests_array_in_utf8_two_in (const gint *ints, gint length, const gchar *a, const gchar
*b);
+void gi_marshalling_tests_array_in_utf8_two_in_out_of_order (gint length, const gchar *a, const gint *ints,
const gchar *b);
/* GError */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]