test/mpool_tests.c

changeset 32
c7af4ec56e19
parent 30
23bb65cbf7a4
child 33
9c219a62070d
     1.1 --- a/test/mpool_tests.c	Fri May 25 17:39:27 2012 +0200
     1.2 +++ b/test/mpool_tests.c	Thu May 31 09:18:26 2012 +0200
     1.3 @@ -22,12 +22,13 @@
     1.4      
     1.5      UcxMempool *pool = ucx_mempool_new(1);
     1.6      
     1.7 -    int *test = (int*) ucx_mempool_malloc(pool, sizeof(int));
     1.8 +    intptr_t *test = (intptr_t*) ucx_mempool_malloc(pool, sizeof(intptr_t));
     1.9      
    1.10      UCX_TEST_ASSERT(pool->ndata == 1, "counter not incremented")
    1.11      UCX_TEST_ASSERT(pool->size == 1, "chcap called")
    1.12      
    1.13 -    int *pooladdr = (int*)((char*)pool->data[0] + sizeof(ucx_destructor));
    1.14 +    intptr_t *pooladdr =
    1.15 +            (intptr_t*)((char*)pool->data[0] + sizeof(ucx_destructor));
    1.16      *pooladdr = 5;
    1.17      
    1.18      UCX_TEST_ASSERT(*test == 5, "wrong pointer")
    1.19 @@ -42,12 +43,13 @@
    1.20      UcxMempool *pool = ucx_mempool_new(1);
    1.21      
    1.22      ucx_mempool_malloc(pool, sizeof(int));
    1.23 -    int *test = (int*) ucx_mempool_malloc(pool, sizeof(int));
    1.24 +    intptr_t *test = (intptr_t*) ucx_mempool_malloc(pool, sizeof(intptr_t));
    1.25      
    1.26      UCX_TEST_ASSERT(pool->ndata == 2, "counter not incremented")
    1.27      UCX_TEST_ASSERT(pool->size == 17, "chcap not called")
    1.28      
    1.29 -    int *pooladdr = (int*)((char*)pool->data[1] + sizeof(ucx_destructor));
    1.30 +    intptr_t *pooladdr =
    1.31 +            (intptr_t*)((char*)pool->data[1] + sizeof(ucx_destructor));
    1.32      *pooladdr = 5;
    1.33      
    1.34      UCX_TEST_ASSERT(*test == 5, "wrong pointer")
    1.35 @@ -61,7 +63,7 @@
    1.36      
    1.37      UcxMempool *pool = ucx_mempool_new(1);
    1.38      
    1.39 -    int *test = (int*) ucx_mempool_calloc(pool, 2, sizeof(int));
    1.40 +    intptr_t *test = (intptr_t*) ucx_mempool_calloc(pool, 2, sizeof(intptr_t));
    1.41      
    1.42      UCX_TEST_ASSERT(test != NULL, "no memory for test data")
    1.43      UCX_TEST_ASSERT(test[0] == 0 && test[1] == 0, "failed")
    1.44 @@ -80,10 +82,10 @@
    1.45      
    1.46      UcxMempool *pool = ucx_mempool_new(2);
    1.47      
    1.48 -    ucx_mempool_malloc(pool, sizeof(int));
    1.49 +    ucx_mempool_malloc(pool, sizeof(intptr_t));
    1.50      intptr_t *test = (intptr_t*) ucx_mempool_calloc(pool, 2, sizeof(intptr_t));
    1.51      
    1.52 -    int *cb = (intptr_t*) malloc(sizeof(intptr_t));
    1.53 +    intptr_t *cb = (intptr_t*) malloc(sizeof(intptr_t));
    1.54      UCX_TEST_ASSERT(cb != NULL && test != NULL, "no memory for test data")
    1.55      
    1.56      test[0] = 5; test[1] = (intptr_t) cb;
    1.57 @@ -138,7 +140,7 @@
    1.58      
    1.59      UcxMempool *pool = ucx_mempool_new(2);
    1.60      
    1.61 -    ucx_mempool_malloc(pool, sizeof(int));
    1.62 +    ucx_mempool_malloc(pool, sizeof(intptr_t));
    1.63      intptr_t *test = (intptr_t*) ucx_mempool_calloc(pool, 2, sizeof(intptr_t));
    1.64      
    1.65      intptr_t *cb = (intptr_t*) malloc(sizeof(intptr_t));

mercurial