aboutsummaryrefslogtreecommitdiff
path: root/tests/list_check.c
diff options
context:
space:
mode:
authorThomas White <taw@bitwiz.org.uk>2011-02-08 22:41:19 +0100
committerThomas White <taw@physics.org>2012-02-22 15:27:13 +0100
commit06ce382d160021fbc8083d0bd48b2735504a39d5 (patch)
tree842b3985e6c9311727e61b1c943ae0c7edb00644 /tests/list_check.c
parentde518c82717f8d07a6721e01200deb2437335a5d (diff)
More work on reflist
Diffstat (limited to 'tests/list_check.c')
-rw-r--r--tests/list_check.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/tests/list_check.c b/tests/list_check.c
index 22ef01e1..a50a8d70 100644
--- a/tests/list_check.c
+++ b/tests/list_check.c
@@ -54,11 +54,11 @@ static int test_lists(int num_items)
int j;
int duplicate = 0;
- //if ( random() > RAND_MAX/2 ) {
+ if ( random() > RAND_MAX/2 ) {
h = RANDOM_INDEX;
k = RANDOM_INDEX;
l = RANDOM_INDEX;
- //} /* else use the same as last time */
+ } /* else use the same as last time */
/* Count the number of times this reflection appeared before */
for ( j=0; j<i; j++ ) {
@@ -86,6 +86,10 @@ static int test_lists(int num_items)
check[i].dup = duplicate;
check[i].found = 0;
+ if ( (h==-178) && (k==-45) && (l==55)) {
+ printf("added, now %i %i\n", check[i].dup, i);
+ }
+
}
/* Iterate over the list and check we find everything */
@@ -150,13 +154,17 @@ static int test_lists(int num_items)
delete_refl(refl);
check[i].del = 1;
+ if ( (h==-119) && (k==20) && (l==-69)) {
+ printf("deleting, now %i\n", check[j].dup);
+ }
/* Update all counts */
- for ( j=0; j<i; j++ ) {
+ for ( j=0; j<num_items; j++ ) {
if ( (check[j].h == h)
&& (check[j].k == k)
&& (check[j].l == l) ) {
check[j].dup--;
+
}
}
@@ -179,7 +187,7 @@ static int test_lists(int num_items)
if ( refl != NULL ) {
/* Whoops, found it. Was it a duplicate? */
- if ( check[i].dup == 0 ) {
+ if ( check[i].dup == -1 ) {
fprintf(stderr, "Found %3i %i %3i after"
" deletion.\n", h, k, l);
return 1;
@@ -188,7 +196,7 @@ static int test_lists(int num_items)
int j;
Reflection *c;
- for ( j=0; j<check[i].dup; j++ ) {
+ for ( j=0; j<check[i].dup+1; j++ ) {
Reflection *r2;
r2 = find_refl(list, h, k, l);
if ( r2 == NULL ) {