diff options
author | C. Scott Ananian <cscott@litl.com> | 2009-05-01 18:20:06 -0400 |
---|---|---|
committer | Johan Bilien <jobi@litl.com> | 2009-05-12 16:06:13 +0100 |
commit | 9e85ff040f31a6ea91bb3f9d529c28c236a3dcae (patch) | |
tree | 50f4c986faee251236800a95e87efddd66d4613f /tests | |
parent | 26ea778b1533a8499cfb2e98c25037a107569e14 (diff) | |
download | gobject-introspection-9e85ff040f31a6ea91bb3f9d529c28c236a3dcae.tar.gz |
Fix the list comparison assertions.
We weren't checking the length of the input list, and we were erroneously
comparing every element in the test sequence against the *first* element
of the passed-in list.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/everything/everything.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/tests/everything/everything.c b/tests/everything/everything.c index d02182d4..ddab7b67 100644 --- a/tests/everything/everything.c +++ b/tests/everything/everything.c @@ -483,8 +483,11 @@ static void assert_test_sequence_list (const GList *in) const GList *l; gsize i; - for (i = 0, l = in; l != NULL; ++i, l = l->next) - g_assert (strcmp (in->data, test_sequence[i]) == 0); + for (i = 0, l = in; l != NULL; ++i, l = l->next) { + g_assert (i < G_N_ELEMENTS(test_sequence)); + g_assert (strcmp (l->data, test_sequence[i]) == 0); + } + g_assert (i == G_N_ELEMENTS(test_sequence)); } /** @@ -602,8 +605,11 @@ static void assert_test_sequence_slist (const GSList *in) const GSList *l; gsize i; - for (i = 0, l = in; l != NULL; ++i, l = l->next) - g_assert (strcmp (in->data, test_sequence[i]) == 0); + for (i = 0, l = in; l != NULL; ++i, l = l->next) { + g_assert (i < G_N_ELEMENTS(test_sequence)); + g_assert (strcmp (l->data, test_sequence[i]) == 0); + } + g_assert (i == G_N_ELEMENTS(test_sequence)); } /** |