[gobject-introspection] gimarshallingtests: add a few more array tests



commit 88e8592c5bb8709c035865f084e104db54564a89
Author: Dan Winship <danw gnome org>
Date:   Thu Jun 2 14:57:58 2011 -0400

    gimarshallingtests: add a few more array tests
    
    Add some tests with parameters on either side of an out array length
    parameter, to ensure that bindings that omit the length parameter
    don't mess up any other parameters.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=651558

 tests/gimarshallingtests.c |   66 ++++++++++++++++++++++++++++++++++++++++++++
 tests/gimarshallingtests.h |    3 ++
 2 files changed, 69 insertions(+), 0 deletions(-)
---
diff --git a/tests/gimarshallingtests.c b/tests/gimarshallingtests.c
index 56df373..7275f79 100644
--- a/tests/gimarshallingtests.c
+++ b/tests/gimarshallingtests.c
@@ -1211,6 +1211,26 @@ gi_marshalling_tests_array_return (gint *length)
 }
 
 /**
+ * gi_marshalling_tests_array_return_etc:
+ * @first:
+ * @length: (out):
+ * @last:
+ * @sum: (out):
+ * Returns: (array length=length):
+ */
+const gint *
+gi_marshalling_tests_array_return_etc (gint first, gint *length, gint last, gint *sum)
+{
+    static gint ints[] = {-1, 0, 1, 2};
+
+    ints[0] = first;
+    ints[3] = last;
+    *sum = first + last;
+    *length = 4;
+    return ints;
+}
+
+/**
  * gi_marshalling_tests_array_in:
  * @ints: (array length=length):
  */
@@ -1252,6 +1272,26 @@ gi_marshalling_tests_array_out (gint **ints, gint *length)
 }
 
 /**
+ * gi_marshalling_tests_array_out_etc:
+ * @first:
+ * @ints: (out) (array length=length) (transfer none):
+ * @length: (out):
+ * @last:
+ * @sum: (out):
+ */
+void
+gi_marshalling_tests_array_out_etc (gint first, gint **ints, gint *length, gint last, gint *sum)
+{
+    static gint values[] = {-1, 0, 1, 2};
+
+    values[0] = first;
+    values[3] = last;
+    *sum = first + last;
+    *length = 4;
+    *ints = values;
+}
+
+/**
  * gi_marshalling_tests_array_inout:
  * @ints: (inout) (array length=length) (transfer none):
  * @length: (inout):
@@ -1272,6 +1312,32 @@ gi_marshalling_tests_array_inout (gint **ints, gint *length)
 }
 
 /**
+ * gi_marshalling_tests_array_inout_etc:
+ * @first:
+ * @ints: (inout) (array length=length) (transfer none):
+ * @length: (inout):
+ * @last:
+ * @sum: (out):
+ */
+void
+gi_marshalling_tests_array_inout_etc (gint first, gint **ints, gint *length, gint last, gint *sum)
+{
+    static gint values[] = {-2, -1, 0, 1, 2};
+
+    g_assert(*length == 4);
+    g_assert((*ints)[0] == -1);
+    g_assert((*ints)[1] == 0);
+    g_assert((*ints)[2] == 1);
+    g_assert((*ints)[3] == 2);
+
+    values[0] = first;
+    values[4] = last;
+    *sum = first + last;
+    *length = 5;
+    *ints = values;
+}
+
+/**
  * gi_marshalling_tests_array_zero_terminated_return:
  * Returns: (array zero-terminated=1) (transfer none):
  */
diff --git a/tests/gimarshallingtests.h b/tests/gimarshallingtests.h
index f7b59b3..ef80a4c 100644
--- a/tests/gimarshallingtests.h
+++ b/tests/gimarshallingtests.h
@@ -279,14 +279,17 @@ void gi_marshalling_tests_array_fixed_inout (gint **ints);
 /* Variable-size */
 
 const gint *gi_marshalling_tests_array_return (gint *length);
+const gint *gi_marshalling_tests_array_return_etc (gint first, gint *length, gint last, gint *sum);
 
 void gi_marshalling_tests_array_in (const gint *ints, gint length);
 
 void gi_marshalling_tests_array_uint8_in (const guint8 *chars, gint length);
 
 void gi_marshalling_tests_array_out (gint **ints, gint *length);
+void gi_marshalling_tests_array_out_etc (gint first, gint **ints, gint *length, gint last, gint *sum);
 
 void gi_marshalling_tests_array_inout (gint **ints, gint *length);
+void gi_marshalling_tests_array_inout_etc (gint first, gint **ints, gint *length, gint last, gint *sum);
 
 /* Zero-terminated */
 



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