diff options
author | Colin Walters <walters@verbum.org> | 2012-11-05 18:13:24 -0500 |
---|---|---|
committer | Colin Walters <walters@verbum.org> | 2012-11-07 09:09:28 -0500 |
commit | af24c2bf8d07393904c537c0da6eb4481feb84bd (patch) | |
tree | d2a6b7552b8b19bf417971dfe4b95758f8c3369a /tests/gimarshallingtests.c | |
parent | db71321a5b23715ac047058e56c1fcb6a5985376 (diff) | |
download | gobject-introspection-af24c2bf8d07393904c537c0da6eb4481feb84bd.tar.gz |
gimarshallingtests: Add some GBytes tests
Will be used by gjs for new byte array work.
https://bugzilla.gnome.org/show_bug.cgi?id=687696
Diffstat (limited to 'tests/gimarshallingtests.c')
-rw-r--r-- | tests/gimarshallingtests.c | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/tests/gimarshallingtests.c b/tests/gimarshallingtests.c index e05f9169..5ce800d2 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 |