summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorC. Scott Ananian <cscott@litl.com>2009-05-01 18:20:06 -0400
committerJohan Bilien <jobi@litl.com>2009-05-12 16:06:13 +0100
commit9e85ff040f31a6ea91bb3f9d529c28c236a3dcae (patch)
tree50f4c986faee251236800a95e87efddd66d4613f
parent26ea778b1533a8499cfb2e98c25037a107569e14 (diff)
downloadgobject-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.
-rw-r--r--tests/everything/everything.c14
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));
}
/**