test/mpool_tests.c

changeset 32
c7af4ec56e19
parent 30
23bb65cbf7a4
child 33
9c219a62070d
--- 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));

mercurial