/* * list_check.c * * Unit test for the reflection list module * * (c) 2011 Thomas White * * Part of CrystFEL - crystallography with a FEL * */ #ifdef HAVE_CONFIG_H #include #endif #include #include #include "../src/reflist.h" struct refltemp { signed int h; signed int k; signed int l; int del; int dup; int found; }; #define RANDOM_INDEX (128*random()/RAND_MAX - 256*random()/RAND_MAX) static int test_lists(int num_items) { struct refltemp *check; RefList *list; int i; signed int h, k, l; Reflection *refl; RefListIterator *iter; check = malloc(num_items * sizeof(struct refltemp)); list = reflist_new(); printf("Testing with %i\n", num_items); h = RANDOM_INDEX; k = RANDOM_INDEX; l = RANDOM_INDEX; for ( i=0; i RAND_MAX/2 ) { h = RANDOM_INDEX; k = RANDOM_INDEX; l = RANDOM_INDEX; //} /* else use the same as last time */ /* Count the number of times this reflection appeared before */ for ( j=0; j