diff options
author | Martin Pitt <martinpitt@gnome.org> | 2012-10-11 16:05:37 +0200 |
---|---|---|
committer | Martin Pitt <martinpitt@gnome.org> | 2012-10-11 16:07:15 +0200 |
commit | 3d742120bd6a0ff7c44362f37e99a0af5bba70ca (patch) | |
tree | 1d95e0119288c6751bf531244a2866b19855a3a9 /tests/gimarshallingtests.c | |
parent | 460cef9cfab15523b453838fa7794d7a203564fc (diff) | |
download | gobject-introspection-3d742120bd6a0ff7c44362f37e99a0af5bba70ca.tar.gz |
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
Diffstat (limited to 'tests/gimarshallingtests.c')
-rw-r--r-- | tests/gimarshallingtests.c | 64 |
1 files changed, 64 insertions, 0 deletions
diff --git a/tests/gimarshallingtests.c b/tests/gimarshallingtests.c index 3eb6e075..3d6e3453 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): */ |