# HG changeset patch # User Mike Becker # Date 1349343443 -7200 # Node ID 583718dd4cf32090e6beee29fc4209ddb5f8689e # Parent bf8ab7bb74ff36785c62a54e78dcc70a51f33704 added semicolons to assert makros diff -r bf8ab7bb74ff -r 583718dd4cf3 test/dlist_tests.c --- a/test/dlist_tests.c Tue Oct 02 13:43:17 2012 +0200 +++ b/test/dlist_tests.c Thu Oct 04 11:37:23 2012 +0200 @@ -8,12 +8,12 @@ UcxDlist *list = ucx_dlist_append(NULL, "Hello"); UCX_TEST_BEGIN - UCX_TEST_ASSERT(strncmp(list->data, "Hello", 5) == 0, "failed") + UCX_TEST_ASSERT(strncmp(list->data, "Hello", 5) == 0, "failed"); list = ucx_dlist_append(list, " World!"); - UCX_TEST_ASSERT(strncmp(list->next->data, " World!", 7) == 0, "failed") - UCX_TEST_ASSERT(list->next->next == NULL, "failed") + UCX_TEST_ASSERT(strncmp(list->next->data, " World!", 7) == 0, "failed"); + UCX_TEST_ASSERT(list->next->next == NULL, "failed"); UCX_TEST_END ucx_dlist_free(list); @@ -25,9 +25,9 @@ list = ucx_dlist_prepend(list, "Hello"); - UCX_TEST_ASSERT(strncmp(list->data, "Hello", 5) == 0, "failed") - UCX_TEST_ASSERT(strncmp(list->next->data, " World!", 7) == 0, "failed") - UCX_TEST_ASSERT(list->next->next == NULL, "failed") + UCX_TEST_ASSERT(strncmp(list->data, "Hello", 5) == 0, "failed"); + UCX_TEST_ASSERT(strncmp(list->next->data, " World!", 7) == 0, "failed"); + UCX_TEST_ASSERT(list->next->next == NULL, "failed"); UCX_TEST_END ucx_dlist_free(list); @@ -42,8 +42,8 @@ list3 = ucx_dlist_prepend(list3, "Hallo"); UCX_TEST_BEGIN - UCX_TEST_ASSERT(ucx_dlist_equals(list, list2, cmp_string, NULL), "failed") - UCX_TEST_ASSERT(!ucx_dlist_equals(list, list3, cmp_string, NULL), "failed") + UCX_TEST_ASSERT(ucx_dlist_equals(list, list2, cmp_string, NULL), "failed"); + UCX_TEST_ASSERT(!ucx_dlist_equals(list, list3, cmp_string, NULL), "failed"); UCX_TEST_END ucx_dlist_free(list3); @@ -58,9 +58,9 @@ list = ucx_dlist_concat(list, list2); - UCX_TEST_ASSERT(strncmp(list->data, "Hello", 5) == 0, "failed") - UCX_TEST_ASSERT(strncmp(list->next->data, " World!", 7) == 0, "failed") - UCX_TEST_ASSERT(list->next->next == NULL, "failed") + UCX_TEST_ASSERT(strncmp(list->data, "Hello", 5) == 0, "failed"); + UCX_TEST_ASSERT(strncmp(list->next->data, " World!", 7) == 0, "failed"); + UCX_TEST_ASSERT(list->next->next == NULL, "failed"); UCX_TEST_END ucx_dlist_free(list); @@ -130,9 +130,9 @@ list = ucx_dlist_remove(list, ucx_dlist_get(list, 1)); - UCX_TEST_ASSERT(strncmp(list->data, "Hello", 5) == 0, "failed") - UCX_TEST_ASSERT(strncmp(list->next->data, " World!", 7) == 0, "failed") - UCX_TEST_ASSERT(list->next->next == NULL, "failed") + UCX_TEST_ASSERT(strncmp(list->data, "Hello", 5) == 0, "failed"); + UCX_TEST_ASSERT(strncmp(list->next->data, " World!", 7) == 0, "failed"); + UCX_TEST_ASSERT(list->next->next == NULL, "failed"); UCX_TEST_END ucx_dlist_free(list); @@ -152,9 +152,9 @@ UcxDlist *copy = ucx_dlist_clone(list, copy_string, NULL); UCX_TEST_BEGIN - UCX_TEST_ASSERT(ucx_dlist_equals(list, copy, cmp_string, NULL), "failed") - UCX_TEST_ASSERT(hello != copy->data, "first element is no copy") - UCX_TEST_ASSERT(world != copy->next->data, "second element is no copy") + UCX_TEST_ASSERT(ucx_dlist_equals(list, copy, cmp_string, NULL), "failed"); + UCX_TEST_ASSERT(hello != copy->data, "first element is no copy"); + UCX_TEST_ASSERT(world != copy->next->data, "second element is no copy"); UCX_TEST_END free(copy->next->data); diff -r bf8ab7bb74ff -r 583718dd4cf3 test/list_tests.c --- a/test/list_tests.c Tue Oct 02 13:43:17 2012 +0200 +++ b/test/list_tests.c Thu Oct 04 11:37:23 2012 +0200 @@ -7,12 +7,12 @@ UCX_TEST_IMPLEMENT(test_ucx_list_append) { UcxList *list = ucx_list_append(NULL, "Hello"); UCX_TEST_BEGIN - UCX_TEST_ASSERT(strncmp(list->data, "Hello", 5) == 0, "failed") + UCX_TEST_ASSERT(strncmp(list->data, "Hello", 5) == 0, "failed"); list = ucx_list_append(list, " World!"); - UCX_TEST_ASSERT(strncmp(list->next->data, " World!", 7) == 0, "failed") - UCX_TEST_ASSERT(list->next->next == NULL, "failed") + UCX_TEST_ASSERT(strncmp(list->next->data, " World!", 7) == 0, "failed"); + UCX_TEST_ASSERT(list->next->next == NULL, "failed"); UCX_TEST_END ucx_list_free(list); @@ -23,9 +23,9 @@ UCX_TEST_BEGIN list = ucx_list_prepend(list, "Hello"); - UCX_TEST_ASSERT(strncmp(list->data, "Hello", 5) == 0, "failed") - UCX_TEST_ASSERT(strncmp(list->next->data, " World!", 7) == 0, "failed") - UCX_TEST_ASSERT(list->next->next == NULL, "failed") + UCX_TEST_ASSERT(strncmp(list->data, "Hello", 5) == 0, "failed"); + UCX_TEST_ASSERT(strncmp(list->next->data, " World!", 7) == 0, "failed"); + UCX_TEST_ASSERT(list->next->next == NULL, "failed"); UCX_TEST_END ucx_list_free(list); @@ -40,8 +40,8 @@ list3 = ucx_list_prepend(list3, "Hallo"); UCX_TEST_BEGIN - UCX_TEST_ASSERT(ucx_list_equals(list, list2, cmp_string, NULL), "failed") - UCX_TEST_ASSERT(!ucx_list_equals(list, list3, cmp_string, NULL), "failed") + UCX_TEST_ASSERT(ucx_list_equals(list, list2, cmp_string, NULL), "failed"); + UCX_TEST_ASSERT(!ucx_list_equals(list, list3, cmp_string, NULL), "failed"); UCX_TEST_END ucx_list_free(list3); @@ -56,9 +56,9 @@ list = ucx_list_concat(list, list2); UCX_TEST_BEGIN - UCX_TEST_ASSERT(strncmp(list->data, "Hello", 5) == 0, "failed") - UCX_TEST_ASSERT(strncmp(list->next->data, " World!", 7) == 0, "failed") - UCX_TEST_ASSERT(list->next->next == NULL, "failed") + UCX_TEST_ASSERT(strncmp(list->data, "Hello", 5) == 0, "failed"); + UCX_TEST_ASSERT(strncmp(list->next->data, " World!", 7) == 0, "failed"); + UCX_TEST_ASSERT(list->next->next == NULL, "failed"); UCX_TEST_END if (list->next == NULL) { @@ -118,9 +118,9 @@ list = ucx_list_remove(list, ucx_list_get(list, 1)); - UCX_TEST_ASSERT(strncmp(list->data, "Hello", 5) == 0, "failed") - UCX_TEST_ASSERT(strncmp(list->next->data, " World!", 7) == 0, "failed") - UCX_TEST_ASSERT(list->next->next == NULL, "failed") + UCX_TEST_ASSERT(strncmp(list->data, "Hello", 5) == 0, "failed"); + UCX_TEST_ASSERT(strncmp(list->next->data, " World!", 7) == 0, "failed"); + UCX_TEST_ASSERT(list->next->next == NULL, "failed"); UCX_TEST_END ucx_list_free(list); @@ -140,9 +140,9 @@ UcxList *copy = ucx_list_clone(list, copy_string, NULL); UCX_TEST_BEGIN - UCX_TEST_ASSERT(ucx_list_equals(list, copy, cmp_string, NULL), "failed") - UCX_TEST_ASSERT(hello != copy->data, "first element is no copy") - UCX_TEST_ASSERT(world != copy->next->data, "second element is no copy") + UCX_TEST_ASSERT(ucx_list_equals(list, copy, cmp_string, NULL), "failed"); + UCX_TEST_ASSERT(hello != copy->data, "first element is no copy"); + UCX_TEST_ASSERT(world != copy->next->data, "second element is no copy"); UCX_TEST_END free(copy->next->data); diff -r bf8ab7bb74ff -r 583718dd4cf3 test/main.c --- a/test/main.c Tue Oct 02 13:43:17 2012 +0200 +++ b/test/main.c Thu Oct 04 11:37:23 2012 +0200 @@ -53,13 +53,13 @@ UCX_TEST_IMPLEMENT(testTestSuitePositive) { UCX_TEST_BEGIN - UCX_TEST_ASSERT(2*2 == 4, "the test framework fails") + UCX_TEST_ASSERT(2*2 == 4, "the test framework fails"); UCX_TEST_END } UCX_TEST_IMPLEMENT(testTestSuiteNegative) { UCX_TEST_BEGIN - UCX_TEST_ASSERT(2*(-2) == 4, "the test framework works") + UCX_TEST_ASSERT(2*(-2) == 4, "the test framework works"); UCX_TEST_END } diff -r bf8ab7bb74ff -r 583718dd4cf3 test/map_tests.c --- a/test/map_tests.c Tue Oct 02 13:43:17 2012 +0200 +++ b/test/map_tests.c Thu Oct 04 11:37:23 2012 +0200 @@ -7,8 +7,8 @@ UCX_TEST_IMPLEMENT(test_ucx_map_new) { UcxMap *map = ucx_map_new(16); UCX_TEST_BEGIN - UCX_TEST_ASSERT(map->size == 16, "wrong size") - UCX_TEST_ASSERT(map->map != NULL, "failed") + UCX_TEST_ASSERT(map->size == 16, "wrong size"); + UCX_TEST_ASSERT(map->map != NULL, "failed"); UCX_TEST_END ucx_map_free(map); @@ -17,9 +17,9 @@ UCX_TEST_IMPLEMENT(test_ucx_key) { UcxKey key = ucx_key("This is a text.", 15); UCX_TEST_BEGIN - UCX_TEST_ASSERT(strncmp(key.data, "This is a text.", 15) == 0, "failed") - UCX_TEST_ASSERT(key.len == 15, "failed") - UCX_TEST_ASSERT(key.hash == 1261186027, "hash failed") + UCX_TEST_ASSERT(strncmp(key.data, "This is a text.", 15) == 0, "failed"); + UCX_TEST_ASSERT(key.len == 15, "failed"); + UCX_TEST_ASSERT(key.hash == 1261186027, "hash failed"); UCX_TEST_END } @@ -38,30 +38,30 @@ ucx_map_cstr_put(map, "KeY3", &td[3]); /* 2 */ ucx_map_cstr_put(map, "KEY4", &td[4]); /* 0 */ - UCX_TEST_ASSERT(*((int*)map->map[0]->data) == td[0], "failed Key0") - UCX_TEST_ASSERT(map->map[0]->next != NULL, "no list at slot 0") - UCX_TEST_ASSERT(*((int*)map->map[0]->next->data) == td[2], "failed Key2") - UCX_TEST_ASSERT(map->map[0]->next->next != NULL, "list corrupt at slot 0") + UCX_TEST_ASSERT(*((int*)map->map[0]->data) == td[0], "failed Key0"); + UCX_TEST_ASSERT(map->map[0]->next != NULL, "no list at slot 0"); + UCX_TEST_ASSERT(*((int*)map->map[0]->next->data) == td[2], "failed Key2"); + UCX_TEST_ASSERT(map->map[0]->next->next != NULL, "list corrupt at slot 0"); UCX_TEST_ASSERT(*((int*)map->map[0]->next->next->data) == td[4], "failed Key4") UCX_TEST_ASSERT(map->map[0]->next->next->next == NULL, "slot 0 not terminated") - UCX_TEST_ASSERT(map->map[1] == NULL, "slot 1 not terminated") + UCX_TEST_ASSERT(map->map[1] == NULL, "slot 1 not terminated"); - UCX_TEST_ASSERT(*((int*)map->map[2]->data) == td[3], "failed KeY3") - UCX_TEST_ASSERT(map->map[2]->next == NULL, "slot 2 not terminated") + UCX_TEST_ASSERT(*((int*)map->map[2]->data) == td[3], "failed KeY3"); + UCX_TEST_ASSERT(map->map[2]->next == NULL, "slot 2 not terminated"); - UCX_TEST_ASSERT(*((int*)map->map[3]->data) == td[1], "failed Key1") + UCX_TEST_ASSERT(*((int*)map->map[3]->data) == td[1], "failed Key1"); ucx_map_cstr_put(map, "Key0", &td[3]); /* 0 */ - UCX_TEST_ASSERT(*((int*)map->map[0]->data) == td[3], "overwrite failed") + UCX_TEST_ASSERT(*((int*)map->map[0]->data) == td[3], "overwrite failed"); UCX_TEST_ASSERT(*((int*)map->map[0]->next->data) == td[2], "overwrite failed") UCX_TEST_ASSERT(*((int*)map->map[0]->next->next->data) == td[4], "overwrite failed") - UCX_TEST_ASSERT(map->map[0]->next->next->next == NULL, "overwrite failed") + UCX_TEST_ASSERT(map->map[0]->next->next->next == NULL, "overwrite failed"); UCX_TEST_END ucx_map_free(map); @@ -85,11 +85,11 @@ td[2] = *((int*)ucx_map_cstr_get(map, "Key2")); td[3] = *((int*)ucx_map_cstr_get(map, "KeY3")); td[4] = *((int*)ucx_map_cstr_get(map, "KEY4")); - UCX_TEST_ASSERT(td[0] == 10, "failed key 0") - UCX_TEST_ASSERT(td[1] == 42, "failed key 1") - UCX_TEST_ASSERT(td[2] == 70, "failed key 2") - UCX_TEST_ASSERT(td[3] == 11200, "failed key 3") - UCX_TEST_ASSERT(td[4] == 80000, "failed key 4") + UCX_TEST_ASSERT(td[0] == 10, "failed key 0"); + UCX_TEST_ASSERT(td[1] == 42, "failed key 1"); + UCX_TEST_ASSERT(td[2] == 70, "failed key 2"); + UCX_TEST_ASSERT(td[3] == 11200, "failed key 3"); + UCX_TEST_ASSERT(td[4] == 80000, "failed key 4"); UCX_TEST_END ucx_map_free(map); diff -r bf8ab7bb74ff -r 583718dd4cf3 test/mpool_tests.c --- a/test/mpool_tests.c Tue Oct 02 13:43:17 2012 +0200 +++ b/test/mpool_tests.c Thu Oct 04 11:37:23 2012 +0200 @@ -9,9 +9,9 @@ UCX_TEST_IMPLEMENT(test_ucx_mempool_new) { UcxMempool *pool = ucx_mempool_new(16); UCX_TEST_BEGIN - UCX_TEST_ASSERT(pool->size == 16, "wrong size") - UCX_TEST_ASSERT(pool->ndata == 0, "uninitialized counter") - UCX_TEST_ASSERT(pool->data != NULL, "no memory addressed") + UCX_TEST_ASSERT(pool->size == 16, "wrong size"); + UCX_TEST_ASSERT(pool->ndata == 0, "uninitialized counter"); + UCX_TEST_ASSERT(pool->data != NULL, "no memory addressed"); UCX_TEST_END ucx_mempool_free(pool); } @@ -22,14 +22,14 @@ UCX_TEST_BEGIN intptr_t *test = (intptr_t*) ucx_mempool_malloc(pool, sizeof(intptr_t)); - UCX_TEST_ASSERT(pool->ndata == 1, "counter not incremented") - UCX_TEST_ASSERT(pool->size == 1, "chcap called") + UCX_TEST_ASSERT(pool->ndata == 1, "counter not incremented"); + UCX_TEST_ASSERT(pool->size == 1, "chcap called"); intptr_t *pooladdr = (intptr_t*)((char*)pool->data[0] + sizeof(ucx_destructor)); *pooladdr = 5; - UCX_TEST_ASSERT(*test == 5, "wrong pointer") + UCX_TEST_ASSERT(*test == 5, "wrong pointer"); UCX_TEST_END ucx_mempool_free(pool); @@ -42,14 +42,14 @@ ucx_mempool_malloc(pool, sizeof(int)); intptr_t *test = (intptr_t*) ucx_mempool_malloc(pool, sizeof(intptr_t)); - UCX_TEST_ASSERT(pool->ndata == 2, "counter not incremented") - UCX_TEST_ASSERT(pool->size == 17, "chcap not called") + UCX_TEST_ASSERT(pool->ndata == 2, "counter not incremented"); + UCX_TEST_ASSERT(pool->size == 17, "chcap not called"); intptr_t *pooladdr = (intptr_t*)((char*)pool->data[1] + sizeof(ucx_destructor)); *pooladdr = 5; - UCX_TEST_ASSERT(*test == 5, "wrong pointer") + UCX_TEST_ASSERT(*test == 5, "wrong pointer"); UCX_TEST_END ucx_mempool_free(pool); @@ -62,8 +62,8 @@ intptr_t *test = (intptr_t*) ucx_mempool_calloc(pool, 2, sizeof(intptr_t)); - UCX_TEST_ASSERT(test != NULL, "no memory for test data") - UCX_TEST_ASSERT(test[0] == 0 && test[1] == 0, "failed") + UCX_TEST_ASSERT(test != NULL, "no memory for test data"); + UCX_TEST_ASSERT(test[0] == 0 && test[1] == 0, "failed"); UCX_TEST_END ucx_mempool_free(pool); @@ -83,7 +83,7 @@ ucx_mempool_malloc(pool, sizeof(intptr_t)); intptr_t *test = (intptr_t*) ucx_mempool_calloc(pool, 2, sizeof(intptr_t)); - UCX_TEST_ASSERT(cb != NULL && test != NULL, "no memory for test data") + UCX_TEST_ASSERT(cb != NULL && test != NULL, "no memory for test data"); test[0] = 5; test[1] = (intptr_t) cb; *cb = 13; @@ -96,7 +96,7 @@ ucx_mempool_free(pool); - UCX_TEST_ASSERT(*cb == 42, "destructor not called") + UCX_TEST_ASSERT(*cb == 42, "destructor not called"); UCX_TEST_END if (cb != NULL) free(cb); @@ -110,7 +110,7 @@ UCX_TEST_BEGIN UcxMempool *pool = ucx_mempool_new(1); - UCX_TEST_ASSERT(cb != NULL && test != NULL, "no memory for test data") + UCX_TEST_ASSERT(cb != NULL && test != NULL, "no memory for test data"); test[0] = 5; test[1] = (intptr_t) cb; *cb = 13; @@ -120,10 +120,10 @@ ucx_destructor *pooladdr = (ucx_destructor*) ((char*)pool->data[0] + sizeof(ucx_destructor)); - UCX_TEST_ASSERT(*pooladdr == test_setdestr, "failed") + UCX_TEST_ASSERT(*pooladdr == test_setdestr, "failed"); ucx_mempool_free(pool); - UCX_TEST_ASSERT(*cb == 42, "destructor not called") + UCX_TEST_ASSERT(*cb == 42, "destructor not called"); UCX_TEST_END if (test != NULL) free(test); @@ -139,7 +139,7 @@ ucx_mempool_malloc(pool, sizeof(intptr_t)); intptr_t *test = (intptr_t*) ucx_mempool_calloc(pool, 2, sizeof(intptr_t)); - UCX_TEST_ASSERT(cb != NULL && test != NULL, "no memory for test data") + UCX_TEST_ASSERT(cb != NULL && test != NULL, "no memory for test data"); test[0] = 5; test[1] = (intptr_t) cb; *cb = 13; @@ -149,7 +149,7 @@ int *rtest, n = 2; do { n *= 2; - UCX_TEST_ASSERT(n < 65536, "test corrupt - no movement for realloc") + UCX_TEST_ASSERT(n < 65536, "test corrupt - no movement for realloc"); rtest = ucx_mempool_realloc(pool, test, n*sizeof(intptr_t)); } while (rtest == test); test = rtest; @@ -161,7 +161,7 @@ ucx_mempool_free(pool); - UCX_TEST_ASSERT(*cb == 42, "destructor not called") + UCX_TEST_ASSERT(*cb == 42, "destructor not called"); UCX_TEST_END if (cb != NULL) free(cb);