aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2011-04-05 14:09:50 +0200
committerThomas White <taw@physics.org>2012-02-22 15:27:23 +0100
commit28ddf4c3e52adc77d56b0c2e1c6ee00d95cb6f4f (patch)
tree4443016579473938f3e6545f7aa847c59d5360fb /tests
parent40ec8624ccd76c574a136603f3dc2fc6683be969 (diff)
Add test for num_reflections() and fix it
Diffstat (limited to 'tests')
-rw-r--r--tests/list_check.c9
1 files changed, 9 insertions, 0 deletions
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 ) {