test/mpool_tests.c

changeset 69
fb59270b1de3
parent 40
583718dd4cf3
child 103
08018864fb91
equal deleted inserted replaced
68:88dbea299440 69:fb59270b1de3
1 /* 1 /*
2 * 2 *
3 */ 3 */
4 4
5 #include <inttypes.h> 5 #include <stdint.h>
6 6
7 #include "mpool_tests.h" 7 #include "mpool_tests.h"
8 8
9 UCX_TEST_IMPLEMENT(test_ucx_mempool_new) { 9 UCX_TEST_IMPLEMENT(test_ucx_mempool_new) {
10 UcxMempool *pool = ucx_mempool_new(16); 10 UcxMempool *pool = ucx_mempool_new(16);
144 test[0] = 5; test[1] = (intptr_t) cb; 144 test[0] = 5; test[1] = (intptr_t) cb;
145 *cb = 13; 145 *cb = 13;
146 146
147 ucx_mempool_set_destr(test, test_setdestr); 147 ucx_mempool_set_destr(test, test_setdestr);
148 148
149 int *rtest, n = 2; 149 intptr_t *rtest, n = 2;
150 do { 150 do {
151 n *= 2; 151 n *= 2;
152 UCX_TEST_ASSERT(n < 65536, "test corrupt - no movement for realloc"); 152 UCX_TEST_ASSERT(n < 65536, "test corrupt - no movement for realloc");
153 rtest = ucx_mempool_realloc(pool, test, n*sizeof(intptr_t)); 153 rtest = (intptr_t*) ucx_mempool_realloc(pool, test, n*sizeof(intptr_t));
154 } while (rtest == test); 154 } while (rtest == test);
155 test = rtest; 155 test = rtest;
156 156
157 UCX_TEST_ASSERT(*(ucx_destructor*)(pool->data[1]) == test_setdestr, 157 UCX_TEST_ASSERT(*(ucx_destructor*)(pool->data[1]) == test_setdestr,
158 "realloc killed destructor") 158 "realloc killed destructor")

mercurial