[gobject-introspection/gnome-3-6] gimarshallingtests: Add array/GList uint32/64 in/out API
- From: Martin Pitt <martinpitt src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gobject-introspection/gnome-3-6] gimarshallingtests: Add array/GList uint32/64 in/out API
- Date: Thu, 11 Oct 2012 14:07:22 +0000 (UTC)
commit 3d742120bd6a0ff7c44362f37e99a0af5bba70ca
Author: Martin Pitt <martinpitt gnome org>
Date: Thu Oct 11 16:05:37 2012 +0200
gimarshallingtests: Add array/GList uint32/64 in/out API
Add in/out API for testing arrays containing uint64, as well as GList
containing uint32 (GList and GHash can't contain 64 bit values as they store
them in pointers).
https://bugzilla.gnome.org/show_bug.cgi?id=685860
tests/gimarshallingtests.c | 64 ++++++++++++++++++++++++++++++++++++++++++++
tests/gimarshallingtests.h | 4 +++
2 files changed, 68 insertions(+), 0 deletions(-)
---
diff --git a/tests/gimarshallingtests.c b/tests/gimarshallingtests.c
index 3eb6e07..3d6e345 100644
--- a/tests/gimarshallingtests.c
+++ b/tests/gimarshallingtests.c
@@ -1729,6 +1729,28 @@ gi_marshalling_tests_garray_int_none_return (void)
}
/**
+ * gi_marshalling_tests_garray_uint64_none_return:
+ *
+ * Returns: (element-type guint64) (transfer none):
+ */
+GArray *
+gi_marshalling_tests_garray_uint64_none_return (void)
+{
+ static GArray *array = NULL;
+ guint64 i;
+
+ if (array == NULL) {
+ array = g_array_new (TRUE, TRUE, sizeof (guint64));
+ i = 0;
+ g_array_append_val (array, i);
+ i = G_MAXUINT64;
+ g_array_append_val (array, i);
+ }
+
+ return array;
+}
+
+/**
* gi_marshalling_tests_garray_utf8_none_return:
*
* Returns: (element-type utf8) (transfer none):
@@ -1804,6 +1826,18 @@ gi_marshalling_tests_garray_int_none_in (GArray *array_)
}
/**
+ * gi_marshalling_tests_garray_uint64_none_in:
+ * @array_: (element-type guint64) (transfer none):
+ */
+void
+gi_marshalling_tests_garray_uint64_none_in (GArray *array_)
+{
+ g_assert_cmpint(array_->len, ==, 2);
+ g_assert_cmpint(g_array_index (array_, guint64, 0), ==, 0);
+ g_assert_cmpint(g_array_index (array_, guint64, 1), ==, G_MAXUINT64);
+}
+
+/**
* gi_marshalling_tests_garray_utf8_none_in:
* @array_: (element-type utf8) (transfer none):
*/
@@ -2276,6 +2310,24 @@ gi_marshalling_tests_glist_int_none_return (void)
}
/**
+ * gi_marshalling_tests_glist_uint32_none_return:
+ *
+ * Returns: (element-type guint32) (transfer none):
+ */
+GList *
+gi_marshalling_tests_glist_uint32_none_return (void)
+{
+ static GList *list = NULL;
+
+ if (list == NULL) {
+ list = g_list_append(list, GUINT_TO_POINTER(0));
+ list = g_list_append(list, GUINT_TO_POINTER(G_MAXUINT32));
+ }
+
+ return list;
+}
+
+/**
* gi_marshalling_tests_glist_utf8_none_return:
*
* Returns: (element-type utf8) (transfer none):
@@ -2343,6 +2395,18 @@ gi_marshalling_tests_glist_int_none_in (GList *list)
}
/**
+ * gi_marshalling_tests_glist_uint32_none_in:
+ * @list: (element-type guint32) (transfer none):
+ */
+void
+gi_marshalling_tests_glist_uint32_none_in (GList *list)
+{
+ g_assert_cmpint(g_list_length(list), ==, 2);
+ g_assert_cmpint(GPOINTER_TO_UINT(g_list_nth_data(list, 0)), ==, 0);
+ g_assert_cmpint(GPOINTER_TO_UINT(g_list_nth_data(list, 1)), ==, G_MAXUINT32);
+}
+
+/**
* gi_marshalling_tests_glist_utf8_none_in:
* @list: (element-type utf8) (transfer none):
*/
diff --git a/tests/gimarshallingtests.h b/tests/gimarshallingtests.h
index cdcb08e..7768a88 100644
--- a/tests/gimarshallingtests.h
+++ b/tests/gimarshallingtests.h
@@ -422,11 +422,13 @@ GVariant **gi_marshalling_tests_array_gvariant_full_in (GVariant **variants);
/* GArray */
GArray *gi_marshalling_tests_garray_int_none_return (void);
+GArray *gi_marshalling_tests_garray_uint64_none_return (void);
GArray *gi_marshalling_tests_garray_utf8_none_return (void);
GArray *gi_marshalling_tests_garray_utf8_container_return (void);
GArray *gi_marshalling_tests_garray_utf8_full_return (void);
void gi_marshalling_tests_garray_int_none_in (GArray *array_);
+void gi_marshalling_tests_garray_uint64_none_in (GArray *array_);
void gi_marshalling_tests_garray_utf8_none_in (GArray *array_);
void gi_marshalling_tests_garray_utf8_none_out (GArray **array_);
@@ -467,11 +469,13 @@ void gi_marshalling_tests_gstrv_inout (GStrv *g_strv);
/* GList */
GList *gi_marshalling_tests_glist_int_none_return (void);
+GList *gi_marshalling_tests_glist_uint32_none_return (void);
GList *gi_marshalling_tests_glist_utf8_none_return (void);
GList *gi_marshalling_tests_glist_utf8_container_return (void);
GList *gi_marshalling_tests_glist_utf8_full_return (void);
void gi_marshalling_tests_glist_int_none_in (GList *list);
+void gi_marshalling_tests_glist_uint32_none_in (GList *list);
void gi_marshalling_tests_glist_utf8_none_in (GList *list);
void gi_marshalling_tests_glist_utf8_none_out (GList **list);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]