diff options
author | Colin Walters <walters@verbum.org> | 2011-06-17 12:14:58 -0400 |
---|---|---|
committer | Colin Walters <walters@verbum.org> | 2011-06-17 12:14:58 -0400 |
commit | fdfa839105f792890152d558882bab89d64522b5 (patch) | |
tree | 2786de130d24066d60c68c2d9393a21b44912c23 | |
parent | 20f37d1a12ce828984f96211297df64f1db36ec2 (diff) | |
download | gobject-introspection-fdfa839105f792890152d558882bab89d64522b5.tar.gz |
gimarshallingtests: Fix and change byte array tests
gi_marshalling_tests_bytearray_full_return was broken; there
should be no g_strdup() going on here.
While we're at it, change the expected data to actually include
non-ASCII so we're testing something a bit more interesting.
-rw-r--r-- | tests/gimarshallingtests.c | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/tests/gimarshallingtests.c b/tests/gimarshallingtests.c index af2734df..034ef8ff 100644 --- a/tests/gimarshallingtests.c +++ b/tests/gimarshallingtests.c @@ -1811,14 +1811,10 @@ GByteArray * gi_marshalling_tests_bytearray_full_return (void) { GByteArray *array = NULL; - static gchar *values[] = {"0", "1", "2", "3", NULL}; - gint i; + guint8 data[] = {'\0', '1', '\xFF', '3'}; array = g_byte_array_new (); - for (i = 0; values[i]; i++) { - gchar *str = g_strdup (values[i]); - g_byte_array_append (array, (const guint8*)str, 1); - } + g_byte_array_append (array, (const guint8*)data, G_N_ELEMENTS(data)); return array; @@ -1831,11 +1827,11 @@ gi_marshalling_tests_bytearray_full_return (void) void gi_marshalling_tests_bytearray_none_in (GByteArray *array_) { - g_assert (array_->len == 4); - g_assert (g_array_index (array_, char, 0) == '0'); - g_assert (g_array_index (array_, char, 1) == '1'); - g_assert (g_array_index (array_, char, 2) == '2'); - g_assert (g_array_index (array_, char, 3) == '3'); + g_assert_cmpuint (array_->len, ==, 4); + g_assert_cmpuint (g_array_index (array_, unsigned char, 0), ==, 0); + g_assert_cmpuint (g_array_index (array_, unsigned char, 1), ==, 49); + g_assert_cmpuint (g_array_index (array_, unsigned char, 2), ==, 0xFF); + g_assert_cmpuint (g_array_index (array_, unsigned char, 3), ==, 51); } /** |