[gobject-introspection] gimarshallingtests: Add some GBytes tests



commit af24c2bf8d07393904c537c0da6eb4481feb84bd
Author: Colin Walters <walters verbum org>
Date:   Mon Nov 5 18:13:24 2012 -0500

    gimarshallingtests: Add some GBytes tests
    
    Will be used by gjs for new byte array work.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=687696

 tests/gimarshallingtests.c |   30 ++++++++++++++++++++++++++++++
 tests/gimarshallingtests.h |    5 +++++
 2 files changed, 35 insertions(+), 0 deletions(-)
---
diff --git a/tests/gimarshallingtests.c b/tests/gimarshallingtests.c
index e05f916..5ce800d 100644
--- a/tests/gimarshallingtests.c
+++ b/tests/gimarshallingtests.c
@@ -2233,6 +2233,36 @@ gi_marshalling_tests_bytearray_none_in (GByteArray *v)
 }
 
 /**
+ * gi_marshalling_tests_gbytes_full_return:
+ *
+ * Returns: (transfer full):
+ */
+GBytes *
+gi_marshalling_tests_gbytes_full_return (void)
+{
+  static guint8 data[] = {0, 49, 0xFF, 51};
+
+  return g_bytes_new_static (data, G_N_ELEMENTS(data));
+}
+
+/**
+ * gi_marshalling_tests_gbytes_none_in:
+ */
+void
+gi_marshalling_tests_gbytes_none_in (GBytes *v)
+{
+  const guint8 *data;
+  gsize len;
+  data = g_bytes_get_data (v, &len);
+
+  g_assert_cmpuint (len, ==, 4);
+  g_assert_cmpuint (data[0], ==, 0);
+  g_assert_cmpuint (data[1], ==, 49);
+  g_assert_cmpuint (data[2], ==, 0xFF);
+  g_assert_cmpuint (data[3], ==, 51);
+}
+
+/**
  * gi_marshalling_tests_gstrv_return:
  *
  * Returns: (transfer full): an array of strings
diff --git a/tests/gimarshallingtests.h b/tests/gimarshallingtests.h
index 73401ee..1b5d7ce 100644
--- a/tests/gimarshallingtests.h
+++ b/tests/gimarshallingtests.h
@@ -459,6 +459,11 @@ void gi_marshalling_tests_gptrarray_utf8_full_inout (GPtrArray **parray_);
 GByteArray *gi_marshalling_tests_bytearray_full_return (void);
 void gi_marshalling_tests_bytearray_none_in (GByteArray* v);
 
+/* GBytes */
+
+GBytes *gi_marshalling_tests_gbytes_full_return (void);
+void gi_marshalling_tests_gbytes_none_in (GBytes* v);
+
 /* GStrv */
 
 GStrv gi_marshalling_tests_gstrv_return (void);



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