diff options
Diffstat (limited to 'test/tskiplist.c')
-rw-r--r-- | test/tskiplist.c | 1007 |
1 files changed, 501 insertions, 506 deletions
diff --git a/test/tskiplist.c b/test/tskiplist.c index 2806afe..9ad4ea4 100644 --- a/test/tskiplist.c +++ b/test/tskiplist.c @@ -33,21 +33,23 @@ #include "H5SLprivate.h" /* The number of elements in testing arrays */ -#define NUM_ELEMS 1000 +#define NUM_ELEMS 1000 /* Random numbers */ static int *rand_num; static int *sort_rand_num; static int *rev_sort_rand_num; -static int tst_sort(const void *i1, const void *i2) +static int +tst_sort(const void *i1, const void *i2) { - return(*(const int *)i1-*(const int *)i2); + return (*(const int *)i1 - *(const int *)i2); } -static int tst_rev_sort(const void *i1, const void *i2) +static int +tst_rev_sort(const void *i1, const void *i2) { - return(*(const int *)i2-*(const int *)i1); + return (*(const int *)i2 - *(const int *)i1); } /**************************************************************** @@ -59,10 +61,10 @@ static int tst_rev_sort(const void *i1, const void *i2) static void test_skiplist_init(void) { - time_t curr_time; /* Current time, for seeding random number generator */ - int new_val; /* New value to insert */ + time_t curr_time; /* Current time, for seeding random number generator */ + int new_val; /* New value to insert */ unsigned found; /* Flag to indicate value was inserted already */ - size_t u,v; /* Local index variables */ + size_t u, v; /* Local index variables */ /* Allocate arrays */ rand_num = (int *)HDmalloc(sizeof(int) * NUM_ELEMS); @@ -77,7 +79,7 @@ test_skiplist_init(void) HDsrandom((unsigned)curr_time); /* Create randomized set of numbers */ - for(u = 0; u < NUM_ELEMS; u++) { + for (u = 0; u < NUM_ELEMS; u++) { do { /* Reset flag */ found = 0; @@ -86,13 +88,13 @@ test_skiplist_init(void) new_val = (int)(HDrandom() % 10001) - 5001; /* Check if the value is already in the array */ - for(v = 0; v < u; v++) - if(rand_num[v] == new_val) + for (v = 0; v < u; v++) + if (rand_num[v] == new_val) found = 1; - } while(found); + } while (found); /* Set unique value in array */ - rand_num[u]=new_val; + rand_num[u] = new_val; } /* end for */ /* Copy random values to sorted array */ @@ -117,8 +119,8 @@ test_skiplist_init(void) static void test_skiplist_create(void) { - H5SL_t *slist; /* Skip list created */ - herr_t ret; /* Generic return value */ + H5SL_t *slist; /* Skip list created */ + herr_t ret; /* Generic return value */ /* Output message about test being performed */ MESSAGE(6, ("Testing Creating & Closing Skip Lists\n")); @@ -128,7 +130,7 @@ test_skiplist_create(void) CHECK_PTR(slist, "H5SL_create"); /* Try closing the skip list */ - ret=H5SL_close(slist); + ret = H5SL_close(slist); CHECK(ret, FAIL, "H5SL_close"); } /* end test_skiplist_create() */ @@ -142,13 +144,13 @@ test_skiplist_create(void) static void test_skiplist_insert(void) { - H5SL_t *slist; /* Skip list created */ - int key, /* Key of item to insert */ - item; /* Item to insert */ - int search_key; /* Key of item to search for in skip list */ - int *found_item; /* Item found in skip list */ - size_t num; /* Number of elements in skip list */ - herr_t ret; /* Generic return value */ + H5SL_t *slist; /* Skip list created */ + int key, /* Key of item to insert */ + item; /* Item to insert */ + int search_key; /* Key of item to search for in skip list */ + int * found_item; /* Item found in skip list */ + size_t num; /* Number of elements in skip list */ + herr_t ret; /* Generic return value */ /* Output message about test being performed */ MESSAGE(7, ("Testing Insertion Into Skip List\n")); @@ -158,40 +160,41 @@ test_skiplist_insert(void) CHECK_PTR(slist, "H5SL_create"); /* Check that the skip list has no elements */ - num=H5SL_count(slist); + num = H5SL_count(slist); VERIFY(num, 0, "H5SL_count"); /* Try searching for item in empty skip list */ - key=37; - found_item=(int *)H5SL_search(slist,&key); + key = 37; + found_item = (int *)H5SL_search(slist, &key); CHECK_PTR_NULL(found_item, "H5SL_search"); /* Insert an object into the skip list */ - key=2; item=10; - ret=H5SL_insert(slist,&item,&key); + key = 2; + item = 10; + ret = H5SL_insert(slist, &item, &key); CHECK(ret, FAIL, "H5SL_insert"); /* Check that the skip list has one element */ - num=H5SL_count(slist); + num = H5SL_count(slist); VERIFY(num, 1, "H5SL_count"); /* Search for the item just inserted */ - found_item=(int *)H5SL_search(slist,&key); + found_item = (int *)H5SL_search(slist, &key); CHECK_PTR(found_item, "H5SL_search"); VERIFY(*found_item, item, "H5SL_search"); /* Search for an item not in list */ - search_key=37; - found_item=(int *)H5SL_search(slist,&search_key); + search_key = 37; + found_item = (int *)H5SL_search(slist, &search_key); CHECK_PTR_NULL(found_item, "H5SL_search"); /* Attempt to insert duplicate key (should fail) */ - search_key=2; - ret=H5SL_insert(slist,&search_key,&search_key); + search_key = 2; + ret = H5SL_insert(slist, &search_key, &search_key); VERIFY(ret, FAIL, "H5SL_insert"); /* Close the skip list */ - ret=H5SL_close(slist); + ret = H5SL_close(slist); CHECK(ret, FAIL, "H5SL_close"); } /* end test_skiplist_insert() */ @@ -206,10 +209,10 @@ static void test_skiplist_insert_many(void) { H5SL_t *slist; /* Skip list created */ - size_t num; /* Number of elements in skip list */ - size_t u; /* Local index variable */ - int *found_item; /* Item found in skip list */ - herr_t ret; /* Generic return value */ + size_t num; /* Number of elements in skip list */ + size_t u; /* Local index variable */ + int * found_item; /* Item found in skip list */ + herr_t ret; /* Generic return value */ /* Output message about test being performed */ MESSAGE(7, ("Testing Insertion of Many Items Into Skip List\n")); @@ -219,50 +222,50 @@ test_skiplist_insert_many(void) CHECK_PTR(slist, "H5SL_create"); /* Check that the skip list has no elements */ - num=H5SL_count(slist); + num = H5SL_count(slist); VERIFY(num, 0, "H5SL_count"); /* Insert many objects into the skip list */ - for(u=0; u<NUM_ELEMS; u++) { - ret=H5SL_insert(slist,&rand_num[u],&rand_num[u]); + for (u = 0; u < NUM_ELEMS; u++) { + ret = H5SL_insert(slist, &rand_num[u], &rand_num[u]); CHECK(ret, FAIL, "H5SL_insert"); } /* end for */ /* Check that the skip list has correct # of elements */ - num=H5SL_count(slist); + num = H5SL_count(slist); VERIFY(num, NUM_ELEMS, "H5SL_count"); /* Search for all objects in the skip list */ - for(u=0; u<NUM_ELEMS; u++) { - found_item=(int *)H5SL_search(slist,&rand_num[u]); + for (u = 0; u < NUM_ELEMS; u++) { + found_item = (int *)H5SL_search(slist, &rand_num[u]); CHECK_PTR(found_item, "H5SL_search"); - VERIFY(*found_item,rand_num[u],"H5SL_search"); + VERIFY(*found_item, rand_num[u], "H5SL_search"); } /* end for */ /* Release all the items from the list */ - ret=H5SL_release(slist); + ret = H5SL_release(slist); CHECK(ret, FAIL, "H5SL_release"); /* Check that the skip list has no elements */ - num=H5SL_count(slist); + num = H5SL_count(slist); VERIFY(num, 0, "H5SL_count"); /* Insert many objects into the skip list */ - for(u=0; u<NUM_ELEMS; u++) { - ret=H5SL_insert(slist,&rand_num[u],&rand_num[u]); + for (u = 0; u < NUM_ELEMS; u++) { + ret = H5SL_insert(slist, &rand_num[u], &rand_num[u]); CHECK(ret, FAIL, "H5SL_insert"); } /* end for */ /* Check that the skip list has correct # of elements */ - num=H5SL_count(slist); + num = H5SL_count(slist); VERIFY(num, NUM_ELEMS, "H5SL_count"); /* Release all the items from the list */ - ret=H5SL_release(slist); + ret = H5SL_release(slist); CHECK(ret, FAIL, "H5SL_release"); /* Close the skip list */ - ret=H5SL_close(slist); + ret = H5SL_close(slist); CHECK(ret, FAIL, "H5SL_close"); } /* end test_skiplist_insert_many() */ @@ -276,14 +279,14 @@ test_skiplist_insert_many(void) static void test_skiplist_remove(void) { - H5SL_t *slist; /* Skip list created */ - int key1, /* Key of 1st item to insert */ - key2, /* Key of 2nd item to insert */ - key3; /* Key of 3rd item to insert */ - int search_key; /* Key of item to search for in skip list */ - int *found_item; /* Item found in skip list */ - size_t num; /* Number of elements in skip list */ - herr_t ret; /* Generic return value */ + H5SL_t *slist; /* Skip list created */ + int key1, /* Key of 1st item to insert */ + key2, /* Key of 2nd item to insert */ + key3; /* Key of 3rd item to insert */ + int search_key; /* Key of item to search for in skip list */ + int * found_item; /* Item found in skip list */ + size_t num; /* Number of elements in skip list */ + herr_t ret; /* Generic return value */ /* Output message about test being performed */ MESSAGE(7, ("Testing Removal From Skip List\n")); @@ -293,58 +296,58 @@ test_skiplist_remove(void) CHECK_PTR(slist, "H5SL_create"); /* Check that the skip list has no elements */ - num=H5SL_count(slist); + num = H5SL_count(slist); VERIFY(num, 0, "H5SL_count"); /* Try removing an item in empty skip list */ - search_key=37; - found_item=(int *)H5SL_remove(slist,&search_key); + search_key = 37; + found_item = (int *)H5SL_remove(slist, &search_key); CHECK_PTR_NULL(found_item, "H5SL_remove"); /* Insert three objects into the skip list */ - key1=15; - ret=H5SL_insert(slist,&key1,&key1); + key1 = 15; + ret = H5SL_insert(slist, &key1, &key1); CHECK(ret, FAIL, "H5SL_insert"); - key2=10; - ret=H5SL_insert(slist,&key2,&key2); + key2 = 10; + ret = H5SL_insert(slist, &key2, &key2); CHECK(ret, FAIL, "H5SL_insert"); - key3=20; - ret=H5SL_insert(slist,&key3,&key3); + key3 = 20; + ret = H5SL_insert(slist, &key3, &key3); CHECK(ret, FAIL, "H5SL_insert"); /* Check that the skip list has three elements */ - num=H5SL_count(slist); + num = H5SL_count(slist); VERIFY(num, 3, "H5SL_count"); /* Try removing items from skip list */ - search_key=key1; - found_item=(int *)H5SL_remove(slist,&search_key); + search_key = key1; + found_item = (int *)H5SL_remove(slist, &search_key); CHECK_PTR(found_item, "H5SL_remove"); CHECK_PTR_EQ(found_item, &key1, "H5SL_remove"); - search_key=key2; - found_item=(int *)H5SL_remove(slist,&search_key); + search_key = key2; + found_item = (int *)H5SL_remove(slist, &search_key); CHECK_PTR(found_item, "H5SL_remove"); CHECK_PTR_EQ(found_item, &key2, "H5SL_remove"); - search_key=key3; - found_item=(int *)H5SL_remove(slist,&search_key); + search_key = key3; + found_item = (int *)H5SL_remove(slist, &search_key); CHECK_PTR(found_item, "H5SL_remove"); CHECK_PTR_EQ(found_item, &key3, "H5SL_remove"); /* Check that the skip list has no elements */ - num=H5SL_count(slist); + num = H5SL_count(slist); VERIFY(num, 0, "H5SL_count"); /* Try removing items from empty skip list (after its been worked on) */ - search_key=key1; - found_item=(int *)H5SL_remove(slist,&search_key); + search_key = key1; + found_item = (int *)H5SL_remove(slist, &search_key); CHECK_PTR_NULL(found_item, "H5SL_remove"); /* Close the skip list */ - ret=H5SL_close(slist); + ret = H5SL_close(slist); CHECK(ret, FAIL, "H5SL_close"); } /* end test_skiplist_remove() */ @@ -359,10 +362,10 @@ static void test_skiplist_remove_many(void) { H5SL_t *slist; /* Skip list created */ - size_t num; /* Number of elements in skip list */ - size_t u; /* Local index variable */ - int *found_item; /* Item found in skip list */ - herr_t ret; /* Generic return value */ + size_t num; /* Number of elements in skip list */ + size_t u; /* Local index variable */ + int * found_item; /* Item found in skip list */ + herr_t ret; /* Generic return value */ /* Output message about test being performed */ MESSAGE(7, ("Testing Removal of Many Items From Skip List\n")); @@ -372,78 +375,80 @@ test_skiplist_remove_many(void) CHECK_PTR(slist, "H5SL_create"); /* Check that the skip list has no elements */ - num=H5SL_count(slist); + num = H5SL_count(slist); VERIFY(num, 0, "H5SL_count"); /* Insert many objects into the skip list */ - for(u=0; u<NUM_ELEMS; u++) { - ret=H5SL_insert(slist,&rand_num[u],&rand_num[u]); + for (u = 0; u < NUM_ELEMS; u++) { + ret = H5SL_insert(slist, &rand_num[u], &rand_num[u]); CHECK(ret, FAIL, "H5SL_insert"); } /* end for */ /* Check that the skip list has correct # of elements */ - num=H5SL_count(slist); + num = H5SL_count(slist); VERIFY(num, NUM_ELEMS, "H5SL_count"); /* Remove all objects from the skip list (in random order) */ - for(u=0; u<NUM_ELEMS; u++) { - found_item=(int *)H5SL_remove(slist,&rand_num[u]); + for (u = 0; u < NUM_ELEMS; u++) { + found_item = (int *)H5SL_remove(slist, &rand_num[u]); CHECK_PTR(found_item, "H5SL_remove"); - VERIFY(*found_item,rand_num[u],"H5SL_remove"); + VERIFY(*found_item, rand_num[u], "H5SL_remove"); } /* end for */ /* Check that the skip list has correct # of elements */ - num=H5SL_count(slist); + num = H5SL_count(slist); VERIFY(num, 0, "H5SL_count"); -/* Insert & remove again (in sorted order), to check that completely empty skip lists can be added again */ + /* Insert & remove again (in sorted order), to check that completely empty skip lists can be added again + */ /* Insert many objects into the skip list */ - for(u=0; u<NUM_ELEMS; u++) { - ret=H5SL_insert(slist,&rand_num[u],&rand_num[u]); + for (u = 0; u < NUM_ELEMS; u++) { + ret = H5SL_insert(slist, &rand_num[u], &rand_num[u]); CHECK(ret, FAIL, "H5SL_insert"); } /* end for */ /* Check that the skip list has correct # of elements */ - num=H5SL_count(slist); + num = H5SL_count(slist); VERIFY(num, NUM_ELEMS, "H5SL_count"); /* Remove all objects from the skip list */ - for(u=0; u<NUM_ELEMS; u++) { - found_item=(int *)H5SL_remove(slist,&sort_rand_num[u]); + for (u = 0; u < NUM_ELEMS; u++) { + found_item = (int *)H5SL_remove(slist, &sort_rand_num[u]); CHECK_PTR(found_item, "H5SL_remove"); - VERIFY(*found_item,sort_rand_num[u],"H5SL_remove"); + VERIFY(*found_item, sort_rand_num[u], "H5SL_remove"); } /* end for */ /* Check that the skip list has correct # of elements */ - num=H5SL_count(slist); + num = H5SL_count(slist); VERIFY(num, 0, "H5SL_count"); -/* Insert & remove again (in reverse sorted order), to check that completely empty skip lists can be added again */ + /* Insert & remove again (in reverse sorted order), to check that completely empty skip lists can be added + * again */ /* Insert many objects into the skip list */ - for(u=0; u<NUM_ELEMS; u++) { - ret=H5SL_insert(slist,&rand_num[u],&rand_num[u]); + for (u = 0; u < NUM_ELEMS; u++) { + ret = H5SL_insert(slist, &rand_num[u], &rand_num[u]); CHECK(ret, FAIL, "H5SL_insert"); } /* end for */ /* Check that the skip list has correct # of elements */ - num=H5SL_count(slist); + num = H5SL_count(slist); VERIFY(num, NUM_ELEMS, "H5SL_count"); /* Remove all objects from the skip list */ - for(u=0; u<NUM_ELEMS; u++) { - found_item=(int *)H5SL_remove(slist,&rev_sort_rand_num[u]); + for (u = 0; u < NUM_ELEMS; u++) { + found_item = (int *)H5SL_remove(slist, &rev_sort_rand_num[u]); CHECK_PTR(found_item, "H5SL_remove"); - VERIFY(*found_item,rev_sort_rand_num[u],"H5SL_remove"); + VERIFY(*found_item, rev_sort_rand_num[u], "H5SL_remove"); } /* end for */ /* Check that the skip list has correct # of elements */ - num=H5SL_count(slist); + num = H5SL_count(slist); VERIFY(num, 0, "H5SL_count"); /* Close the skip list */ - ret=H5SL_close(slist); + ret = H5SL_close(slist); CHECK(ret, FAIL, "H5SL_close"); } /* end test_skiplist_remove_many() */ @@ -457,12 +462,12 @@ test_skiplist_remove_many(void) static void test_skiplist_firstnext(void) { - H5SL_t *slist; /* Skip list created */ - H5SL_node_t *node; /* Skip list node */ - size_t num; /* Number of elements in skip list */ - size_t u; /* Local index variable */ - int *found_item; /* Item found in skip list */ - herr_t ret; /* Generic return value */ + H5SL_t * slist; /* Skip list created */ + H5SL_node_t *node; /* Skip list node */ + size_t num; /* Number of elements in skip list */ + size_t u; /* Local index variable */ + int * found_item; /* Item found in skip list */ + herr_t ret; /* Generic return value */ /* Output message about test being performed */ MESSAGE(7, ("Testing Iterating Over Skip List With First/Next\n")); @@ -472,44 +477,44 @@ test_skiplist_firstnext(void) CHECK_PTR(slist, "H5SL_create"); /* Check that the skip list has no elements */ - num=H5SL_count(slist); + num = H5SL_count(slist); VERIFY(num, 0, "H5SL_count"); /* Check that the list appears empty */ - node=H5SL_first(slist); + node = H5SL_first(slist); CHECK_PTR_NULL(node, "H5SL_first"); /* Insert many objects into the skip list */ - for(u=0; u<NUM_ELEMS; u++) { - ret=H5SL_insert(slist,&rand_num[u],&rand_num[u]); + for (u = 0; u < NUM_ELEMS; u++) { + ret = H5SL_insert(slist, &rand_num[u], &rand_num[u]); CHECK(ret, FAIL, "H5SL_insert"); } /* end for */ /* Check that the skip list has correct # of elements */ - num=H5SL_count(slist); + num = H5SL_count(slist); VERIFY(num, NUM_ELEMS, "H5SL_count"); /* Iterate over all the nodes in the skip list */ - node=H5SL_first(slist); + node = H5SL_first(slist); CHECK_PTR(node, "H5SL_first"); - u=0; - while(node!=NULL) { - found_item=(int *)H5SL_item(node); - VERIFY(*found_item,sort_rand_num[u],"H5SL_next"); + u = 0; + while (node != NULL) { + found_item = (int *)H5SL_item(node); + VERIFY(*found_item, sort_rand_num[u], "H5SL_next"); u++; - node=H5SL_next(node); + node = H5SL_next(node); } /* end while */ /* Release all the items from the list */ - ret=H5SL_release(slist); + ret = H5SL_release(slist); CHECK(ret, FAIL, "H5SL_release"); /* Check that the list appears empty again */ - node=H5SL_first(slist); + node = H5SL_first(slist); CHECK_PTR_NULL(node, "H5SL_first"); /* Close the skip list */ - ret=H5SL_close(slist); + ret = H5SL_close(slist); CHECK(ret, FAIL, "H5SL_close"); } /* end test_skiplist_firstnext() */ @@ -523,39 +528,20 @@ test_skiplist_firstnext(void) static void test_skiplist_string(void) { - H5SL_t *slist; /* Skip list created */ + H5SL_t * slist; /* Skip list created */ H5SL_node_t *node; /* Skip list node */ - size_t num; /* Number of elements in skip list */ - size_t u; /* Local index variable */ + size_t num; /* Number of elements in skip list */ + size_t u; /* Local index variable */ typedef struct string_node { - int i; + int i; const char *s; } string_node; - string_node data[10]={ - {10,"10"}, - {20,"20"}, - {15,"15"}, - { 5,"05"}, - {50,"50"}, - {30,"30"}, - {31,"31"}, - {32,"32"}, - {80,"80"}, - {90,"90"}}; - string_node hashed_data[10]={ - { 5,"05"}, - {10,"10"}, - {15,"15"}, - {20,"20"}, - {30,"30"}, - {31,"31"}, - {32,"32"}, - {50,"50"}, - {80,"80"}, - {90,"90"} - }; - string_node *found_item; /* Item found in skip list */ - herr_t ret; /* Generic return value */ + string_node data[10] = {{10, "10"}, {20, "20"}, {15, "15"}, {5, "05"}, {50, "50"}, + {30, "30"}, {31, "31"}, {32, "32"}, {80, "80"}, {90, "90"}}; + string_node hashed_data[10] = {{5, "05"}, {10, "10"}, {15, "15"}, {20, "20"}, {30, "30"}, + {31, "31"}, {32, "32"}, {50, "50"}, {80, "80"}, {90, "90"}}; + string_node *found_item; /* Item found in skip list */ + herr_t ret; /* Generic return value */ /* Output message about test being performed */ MESSAGE(7, ("Testing Skip List With String Keys\n")); @@ -565,31 +551,31 @@ test_skiplist_string(void) CHECK_PTR(slist, "H5SL_create"); /* Check that the skip list has no elements */ - num=H5SL_count(slist); + num = H5SL_count(slist); VERIFY(num, 0, "H5SL_count"); /* Insert objects into the skip list */ - for(u=0; u<10; u++) { - ret=H5SL_insert(slist,&data[u],data[u].s); + for (u = 0; u < 10; u++) { + ret = H5SL_insert(slist, &data[u], data[u].s); CHECK(ret, FAIL, "H5SL_insert"); } /* end for */ /* Check that the skip list has correct # of elements */ - num=H5SL_count(slist); + num = H5SL_count(slist); VERIFY(num, 10, "H5SL_count"); /* Iterate over all the nodes in the skip list */ - node=H5SL_first(slist); - u=0; - while(node!=NULL) { - found_item=(string_node *)H5SL_item(node); + node = H5SL_first(slist); + u = 0; + while (node != NULL) { + found_item = (string_node *)H5SL_item(node); VERIFY(found_item->i, hashed_data[u].i, "H5SL_next"); u++; - node=H5SL_next(node); + node = H5SL_next(node); } /* end while */ /* Close the skip list */ - ret=H5SL_close(slist); + ret = H5SL_close(slist); CHECK(ret, FAIL, "H5SL_close"); } /* end test_skiplist_string() */ @@ -597,12 +583,12 @@ test_skiplist_string(void) static herr_t test_skiplist_iter(void *item, void H5_ATTR_UNUSED *key, void *op_data) { - size_t *up=(size_t *)op_data; + size_t *up = (size_t *)op_data; - VERIFY(*(int *)item,sort_rand_num[*up],"H5SL_iterate"); + VERIFY(*(int *)item, sort_rand_num[*up], "H5SL_iterate"); (*up)++; - return(0); + return (0); } /**************************************************************** @@ -614,10 +600,10 @@ test_skiplist_iter(void *item, void H5_ATTR_UNUSED *key, void *op_data) static void test_skiplist_iterate(void) { - H5SL_t *slist; /* Skip list created */ - size_t num; /* Number of elements in skip list */ - size_t u; /* Local index variable */ - herr_t ret; /* Generic return value */ + H5SL_t *slist; /* Skip list created */ + size_t num; /* Number of elements in skip list */ + size_t u; /* Local index variable */ + herr_t ret; /* Generic return value */ /* Output message about test being performed */ MESSAGE(7, ("Testing Iterating Over Skip List\n")); @@ -627,26 +613,26 @@ test_skiplist_iterate(void) CHECK_PTR(slist, "H5SL_create"); /* Check that the skip list has no elements */ - num=H5SL_count(slist); + num = H5SL_count(slist); VERIFY(num, 0, "H5SL_count"); /* Insert many objects into the skip list */ - for(u=0; u<NUM_ELEMS; u++) { - ret=H5SL_insert(slist,&rand_num[u],&rand_num[u]); + for (u = 0; u < NUM_ELEMS; u++) { + ret = H5SL_insert(slist, &rand_num[u], &rand_num[u]); CHECK(ret, FAIL, "H5SL_insert"); } /* end for */ /* Check that the skip list has correct # of elements */ - num=H5SL_count(slist); + num = H5SL_count(slist); VERIFY(num, NUM_ELEMS, "H5SL_count"); /* Iterate over all the nodes in the skip list */ - u=0; - ret=H5SL_iterate(slist,test_skiplist_iter,&u); + u = 0; + ret = H5SL_iterate(slist, test_skiplist_iter, &u); CHECK(ret, FAIL, "H5SL_iterate"); /* Close the skip list */ - ret=H5SL_close(slist); + ret = H5SL_close(slist); CHECK(ret, FAIL, "H5SL_close"); } /* end test_skiplist_iterate() */ @@ -660,14 +646,14 @@ test_skiplist_iterate(void) static void test_skiplist_hsize(void) { - H5SL_t *slist; /* Skip list created */ + H5SL_t * slist; /* Skip list created */ H5SL_node_t *node; /* Skip list node */ - size_t num; /* Number of elements in skip list */ - size_t u; /* Local index variable */ - hsize_t data[10]={ 10, 20, 15, 5, 50, 30, 31, 32, 80, 90}; - hsize_t sorted_data[10]={ 5, 10, 15, 20, 30, 31, 32, 50, 80, 90}; - hsize_t *found_item; /* Item found in skip list */ - herr_t ret; /* Generic return value */ + size_t num; /* Number of elements in skip list */ + size_t u; /* Local index variable */ + hsize_t data[10] = {10, 20, 15, 5, 50, 30, 31, 32, 80, 90}; + hsize_t sorted_data[10] = {5, 10, 15, 20, 30, 31, 32, 50, 80, 90}; + hsize_t * found_item; /* Item found in skip list */ + herr_t ret; /* Generic return value */ /* Output message about test being performed */ MESSAGE(7, ("Testing Skip List With hsize_t Keys\n")); @@ -677,31 +663,31 @@ test_skiplist_hsize(void) CHECK_PTR(slist, "H5SL_create"); /* Check that the skip list has no elements */ - num=H5SL_count(slist); + num = H5SL_count(slist); VERIFY(num, 0, "H5SL_count"); /* Insert objects into the skip list */ - for(u=0; u<10; u++) { - ret=H5SL_insert(slist,&data[u],&data[u]); + for (u = 0; u < 10; u++) { + ret = H5SL_insert(slist, &data[u], &data[u]); CHECK(ret, FAIL, "H5SL_insert"); } /* end for */ /* Check that the skip list has correct # of elements */ - num=H5SL_count(slist); + num = H5SL_count(slist); VERIFY(num, 10, "H5SL_count"); /* Iterate over all the nodes in the skip list */ - node=H5SL_first(slist); - u=0; - while(node!=NULL) { - found_item=(hsize_t *)H5SL_item(node); - VERIFY(*found_item,sorted_data[u],"H5SL_next"); + node = H5SL_first(slist); + u = 0; + while (node != NULL) { + found_item = (hsize_t *)H5SL_item(node); + VERIFY(*found_item, sorted_data[u], "H5SL_next"); u++; - node=H5SL_next(node); + node = H5SL_next(node); } /* end while */ /* Close the skip list */ - ret=H5SL_close(slist); + ret = H5SL_close(slist); CHECK(ret, FAIL, "H5SL_close"); } /* end test_skiplist_hsize() */ @@ -715,14 +701,14 @@ test_skiplist_hsize(void) static void test_skiplist_unsigned(void) { - H5SL_t *slist; /* Skip list created */ + H5SL_t * slist; /* Skip list created */ H5SL_node_t *node; /* Skip list node */ - size_t num; /* Number of elements in skip list */ - size_t u; /* Local index variable */ - unsigned data[10]={ 10, 20, 15, 5, 50, 30, 31, 32, 80, 90}; - unsigned sorted_data[10]={ 5, 10, 15, 20, 30, 31, 32, 50, 80, 90}; - unsigned *found_item; /* Item found in skip list */ - herr_t ret; /* Generic return value */ + size_t num; /* Number of elements in skip list */ + size_t u; /* Local index variable */ + unsigned data[10] = {10, 20, 15, 5, 50, 30, 31, 32, 80, 90}; + unsigned sorted_data[10] = {5, 10, 15, 20, 30, 31, 32, 50, 80, 90}; + unsigned * found_item; /* Item found in skip list */ + herr_t ret; /* Generic return value */ /* Output message about test being performed */ MESSAGE(7, ("Testing Skip List With unsigned Keys\n")); @@ -732,31 +718,31 @@ test_skiplist_unsigned(void) CHECK_PTR(slist, "H5SL_create"); /* Check that the skip list has no elements */ - num=H5SL_count(slist); + num = H5SL_count(slist); VERIFY(num, 0, "H5SL_count"); /* Insert objects into the skip list */ - for(u=0; u<10; u++) { - ret=H5SL_insert(slist,&data[u],&data[u]); + for (u = 0; u < 10; u++) { + ret = H5SL_insert(slist, &data[u], &data[u]); CHECK(ret, FAIL, "H5SL_insert"); } /* end for */ /* Check that the skip list has correct # of elements */ - num=H5SL_count(slist); + num = H5SL_count(slist); VERIFY(num, 10, "H5SL_count"); /* Iterate over all the nodes in the skip list */ - node=H5SL_first(slist); - u=0; - while(node!=NULL) { - found_item=(unsigned *)H5SL_item(node); - VERIFY(*found_item,sorted_data[u],"H5SL_next"); + node = H5SL_first(slist); + u = 0; + while (node != NULL) { + found_item = (unsigned *)H5SL_item(node); + VERIFY(*found_item, sorted_data[u], "H5SL_next"); u++; - node=H5SL_next(node); + node = H5SL_next(node); } /* end while */ /* Close the skip list */ - ret=H5SL_close(slist); + ret = H5SL_close(slist); CHECK(ret, FAIL, "H5SL_close"); } /* end test_skiplist_unsigned() */ @@ -770,14 +756,16 @@ test_skiplist_unsigned(void) static void test_skiplist_obj(void) { - H5SL_t *slist; /* Skip list created */ + H5SL_t * slist; /* Skip list created */ H5SL_node_t *node; /* Skip list node */ - size_t num; /* Number of elements in skip list */ - size_t u; /* Local index variable */ - H5_obj_t data[10]={ {10, 12}, {20, 12}, {10, 32}, {10, 11}, {50, 1}, {8, 12}, {31, 12}, {20, 11}, {31, 11}, {8, 32} }; - H5_obj_t sorted_data[10]={ {8, 12}, {8, 32}, {10, 11}, {10, 12}, {10, 32}, {20, 11}, {20, 12}, {31, 11}, {31, 12}, {50, 1} }; - H5_obj_t *found_item; /* Item found in skip list */ - herr_t ret; /* Generic return value */ + size_t num; /* Number of elements in skip list */ + size_t u; /* Local index variable */ + H5_obj_t data[10] = {{10, 12}, {20, 12}, {10, 32}, {10, 11}, {50, 1}, + {8, 12}, {31, 12}, {20, 11}, {31, 11}, {8, 32}}; + H5_obj_t sorted_data[10] = {{8, 12}, {8, 32}, {10, 11}, {10, 12}, {10, 32}, + {20, 11}, {20, 12}, {31, 11}, {31, 12}, {50, 1}}; + H5_obj_t * found_item; /* Item found in skip list */ + herr_t ret; /* Generic return value */ /* Output message about test being performed */ MESSAGE(7, ("Testing Skip List With H5_obj_t Keys\n")); @@ -787,32 +775,32 @@ test_skiplist_obj(void) CHECK_PTR(slist, "H5SL_create"); /* Check that the skip list has no elements */ - num=H5SL_count(slist); + num = H5SL_count(slist); VERIFY(num, 0, "H5SL_count"); /* Insert objects into the skip list */ - for(u=0; u<10; u++) { - ret=H5SL_insert(slist,&data[u],&data[u]); + for (u = 0; u < 10; u++) { + ret = H5SL_insert(slist, &data[u], &data[u]); CHECK(ret, FAIL, "H5SL_insert"); } /* end for */ /* Check that the skip list has correct # of elements */ - num=H5SL_count(slist); + num = H5SL_count(slist); VERIFY(num, 10, "H5SL_count"); /* Iterate over all the nodes in the skip list */ - node=H5SL_first(slist); - u=0; - while(node!=NULL) { - found_item=(H5_obj_t *)H5SL_item(node); - VERIFY(found_item->fileno,sorted_data[u].fileno,"H5SL_next"); - VERIFY(found_item->addr,sorted_data[u].addr,"H5SL_next"); + node = H5SL_first(slist); + u = 0; + while (node != NULL) { + found_item = (H5_obj_t *)H5SL_item(node); + VERIFY(found_item->fileno, sorted_data[u].fileno, "H5SL_next"); + VERIFY(found_item->addr, sorted_data[u].addr, "H5SL_next"); u++; - node=H5SL_next(node); + node = H5SL_next(node); } /* end while */ /* Close the skip list */ - ret=H5SL_close(slist); + ret = H5SL_close(slist); CHECK(ret, FAIL, "H5SL_close"); } /* end test_skiplist_obj() */ @@ -833,13 +821,14 @@ typedef struct generic_t { static int test_skiplist_generic_cmp(const void *_key1, const void *_key2) { - const generic_t *key1 = (const generic_t *)_key1; - const generic_t *key2 = (const generic_t *)_key2; - long long result = (long long)(key1->a) - (long long)(key1->b) - (long long)(key2->a) + (long long)(key2->b); + const generic_t *key1 = (const generic_t *)_key1; + const generic_t *key2 = (const generic_t *)_key2; + long long result = + (long long)(key1->a) - (long long)(key1->b) - (long long)(key2->a) + (long long)(key2->b); - if(result < 0) + if (result < 0) return -1; - else if(result > 0) + else if (result > 0) return 1; else return 0; @@ -848,14 +837,16 @@ test_skiplist_generic_cmp(const void *_key1, const void *_key2) static void test_skiplist_generic(void) { - H5SL_t *slist; /* Skip list created */ + H5SL_t * slist; /* Skip list created */ H5SL_node_t *node; /* Skip list node */ - size_t num; /* Number of elements in skip list */ - size_t u; /* Local index variable */ - generic_t data[10]={ {10, 1}, {20, 13}, {15, 32}, {5, 2}, {50, 37}, {30, 100}, {31, 38}, {32, 34}, {80, 32}, {90, 0} }; - generic_t sorted_data[10]={ {30, 100}, {15, 32}, {31, 38}, {32, 34}, {5, 2}, {20, 13}, {10, 1}, {50, 37}, {80, 32}, {90, 0} }; - generic_t *found_item; /* Item found in skip list */ - herr_t ret; /* Generic return value */ + size_t num; /* Number of elements in skip list */ + size_t u; /* Local index variable */ + generic_t data[10] = {{10, 1}, {20, 13}, {15, 32}, {5, 2}, {50, 37}, + {30, 100}, {31, 38}, {32, 34}, {80, 32}, {90, 0}}; + generic_t sorted_data[10] = {{30, 100}, {15, 32}, {31, 38}, {32, 34}, {5, 2}, + {20, 13}, {10, 1}, {50, 37}, {80, 32}, {90, 0}}; + generic_t * found_item; /* Item found in skip list */ + herr_t ret; /* Generic return value */ /* Output message about test being performed */ MESSAGE(7, ("Testing Skip List With generic Keys\n")); @@ -865,32 +856,32 @@ test_skiplist_generic(void) CHECK_PTR(slist, "H5SL_create"); /* Check that the skip list has no elements */ - num=H5SL_count(slist); + num = H5SL_count(slist); VERIFY(num, 0, "H5SL_count"); /* Insert objects into the skip list */ - for(u=0; u<10; u++) { - ret=H5SL_insert(slist,&data[u],&data[u]); + for (u = 0; u < 10; u++) { + ret = H5SL_insert(slist, &data[u], &data[u]); CHECK(ret, FAIL, "H5SL_insert"); } /* end for */ /* Check that the skip list has correct # of elements */ - num=H5SL_count(slist); + num = H5SL_count(slist); VERIFY(num, 10, "H5SL_count"); /* Iterate over all the nodes in the skip list */ - node=H5SL_first(slist); - u=0; - while(node!=NULL) { - found_item=(generic_t *)H5SL_item(node); - VERIFY(found_item->a,sorted_data[u].a,"H5SL_next"); - VERIFY(found_item->b,sorted_data[u].b,"H5SL_next"); + node = H5SL_first(slist); + u = 0; + while (node != NULL) { + found_item = (generic_t *)H5SL_item(node); + VERIFY(found_item->a, sorted_data[u].a, "H5SL_next"); + VERIFY(found_item->b, sorted_data[u].b, "H5SL_next"); u++; - node=H5SL_next(node); + node = H5SL_next(node); } /* end while */ /* Close the skip list */ - ret=H5SL_close(slist); + ret = H5SL_close(slist); CHECK(ret, FAIL, "H5SL_close"); } /* end test_skiplist_generic() */ @@ -904,12 +895,12 @@ test_skiplist_generic(void) static void test_skiplist_lastprev(void) { - H5SL_t *slist; /* Skip list created */ - H5SL_node_t *node; /* Skip list node */ - size_t num; /* Number of elements in skip list */ - size_t u; /* Local index variable */ - int *found_item; /* Item found in skip list */ - herr_t ret; /* Generic return value */ + H5SL_t * slist; /* Skip list created */ + H5SL_node_t *node; /* Skip list node */ + size_t num; /* Number of elements in skip list */ + size_t u; /* Local index variable */ + int * found_item; /* Item found in skip list */ + herr_t ret; /* Generic return value */ /* Output message about test being performed */ MESSAGE(7, ("Testing Iterating Over Skip List With Last/Prev\n")); @@ -919,44 +910,44 @@ test_skiplist_lastprev(void) CHECK_PTR(slist, "H5SL_create"); /* Check that the skip list has no elements */ - num=H5SL_count(slist); + num = H5SL_count(slist); VERIFY(num, 0, "H5SL_count"); /* Check that the list appears empty */ - node=H5SL_last(slist); + node = H5SL_last(slist); CHECK_PTR_NULL(node, "H5SL_last"); /* Insert many objects into the skip list */ - for(u=0; u<NUM_ELEMS; u++) { - ret=H5SL_insert(slist,&rand_num[u],&rand_num[u]); + for (u = 0; u < NUM_ELEMS; u++) { + ret = H5SL_insert(slist, &rand_num[u], &rand_num[u]); CHECK(ret, FAIL, "H5SL_insert"); } /* end for */ /* Check that the skip list has correct # of elements */ - num=H5SL_count(slist); + num = H5SL_count(slist); VERIFY(num, NUM_ELEMS, "H5SL_count"); /* Iterate over all the nodes in the skip list */ - node=H5SL_last(slist); + node = H5SL_last(slist); CHECK_PTR(node, "H5SL_last"); - u=NUM_ELEMS-1; - while(node!=NULL) { - found_item=(int *)H5SL_item(node); - VERIFY(*found_item,sort_rand_num[u],"H5SL_prev"); + u = NUM_ELEMS - 1; + while (node != NULL) { + found_item = (int *)H5SL_item(node); + VERIFY(*found_item, sort_rand_num[u], "H5SL_prev"); u--; - node=H5SL_prev(node); + node = H5SL_prev(node); } /* end while */ /* Release all the items from the list */ - ret=H5SL_release(slist); + ret = H5SL_release(slist); CHECK(ret, FAIL, "H5SL_release"); /* Check that the list appears empty again */ - node=H5SL_last(slist); + node = H5SL_last(slist); CHECK_PTR_NULL(node, "H5SL_last"); /* Close the skip list */ - ret=H5SL_close(slist); + ret = H5SL_close(slist); CHECK(ret, FAIL, "H5SL_close"); } /* end test_skiplist_lastprev() */ @@ -970,14 +961,14 @@ test_skiplist_lastprev(void) static void test_skiplist_find(void) { - H5SL_t *slist; /* Skip list created */ + H5SL_t * slist; /* Skip list created */ H5SL_node_t *node; /* Skip list node */ - size_t u; /* Local index variable */ - unsigned data[10]={ 10, 20, 15, 5, 50, 30, 31, 32, 80, 90}; - unsigned sorted_data[10]={ 5, 10, 15, 20, 30, 31, 32, 50, 80, 90}; - unsigned *found_item; /* Item found in skip list */ - unsigned find_item; /* Item to find in skip list */ - herr_t ret; /* Generic return value */ + size_t u; /* Local index variable */ + unsigned data[10] = {10, 20, 15, 5, 50, 30, 31, 32, 80, 90}; + unsigned sorted_data[10] = {5, 10, 15, 20, 30, 31, 32, 50, 80, 90}; + unsigned * found_item; /* Item found in skip list */ + unsigned find_item; /* Item to find in skip list */ + herr_t ret; /* Generic return value */ /* Output message about test being performed */ MESSAGE(7, ("Testing Skip List 'Find' Operation\n")); @@ -987,32 +978,32 @@ test_skiplist_find(void) CHECK_PTR(slist, "H5SL_create"); /* Insert objects into the skip list */ - for(u=0; u<10; u++) { - ret=H5SL_insert(slist,&data[u],&data[u]); + for (u = 0; u < 10; u++) { + ret = H5SL_insert(slist, &data[u], &data[u]); CHECK(ret, FAIL, "H5SL_insert"); } /* end for */ /* Find the element with key==30 in the skip list */ - find_item=30; - node=H5SL_find(slist,&find_item); + find_item = 30; + node = H5SL_find(slist, &find_item); CHECK_PTR(node, "H5SL_find"); /* Iterate over the rest of the nodes in the skip list */ - u=4; - while(node!=NULL) { - found_item=(unsigned *)H5SL_item(node); - VERIFY(*found_item,sorted_data[u],"H5SL_next"); + u = 4; + while (node != NULL) { + found_item = (unsigned *)H5SL_item(node); + VERIFY(*found_item, sorted_data[u], "H5SL_next"); u++; - node=H5SL_next(node); + node = H5SL_next(node); } /* end while */ /* Check for trying to locate non-existent item */ - find_item=81; - node=H5SL_find(slist,&find_item); + find_item = 81; + node = H5SL_find(slist, &find_item); CHECK_PTR_NULL(node, "H5SL_find"); /* Close the skip list */ - ret=H5SL_close(slist); + ret = H5SL_close(slist); CHECK(ret, FAIL, "H5SL_close"); } /* end test_skiplist_find() */ @@ -1026,14 +1017,14 @@ test_skiplist_find(void) static void test_skiplist_add(void) { - H5SL_t *slist; /* Skip list created */ + H5SL_t * slist; /* Skip list created */ H5SL_node_t *node; /* Skip list node */ - size_t u; /* Local index variable */ - unsigned data[10]={ 10, 20, 15, 5, 50, 30, 31, 32, 80, 90}; - unsigned sorted_data[10]={ 5, 10, 15, 20, 30, 31, 32, 50, 80, 90}; - unsigned *found_item; /* Item found in skip list */ - unsigned new_item; /* Item to add to skip list */ - herr_t ret; /* Generic return value */ + size_t u; /* Local index variable */ + unsigned data[10] = {10, 20, 15, 5, 50, 30, 31, 32, 80, 90}; + unsigned sorted_data[10] = {5, 10, 15, 20, 30, 31, 32, 50, 80, 90}; + unsigned * found_item; /* Item found in skip list */ + unsigned new_item; /* Item to add to skip list */ + herr_t ret; /* Generic return value */ /* Output message about test being performed */ MESSAGE(7, ("Testing Skip List 'Add' Operation\n")); @@ -1043,31 +1034,31 @@ test_skiplist_add(void) CHECK_PTR(slist, "H5SL_create"); /* Insert objects into the skip list */ - for(u=0; u<10; u++) { - ret=H5SL_insert(slist,&data[u],&data[u]); + for (u = 0; u < 10; u++) { + ret = H5SL_insert(slist, &data[u], &data[u]); CHECK(ret, FAIL, "H5SL_insert"); } /* end for */ /* Add the element with key==12 in the skip list */ - new_item=12; - node=H5SL_add(slist,&new_item,&new_item); + new_item = 12; + node = H5SL_add(slist, &new_item, &new_item); CHECK_PTR(node, "H5SL_add"); /* Advance to next node in list */ - node=H5SL_next(node); + node = H5SL_next(node); CHECK_PTR(node, "H5SL_next"); /* Iterate over the rest of the nodes in the skip list */ - u=2; - while(node!=NULL) { - found_item=(unsigned *)H5SL_item(node); - VERIFY(*found_item,sorted_data[u],"H5SL_item"); + u = 2; + while (node != NULL) { + found_item = (unsigned *)H5SL_item(node); + VERIFY(*found_item, sorted_data[u], "H5SL_item"); u++; - node=H5SL_next(node); + node = H5SL_next(node); } /* end while */ /* Close the skip list */ - ret=H5SL_close(slist); + ret = H5SL_close(slist); CHECK(ret, FAIL, "H5SL_close"); } /* end test_skiplist_add() */ @@ -1075,12 +1066,12 @@ test_skiplist_add(void) static herr_t test_skiplist_destroy_free(void *item, void H5_ATTR_UNUSED *key, void *op_data) { - unsigned *free_count=(unsigned *)op_data; + unsigned *free_count = (unsigned *)op_data; - VERIFY(*(int *)item,sort_rand_num[*free_count],"H5SL_destroy"); + VERIFY(*(int *)item, sort_rand_num[*free_count], "H5SL_destroy"); (*free_count)++; - return(0); + return (0); } /**************************************************************** @@ -1092,10 +1083,10 @@ test_skiplist_destroy_free(void *item, void H5_ATTR_UNUSED *key, void *op_data) static void test_skiplist_destroy(void) { - H5SL_t *slist; /* Skip list created */ - size_t u; /* Local index variable */ + H5SL_t * slist; /* Skip list created */ + size_t u; /* Local index variable */ unsigned free_count; /* Number of items freed */ - herr_t ret; /* Generic return value */ + herr_t ret; /* Generic return value */ /* Output message about test being performed */ MESSAGE(7, ("Testing Skip List 'Destroy' Operation\n")); @@ -1105,14 +1096,14 @@ test_skiplist_destroy(void) CHECK_PTR(slist, "H5SL_create"); /* Insert objects into the skip list */ - for(u=0; u<NUM_ELEMS; u++) { - ret=H5SL_insert(slist,&rand_num[u],&rand_num[u]); + for (u = 0; u < NUM_ELEMS; u++) { + ret = H5SL_insert(slist, &rand_num[u], &rand_num[u]); CHECK(ret, FAIL, "H5SL_insert"); } /* end for */ /* Destroy the skip list */ - free_count=0; - ret=H5SL_destroy(slist,test_skiplist_destroy_free,&free_count); + free_count = 0; + ret = H5SL_destroy(slist, test_skiplist_destroy_free, &free_count); CHECK(ret, FAIL, "H5SL_destroy"); VERIFY(free_count, NUM_ELEMS, "H5SL_destroy"); @@ -1127,11 +1118,11 @@ test_skiplist_destroy(void) static void test_skiplist_free(void) { - H5SL_t *slist; /* Skip list created */ - size_t num; /* Number of elements in skip list */ - size_t u; /* Local index variable */ + H5SL_t * slist; /* Skip list created */ + size_t num; /* Number of elements in skip list */ + size_t u; /* Local index variable */ unsigned free_count; /* Number of items freed */ - herr_t ret; /* Generic return value */ + herr_t ret; /* Generic return value */ /* Output message about test being performed */ MESSAGE(7, ("Testing Skip List 'Free' Operation\n")); @@ -1141,33 +1132,33 @@ test_skiplist_free(void) CHECK_PTR(slist, "H5SL_create"); /* Insert objects into the skip list */ - for(u=0; u<NUM_ELEMS; u++) { - ret=H5SL_insert(slist,&rand_num[u],&rand_num[u]); + for (u = 0; u < NUM_ELEMS; u++) { + ret = H5SL_insert(slist, &rand_num[u], &rand_num[u]); CHECK(ret, FAIL, "H5SL_insert"); } /* end for */ /* Destroy the skip list */ - free_count=0; - ret=H5SL_free(slist,test_skiplist_destroy_free,&free_count); + free_count = 0; + ret = H5SL_free(slist, test_skiplist_destroy_free, &free_count); CHECK(ret, FAIL, "H5SL_destroy"); VERIFY(free_count, NUM_ELEMS, "H5SL_free"); /* Check that the skip list has correct # of elements */ - num=H5SL_count(slist); + num = H5SL_count(slist); VERIFY(num, 0, "H5SL_count"); /* Insert objects into the skip list again */ - for(u=0; u<NUM_ELEMS; u++) { - ret=H5SL_insert(slist,&rand_num[u],&rand_num[u]); + for (u = 0; u < NUM_ELEMS; u++) { + ret = H5SL_insert(slist, &rand_num[u], &rand_num[u]); CHECK(ret, FAIL, "H5SL_insert"); } /* end for */ /* Check that the skip list has correct # of elements */ - num=H5SL_count(slist); + num = H5SL_count(slist); VERIFY(num, NUM_ELEMS, "H5SL_count"); /* Close the skip list */ - ret=H5SL_close(slist); + ret = H5SL_close(slist); CHECK(ret, FAIL, "H5SL_close"); } /* end test_skiplist_free() */ @@ -1181,32 +1172,34 @@ test_skiplist_free(void) /* Macro definitions */ #define TEST_TFS_MAX_NOBJS 100 #define TEST_TFS_MIN_NOBJS 5 -#define TEST_TFS_NITER 50 +#define TEST_TFS_NITER 50 /* Structure to hold the list of objects */ typedef struct { - H5SL_t *slist; /* Skiplist holding the objects */ - struct test_tfs_obj_t *list; /* Linear list of objects */ - int nobjs; /* Number of objects in list */ - int nobjs_rem; /* Number of objects in list that have not been freed */ + H5SL_t * slist; /* Skiplist holding the objects */ + struct test_tfs_obj_t *list; /* Linear list of objects */ + int nobjs; /* Number of objects in list */ + int nobjs_rem; /* Number of objects in list that have not been freed */ } test_tfs_list_t; /* Structure for an object */ typedef struct test_tfs_obj_t { - int idx; /* Index (key) for this object */ - int nfrees; /* Number of times this object has been freed */ + int idx; /* Index (key) for this object */ + int nfrees; /* Number of times this object has been freed */ } test_tfs_obj_t; /* op_data struct for H5SL_iterate() */ typedef struct test_tfs_it_ud_t { - test_tfs_list_t *obj_list; /* List of objects */ - int last_idx; /* Index of last object visited in iteration */ - int ncalls; /* Number of times this callback was called */ + test_tfs_list_t *obj_list; /* List of objects */ + int last_idx; /* Index of last object visited in iteration */ + int ncalls; /* Number of times this callback was called */ } test_tfs_it_ud_t; /* iterate callback */ -static herr_t test_tfs_iter(void *_obj, void *key, void *_udata) { - test_tfs_obj_t *obj = (test_tfs_obj_t *)_obj; +static herr_t +test_tfs_iter(void *_obj, void *key, void *_udata) +{ + test_tfs_obj_t * obj = (test_tfs_obj_t *)_obj; test_tfs_it_ud_t *udata = (test_tfs_it_ud_t *)_udata; /* Check consistency */ @@ -1219,21 +1212,23 @@ static herr_t test_tfs_iter(void *_obj, void *key, void *_udata) { /* Verify we were given the correct object */ do { udata->last_idx++; - } while(udata->obj_list->list[udata->last_idx].nfrees != 0); + } while (udata->obj_list->list[udata->last_idx].nfrees != 0); VERIFY(udata->last_idx, obj->idx, "H5SL_iterate"); return 0; } /* end test_tfs_iter() */ /* try_free_safe callback */ -static htri_t test_tfs_free(void *_obj, void *key, void *_obj_list) { - test_tfs_obj_t *obj = (test_tfs_obj_t *)_obj; +static htri_t +test_tfs_free(void *_obj, void *key, void *_obj_list) +{ + test_tfs_obj_t * obj = (test_tfs_obj_t *)_obj; test_tfs_list_t *obj_list = (test_tfs_list_t *)_obj_list; test_tfs_it_ud_t iter_ud; - int nrems, rem_idx, i, j; - test_tfs_obj_t *obj_ret; - herr_t ret; /* return value */ - htri_t ret_value; + int nrems, rem_idx, i, j; + test_tfs_obj_t * obj_ret; + herr_t ret; /* return value */ + htri_t ret_value; /* Check consistency */ CHECK_PTR_EQ((void *)&obj->idx, key, "obj->idx"); @@ -1249,22 +1244,22 @@ static htri_t test_tfs_free(void *_obj, void *key, void *_obj_list) { nrems = (int)(HDrandom() % (long)3); /* Remove objects */ - for(i = 0; i < nrems; i++) + for (i = 0; i < nrems; i++) /* Check nobjs_rem */ - if(obj_list->nobjs_rem > 0) { + if (obj_list->nobjs_rem > 0) { /* Remove a random object from the list */ rem_idx = (int)(HDrandom() % (long)obj_list->nobjs_rem); /* Scan the list, finding the rem_idx'th object that has not been * freed */ - for(j = 0; j < obj_list->nobjs; j++) - if(obj_list->list[j].nfrees == 0) { - if(rem_idx == 0) + for (j = 0; j < obj_list->nobjs; j++) + if (obj_list->list[j].nfrees == 0) { + if (rem_idx == 0) break; else rem_idx--; } /* end if */ - if(j == obj_list->nobjs) + if (j == obj_list->nobjs) ERROR("invalid obj_list"); else { /* Remove the object */ @@ -1273,7 +1268,7 @@ static htri_t test_tfs_free(void *_obj, void *key, void *_obj_list) { obj_ret->nfrees++; obj_list->nobjs_rem--; } /* end else */ - } /* end if */ + } /* end if */ /* Mark this object as not freed so we know to expect it in the iterate call */ @@ -1281,21 +1276,21 @@ static htri_t test_tfs_free(void *_obj, void *key, void *_obj_list) { obj_list->nobjs_rem++; /* Iterate over skip list (maybe) */ - if(HDrandom() % (long)5) { + if (HDrandom() % (long)5) { iter_ud.obj_list = obj_list; iter_ud.last_idx = -1; - iter_ud.ncalls = 0; - ret = H5SL_iterate(obj_list->slist, test_tfs_iter, &iter_ud); + iter_ud.ncalls = 0; + ret = H5SL_iterate(obj_list->slist, test_tfs_iter, &iter_ud); CHECK(ret, FAIL, "H5SL_iterate"); VERIFY(iter_ud.ncalls, obj_list->nobjs_rem, "H5SL_iterate"); } /* end if */ /* Verify nobjs_rem is non-negative */ - if(obj_list->nobjs_rem < 0) + if (obj_list->nobjs_rem < 0) ERROR("invalid nobjs_rem"); /* Decide whether this object should be freed */ - if(HDrandom() % (long)2) { + if (HDrandom() % (long)2) { /* Free the object */ ret_value = TRUE; obj->nfrees++; @@ -1313,11 +1308,11 @@ static void test_skiplist_try_free_safe(void) { test_tfs_list_t obj_list; - test_tfs_obj_t list[TEST_TFS_MAX_NOBJS]; - int i, j; - int nobjs_found; - hsize_t count; - herr_t ret; /* Generic return value */ + test_tfs_obj_t list[TEST_TFS_MAX_NOBJS]; + int i, j; + int nobjs_found; + hsize_t count; + herr_t ret; /* Generic return value */ /* Output message about test being performed */ MESSAGE(7, ("Testing Skip List 'Try Free Safe' Operation\n")); @@ -1328,15 +1323,16 @@ test_skiplist_try_free_safe(void) /* Init obj_list.list */ obj_list.list = list; - for(j = 0; j < TEST_TFS_MAX_NOBJS; j++) + for (j = 0; j < TEST_TFS_MAX_NOBJS; j++) list[j].idx = j; - for(i = 0; i < TEST_TFS_NITER; i++) { + for (i = 0; i < TEST_TFS_NITER; i++) { /* Build object list */ - obj_list.nobjs = obj_list.nobjs_rem = (int)(TEST_TFS_MIN_NOBJS + (HDrandom() % (long)(TEST_TFS_MAX_NOBJS - TEST_TFS_MIN_NOBJS + 1))); - for(j = 0; j < obj_list.nobjs; j++) { + obj_list.nobjs = obj_list.nobjs_rem = + (int)(TEST_TFS_MIN_NOBJS + (HDrandom() % (long)(TEST_TFS_MAX_NOBJS - TEST_TFS_MIN_NOBJS + 1))); + for (j = 0; j < obj_list.nobjs; j++) { list[j].nfrees = 0; - ret = H5SL_insert(obj_list.slist, &list[j], &list[j].idx); + ret = H5SL_insert(obj_list.slist, &list[j], &list[j].idx); CHECK(ret, FAIL, "H5SL_insert"); } /* end for */ @@ -1347,8 +1343,8 @@ test_skiplist_try_free_safe(void) /* Verify list */ nobjs_found = 0; - for(j = 0; j < obj_list.nobjs; j++) - if(list[j].nfrees == 0) + for (j = 0; j < obj_list.nobjs; j++) + if (list[j].nfrees == 0) nobjs_found++; else VERIFY(list[j].nfrees, (long)1, "list[j].nfrees"); @@ -1383,13 +1379,13 @@ test_skiplist_try_free_safe(void) static void test_skiplist_less(void) { - H5SL_t *slist; /* Skip list created */ - size_t u; /* Local index variable */ - unsigned data[10]={ 10, 20, 15, 5, 50, 30, 31, 32, 80, 90}; + H5SL_t * slist; /* Skip list created */ + size_t u; /* Local index variable */ + unsigned data[10] = {10, 20, 15, 5, 50, 30, 31, 32, 80, 90}; /* unsigned sorted_data[10]={ 5, 10, 15, 20, 30, 31, 32, 50, 80, 90}; */ - unsigned *found_item; /* Item found in skip list */ - unsigned find_item; /* Item to add to skip list */ - herr_t ret; /* Generic return value */ + unsigned *found_item; /* Item found in skip list */ + unsigned find_item; /* Item to add to skip list */ + herr_t ret; /* Generic return value */ /* Output message about test being performed */ MESSAGE(7, ("Testing Skip List 'Less' Operation\n")); @@ -1399,41 +1395,41 @@ test_skiplist_less(void) CHECK_PTR(slist, "H5SL_create"); /* Insert objects into the skip list */ - for(u=0; u<10; u++) { - ret=H5SL_insert(slist,&data[u],&data[u]); + for (u = 0; u < 10; u++) { + ret = H5SL_insert(slist, &data[u], &data[u]); CHECK(ret, FAIL, "H5SL_insert"); } /* end for */ /* Check for exact match of items in various positions */ - find_item=20; - found_item=(unsigned *)H5SL_less(slist,&find_item); - VERIFY(*found_item,find_item,"H5SL_less"); - find_item=90; - found_item=(unsigned *)H5SL_less(slist,&find_item); - VERIFY(*found_item,find_item,"H5SL_less"); - find_item=5; - found_item=(unsigned *)H5SL_less(slist,&find_item); - VERIFY(*found_item,find_item,"H5SL_less"); + find_item = 20; + found_item = (unsigned *)H5SL_less(slist, &find_item); + VERIFY(*found_item, find_item, "H5SL_less"); + find_item = 90; + found_item = (unsigned *)H5SL_less(slist, &find_item); + VERIFY(*found_item, find_item, "H5SL_less"); + find_item = 5; + found_item = (unsigned *)H5SL_less(slist, &find_item); + VERIFY(*found_item, find_item, "H5SL_less"); /* Find item less than a missing key, in various positions */ - find_item=19; - found_item=(unsigned *)H5SL_less(slist,&find_item); - VERIFY(*found_item,15,"H5SL_less"); - find_item=89; - found_item=(unsigned *)H5SL_less(slist,&find_item); - VERIFY(*found_item,80,"H5SL_less"); - find_item=100; - found_item=(unsigned *)H5SL_less(slist,&find_item); - VERIFY(*found_item,90,"H5SL_less"); - find_item=9; - found_item=(unsigned *)H5SL_less(slist,&find_item); - VERIFY(*found_item,5,"H5SL_less"); - find_item=4; - found_item=(unsigned *)H5SL_less(slist,&find_item); + find_item = 19; + found_item = (unsigned *)H5SL_less(slist, &find_item); + VERIFY(*found_item, 15, "H5SL_less"); + find_item = 89; + found_item = (unsigned *)H5SL_less(slist, &find_item); + VERIFY(*found_item, 80, "H5SL_less"); + find_item = 100; + found_item = (unsigned *)H5SL_less(slist, &find_item); + VERIFY(*found_item, 90, "H5SL_less"); + find_item = 9; + found_item = (unsigned *)H5SL_less(slist, &find_item); + VERIFY(*found_item, 5, "H5SL_less"); + find_item = 4; + found_item = (unsigned *)H5SL_less(slist, &find_item); CHECK_PTR_NULL(found_item, "H5SL_less"); /* Close the skip list */ - ret=H5SL_close(slist); + ret = H5SL_close(slist); CHECK(ret, FAIL, "H5SL_close"); } /* end test_skiplist_less() */ @@ -1447,13 +1443,13 @@ test_skiplist_less(void) static void test_skiplist_greater(void) { - H5SL_t *slist; /* Skip list created */ - size_t u; /* Local index variable */ - unsigned data[10]={ 10, 20, 15, 5, 50, 30, 31, 32, 80, 90}; + H5SL_t * slist; /* Skip list created */ + size_t u; /* Local index variable */ + unsigned data[10] = {10, 20, 15, 5, 50, 30, 31, 32, 80, 90}; /* unsigned sorted_data[10]={ 5, 10, 15, 20, 30, 31, 32, 50, 80, 90}; */ - unsigned *found_item; /* Item found in skip list */ - unsigned find_item; /* Item to add to skip list */ - herr_t ret; /* Generic return value */ + unsigned *found_item; /* Item found in skip list */ + unsigned find_item; /* Item to add to skip list */ + herr_t ret; /* Generic return value */ /* Output message about test being performed */ MESSAGE(7, ("Testing Skip List 'Greater' Operation\n")); @@ -1463,36 +1459,36 @@ test_skiplist_greater(void) CHECK_PTR(slist, "H5SL_create"); /* Insert objects into the skip list */ - for(u = 0; u < 10; u++) { + for (u = 0; u < 10; u++) { ret = H5SL_insert(slist, &data[u], &data[u]); CHECK(ret, FAIL, "H5SL_insert"); } /* end for */ /* Check for exact match of items in various positions */ - find_item = 20; + find_item = 20; found_item = (unsigned *)H5SL_greater(slist, &find_item); VERIFY(*found_item, find_item, "H5SL_greater"); - find_item = 90; + find_item = 90; found_item = (unsigned *)H5SL_greater(slist, &find_item); VERIFY(*found_item, find_item, "H5SL_greater"); - find_item = 5; + find_item = 5; found_item = (unsigned *)H5SL_greater(slist, &find_item); VERIFY(*found_item, find_item, "H5SL_greater"); /* Find item greater than a missing key, in various positions */ - find_item = 19; - found_item = (unsigned *)H5SL_greater(slist,&find_item); + find_item = 19; + found_item = (unsigned *)H5SL_greater(slist, &find_item); VERIFY(*found_item, 20, "H5SL_greater"); - find_item = 89; + find_item = 89; found_item = (unsigned *)H5SL_greater(slist, &find_item); VERIFY(*found_item, 90, "H5SL_greater"); - find_item = 100; + find_item = 100; found_item = (unsigned *)H5SL_greater(slist, &find_item); CHECK_PTR_NULL(found_item, "H5SL_greater"); - find_item = 6; + find_item = 6; found_item = (unsigned *)H5SL_greater(slist, &find_item); VERIFY(*found_item, 10, "H5SL_greater"); - find_item = 4; + find_item = 4; found_item = (unsigned *)H5SL_greater(slist, &find_item); VERIFY(*found_item, 5, "H5SL_greater"); @@ -1511,14 +1507,14 @@ test_skiplist_greater(void) static void test_skiplist_below(void) { - H5SL_t *slist; /* Skip list created */ + H5SL_t * slist; /* Skip list created */ H5SL_node_t *node; /* Skip list node */ - size_t u; /* Local index variable */ - unsigned data[10]={ 10, 20, 15, 5, 50, 30, 31, 32, 80, 90}; + size_t u; /* Local index variable */ + unsigned data[10] = {10, 20, 15, 5, 50, 30, 31, 32, 80, 90}; /* unsigned sorted_data[10]={ 5, 10, 15, 20, 30, 31, 32, 50, 80, 90}; */ - unsigned *found_item; /* Item found in skip list */ - unsigned find_item; /* Item to add to skip list */ - herr_t ret; /* Generic return value */ + unsigned *found_item; /* Item found in skip list */ + unsigned find_item; /* Item to add to skip list */ + herr_t ret; /* Generic return value */ /* Output message about test being performed */ MESSAGE(7, ("Testing Skip List 'Below' Operation\n")); @@ -1528,51 +1524,51 @@ test_skiplist_below(void) CHECK_PTR(slist, "H5SL_create"); /* Insert objects into the skip list */ - for(u = 0; u < 10; u++) { + for (u = 0; u < 10; u++) { ret = H5SL_insert(slist, &data[u], &data[u]); CHECK(ret, FAIL, "H5SL_insert"); } /* end for */ /* Check for exact match of items in various positions */ find_item = 20; - node = H5SL_below(slist, &find_item); + node = H5SL_below(slist, &find_item); CHECK_PTR(node, "H5SL_below"); found_item = (unsigned *)H5SL_item(node); VERIFY(*found_item, find_item, "H5SL_below"); find_item = 90; - node = H5SL_below(slist, &find_item); + node = H5SL_below(slist, &find_item); CHECK_PTR(node, "H5SL_below"); found_item = (unsigned *)H5SL_item(node); VERIFY(*found_item, find_item, "H5SL_below"); find_item = 5; - node = H5SL_below(slist, &find_item); + node = H5SL_below(slist, &find_item); CHECK_PTR(node, "H5SL_below"); found_item = (unsigned *)H5SL_item(node); VERIFY(*found_item, find_item, "H5SL_below"); /* Find item less than a missing key, in various positions */ find_item = 19; - node = H5SL_below(slist, &find_item); + node = H5SL_below(slist, &find_item); CHECK_PTR(node, "H5SL_below"); found_item = (unsigned *)H5SL_item(node); VERIFY(*found_item, 15, "H5SL_below"); find_item = 89; - node = H5SL_below(slist, &find_item); + node = H5SL_below(slist, &find_item); CHECK_PTR(node, "H5SL_below"); found_item = (unsigned *)H5SL_item(node); VERIFY(*found_item, 80, "H5SL_below"); find_item = 100; - node = H5SL_below(slist, &find_item); + node = H5SL_below(slist, &find_item); CHECK_PTR(node, "H5SL_below"); found_item = (unsigned *)H5SL_item(node); VERIFY(*found_item, 90, "H5SL_below"); find_item = 9; - node = H5SL_below(slist, &find_item); + node = H5SL_below(slist, &find_item); CHECK_PTR(node, "H5SL_below"); found_item = (unsigned *)H5SL_item(node); VERIFY(*found_item, 5, "H5SL_below"); find_item = 4; - node = (H5SL_node_t *)H5SL_less(slist, &find_item); + node = (H5SL_node_t *)H5SL_less(slist, &find_item); CHECK_PTR_NULL(node, "H5SL_below"); /* Close the skip list */ @@ -1590,14 +1586,14 @@ test_skiplist_below(void) static void test_skiplist_above(void) { - H5SL_t *slist; /* Skip list created */ + H5SL_t * slist; /* Skip list created */ H5SL_node_t *node; /* Skip list node */ - size_t u; /* Local index variable */ - unsigned data[10]={ 10, 20, 15, 5, 50, 30, 31, 32, 80, 90}; + size_t u; /* Local index variable */ + unsigned data[10] = {10, 20, 15, 5, 50, 30, 31, 32, 80, 90}; /* unsigned sorted_data[10]={ 5, 10, 15, 20, 30, 31, 32, 50, 80, 90}; */ - unsigned *found_item; /* Item found in skip list */ - unsigned find_item; /* Item to add to skip list */ - herr_t ret; /* Generic return value */ + unsigned *found_item; /* Item found in skip list */ + unsigned find_item; /* Item to add to skip list */ + herr_t ret; /* Generic return value */ /* Output message about test being performed */ MESSAGE(7, ("Testing Skip List 'Above' Operation\n")); @@ -1607,49 +1603,49 @@ test_skiplist_above(void) CHECK_PTR(slist, "H5SL_create"); /* Insert objects into the skip list */ - for(u = 0; u < 10; u++) { + for (u = 0; u < 10; u++) { ret = H5SL_insert(slist, &data[u], &data[u]); CHECK(ret, FAIL, "H5SL_insert"); } /* end for */ /* Check for exact match of items in various positions */ find_item = 20; - node = H5SL_above(slist, &find_item); + node = H5SL_above(slist, &find_item); CHECK_PTR(node, "H5SL_above"); found_item = (unsigned *)H5SL_item(node); VERIFY(*found_item, find_item, "H5SL_above"); find_item = 90; - node = H5SL_above(slist, &find_item); + node = H5SL_above(slist, &find_item); CHECK_PTR(node, "H5SL_above"); found_item = (unsigned *)H5SL_item(node); VERIFY(*found_item, find_item, "H5SL_above"); find_item = 5; - node = H5SL_above(slist, &find_item); + node = H5SL_above(slist, &find_item); CHECK_PTR(node, "H5SL_above"); found_item = (unsigned *)H5SL_item(node); VERIFY(*found_item, find_item, "H5SL_above"); /* Find item greater than a missing key, in various positions */ find_item = 19; - node = H5SL_above(slist, &find_item); + node = H5SL_above(slist, &find_item); CHECK_PTR(node, "H5SL_above"); found_item = (unsigned *)H5SL_item(node); VERIFY(*found_item, 20, "H5SL_above"); find_item = 89; - node = H5SL_above(slist, &find_item); + node = H5SL_above(slist, &find_item); CHECK_PTR(node, "H5SL_above"); found_item = (unsigned *)H5SL_item(node); VERIFY(*found_item, 90, "H5SL_above"); find_item = 100; - node = H5SL_above(slist, &find_item); + node = H5SL_above(slist, &find_item); CHECK_PTR_NULL(node, "H5SL_above"); find_item = 6; - node = H5SL_above(slist, &find_item); + node = H5SL_above(slist, &find_item); CHECK_PTR(node, "H5SL_above"); found_item = (unsigned *)H5SL_item(node); VERIFY(*found_item, 10, "H5SL_above"); find_item = 4; - node = H5SL_above(slist, &find_item); + node = H5SL_above(slist, &find_item); CHECK_PTR(node, "H5SL_above"); found_item = (unsigned *)H5SL_item(node); VERIFY(*found_item, 5, "H5SL_above"); @@ -1669,12 +1665,12 @@ test_skiplist_above(void) static void test_skiplist_remove_first(void) { - H5SL_t *slist; /* Skip list created */ - size_t u; /* Local index variable */ - unsigned data[10]={ 10, 20, 15, 5, 50, 30, 31, 32, 80, 90}; - unsigned sorted_data[10]={ 5, 10, 15, 20, 30, 31, 32, 50, 80, 90}; - unsigned *found_item; /* Item found in skip list */ - herr_t ret; /* Generic return value */ + H5SL_t * slist; /* Skip list created */ + size_t u; /* Local index variable */ + unsigned data[10] = {10, 20, 15, 5, 50, 30, 31, 32, 80, 90}; + unsigned sorted_data[10] = {5, 10, 15, 20, 30, 31, 32, 50, 80, 90}; + unsigned *found_item; /* Item found in skip list */ + herr_t ret; /* Generic return value */ /* Output message about test being performed */ MESSAGE(7, ("Testing Skip List 'Remove First' Operation\n")); @@ -1684,13 +1680,13 @@ test_skiplist_remove_first(void) CHECK_PTR(slist, "H5SL_create"); /* Insert objects into the skip list */ - for(u = 0; u < 10; u++) { + for (u = 0; u < 10; u++) { ret = H5SL_insert(slist, &data[u], &data[u]); CHECK(ret, FAIL, "H5SL_insert"); } /* end for */ /* Remove objects from the skip list */ - for(u = 0; u < 10; u++) { + for (u = 0; u < 10; u++) { found_item = (unsigned *)H5SL_remove_first(slist); VERIFY(*found_item, sorted_data[u], "H5SL_remove_first"); } /* end for */ @@ -1714,11 +1710,11 @@ test_skiplist_remove_first(void) static void test_skiplist_remove_first_many(void) { - H5SL_t *slist; /* Skip list created */ - size_t u; /* Local index variable */ - int *found_item; /* Item found in skip list */ + H5SL_t *slist; /* Skip list created */ + size_t u; /* Local index variable */ + int * found_item; /* Item found in skip list */ int prev_item = INT_MIN; /* Previously found item in skip list */ - herr_t ret; /* Generic return value */ + herr_t ret; /* Generic return value */ /* Output message about test being performed */ MESSAGE(7, ("Testing Skip List 'Remove First' Operation\n")); @@ -1728,13 +1724,13 @@ test_skiplist_remove_first_many(void) CHECK_PTR(slist, "H5SL_create"); /* Insert objects into the skip list */ - for(u = 0; u < NUM_ELEMS; u++) { + for (u = 0; u < NUM_ELEMS; u++) { ret = H5SL_insert(slist, &rand_num[u], &rand_num[u]); CHECK(ret, FAIL, "H5SL_insert"); } /* end for */ /* Remove objects from the skip list */ - for(u = 0; u < NUM_ELEMS; u++) { + for (u = 0; u < NUM_ELEMS; u++) { found_item = (int *)H5SL_remove_first(slist); VERIFY(*found_item > prev_item, TRUE, "H5SL_remove_first"); prev_item = *found_item; @@ -1760,11 +1756,11 @@ static void test_skiplist_term(void) { /* Release arrays */ - if(rand_num) + if (rand_num) HDfree(rand_num); - if(sort_rand_num) + if (sort_rand_num) HDfree(sort_rand_num); - if(rev_sort_rand_num) + if (rev_sort_rand_num) HDfree(rev_sort_rand_num); } /* end test_skiplist_term() */ @@ -1783,33 +1779,32 @@ test_skiplist(void) test_skiplist_init(); /* Actual skip list tests */ - test_skiplist_create(); /* Test skip list creation */ - test_skiplist_insert(); /* Test basic skip list insertion */ - test_skiplist_insert_many(); /* Test insertion of many items into skip list */ - test_skiplist_remove(); /* Test basic skip list removal */ - test_skiplist_remove_many(); /* Test removal of many items from skip list */ - test_skiplist_firstnext(); /* Test iteration over skip list nodes with first/next */ - test_skiplist_string(); /* Test skip list string keys */ - test_skiplist_iterate(); /* Test iteration over skip list nodes with callback */ - test_skiplist_hsize(); /* Test skip list hsize_t keys */ - test_skiplist_unsigned(); /* Test skip list unsigned keys */ - test_skiplist_obj(); /* Test skip list H5_obj_t keys */ - test_skiplist_generic(); /* Test skip list generic keys */ - test_skiplist_lastprev(); /* Test iteration over skip list nodes with last/prev */ - test_skiplist_find(); /* Test 'find' operation */ - test_skiplist_add(); /* Test 'add' operation */ - test_skiplist_destroy(); /* Test 'destroy' operation */ - test_skiplist_free(); /* Test 'free' operation */ - test_skiplist_try_free_safe(); /* Test 'try_free_safe' operation */ - test_skiplist_less(); /* Test 'less' operation */ - test_skiplist_greater(); /* Test 'greater' operation */ - test_skiplist_below(); /* Test 'below' operation */ - test_skiplist_above(); /* Test 'above' operation */ - test_skiplist_remove_first(); /* Test 'remove first' operation */ - test_skiplist_remove_first_many(); /* Test 'remove first' operation on large skip lists */ + test_skiplist_create(); /* Test skip list creation */ + test_skiplist_insert(); /* Test basic skip list insertion */ + test_skiplist_insert_many(); /* Test insertion of many items into skip list */ + test_skiplist_remove(); /* Test basic skip list removal */ + test_skiplist_remove_many(); /* Test removal of many items from skip list */ + test_skiplist_firstnext(); /* Test iteration over skip list nodes with first/next */ + test_skiplist_string(); /* Test skip list string keys */ + test_skiplist_iterate(); /* Test iteration over skip list nodes with callback */ + test_skiplist_hsize(); /* Test skip list hsize_t keys */ + test_skiplist_unsigned(); /* Test skip list unsigned keys */ + test_skiplist_obj(); /* Test skip list H5_obj_t keys */ + test_skiplist_generic(); /* Test skip list generic keys */ + test_skiplist_lastprev(); /* Test iteration over skip list nodes with last/prev */ + test_skiplist_find(); /* Test 'find' operation */ + test_skiplist_add(); /* Test 'add' operation */ + test_skiplist_destroy(); /* Test 'destroy' operation */ + test_skiplist_free(); /* Test 'free' operation */ + test_skiplist_try_free_safe(); /* Test 'try_free_safe' operation */ + test_skiplist_less(); /* Test 'less' operation */ + test_skiplist_greater(); /* Test 'greater' operation */ + test_skiplist_below(); /* Test 'below' operation */ + test_skiplist_above(); /* Test 'above' operation */ + test_skiplist_remove_first(); /* Test 'remove first' operation */ + test_skiplist_remove_first_many(); /* Test 'remove first' operation on large skip lists */ /* Release skip list testing data */ test_skiplist_term(); -} /* end test_skiplist() */ - +} /* end test_skiplist() */ |