Thu, 31 May 2012 09:18:26 +0200
consequently used intptr_t in mpool tests
test/map_tests.c | file | annotate | diff | comparison | revisions | |
test/mpool_tests.c | file | annotate | diff | comparison | revisions |
--- a/test/map_tests.c Fri May 25 17:39:27 2012 +0200 +++ b/test/map_tests.c Thu May 31 09:18:26 2012 +0200 @@ -69,6 +69,7 @@ } UCX_TEST_BEGIN(test_ucx_map_get) { + // TODO: UCX_TEST_END } @@ -79,24 +80,24 @@ int v2 = 15; int v3 = 7; int v4 = 9; - + ucx_map_cstr_put(map, "v1", &v1); ucx_map_cstr_put(map, "v2", &v2); ucx_map_cstr_put(map, "v3", &v3); ucx_map_cstr_put(map, "v4", &v4); - + UcxMapIterator i = ucx_map_iterator(map); int check = 0; int hit = 0; - + UCX_MAP_FOREACH(int*, v, map, i) { check += *v; hit++; } - + UCX_TEST_ASSERT(hit == 4, "test1: wrong number of hits"); UCX_TEST_ASSERT(check == v1+v2+v3+v4, "test1: wrong result"); - + ucx_map_free(map); map = ucx_map_new(1);
--- a/test/mpool_tests.c Fri May 25 17:39:27 2012 +0200 +++ b/test/mpool_tests.c Thu May 31 09:18:26 2012 +0200 @@ -22,12 +22,13 @@ UcxMempool *pool = ucx_mempool_new(1); - int *test = (int*) ucx_mempool_malloc(pool, sizeof(int)); + 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") - int *pooladdr = (int*)((char*)pool->data[0] + sizeof(ucx_destructor)); + intptr_t *pooladdr = + (intptr_t*)((char*)pool->data[0] + sizeof(ucx_destructor)); *pooladdr = 5; UCX_TEST_ASSERT(*test == 5, "wrong pointer") @@ -42,12 +43,13 @@ UcxMempool *pool = ucx_mempool_new(1); ucx_mempool_malloc(pool, sizeof(int)); - int *test = (int*) 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") - int *pooladdr = (int*)((char*)pool->data[1] + sizeof(ucx_destructor)); + intptr_t *pooladdr = + (intptr_t*)((char*)pool->data[1] + sizeof(ucx_destructor)); *pooladdr = 5; UCX_TEST_ASSERT(*test == 5, "wrong pointer") @@ -61,7 +63,7 @@ UcxMempool *pool = ucx_mempool_new(1); - int *test = (int*) ucx_mempool_calloc(pool, 2, sizeof(int)); + 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") @@ -80,10 +82,10 @@ UcxMempool *pool = ucx_mempool_new(2); - ucx_mempool_malloc(pool, sizeof(int)); + ucx_mempool_malloc(pool, sizeof(intptr_t)); intptr_t *test = (intptr_t*) ucx_mempool_calloc(pool, 2, sizeof(intptr_t)); - int *cb = (intptr_t*) malloc(sizeof(intptr_t)); + intptr_t *cb = (intptr_t*) malloc(sizeof(intptr_t)); UCX_TEST_ASSERT(cb != NULL && test != NULL, "no memory for test data") test[0] = 5; test[1] = (intptr_t) cb; @@ -138,7 +140,7 @@ UcxMempool *pool = ucx_mempool_new(2); - ucx_mempool_malloc(pool, sizeof(int)); + ucx_mempool_malloc(pool, sizeof(intptr_t)); intptr_t *test = (intptr_t*) ucx_mempool_calloc(pool, 2, sizeof(intptr_t)); intptr_t *cb = (intptr_t*) malloc(sizeof(intptr_t));