diff options
-rw-r--r-- | src/reflist.c | 2 | ||||
-rw-r--r-- | tests/list_check.c | 9 |
2 files changed, 10 insertions, 1 deletions
diff --git a/src/reflist.c b/src/reflist.c index 36753bd5..e420b736 100644 --- a/src/reflist.c +++ b/src/reflist.c @@ -775,7 +775,7 @@ static int recursive_count(Reflection *refl) { int count_left, count_right; - if ( refl == NULL ) return 1; + if ( refl == NULL ) return 0; count_left = recursive_count(refl->child[0]); count_right = recursive_count(refl->child[1]); diff --git a/tests/list_check.c b/tests/list_check.c index 2b75ab72..180aeb6a 100644 --- a/tests/list_check.c +++ b/tests/list_check.c @@ -90,6 +90,7 @@ static int test_lists(int num_items) optimise_reflist(list); /* Iterate over the list and check we find everything */ + int count = 0; for ( refl = first_refl(list, &iter); refl != NULL; refl = next_refl(refl, iter) ) { @@ -107,7 +108,15 @@ static int test_lists(int num_items) } } + count++; + + } + if ( count != num_reflections(list) ) { + fprintf(stderr, "num_reflections gave %i, iteration gave %i\n", + num_reflections(list), count); + return 1; } + for ( i=0; i<num_items; i++ ) { if ( check[i].found == 0 ) { |