test/mpool_tests.c

Tue, 21 Feb 2012 01:13:17 +0100

author
Mike Becker <universe@uap-core.de>
date
Tue, 21 Feb 2012 01:13:17 +0100
changeset 29
bce0d7f2912b
parent 28
1666cbeb1db8
child 30
23bb65cbf7a4
permissions
-rw-r--r--

fixed map with the help of new tests

13
98ac89e3aa37 Added mempool
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1 /*
98ac89e3aa37 Added mempool
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
2 *
98ac89e3aa37 Added mempool
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
3 */
98ac89e3aa37 Added mempool
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
4
98ac89e3aa37 Added mempool
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
5 #include "mpool_tests.h"
98ac89e3aa37 Added mempool
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
6
28
1666cbeb1db8 new mempool tests
Mike Becker <universe@uap-core.de>
parents: 19
diff changeset
7 UCX_TEST_BEGIN(test_ucx_mempool_new) {
1666cbeb1db8 new mempool tests
Mike Becker <universe@uap-core.de>
parents: 19
diff changeset
8 UcxMempool *pool = ucx_mempool_new(16);
1666cbeb1db8 new mempool tests
Mike Becker <universe@uap-core.de>
parents: 19
diff changeset
9
1666cbeb1db8 new mempool tests
Mike Becker <universe@uap-core.de>
parents: 19
diff changeset
10 UCX_TEST_ASSERT(pool->size == 16, "wrong size")
1666cbeb1db8 new mempool tests
Mike Becker <universe@uap-core.de>
parents: 19
diff changeset
11 UCX_TEST_ASSERT(pool->ndata == 0, "uninitialized counter")
1666cbeb1db8 new mempool tests
Mike Becker <universe@uap-core.de>
parents: 19
diff changeset
12 UCX_TEST_ASSERT(pool->data != NULL, "no memory addressed")
1666cbeb1db8 new mempool tests
Mike Becker <universe@uap-core.de>
parents: 19
diff changeset
13
1666cbeb1db8 new mempool tests
Mike Becker <universe@uap-core.de>
parents: 19
diff changeset
14 ucx_mempool_free(pool);
1666cbeb1db8 new mempool tests
Mike Becker <universe@uap-core.de>
parents: 19
diff changeset
15
1666cbeb1db8 new mempool tests
Mike Becker <universe@uap-core.de>
parents: 19
diff changeset
16 UCX_TEST_END
1666cbeb1db8 new mempool tests
Mike Becker <universe@uap-core.de>
parents: 19
diff changeset
17 }
13
98ac89e3aa37 Added mempool
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
18
28
1666cbeb1db8 new mempool tests
Mike Becker <universe@uap-core.de>
parents: 19
diff changeset
19 UCX_TEST_BEGIN(test_ucx_mempool_malloc) {
1666cbeb1db8 new mempool tests
Mike Becker <universe@uap-core.de>
parents: 19
diff changeset
20
1666cbeb1db8 new mempool tests
Mike Becker <universe@uap-core.de>
parents: 19
diff changeset
21 UcxMempool *pool = ucx_mempool_new(1);
1666cbeb1db8 new mempool tests
Mike Becker <universe@uap-core.de>
parents: 19
diff changeset
22
1666cbeb1db8 new mempool tests
Mike Becker <universe@uap-core.de>
parents: 19
diff changeset
23 int *test = (int*) ucx_mempool_malloc(pool, sizeof(int));
1666cbeb1db8 new mempool tests
Mike Becker <universe@uap-core.de>
parents: 19
diff changeset
24
1666cbeb1db8 new mempool tests
Mike Becker <universe@uap-core.de>
parents: 19
diff changeset
25 UCX_TEST_ASSERT(pool->ndata == 1, "counter not incremented")
1666cbeb1db8 new mempool tests
Mike Becker <universe@uap-core.de>
parents: 19
diff changeset
26 UCX_TEST_ASSERT(pool->size == 1, "chcap called")
1666cbeb1db8 new mempool tests
Mike Becker <universe@uap-core.de>
parents: 19
diff changeset
27
1666cbeb1db8 new mempool tests
Mike Becker <universe@uap-core.de>
parents: 19
diff changeset
28 int *pooladdr = (int*)((char*)pool->data[0] + sizeof(ucx_destructor));
1666cbeb1db8 new mempool tests
Mike Becker <universe@uap-core.de>
parents: 19
diff changeset
29 *pooladdr = 5;
1666cbeb1db8 new mempool tests
Mike Becker <universe@uap-core.de>
parents: 19
diff changeset
30
1666cbeb1db8 new mempool tests
Mike Becker <universe@uap-core.de>
parents: 19
diff changeset
31 UCX_TEST_ASSERT(*test == 5, "wrong pointer")
1666cbeb1db8 new mempool tests
Mike Becker <universe@uap-core.de>
parents: 19
diff changeset
32
1666cbeb1db8 new mempool tests
Mike Becker <universe@uap-core.de>
parents: 19
diff changeset
33 ucx_mempool_free(pool);
1666cbeb1db8 new mempool tests
Mike Becker <universe@uap-core.de>
parents: 19
diff changeset
34
1666cbeb1db8 new mempool tests
Mike Becker <universe@uap-core.de>
parents: 19
diff changeset
35 UCX_TEST_END
13
98ac89e3aa37 Added mempool
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
36 }
98ac89e3aa37 Added mempool
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
37
28
1666cbeb1db8 new mempool tests
Mike Becker <universe@uap-core.de>
parents: 19
diff changeset
38 UCX_TEST_BEGIN(test_ucx_mempool_malloc_with_chcap) {
1666cbeb1db8 new mempool tests
Mike Becker <universe@uap-core.de>
parents: 19
diff changeset
39
1666cbeb1db8 new mempool tests
Mike Becker <universe@uap-core.de>
parents: 19
diff changeset
40 UcxMempool *pool = ucx_mempool_new(1);
1666cbeb1db8 new mempool tests
Mike Becker <universe@uap-core.de>
parents: 19
diff changeset
41
1666cbeb1db8 new mempool tests
Mike Becker <universe@uap-core.de>
parents: 19
diff changeset
42 ucx_mempool_malloc(pool, sizeof(int));
1666cbeb1db8 new mempool tests
Mike Becker <universe@uap-core.de>
parents: 19
diff changeset
43 int *test = (int*) ucx_mempool_malloc(pool, sizeof(int));
1666cbeb1db8 new mempool tests
Mike Becker <universe@uap-core.de>
parents: 19
diff changeset
44
1666cbeb1db8 new mempool tests
Mike Becker <universe@uap-core.de>
parents: 19
diff changeset
45 UCX_TEST_ASSERT(pool->ndata == 2, "counter not incremented")
1666cbeb1db8 new mempool tests
Mike Becker <universe@uap-core.de>
parents: 19
diff changeset
46 UCX_TEST_ASSERT(pool->size == 17, "chcap not called")
1666cbeb1db8 new mempool tests
Mike Becker <universe@uap-core.de>
parents: 19
diff changeset
47
1666cbeb1db8 new mempool tests
Mike Becker <universe@uap-core.de>
parents: 19
diff changeset
48 int *pooladdr = (int*)((char*)pool->data[1] + sizeof(ucx_destructor));
1666cbeb1db8 new mempool tests
Mike Becker <universe@uap-core.de>
parents: 19
diff changeset
49 *pooladdr = 5;
1666cbeb1db8 new mempool tests
Mike Becker <universe@uap-core.de>
parents: 19
diff changeset
50
1666cbeb1db8 new mempool tests
Mike Becker <universe@uap-core.de>
parents: 19
diff changeset
51 UCX_TEST_ASSERT(*test == 5, "wrong pointer")
1666cbeb1db8 new mempool tests
Mike Becker <universe@uap-core.de>
parents: 19
diff changeset
52
1666cbeb1db8 new mempool tests
Mike Becker <universe@uap-core.de>
parents: 19
diff changeset
53 ucx_mempool_free(pool);
1666cbeb1db8 new mempool tests
Mike Becker <universe@uap-core.de>
parents: 19
diff changeset
54
1666cbeb1db8 new mempool tests
Mike Becker <universe@uap-core.de>
parents: 19
diff changeset
55 UCX_TEST_END
1666cbeb1db8 new mempool tests
Mike Becker <universe@uap-core.de>
parents: 19
diff changeset
56 }
1666cbeb1db8 new mempool tests
Mike Becker <universe@uap-core.de>
parents: 19
diff changeset
57
1666cbeb1db8 new mempool tests
Mike Becker <universe@uap-core.de>
parents: 19
diff changeset
58 UCX_TEST_BEGIN(test_ucx_mempool_calloc) {
1666cbeb1db8 new mempool tests
Mike Becker <universe@uap-core.de>
parents: 19
diff changeset
59
1666cbeb1db8 new mempool tests
Mike Becker <universe@uap-core.de>
parents: 19
diff changeset
60 UcxMempool *pool = ucx_mempool_new(1);
1666cbeb1db8 new mempool tests
Mike Becker <universe@uap-core.de>
parents: 19
diff changeset
61
1666cbeb1db8 new mempool tests
Mike Becker <universe@uap-core.de>
parents: 19
diff changeset
62 int *test = (int*) ucx_mempool_calloc(pool, 2, sizeof(int));
1666cbeb1db8 new mempool tests
Mike Becker <universe@uap-core.de>
parents: 19
diff changeset
63
1666cbeb1db8 new mempool tests
Mike Becker <universe@uap-core.de>
parents: 19
diff changeset
64 UCX_TEST_ASSERT(test != NULL, "no memory for test data")
1666cbeb1db8 new mempool tests
Mike Becker <universe@uap-core.de>
parents: 19
diff changeset
65 UCX_TEST_ASSERT(test[0] == 0 && test[1] == 0, "failed")
1666cbeb1db8 new mempool tests
Mike Becker <universe@uap-core.de>
parents: 19
diff changeset
66
1666cbeb1db8 new mempool tests
Mike Becker <universe@uap-core.de>
parents: 19
diff changeset
67 ucx_mempool_free(pool);
1666cbeb1db8 new mempool tests
Mike Becker <universe@uap-core.de>
parents: 19
diff changeset
68
1666cbeb1db8 new mempool tests
Mike Becker <universe@uap-core.de>
parents: 19
diff changeset
69 UCX_TEST_END
1666cbeb1db8 new mempool tests
Mike Becker <universe@uap-core.de>
parents: 19
diff changeset
70 }
1666cbeb1db8 new mempool tests
Mike Becker <universe@uap-core.de>
parents: 19
diff changeset
71
1666cbeb1db8 new mempool tests
Mike Becker <universe@uap-core.de>
parents: 19
diff changeset
72 void test_setdestr(void* elem) {
1666cbeb1db8 new mempool tests
Mike Becker <universe@uap-core.de>
parents: 19
diff changeset
73 int *cb = (int*) ((int*) elem)[1];
1666cbeb1db8 new mempool tests
Mike Becker <universe@uap-core.de>
parents: 19
diff changeset
74 *cb = 42;
13
98ac89e3aa37 Added mempool
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
75 }
98ac89e3aa37 Added mempool
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
76
28
1666cbeb1db8 new mempool tests
Mike Becker <universe@uap-core.de>
parents: 19
diff changeset
77 UCX_TEST_BEGIN(test_ucx_mempool_set_destr) {
1666cbeb1db8 new mempool tests
Mike Becker <universe@uap-core.de>
parents: 19
diff changeset
78
1666cbeb1db8 new mempool tests
Mike Becker <universe@uap-core.de>
parents: 19
diff changeset
79 UcxMempool *pool = ucx_mempool_new(2);
1666cbeb1db8 new mempool tests
Mike Becker <universe@uap-core.de>
parents: 19
diff changeset
80
1666cbeb1db8 new mempool tests
Mike Becker <universe@uap-core.de>
parents: 19
diff changeset
81 ucx_mempool_malloc(pool, sizeof(int));
1666cbeb1db8 new mempool tests
Mike Becker <universe@uap-core.de>
parents: 19
diff changeset
82 int *test = (int*) ucx_mempool_calloc(pool, 2, sizeof(int));
1666cbeb1db8 new mempool tests
Mike Becker <universe@uap-core.de>
parents: 19
diff changeset
83
1666cbeb1db8 new mempool tests
Mike Becker <universe@uap-core.de>
parents: 19
diff changeset
84 int *cb = (int*) malloc(sizeof(int));
1666cbeb1db8 new mempool tests
Mike Becker <universe@uap-core.de>
parents: 19
diff changeset
85 UCX_TEST_ASSERT(cb != NULL && test != NULL, "no memory for test data")
1666cbeb1db8 new mempool tests
Mike Becker <universe@uap-core.de>
parents: 19
diff changeset
86
1666cbeb1db8 new mempool tests
Mike Becker <universe@uap-core.de>
parents: 19
diff changeset
87 test[0] = 5; test[1] = (int) cb;
1666cbeb1db8 new mempool tests
Mike Becker <universe@uap-core.de>
parents: 19
diff changeset
88 *cb = 13;
1666cbeb1db8 new mempool tests
Mike Becker <universe@uap-core.de>
parents: 19
diff changeset
89
1666cbeb1db8 new mempool tests
Mike Becker <universe@uap-core.de>
parents: 19
diff changeset
90 ucx_mempool_set_destr(test, test_setdestr);
1666cbeb1db8 new mempool tests
Mike Becker <universe@uap-core.de>
parents: 19
diff changeset
91
1666cbeb1db8 new mempool tests
Mike Becker <universe@uap-core.de>
parents: 19
diff changeset
92 UCX_TEST_ASSERT(
1666cbeb1db8 new mempool tests
Mike Becker <universe@uap-core.de>
parents: 19
diff changeset
93 *(ucx_destructor*)(pool->data[1]) == test_setdestr, "failed")
1666cbeb1db8 new mempool tests
Mike Becker <universe@uap-core.de>
parents: 19
diff changeset
94 UCX_TEST_ASSERT(
1666cbeb1db8 new mempool tests
Mike Becker <universe@uap-core.de>
parents: 19
diff changeset
95 test[0] == 5 && test[1] == (int) cb, "setdestr destroyed data")
1666cbeb1db8 new mempool tests
Mike Becker <universe@uap-core.de>
parents: 19
diff changeset
96
1666cbeb1db8 new mempool tests
Mike Becker <universe@uap-core.de>
parents: 19
diff changeset
97 ucx_mempool_free(pool);
1666cbeb1db8 new mempool tests
Mike Becker <universe@uap-core.de>
parents: 19
diff changeset
98
1666cbeb1db8 new mempool tests
Mike Becker <universe@uap-core.de>
parents: 19
diff changeset
99 UCX_TEST_ASSERT(*cb == 42, "destructor not called")
13
98ac89e3aa37 Added mempool
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
100
28
1666cbeb1db8 new mempool tests
Mike Becker <universe@uap-core.de>
parents: 19
diff changeset
101 free(cb);
1666cbeb1db8 new mempool tests
Mike Becker <universe@uap-core.de>
parents: 19
diff changeset
102
1666cbeb1db8 new mempool tests
Mike Becker <universe@uap-core.de>
parents: 19
diff changeset
103 UCX_TEST_END
1666cbeb1db8 new mempool tests
Mike Becker <universe@uap-core.de>
parents: 19
diff changeset
104 }
13
98ac89e3aa37 Added mempool
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
105
98ac89e3aa37 Added mempool
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
106
28
1666cbeb1db8 new mempool tests
Mike Becker <universe@uap-core.de>
parents: 19
diff changeset
107 UCX_TEST_BEGIN(test_ucx_mempool_reg_destr) {
1666cbeb1db8 new mempool tests
Mike Becker <universe@uap-core.de>
parents: 19
diff changeset
108
1666cbeb1db8 new mempool tests
Mike Becker <universe@uap-core.de>
parents: 19
diff changeset
109 UcxMempool *pool = ucx_mempool_new(1);
1666cbeb1db8 new mempool tests
Mike Becker <universe@uap-core.de>
parents: 19
diff changeset
110
1666cbeb1db8 new mempool tests
Mike Becker <universe@uap-core.de>
parents: 19
diff changeset
111 int *test = (int*) ucx_mempool_calloc(pool, 2, sizeof(int));
1666cbeb1db8 new mempool tests
Mike Becker <universe@uap-core.de>
parents: 19
diff changeset
112
1666cbeb1db8 new mempool tests
Mike Becker <universe@uap-core.de>
parents: 19
diff changeset
113 int *cb = (int*) malloc(sizeof(int));
1666cbeb1db8 new mempool tests
Mike Becker <universe@uap-core.de>
parents: 19
diff changeset
114 UCX_TEST_ASSERT(cb != NULL && test != NULL, "no memory for test data")
1666cbeb1db8 new mempool tests
Mike Becker <universe@uap-core.de>
parents: 19
diff changeset
115
1666cbeb1db8 new mempool tests
Mike Becker <universe@uap-core.de>
parents: 19
diff changeset
116 test[0] = 5; test[1] = (int) cb;
1666cbeb1db8 new mempool tests
Mike Becker <universe@uap-core.de>
parents: 19
diff changeset
117 *cb = 13;
1666cbeb1db8 new mempool tests
Mike Becker <universe@uap-core.de>
parents: 19
diff changeset
118
1666cbeb1db8 new mempool tests
Mike Becker <universe@uap-core.de>
parents: 19
diff changeset
119 ucx_mempool_reg_destr(pool, test, test_setdestr);
1666cbeb1db8 new mempool tests
Mike Becker <universe@uap-core.de>
parents: 19
diff changeset
120
1666cbeb1db8 new mempool tests
Mike Becker <universe@uap-core.de>
parents: 19
diff changeset
121 ucx_destructor *pooladdr = (ucx_destructor*)
1666cbeb1db8 new mempool tests
Mike Becker <universe@uap-core.de>
parents: 19
diff changeset
122 ((char*)pool->data[1] + sizeof(ucx_destructor));
1666cbeb1db8 new mempool tests
Mike Becker <universe@uap-core.de>
parents: 19
diff changeset
123
1666cbeb1db8 new mempool tests
Mike Becker <universe@uap-core.de>
parents: 19
diff changeset
124 UCX_TEST_ASSERT(*pooladdr == test_setdestr, "failed")
1666cbeb1db8 new mempool tests
Mike Becker <universe@uap-core.de>
parents: 19
diff changeset
125
1666cbeb1db8 new mempool tests
Mike Becker <universe@uap-core.de>
parents: 19
diff changeset
126 ucx_mempool_free(pool);
1666cbeb1db8 new mempool tests
Mike Becker <universe@uap-core.de>
parents: 19
diff changeset
127
1666cbeb1db8 new mempool tests
Mike Becker <universe@uap-core.de>
parents: 19
diff changeset
128 UCX_TEST_ASSERT(*cb == 42, "destructor not called")
1666cbeb1db8 new mempool tests
Mike Becker <universe@uap-core.de>
parents: 19
diff changeset
129
1666cbeb1db8 new mempool tests
Mike Becker <universe@uap-core.de>
parents: 19
diff changeset
130 free(cb);
1666cbeb1db8 new mempool tests
Mike Becker <universe@uap-core.de>
parents: 19
diff changeset
131
1666cbeb1db8 new mempool tests
Mike Becker <universe@uap-core.de>
parents: 19
diff changeset
132 UCX_TEST_END
1666cbeb1db8 new mempool tests
Mike Becker <universe@uap-core.de>
parents: 19
diff changeset
133 }
13
98ac89e3aa37 Added mempool
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
134
28
1666cbeb1db8 new mempool tests
Mike Becker <universe@uap-core.de>
parents: 19
diff changeset
135 UCX_TEST_BEGIN(test_ucx_mempool_realloc) {
1666cbeb1db8 new mempool tests
Mike Becker <universe@uap-core.de>
parents: 19
diff changeset
136
1666cbeb1db8 new mempool tests
Mike Becker <universe@uap-core.de>
parents: 19
diff changeset
137 UcxMempool *pool = ucx_mempool_new(2);
1666cbeb1db8 new mempool tests
Mike Becker <universe@uap-core.de>
parents: 19
diff changeset
138
1666cbeb1db8 new mempool tests
Mike Becker <universe@uap-core.de>
parents: 19
diff changeset
139 ucx_mempool_malloc(pool, sizeof(int));
1666cbeb1db8 new mempool tests
Mike Becker <universe@uap-core.de>
parents: 19
diff changeset
140 int *test = (int*) ucx_mempool_calloc(pool, 2, sizeof(int));
1666cbeb1db8 new mempool tests
Mike Becker <universe@uap-core.de>
parents: 19
diff changeset
141
1666cbeb1db8 new mempool tests
Mike Becker <universe@uap-core.de>
parents: 19
diff changeset
142 int *cb = (int*) malloc(sizeof(int));
1666cbeb1db8 new mempool tests
Mike Becker <universe@uap-core.de>
parents: 19
diff changeset
143 UCX_TEST_ASSERT(cb != NULL && test != NULL, "no memory for test data")
1666cbeb1db8 new mempool tests
Mike Becker <universe@uap-core.de>
parents: 19
diff changeset
144
1666cbeb1db8 new mempool tests
Mike Becker <universe@uap-core.de>
parents: 19
diff changeset
145 test[0] = 5; test[1] = (int) cb;
1666cbeb1db8 new mempool tests
Mike Becker <universe@uap-core.de>
parents: 19
diff changeset
146 *cb = 13;
1666cbeb1db8 new mempool tests
Mike Becker <universe@uap-core.de>
parents: 19
diff changeset
147
1666cbeb1db8 new mempool tests
Mike Becker <universe@uap-core.de>
parents: 19
diff changeset
148 ucx_mempool_set_destr(test, test_setdestr);
14
b78e174b6814 Fixed realloc
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 13
diff changeset
149
28
1666cbeb1db8 new mempool tests
Mike Becker <universe@uap-core.de>
parents: 19
diff changeset
150 int *rtest, n = 2;
1666cbeb1db8 new mempool tests
Mike Becker <universe@uap-core.de>
parents: 19
diff changeset
151 do {
1666cbeb1db8 new mempool tests
Mike Becker <universe@uap-core.de>
parents: 19
diff changeset
152 n *= 2;
1666cbeb1db8 new mempool tests
Mike Becker <universe@uap-core.de>
parents: 19
diff changeset
153 UCX_TEST_ASSERT(n < 65536, "test corrupt - no movement for realloc")
1666cbeb1db8 new mempool tests
Mike Becker <universe@uap-core.de>
parents: 19
diff changeset
154 rtest = ucx_mempool_realloc(pool, test, n*sizeof(int));
1666cbeb1db8 new mempool tests
Mike Becker <universe@uap-core.de>
parents: 19
diff changeset
155 } while (rtest == test);
1666cbeb1db8 new mempool tests
Mike Becker <universe@uap-core.de>
parents: 19
diff changeset
156 test = rtest;
1666cbeb1db8 new mempool tests
Mike Becker <universe@uap-core.de>
parents: 19
diff changeset
157
1666cbeb1db8 new mempool tests
Mike Becker <universe@uap-core.de>
parents: 19
diff changeset
158 UCX_TEST_ASSERT(*(ucx_destructor*)(pool->data[1]) == test_setdestr,
1666cbeb1db8 new mempool tests
Mike Becker <universe@uap-core.de>
parents: 19
diff changeset
159 "realloc killed destructor")
1666cbeb1db8 new mempool tests
Mike Becker <universe@uap-core.de>
parents: 19
diff changeset
160 UCX_TEST_ASSERT(
1666cbeb1db8 new mempool tests
Mike Becker <universe@uap-core.de>
parents: 19
diff changeset
161 test[0] == 5 && test[1] == (int) cb, "realloc destroyed data")
1666cbeb1db8 new mempool tests
Mike Becker <universe@uap-core.de>
parents: 19
diff changeset
162
1666cbeb1db8 new mempool tests
Mike Becker <universe@uap-core.de>
parents: 19
diff changeset
163 ucx_mempool_free(pool);
1666cbeb1db8 new mempool tests
Mike Becker <universe@uap-core.de>
parents: 19
diff changeset
164
1666cbeb1db8 new mempool tests
Mike Becker <universe@uap-core.de>
parents: 19
diff changeset
165 UCX_TEST_ASSERT(*cb == 42, "destructor not called")
13
98ac89e3aa37 Added mempool
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
166
28
1666cbeb1db8 new mempool tests
Mike Becker <universe@uap-core.de>
parents: 19
diff changeset
167 free(cb);
13
98ac89e3aa37 Added mempool
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
168
28
1666cbeb1db8 new mempool tests
Mike Becker <universe@uap-core.de>
parents: 19
diff changeset
169 UCX_TEST_END
13
98ac89e3aa37 Added mempool
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
170 }

mercurial