• R/O
  • SSH
  • HTTPS

cstl: Commit


Commit MetaInfo

Revision399 (tree)
Time2010-07-26 21:30:55
Authorkatono

Log Message

ユニットテストライブラリを使うように修正。

Change Summary

Incremental Difference

--- branches/try-vfunc/test/vector_test.c (revision 398)
+++ branches/try-vfunc/test/vector_test.c (revision 399)
@@ -1,6 +1,6 @@
11 #include <stdio.h>
22 #include <string.h>
3-#include <assert.h>
3+#include "../unittest/UnitTest.h"
44 #include "../cstl/vector.h"
55 #include "Pool.h"
66 #ifdef MY_MALLOC
@@ -17,6 +17,9 @@
1717 #include "IntVector.h"
1818 #else
1919
20+/*#undef CSTL_ASSERT*/
21+/*#define CSTL_ASSERT ASSERT_FATAL*/
22+
2023 CSTL_VECTOR_INTERFACE(UCharVector, unsigned char)
2124 CSTL_VECTOR_INTERFACE(IntVector, int)
2225
@@ -53,57 +56,56 @@
5356 void VectorTest_test_1_1(void)
5457 {
5558 size_t a;
56- printf("***** test_1_1 *****\n");
5759 uv = UCharVector_new_reserve(SIZE);
5860 vector_init_hoge();
5961 /* 初期状態 */
60- assert(cstl_capacity(uv) == SIZE);
61- assert(cstl_size(uv) == 0);
62- assert(cstl_empty(uv));
62+ ASSERT(cstl_capacity(uv) == SIZE);
63+ ASSERT(cstl_size(uv) == 0);
64+ ASSERT(cstl_empty(uv));
6365 /* insert_array */
6466 cstl_clear(uv);
65- assert(cstl_insert_array(uv, cstl_begin(uv), hoge, SIZE));
66- assert(memcmp(cstl_at(uv, 0), hoge, SIZE) == 0);
67- assert(cstl_capacity(uv) == SIZE);
68- assert(cstl_size(uv) == SIZE);
69- assert(!cstl_empty(uv));
67+ ASSERT(cstl_insert_array(uv, cstl_begin(uv), hoge, SIZE));
68+ ASSERT(memcmp(cstl_at(uv, 0), hoge, SIZE) == 0);
69+ ASSERT(cstl_capacity(uv) == SIZE);
70+ ASSERT(cstl_size(uv) == SIZE);
71+ ASSERT(!cstl_empty(uv));
7072 /* clear */
7173 cstl_clear(uv);
72- assert(cstl_size(uv) == 0);
73- assert(cstl_empty(uv));
74+ ASSERT(cstl_size(uv) == 0);
75+ ASSERT(cstl_empty(uv));
7476 /* insert_array */
7577 cstl_clear(uv);
76- assert(cstl_insert_array(uv, cstl_begin(uv), &hoge[1], 255));
77- assert(memcmp(cstl_at(uv, 0), &hoge[1], 255) == 0);
78+ ASSERT(cstl_insert_array(uv, cstl_begin(uv), &hoge[1], 255));
79+ ASSERT(memcmp(cstl_at(uv, 0), &hoge[1], 255) == 0);
7880 a = cstl_capacity(uv);
79- assert(a > SIZE);
80- assert(cstl_size(uv) == 255);
81- assert(!cstl_empty(uv));
81+ ASSERT(a > SIZE);
82+ ASSERT(cstl_size(uv) == 255);
83+ ASSERT(!cstl_empty(uv));
8284 /* clear */
8385 cstl_clear(uv);
84- assert(cstl_size(uv) == 0);
85- assert(cstl_empty(uv));
86+ ASSERT(cstl_size(uv) == 0);
87+ ASSERT(cstl_empty(uv));
8688 /* insert_array */
8789 cstl_clear(uv);
88- assert(cstl_insert_array(uv, cstl_begin(uv), hoge, SIZE));
89- assert(memcmp(cstl_at(uv, 0), hoge, SIZE) == 0);
90- assert(cstl_capacity(uv) == a);
91- assert(cstl_size(uv) == SIZE);
92- assert(!cstl_empty(uv));
90+ ASSERT(cstl_insert_array(uv, cstl_begin(uv), hoge, SIZE));
91+ ASSERT(memcmp(cstl_at(uv, 0), hoge, SIZE) == 0);
92+ ASSERT(cstl_capacity(uv) == a);
93+ ASSERT(cstl_size(uv) == SIZE);
94+ ASSERT(!cstl_empty(uv));
9395 /* clear */
9496 cstl_clear(uv);
95- assert(cstl_size(uv) == 0);
96- assert(cstl_empty(uv));
97+ ASSERT(cstl_size(uv) == 0);
98+ ASSERT(cstl_empty(uv));
9799 /* reserve */
98- assert(cstl_reserve(uv, 1024));
99- assert(cstl_capacity(uv) == 1024);
100- assert(cstl_size(uv) == 0);
101- assert(cstl_empty(uv));
100+ ASSERT(cstl_reserve(uv, 1024));
101+ ASSERT(cstl_capacity(uv) == 1024);
102+ ASSERT(cstl_size(uv) == 0);
103+ ASSERT(cstl_empty(uv));
102104
103- assert(cstl_reserve(uv, 256));
104- assert(cstl_capacity(uv) == 1024);
105- assert(cstl_size(uv) == 0);
106- assert(cstl_empty(uv));
105+ ASSERT(cstl_reserve(uv, 256));
106+ ASSERT(cstl_capacity(uv) == 1024);
107+ ASSERT(cstl_size(uv) == 0);
108+ ASSERT(cstl_empty(uv));
107109
108110 POOL_DUMP_OVERFLOW(&pool);
109111 cstl_delete(uv);
@@ -110,8 +112,8 @@
110112
111113 /* new */
112114 uv = UCharVector_new();
113- assert(cstl_size(uv) == 0);
114- assert(cstl_empty(uv));
115+ ASSERT(cstl_size(uv) == 0);
116+ ASSERT(cstl_empty(uv));
115117 cstl_delete(uv);
116118 }
117119
@@ -119,44 +121,43 @@
119121 {
120122 int i;
121123 size_t a;
122- printf("***** test_1_2 *****\n");
123124 uv = UCharVector_new_reserve(SIZE);
124125 vector_init_hoge();
125126 /* push_back */
126127 for (i = 0; i < SIZE; i++) {
127- assert(cstl_push_back(uv, hoge[i]));
128- assert(cstl_size(uv) == i+1);
129- assert(*cstl_front(uv) == hoge[0]);
130- assert(*cstl_back(uv) == hoge[i]);
128+ ASSERT(cstl_push_back(uv, hoge[i]));
129+ ASSERT(cstl_size(uv) == i+1);
130+ ASSERT(*cstl_front(uv) == hoge[0]);
131+ ASSERT(*cstl_back(uv) == hoge[i]);
131132 }
132- assert(memcmp(cstl_at(uv, 0), hoge, SIZE) == 0);
133- assert(cstl_capacity(uv) == SIZE);
134- assert(cstl_size(uv) == SIZE);
135- assert(!cstl_empty(uv));
133+ ASSERT(memcmp(cstl_at(uv, 0), hoge, SIZE) == 0);
134+ ASSERT(cstl_capacity(uv) == SIZE);
135+ ASSERT(cstl_size(uv) == SIZE);
136+ ASSERT(!cstl_empty(uv));
136137 for (i = i; i < 256; i++) {
137- assert(cstl_push_back(uv, hoge[i]));
138- assert(cstl_size(uv) == i+1);
139- assert(*cstl_front(uv) == hoge[0]);
140- assert(*cstl_back(uv) == hoge[i]);
138+ ASSERT(cstl_push_back(uv, hoge[i]));
139+ ASSERT(cstl_size(uv) == i+1);
140+ ASSERT(*cstl_front(uv) == hoge[0]);
141+ ASSERT(*cstl_back(uv) == hoge[i]);
141142 }
142- assert(memcmp(cstl_at(uv, 0), hoge, 256) == 0);
143+ ASSERT(memcmp(cstl_at(uv, 0), hoge, 256) == 0);
143144 a = cstl_capacity(uv);
144- assert(a > SIZE);
145- assert(cstl_size(uv) == 256);
146- assert(!cstl_empty(uv));
145+ ASSERT(a > SIZE);
146+ ASSERT(cstl_size(uv) == 256);
147+ ASSERT(!cstl_empty(uv));
147148 /* front, back */
148- assert(*cstl_front(uv) == hoge[0]);
149- assert(*cstl_back(uv) == hoge[255]);
149+ ASSERT(*cstl_front(uv) == hoge[0]);
150+ ASSERT(*cstl_back(uv) == hoge[255]);
150151 /* pop_back */
151152 for (i = 255; i >= 0; i--) {
152- assert(*cstl_front(uv) == hoge[0]);
153- assert(*cstl_back(uv) == hoge[i]);
153+ ASSERT(*cstl_front(uv) == hoge[0]);
154+ ASSERT(*cstl_back(uv) == hoge[i]);
154155 cstl_pop_back(uv);
155- assert(cstl_size(uv) == i);
156+ ASSERT(cstl_size(uv) == i);
156157 }
157- assert(cstl_size(uv) == 0);
158- assert(cstl_empty(uv));
159- assert(cstl_capacity(uv) == a);
158+ ASSERT(cstl_size(uv) == 0);
159+ ASSERT(cstl_empty(uv));
160+ ASSERT(cstl_capacity(uv) == a);
160161
161162 POOL_DUMP_OVERFLOW(&pool);
162163 cstl_delete(uv);
@@ -165,25 +166,24 @@
165166 void VectorTest_test_1_3(void)
166167 {
167168 int i;
168- printf("***** test_1_3 *****\n");
169169 uv = UCharVector_new_reserve(SIZE);
170170 vector_init_hoge();
171171 /* insert_array */
172172 cstl_clear(uv);
173- assert(cstl_insert_array(uv, cstl_begin(uv), hoge, SIZE));
174- assert(memcmp(cstl_at(uv, 0), hoge, SIZE) == 0);
175- assert(cstl_capacity(uv) == SIZE);
176- assert(cstl_size(uv) == SIZE);
177- assert(!cstl_empty(uv));
173+ ASSERT(cstl_insert_array(uv, cstl_begin(uv), hoge, SIZE));
174+ ASSERT(memcmp(cstl_at(uv, 0), hoge, SIZE) == 0);
175+ ASSERT(cstl_capacity(uv) == SIZE);
176+ ASSERT(cstl_size(uv) == SIZE);
177+ ASSERT(!cstl_empty(uv));
178178 /* at */
179179 for (i = 0; i < SIZE; i++) {
180- assert(*cstl_at(uv, i) == hoge[i]);
180+ ASSERT(*cstl_at(uv, i) == hoge[i]);
181181 *cstl_at(uv, i) = hoge[i]+1;
182- assert(*cstl_at(uv, i) == hoge[i]+1);
182+ ASSERT(*cstl_at(uv, i) == hoge[i]+1);
183183 }
184- assert(cstl_capacity(uv) == SIZE);
185- assert(cstl_size(uv) == SIZE);
186- assert(!cstl_empty(uv));
184+ ASSERT(cstl_capacity(uv) == SIZE);
185+ ASSERT(cstl_size(uv) == SIZE);
186+ ASSERT(!cstl_empty(uv));
187187
188188 POOL_DUMP_OVERFLOW(&pool);
189189 cstl_delete(uv);
@@ -194,51 +194,50 @@
194194 int i;
195195 unsigned char buf[256];
196196 UCharVectorIterator iter;
197- printf("***** test_1_4 *****\n");
198197 uv = UCharVector_new_reserve(SIZE);
199198 /* insert */
200199 for (i = 0; i < SIZE; i++) {
201- assert(cstl_insert(uv, cstl_begin(uv), hoge[i], NULL));
200+ ASSERT(cstl_insert(uv, cstl_begin(uv), hoge[i], NULL));
202201 buf[i] = SIZE - i - 1;
203202 }
204- assert(memcmp(cstl_at(uv, 0), buf, SIZE) == 0);
205- assert(cstl_capacity(uv) == SIZE);
206- assert(cstl_size(uv) == SIZE);
207- assert(!cstl_empty(uv));
203+ ASSERT(memcmp(cstl_at(uv, 0), buf, SIZE) == 0);
204+ ASSERT(cstl_capacity(uv) == SIZE);
205+ ASSERT(cstl_size(uv) == SIZE);
206+ ASSERT(!cstl_empty(uv));
208207 for (i = SIZE; i < 256; i++) {
209-/* assert(cstl_insert(uv, cstl_size(uv), hoge[i]));*/
210- assert(cstl_insert(uv, cstl_end(uv), hoge[i], NULL));
208+/* ASSERT(cstl_insert(uv, cstl_size(uv), hoge[i]));*/
209+ ASSERT(cstl_insert(uv, cstl_end(uv), hoge[i], NULL));
211210 buf[i] = i;
212- assert(cstl_capacity(uv) > SIZE);
211+ ASSERT(cstl_capacity(uv) > SIZE);
213212 }
214- assert(memcmp(&cstl_at(uv, 0)[SIZE], &buf[SIZE], 256-SIZE) == 0);
215- assert(cstl_size(uv) == 256);
216-/* assert(cstl_insert(uv, SIZE, 0, NULL));*/
217- assert(cstl_insert(uv, cstl_iter_add(cstl_begin(uv), SIZE), 0, NULL));
218- assert(memcmp(cstl_at(uv, 0), buf, SIZE) == 0);
219- assert(cstl_at(uv, 0)[SIZE] == 0);
220- assert(memcmp(&cstl_at(uv, 0)[SIZE+1], &buf[SIZE], 256-SIZE) == 0);
221- assert(cstl_size(uv) == 257);
213+ ASSERT(memcmp(&cstl_at(uv, 0)[SIZE], &buf[SIZE], 256-SIZE) == 0);
214+ ASSERT(cstl_size(uv) == 256);
215+/* ASSERT(cstl_insert(uv, SIZE, 0, NULL));*/
216+ ASSERT(cstl_insert(uv, cstl_iter_add(cstl_begin(uv), SIZE), 0, NULL));
217+ ASSERT(memcmp(cstl_at(uv, 0), buf, SIZE) == 0);
218+ ASSERT(cstl_at(uv, 0)[SIZE] == 0);
219+ ASSERT(memcmp(&cstl_at(uv, 0)[SIZE+1], &buf[SIZE], 256-SIZE) == 0);
220+ ASSERT(cstl_size(uv) == 257);
222221 /* erase */
223222 /* cstl_erase(uv, SIZE, 1);*/
224223 iter = cstl_begin(uv);
225224 cstl_erase(uv, cstl_iter_add(iter, SIZE));
226- assert(memcmp(cstl_at(uv, 0), buf, SIZE) == 0);
227- assert(memcmp(&cstl_at(uv, 0)[SIZE], &buf[SIZE], 256-SIZE) == 0);
225+ ASSERT(memcmp(cstl_at(uv, 0), buf, SIZE) == 0);
226+ ASSERT(memcmp(&cstl_at(uv, 0)[SIZE], &buf[SIZE], 256-SIZE) == 0);
228227 for (i = SIZE; i < 256; i++) {
229228 /* cstl_erase(uv, cstl_size(uv)-1, 1);*/
230229 iter = cstl_end(uv);
231230 cstl_erase(uv, cstl_iter_prev(iter));
232231 }
233- assert(memcmp(cstl_at(uv, 0), buf, SIZE) == 0);
234- assert(cstl_size(uv) == SIZE);
232+ ASSERT(memcmp(cstl_at(uv, 0), buf, SIZE) == 0);
233+ ASSERT(cstl_size(uv) == SIZE);
235234 for (i = 0; i < SIZE; i++) {
236- assert(memcmp(cstl_at(uv, 0), &buf[i], SIZE-i) == 0);
235+ ASSERT(memcmp(cstl_at(uv, 0), &buf[i], SIZE-i) == 0);
237236 /* cstl_erase(uv, 0, 1);*/
238237 cstl_erase(uv, cstl_begin(uv));
239- assert(cstl_size(uv) == SIZE-i-1);
238+ ASSERT(cstl_size(uv) == SIZE-i-1);
240239 }
241- assert(cstl_size(uv) == 0);
240+ ASSERT(cstl_size(uv) == 0);
242241
243242 POOL_DUMP_OVERFLOW(&pool);
244243 cstl_delete(uv);
@@ -247,61 +246,60 @@
247246 void VectorTest_test_1_5(void)
248247 {
249248 UCharVectorIterator iter;
250- printf("***** test_1_5 *****\n");
251249 uv = UCharVector_new_reserve(SIZE);
252250 vector_init_hoge();
253251 /* insert_array */
254- assert(cstl_insert_array(uv, cstl_begin(uv), hoge, SIZE));
255- assert(memcmp(cstl_at(uv, 0), hoge, SIZE) == 0);
256- assert(cstl_capacity(uv) == SIZE);
257- assert(cstl_size(uv) == SIZE);
252+ ASSERT(cstl_insert_array(uv, cstl_begin(uv), hoge, SIZE));
253+ ASSERT(memcmp(cstl_at(uv, 0), hoge, SIZE) == 0);
254+ ASSERT(cstl_capacity(uv) == SIZE);
255+ ASSERT(cstl_size(uv) == SIZE);
258256
259- assert(cstl_insert_array(uv, cstl_end(uv), &hoge[SIZE], 256-SIZE));
260- assert(memcmp(cstl_at(uv, 0), hoge, 256) == 0);
261- assert(cstl_capacity(uv) > SIZE);
262- assert(cstl_size(uv) == 256);
257+ ASSERT(cstl_insert_array(uv, cstl_end(uv), &hoge[SIZE], 256-SIZE));
258+ ASSERT(memcmp(cstl_at(uv, 0), hoge, 256) == 0);
259+ ASSERT(cstl_capacity(uv) > SIZE);
260+ ASSERT(cstl_size(uv) == 256);
263261
264- assert(cstl_insert_array(uv, cstl_iter_add(cstl_begin(uv), SIZE), hoge, SIZE));
265- assert(memcmp(cstl_at(uv, 0), hoge, SIZE) == 0);
266- assert(memcmp(&cstl_at(uv, 0)[SIZE], hoge, 256) == 0);
267- assert(cstl_size(uv) == 256+SIZE);
262+ ASSERT(cstl_insert_array(uv, cstl_iter_add(cstl_begin(uv), SIZE), hoge, SIZE));
263+ ASSERT(memcmp(cstl_at(uv, 0), hoge, SIZE) == 0);
264+ ASSERT(memcmp(&cstl_at(uv, 0)[SIZE], hoge, 256) == 0);
265+ ASSERT(cstl_size(uv) == 256+SIZE);
268266
269- assert(cstl_insert_array(uv, cstl_begin(uv), hoge, 1));
270- assert(*cstl_at(uv, 0) == hoge[0]);
271- assert(memcmp(&cstl_at(uv, 0)[1], hoge, SIZE) == 0);
272- assert(memcmp(&cstl_at(uv, 0)[SIZE+1], hoge, 256) == 0);
273- assert(cstl_size(uv) == 257+SIZE);
267+ ASSERT(cstl_insert_array(uv, cstl_begin(uv), hoge, 1));
268+ ASSERT(*cstl_at(uv, 0) == hoge[0]);
269+ ASSERT(memcmp(&cstl_at(uv, 0)[1], hoge, SIZE) == 0);
270+ ASSERT(memcmp(&cstl_at(uv, 0)[SIZE+1], hoge, 256) == 0);
271+ ASSERT(cstl_size(uv) == 257+SIZE);
274272
275- assert(cstl_insert_array(uv, cstl_begin(uv), hoge, 0));
276- assert(*cstl_at(uv, 0) == hoge[0]);
277- assert(memcmp(&cstl_at(uv, 0)[1], hoge, SIZE) == 0);
278- assert(memcmp(&cstl_at(uv, 0)[SIZE+1], hoge, 256) == 0);
279- assert(cstl_size(uv) == 257+SIZE);
273+ ASSERT(cstl_insert_array(uv, cstl_begin(uv), hoge, 0));
274+ ASSERT(*cstl_at(uv, 0) == hoge[0]);
275+ ASSERT(memcmp(&cstl_at(uv, 0)[1], hoge, SIZE) == 0);
276+ ASSERT(memcmp(&cstl_at(uv, 0)[SIZE+1], hoge, 256) == 0);
277+ ASSERT(cstl_size(uv) == 257+SIZE);
280278 /* erase */
281279 /* cstl_erase(uv, 0, 1);*/
282280 cstl_erase(uv, cstl_begin(uv));
283- assert(memcmp(cstl_at(uv, 0), hoge, SIZE) == 0);
284- assert(memcmp(&cstl_at(uv, 0)[SIZE], hoge, 256) == 0);
285- assert(cstl_size(uv) == 256+SIZE);
281+ ASSERT(memcmp(cstl_at(uv, 0), hoge, SIZE) == 0);
282+ ASSERT(memcmp(&cstl_at(uv, 0)[SIZE], hoge, 256) == 0);
283+ ASSERT(cstl_size(uv) == 256+SIZE);
286284
287285 /* cstl_erase(uv, SIZE, SIZE);*/
288286 iter = cstl_begin(uv);
289287 iter = cstl_iter_add(iter, SIZE);
290288 cstl_erase_range(uv, iter, cstl_iter_add(iter, SIZE));
291- assert(memcmp(cstl_at(uv, 0), hoge, 256) == 0);
292- assert(cstl_size(uv) == 256);
289+ ASSERT(memcmp(cstl_at(uv, 0), hoge, 256) == 0);
290+ ASSERT(cstl_size(uv) == 256);
293291
294292 /* cstl_erase(uv, SIZE, 256-SIZE);*/
295293 iter = cstl_begin(uv);
296294 iter = cstl_iter_add(iter, SIZE);
297295 cstl_erase_range(uv, iter, cstl_iter_add(iter, 256-SIZE));
298- assert(memcmp(cstl_at(uv, 0), hoge, SIZE) == 0);
299- assert(cstl_size(uv) == SIZE);
296+ ASSERT(memcmp(cstl_at(uv, 0), hoge, SIZE) == 0);
297+ ASSERT(cstl_size(uv) == SIZE);
300298
301299 /* cstl_erase(uv, 0, SIZE);*/
302300 iter = cstl_begin(uv);
303301 cstl_erase_range(uv, iter, cstl_iter_add(iter, SIZE));
304- assert(cstl_size(uv) == 0);
302+ ASSERT(cstl_size(uv) == 0);
305303
306304 POOL_DUMP_OVERFLOW(&pool);
307305 cstl_delete(uv);
@@ -314,138 +312,137 @@
314312 size_t i;
315313 unsigned char b[] = {1, 2, 4, 43, 2, 54, 1, 0, 2, 24};
316314 size_t cap1, cap2;
317- printf("***** test_1_6 *****\n");
318315 uv = UCharVector_new_reserve(SIZE);
319316 vector_init_hoge();
320317
321318 cstl_clear(uv);
322- assert(cstl_insert_array(uv, cstl_begin(uv), hoge, SIZE));
323- assert(memcmp(cstl_at(uv, 0), hoge, SIZE) == 0);
324- assert(cstl_size(uv) == SIZE);
325- assert(cstl_capacity(uv) == SIZE);
319+ ASSERT(cstl_insert_array(uv, cstl_begin(uv), hoge, SIZE));
320+ ASSERT(memcmp(cstl_at(uv, 0), hoge, SIZE) == 0);
321+ ASSERT(cstl_size(uv) == SIZE);
322+ ASSERT(cstl_capacity(uv) == SIZE);
326323 /* resize */
327- assert(cstl_resize(uv, SIZE + 10, 255));
328- assert(cstl_size(uv) == SIZE + 10);
329- assert(memcmp(cstl_at(uv, 0), hoge, SIZE) == 0);
330- assert(*cstl_at(uv, SIZE) == 255);
331- assert(*cstl_at(uv, SIZE + 9) == 255);
332- assert(cstl_capacity(uv) > SIZE);
324+ ASSERT(cstl_resize(uv, SIZE + 10, 255));
325+ ASSERT(cstl_size(uv) == SIZE + 10);
326+ ASSERT(memcmp(cstl_at(uv, 0), hoge, SIZE) == 0);
327+ ASSERT(*cstl_at(uv, SIZE) == 255);
328+ ASSERT(*cstl_at(uv, SIZE + 9) == 255);
329+ ASSERT(cstl_capacity(uv) > SIZE);
333330
334- assert(cstl_resize(uv, SIZE - 10, 255));
335- assert(cstl_size(uv) == SIZE - 10);
331+ ASSERT(cstl_resize(uv, SIZE - 10, 255));
332+ ASSERT(cstl_size(uv) == SIZE - 10);
336333
337- assert(cstl_resize(uv, 0, 255));
338- assert(cstl_empty(uv));
334+ ASSERT(cstl_resize(uv, 0, 255));
335+ ASSERT(cstl_empty(uv));
339336 /* shrink */
340- assert(cstl_resize(uv, 1000, 255));
341- assert(cstl_capacity(uv) == 1000);
342- assert(cstl_size(uv) == 1000);
343- assert(cstl_resize(uv, 100, 255));
344- assert(cstl_capacity(uv) == 1000);
345- assert(cstl_size(uv) == 100);
337+ ASSERT(cstl_resize(uv, 1000, 255));
338+ ASSERT(cstl_capacity(uv) == 1000);
339+ ASSERT(cstl_size(uv) == 1000);
340+ ASSERT(cstl_resize(uv, 100, 255));
341+ ASSERT(cstl_capacity(uv) == 1000);
342+ ASSERT(cstl_size(uv) == 100);
346343 cstl_shrink(uv, 500);
347- assert(cstl_capacity(uv) == 500);
348- assert(cstl_size(uv) == 100);
344+ ASSERT(cstl_capacity(uv) == 500);
345+ ASSERT(cstl_size(uv) == 100);
349346 cstl_shrink(uv, 0);
350- assert(cstl_capacity(uv) == 100);
351- assert(cstl_size(uv) == 100);
352- assert(cstl_resize(uv, 10, 255));
347+ ASSERT(cstl_capacity(uv) == 100);
348+ ASSERT(cstl_size(uv) == 100);
349+ ASSERT(cstl_resize(uv, 10, 255));
353350 cstl_shrink(uv, 500);
354- assert(cstl_capacity(uv) == 100);
355- assert(cstl_size(uv) == 10);
351+ ASSERT(cstl_capacity(uv) == 100);
352+ ASSERT(cstl_size(uv) == 10);
356353 cstl_shrink(uv, 0);
357- assert(cstl_capacity(uv) == 10);
358- assert(cstl_size(uv) == 10);
354+ ASSERT(cstl_capacity(uv) == 10);
355+ ASSERT(cstl_size(uv) == 10);
359356 /* swap */
360357 x = UCharVector_new_reserve(SIZE);
361358 cstl_clear(uv);
362359 cstl_shrink(uv, 0);
363360 cstl_clear(uv);
364- assert(cstl_insert_array(uv, cstl_begin(uv), hoge, SIZE));
365- assert(memcmp(cstl_at(uv, 0), hoge, SIZE) == 0);
366- assert(cstl_size(uv) == SIZE);
361+ ASSERT(cstl_insert_array(uv, cstl_begin(uv), hoge, SIZE));
362+ ASSERT(memcmp(cstl_at(uv, 0), hoge, SIZE) == 0);
363+ ASSERT(cstl_size(uv) == SIZE);
367364 cap1 = cstl_capacity(uv);
368365 cstl_clear(x);
369366 cstl_shrink(x, 0);
370367 cstl_clear(x);
371- assert(cstl_insert_array(x, cstl_begin(uv), b, sizeof b));
372- assert(memcmp(cstl_at(x, 0), b, sizeof b) == 0);
373- assert(cstl_size(x) == sizeof b);
368+ ASSERT(cstl_insert_array(x, cstl_begin(uv), b, sizeof b));
369+ ASSERT(memcmp(cstl_at(x, 0), b, sizeof b) == 0);
370+ ASSERT(cstl_size(x) == sizeof b);
374371 cap2 = cstl_capacity(x);
375372
376373 cstl_swap(uv, x);
377374
378- assert(memcmp(cstl_at(uv, 0), b, sizeof b) == 0);
379- assert(cstl_size(uv) == sizeof b);
380- assert(cstl_capacity(uv) == cap2);
381- assert(memcmp(cstl_at(x, 0), hoge, SIZE) == 0);
382- assert(cstl_size(x) == SIZE);
383- assert(cstl_capacity(x) == cap1);
375+ ASSERT(memcmp(cstl_at(uv, 0), b, sizeof b) == 0);
376+ ASSERT(cstl_size(uv) == sizeof b);
377+ ASSERT(cstl_capacity(uv) == cap2);
378+ ASSERT(memcmp(cstl_at(x, 0), hoge, SIZE) == 0);
379+ ASSERT(cstl_size(x) == SIZE);
380+ ASSERT(cstl_capacity(x) == cap1);
384381 /* insert_range */
385382 cstl_clear(uv);
386383 cstl_shrink(uv, 0);
387384 cstl_clear(x);
388385 cstl_shrink(x, 0);
389- assert(cstl_insert_array(uv, cstl_begin(uv), hoge, SIZE));
390- assert(cstl_insert_array(x, cstl_begin(uv), b, sizeof b));
391-/* assert(cstl_insert_range(uv, 0, x, 0, sizeof b));*/
392- assert(cstl_insert_range(uv, cstl_begin(uv), cstl_begin(x), cstl_iter_add(cstl_begin(x), sizeof b)));
386+ ASSERT(cstl_insert_array(uv, cstl_begin(uv), hoge, SIZE));
387+ ASSERT(cstl_insert_array(x, cstl_begin(uv), b, sizeof b));
388+/* ASSERT(cstl_insert_range(uv, 0, x, 0, sizeof b));*/
389+ ASSERT(cstl_insert_range(uv, cstl_begin(uv), cstl_begin(x), cstl_iter_add(cstl_begin(x), sizeof b)));
393390 for (i = 0; i < cstl_size(uv); i++) {
394391 if (i < sizeof b) {
395- assert(*cstl_at(uv, i) == *cstl_at(x, i));
392+ ASSERT(*cstl_at(uv, i) == *cstl_at(x, i));
396393 } else {
397- assert(*cstl_at(uv, i) == hoge[i - sizeof b]);
394+ ASSERT(*cstl_at(uv, i) == hoge[i - sizeof b]);
398395 }
399396 printf("%02d ", *cstl_at(uv, i));
400397 }
401398 printf("\n");
402399 cstl_clear(uv);
403- assert(cstl_insert_array(uv, cstl_begin(uv), hoge, SIZE));
400+ ASSERT(cstl_insert_array(uv, cstl_begin(uv), hoge, SIZE));
404401 for (i = 0; i < cstl_size(uv); i++) {
405402 printf("%02d ", *cstl_at(uv, i));
406403 }
407404 printf("\n");
408405
409-/* assert(cstl_insert_range(uv, 0, uv, 1, 4));*/
406+/* ASSERT(cstl_insert_range(uv, 0, uv, 1, 4));*/
410407 iter = cstl_begin(uv);
411- assert(cstl_insert_range(uv, iter, cstl_iter_add(iter, 1), cstl_iter_add(iter, 5)));
408+ ASSERT(cstl_insert_range(uv, iter, cstl_iter_add(iter, 1), cstl_iter_add(iter, 5)));
412409 for (i = 0; i < cstl_size(uv); i++) {
413410 if (i < 4) {
414- assert(*cstl_at(uv, i) == hoge[1 + i]);
411+ ASSERT(*cstl_at(uv, i) == hoge[1 + i]);
415412 } else {
416- assert(*cstl_at(uv, i) == hoge[i - 4]);
413+ ASSERT(*cstl_at(uv, i) == hoge[i - 4]);
417414 }
418415 printf("%02d ", *cstl_at(uv, i));
419416 }
420417 printf("\n");
421418 cstl_clear(uv);
422- assert(cstl_insert_array(uv, cstl_begin(uv), hoge, SIZE));
423-/* assert(cstl_insert_range(uv, 3, uv, 1, 4));*/
419+ ASSERT(cstl_insert_array(uv, cstl_begin(uv), hoge, SIZE));
420+/* ASSERT(cstl_insert_range(uv, 3, uv, 1, 4));*/
424421 iter = cstl_begin(uv);
425- assert(cstl_insert_range(uv, cstl_iter_add(iter, 3), cstl_iter_add(iter, 1), cstl_iter_add(iter, 5)));
422+ ASSERT(cstl_insert_range(uv, cstl_iter_add(iter, 3), cstl_iter_add(iter, 1), cstl_iter_add(iter, 5)));
426423 for (i = 0; i < cstl_size(uv); i++) {
427424 if (i < 3) {
428- assert(*cstl_at(uv, i) == hoge[i]);
425+ ASSERT(*cstl_at(uv, i) == hoge[i]);
429426 } else if (3 <= i && i < 3 + 4) {
430- assert(*cstl_at(uv, i) == hoge[1 + i - 3]);
427+ ASSERT(*cstl_at(uv, i) == hoge[1 + i - 3]);
431428 } else {
432- assert(*cstl_at(uv, i) == hoge[i - 4]);
429+ ASSERT(*cstl_at(uv, i) == hoge[i - 4]);
433430 }
434431 printf("%02d ", *cstl_at(uv, i));
435432 }
436433 printf("\n");
437434 cstl_clear(uv);
438- assert(cstl_insert_array(uv, cstl_begin(uv), hoge, SIZE));
439-/* assert(cstl_insert_range(uv, 5, uv, 1, 4));*/
435+ ASSERT(cstl_insert_array(uv, cstl_begin(uv), hoge, SIZE));
436+/* ASSERT(cstl_insert_range(uv, 5, uv, 1, 4));*/
440437 iter = cstl_begin(uv);
441- assert(cstl_insert_range(uv, cstl_iter_add(iter, 5), cstl_iter_add(iter, 1), cstl_iter_add(iter, 5)));
438+ ASSERT(cstl_insert_range(uv, cstl_iter_add(iter, 5), cstl_iter_add(iter, 1), cstl_iter_add(iter, 5)));
442439 for (i = 0; i < cstl_size(uv); i++) {
443440 if (i < 5) {
444- assert(*cstl_at(uv, i) == hoge[i]);
441+ ASSERT(*cstl_at(uv, i) == hoge[i]);
445442 } else if (5 <= i && i < 5 + 4) {
446- assert(*cstl_at(uv, i) == hoge[1 + i - 5]);
443+ ASSERT(*cstl_at(uv, i) == hoge[1 + i - 5]);
447444 } else {
448- assert(*cstl_at(uv, i) == hoge[i - 4]);
445+ ASSERT(*cstl_at(uv, i) == hoge[i - 4]);
449446 }
450447 printf("%02d ", *cstl_at(uv, i));
451448 }
@@ -462,57 +459,56 @@
462459 void VectorTest_test_2_1(void)
463460 {
464461 size_t a;
465- printf("***** test_2_1 *****\n");
466462 iv = IntVector_new_reserve(SIZE);
467463 vector_init_piyo();
468464 /* 初期状態 */
469- assert(cstl_capacity(iv) == SIZE);
470- assert(cstl_size(iv) == 0);
471- assert(cstl_empty(iv));
465+ ASSERT(cstl_capacity(iv) == SIZE);
466+ ASSERT(cstl_size(iv) == 0);
467+ ASSERT(cstl_empty(iv));
472468 /* insert_array */
473469 cstl_clear(iv);
474- assert(cstl_insert_array(iv, cstl_begin(iv), piyo, SIZE));
475- assert(memcmp(cstl_at(iv, 0), piyo, SIZE) == 0);
476- assert(cstl_capacity(iv) == SIZE);
477- assert(cstl_size(iv) == SIZE);
478- assert(!cstl_empty(iv));
470+ ASSERT(cstl_insert_array(iv, cstl_begin(iv), piyo, SIZE));
471+ ASSERT(memcmp(cstl_at(iv, 0), piyo, SIZE) == 0);
472+ ASSERT(cstl_capacity(iv) == SIZE);
473+ ASSERT(cstl_size(iv) == SIZE);
474+ ASSERT(!cstl_empty(iv));
479475 /* clear */
480476 cstl_clear(iv);
481- assert(cstl_size(iv) == 0);
482- assert(cstl_empty(iv));
477+ ASSERT(cstl_size(iv) == 0);
478+ ASSERT(cstl_empty(iv));
483479 /* insert_array */
484480 cstl_clear(iv);
485- assert(cstl_insert_array(iv, cstl_begin(iv), &piyo[1], 255));
486- assert(memcmp(cstl_at(iv, 0), &piyo[1], 255) == 0);
481+ ASSERT(cstl_insert_array(iv, cstl_begin(iv), &piyo[1], 255));
482+ ASSERT(memcmp(cstl_at(iv, 0), &piyo[1], 255) == 0);
487483 a = cstl_capacity(iv);
488- assert(a > SIZE);
489- assert(cstl_size(iv) == 255);
490- assert(!cstl_empty(iv));
484+ ASSERT(a > SIZE);
485+ ASSERT(cstl_size(iv) == 255);
486+ ASSERT(!cstl_empty(iv));
491487 /* clear */
492488 cstl_clear(iv);
493- assert(cstl_size(iv) == 0);
494- assert(cstl_empty(iv));
489+ ASSERT(cstl_size(iv) == 0);
490+ ASSERT(cstl_empty(iv));
495491 /* insert_array */
496492 cstl_clear(iv);
497- assert(cstl_insert_array(iv, cstl_begin(iv), piyo, SIZE));
498- assert(memcmp(cstl_at(iv, 0), piyo, SIZE) == 0);
499- assert(cstl_capacity(iv) == a);
500- assert(cstl_size(iv) == SIZE);
501- assert(!cstl_empty(iv));
493+ ASSERT(cstl_insert_array(iv, cstl_begin(iv), piyo, SIZE));
494+ ASSERT(memcmp(cstl_at(iv, 0), piyo, SIZE) == 0);
495+ ASSERT(cstl_capacity(iv) == a);
496+ ASSERT(cstl_size(iv) == SIZE);
497+ ASSERT(!cstl_empty(iv));
502498 /* clear */
503499 cstl_clear(iv);
504- assert(cstl_size(iv) == 0);
505- assert(cstl_empty(iv));
500+ ASSERT(cstl_size(iv) == 0);
501+ ASSERT(cstl_empty(iv));
506502 /* reserve */
507- assert(cstl_reserve(iv, 1024));
508- assert(cstl_capacity(iv) == 1024);
509- assert(cstl_size(iv) == 0);
510- assert(cstl_empty(iv));
503+ ASSERT(cstl_reserve(iv, 1024));
504+ ASSERT(cstl_capacity(iv) == 1024);
505+ ASSERT(cstl_size(iv) == 0);
506+ ASSERT(cstl_empty(iv));
511507
512- assert(cstl_reserve(iv, 256));
513- assert(cstl_capacity(iv) == 1024);
514- assert(cstl_size(iv) == 0);
515- assert(cstl_empty(iv));
508+ ASSERT(cstl_reserve(iv, 256));
509+ ASSERT(cstl_capacity(iv) == 1024);
510+ ASSERT(cstl_size(iv) == 0);
511+ ASSERT(cstl_empty(iv));
516512
517513 POOL_DUMP_OVERFLOW(&pool);
518514 cstl_delete(iv);
@@ -522,44 +518,43 @@
522518 {
523519 int i;
524520 size_t a;
525- printf("***** test_2_2 *****\n");
526521 iv = IntVector_new_reserve(SIZE);
527522 vector_init_piyo();
528523 /* push_back */
529524 for (i = 0; i < SIZE; i++) {
530- assert(cstl_push_back(iv, piyo[i]));
531- assert(cstl_size(iv) == i+1);
532- assert(*cstl_front(iv) == piyo[0]);
533- assert(*cstl_back(iv) == piyo[i]);
525+ ASSERT(cstl_push_back(iv, piyo[i]));
526+ ASSERT(cstl_size(iv) == i+1);
527+ ASSERT(*cstl_front(iv) == piyo[0]);
528+ ASSERT(*cstl_back(iv) == piyo[i]);
534529 }
535- assert(memcmp(cstl_at(iv, 0), piyo, SIZE) == 0);
536- assert(cstl_capacity(iv) == SIZE);
537- assert(cstl_size(iv) == SIZE);
538- assert(!cstl_empty(iv));
530+ ASSERT(memcmp(cstl_at(iv, 0), piyo, SIZE) == 0);
531+ ASSERT(cstl_capacity(iv) == SIZE);
532+ ASSERT(cstl_size(iv) == SIZE);
533+ ASSERT(!cstl_empty(iv));
539534 for (i = i; i < 256; i++) {
540- assert(cstl_push_back(iv, piyo[i]));
541- assert(cstl_size(iv) == i+1);
542- assert(*cstl_front(iv) == piyo[0]);
543- assert(*cstl_back(iv) == piyo[i]);
535+ ASSERT(cstl_push_back(iv, piyo[i]));
536+ ASSERT(cstl_size(iv) == i+1);
537+ ASSERT(*cstl_front(iv) == piyo[0]);
538+ ASSERT(*cstl_back(iv) == piyo[i]);
544539 }
545- assert(memcmp(cstl_at(iv, 0), piyo, 256) == 0);
540+ ASSERT(memcmp(cstl_at(iv, 0), piyo, 256) == 0);
546541 a = cstl_capacity(iv);
547- assert(a > SIZE);
548- assert(cstl_size(iv) == 256);
549- assert(!cstl_empty(iv));
542+ ASSERT(a > SIZE);
543+ ASSERT(cstl_size(iv) == 256);
544+ ASSERT(!cstl_empty(iv));
550545 /* front, back */
551- assert(*cstl_front(iv) == piyo[0]);
552- assert(*cstl_back(iv) == piyo[255]);
546+ ASSERT(*cstl_front(iv) == piyo[0]);
547+ ASSERT(*cstl_back(iv) == piyo[255]);
553548 /* pop_back */
554549 for (i = 255; i >= 0; i--) {
555- assert(*cstl_front(iv) == piyo[0]);
556- assert(*cstl_back(iv) == piyo[i]);
550+ ASSERT(*cstl_front(iv) == piyo[0]);
551+ ASSERT(*cstl_back(iv) == piyo[i]);
557552 cstl_pop_back(iv);
558- assert(cstl_size(iv) == i);
553+ ASSERT(cstl_size(iv) == i);
559554 }
560- assert(cstl_size(iv) == 0);
561- assert(cstl_empty(iv));
562- assert(cstl_capacity(iv) == a);
555+ ASSERT(cstl_size(iv) == 0);
556+ ASSERT(cstl_empty(iv));
557+ ASSERT(cstl_capacity(iv) == a);
563558
564559 POOL_DUMP_OVERFLOW(&pool);
565560 cstl_delete(iv);
@@ -568,25 +563,24 @@
568563 void VectorTest_test_2_3(void)
569564 {
570565 int i;
571- printf("***** test_2_3 *****\n");
572566 iv = IntVector_new_reserve(SIZE);
573567 vector_init_piyo();
574568 /* insert_array */
575569 cstl_clear(iv);
576- assert(cstl_insert_array(iv, cstl_begin(iv), piyo, SIZE));
577- assert(memcmp(cstl_at(iv, 0), piyo, SIZE) == 0);
578- assert(cstl_capacity(iv) == SIZE);
579- assert(cstl_size(iv) == SIZE);
580- assert(!cstl_empty(iv));
570+ ASSERT(cstl_insert_array(iv, cstl_begin(iv), piyo, SIZE));
571+ ASSERT(memcmp(cstl_at(iv, 0), piyo, SIZE) == 0);
572+ ASSERT(cstl_capacity(iv) == SIZE);
573+ ASSERT(cstl_size(iv) == SIZE);
574+ ASSERT(!cstl_empty(iv));
581575 /* at */
582576 for (i = 0; i < SIZE; i++) {
583- assert(*cstl_at(iv, i) == piyo[i]);
577+ ASSERT(*cstl_at(iv, i) == piyo[i]);
584578 *cstl_at(iv, i) = piyo[i]+1;
585- assert(*cstl_at(iv, i) == piyo[i]+1);
579+ ASSERT(*cstl_at(iv, i) == piyo[i]+1);
586580 }
587- assert(cstl_capacity(iv) == SIZE);
588- assert(cstl_size(iv) == SIZE);
589- assert(!cstl_empty(iv));
581+ ASSERT(cstl_capacity(iv) == SIZE);
582+ ASSERT(cstl_size(iv) == SIZE);
583+ ASSERT(!cstl_empty(iv));
590584
591585 POOL_DUMP_OVERFLOW(&pool);
592586 cstl_delete(iv);
@@ -597,52 +591,51 @@
597591 int i;
598592 int buf[256];
599593 IntVectorIterator iter;
600- printf("***** test_2_4 *****\n");
601594 iv = IntVector_new_reserve(SIZE);
602595 /* insert */
603596 for (i = 0; i < SIZE; i++) {
604-/* assert(cstl_insert(iv, 0, piyo[i]));*/
605- assert(cstl_insert(iv, cstl_begin(iv), piyo[i], NULL));
597+/* ASSERT(cstl_insert(iv, 0, piyo[i]));*/
598+ ASSERT(cstl_insert(iv, cstl_begin(iv), piyo[i], NULL));
606599 buf[i] = SIZE - i - 1;
607600 }
608- assert(memcmp(cstl_at(iv, 0), buf, SIZE) == 0);
609- assert(cstl_capacity(iv) == SIZE);
610- assert(cstl_size(iv) == SIZE);
611- assert(!cstl_empty(iv));
601+ ASSERT(memcmp(cstl_at(iv, 0), buf, SIZE) == 0);
602+ ASSERT(cstl_capacity(iv) == SIZE);
603+ ASSERT(cstl_size(iv) == SIZE);
604+ ASSERT(!cstl_empty(iv));
612605 for (i = SIZE; i < 256; i++) {
613-/* assert(cstl_insert(iv, cstl_size(iv), piyo[i]));*/
614- assert(cstl_insert(iv, cstl_end(iv), piyo[i], NULL));
606+/* ASSERT(cstl_insert(iv, cstl_size(iv), piyo[i]));*/
607+ ASSERT(cstl_insert(iv, cstl_end(iv), piyo[i], NULL));
615608 buf[i] = i;
616- assert(cstl_capacity(iv) > SIZE);
609+ ASSERT(cstl_capacity(iv) > SIZE);
617610 }
618- assert(memcmp(&cstl_at(iv, 0)[SIZE], &buf[SIZE], 256-SIZE) == 0);
619- assert(cstl_size(iv) == 256);
620-/* assert(cstl_insert(iv, SIZE, 0));*/
621- assert(cstl_insert(iv, cstl_iter_add(cstl_begin(iv), SIZE), 0, NULL));
622- assert(memcmp(cstl_at(iv, 0), buf, SIZE) == 0);
623- assert(cstl_at(iv, 0)[SIZE] == 0);
624- assert(memcmp(&cstl_at(iv, 0)[SIZE+1], &buf[SIZE], 256-SIZE) == 0);
625- assert(cstl_size(iv) == 257);
611+ ASSERT(memcmp(&cstl_at(iv, 0)[SIZE], &buf[SIZE], 256-SIZE) == 0);
612+ ASSERT(cstl_size(iv) == 256);
613+/* ASSERT(cstl_insert(iv, SIZE, 0));*/
614+ ASSERT(cstl_insert(iv, cstl_iter_add(cstl_begin(iv), SIZE), 0, NULL));
615+ ASSERT(memcmp(cstl_at(iv, 0), buf, SIZE) == 0);
616+ ASSERT(cstl_at(iv, 0)[SIZE] == 0);
617+ ASSERT(memcmp(&cstl_at(iv, 0)[SIZE+1], &buf[SIZE], 256-SIZE) == 0);
618+ ASSERT(cstl_size(iv) == 257);
626619 /* erase */
627620 /* cstl_erase(iv, SIZE, 1);*/
628621 iter = cstl_begin(iv);
629622 cstl_erase(iv, cstl_iter_add(iter, SIZE));
630- assert(memcmp(cstl_at(iv, 0), buf, SIZE) == 0);
631- assert(memcmp(&cstl_at(iv, 0)[SIZE], &buf[SIZE], 256-SIZE) == 0);
623+ ASSERT(memcmp(cstl_at(iv, 0), buf, SIZE) == 0);
624+ ASSERT(memcmp(&cstl_at(iv, 0)[SIZE], &buf[SIZE], 256-SIZE) == 0);
632625 for (i = SIZE; i < 256; i++) {
633626 /* cstl_erase(iv, cstl_size(iv)-1, 1);*/
634627 iter = cstl_end(iv);
635628 cstl_erase(iv, cstl_iter_prev(iter));
636629 }
637- assert(memcmp(cstl_at(iv, 0), buf, SIZE) == 0);
638- assert(cstl_size(iv) == SIZE);
630+ ASSERT(memcmp(cstl_at(iv, 0), buf, SIZE) == 0);
631+ ASSERT(cstl_size(iv) == SIZE);
639632 for (i = 0; i < SIZE; i++) {
640- assert(memcmp(cstl_at(iv, 0), &buf[i], SIZE-i) == 0);
633+ ASSERT(memcmp(cstl_at(iv, 0), &buf[i], SIZE-i) == 0);
641634 /* cstl_erase(iv, 0, 1);*/
642635 cstl_erase(iv, cstl_begin(iv));
643- assert(cstl_size(iv) == SIZE-i-1);
636+ ASSERT(cstl_size(iv) == SIZE-i-1);
644637 }
645- assert(cstl_size(iv) == 0);
638+ ASSERT(cstl_size(iv) == 0);
646639
647640 POOL_DUMP_OVERFLOW(&pool);
648641 cstl_delete(iv);
@@ -651,55 +644,54 @@
651644 void VectorTest_test_2_5(void)
652645 {
653646 IntVectorIterator iter;
654- printf("***** test_2_5 *****\n");
655647 iv = IntVector_new_reserve(SIZE);
656648 vector_init_piyo();
657649 /* insert_array */
658- assert(cstl_insert_array(iv, cstl_begin(iv), piyo, SIZE));
659- assert(memcmp(cstl_at(iv, 0), piyo, SIZE) == 0);
660- assert(cstl_capacity(iv) == SIZE);
661- assert(cstl_size(iv) == SIZE);
650+ ASSERT(cstl_insert_array(iv, cstl_begin(iv), piyo, SIZE));
651+ ASSERT(memcmp(cstl_at(iv, 0), piyo, SIZE) == 0);
652+ ASSERT(cstl_capacity(iv) == SIZE);
653+ ASSERT(cstl_size(iv) == SIZE);
662654
663- assert(cstl_insert_array(iv, cstl_end(iv), &piyo[SIZE], 256-SIZE));
664- assert(memcmp(cstl_at(iv, 0), piyo, 256) == 0);
665- assert(cstl_capacity(iv) > SIZE);
666- assert(cstl_size(iv) == 256);
655+ ASSERT(cstl_insert_array(iv, cstl_end(iv), &piyo[SIZE], 256-SIZE));
656+ ASSERT(memcmp(cstl_at(iv, 0), piyo, 256) == 0);
657+ ASSERT(cstl_capacity(iv) > SIZE);
658+ ASSERT(cstl_size(iv) == 256);
667659
668- assert(cstl_insert_array(iv, cstl_iter_add(cstl_begin(iv), SIZE), piyo, SIZE));
669- assert(memcmp(cstl_at(iv, 0), piyo, SIZE) == 0);
670- assert(memcmp(&cstl_at(iv, 0)[SIZE], piyo, 256) == 0);
671- assert(cstl_size(iv) == 256+SIZE);
660+ ASSERT(cstl_insert_array(iv, cstl_iter_add(cstl_begin(iv), SIZE), piyo, SIZE));
661+ ASSERT(memcmp(cstl_at(iv, 0), piyo, SIZE) == 0);
662+ ASSERT(memcmp(&cstl_at(iv, 0)[SIZE], piyo, 256) == 0);
663+ ASSERT(cstl_size(iv) == 256+SIZE);
672664
673- assert(cstl_insert_array(iv, cstl_begin(iv), piyo, 1));
674- assert(*cstl_at(iv, 0) == piyo[0]);
675- assert(memcmp(&cstl_at(iv, 0)[1], piyo, SIZE) == 0);
676- assert(memcmp(&cstl_at(iv, 0)[SIZE+1], piyo, 256) == 0);
677- assert(cstl_size(iv) == 257+SIZE);
665+ ASSERT(cstl_insert_array(iv, cstl_begin(iv), piyo, 1));
666+ ASSERT(*cstl_at(iv, 0) == piyo[0]);
667+ ASSERT(memcmp(&cstl_at(iv, 0)[1], piyo, SIZE) == 0);
668+ ASSERT(memcmp(&cstl_at(iv, 0)[SIZE+1], piyo, 256) == 0);
669+ ASSERT(cstl_size(iv) == 257+SIZE);
678670 /* erase */
679671 /* cstl_erase(iv, 0, 1);*/
680672 cstl_erase(iv, cstl_begin(iv));
681- assert(memcmp(cstl_at(iv, 0), piyo, SIZE) == 0);
682- assert(memcmp(&cstl_at(iv, 0)[SIZE], piyo, 256) == 0);
683- assert(cstl_size(iv) == 256+SIZE);
673+ ASSERT(memcmp(cstl_at(iv, 0), piyo, SIZE) == 0);
674+ ASSERT(memcmp(&cstl_at(iv, 0)[SIZE], piyo, 256) == 0);
675+ ASSERT(cstl_size(iv) == 256+SIZE);
684676
685677 /* cstl_erase(iv, SIZE, SIZE);*/
686678 iter = cstl_begin(iv);
687679 iter = cstl_iter_add(iter, SIZE);
688680 cstl_erase_range(iv, iter, cstl_iter_add(iter, SIZE));
689- assert(memcmp(cstl_at(iv, 0), piyo, 256) == 0);
690- assert(cstl_size(iv) == 256);
681+ ASSERT(memcmp(cstl_at(iv, 0), piyo, 256) == 0);
682+ ASSERT(cstl_size(iv) == 256);
691683
692684 /* cstl_erase(iv, SIZE, 256-SIZE);*/
693685 iter = cstl_begin(iv);
694686 iter = cstl_iter_add(iter, SIZE);
695687 cstl_erase_range(iv, iter, cstl_iter_add(iter, 256-SIZE));
696- assert(memcmp(cstl_at(iv, 0), piyo, SIZE) == 0);
697- assert(cstl_size(iv) == SIZE);
688+ ASSERT(memcmp(cstl_at(iv, 0), piyo, SIZE) == 0);
689+ ASSERT(cstl_size(iv) == SIZE);
698690
699691 /* cstl_erase(iv, 0, SIZE);*/
700692 iter = cstl_begin(iv);
701693 cstl_erase_range(iv, iter, cstl_iter_add(iter, SIZE));
702- assert(cstl_size(iv) == 0);
694+ ASSERT(cstl_size(iv) == 0);
703695
704696 POOL_DUMP_OVERFLOW(&pool);
705697 cstl_delete(iv);
@@ -706,31 +698,37 @@
706698 }
707699
708700
701+static TestCase vector_tests[] = {
702+ { "VectorTest_test_1_1", VectorTest_test_1_1 },
703+ { "VectorTest_test_1_2", VectorTest_test_1_2 },
704+ { "VectorTest_test_1_3", VectorTest_test_1_3 },
705+ { "VectorTest_test_1_4", VectorTest_test_1_4 },
706+ { "VectorTest_test_1_5", VectorTest_test_1_5 },
707+ { "VectorTest_test_1_6", VectorTest_test_1_6 },
708+ { "VectorTest_test_2_1", VectorTest_test_2_1 },
709+ { "VectorTest_test_2_2", VectorTest_test_2_2 },
710+ { "VectorTest_test_2_3", VectorTest_test_2_3 },
711+ { "VectorTest_test_2_4", VectorTest_test_2_4 },
712+ { "VectorTest_test_2_5", VectorTest_test_2_5 },
713+ TEST_CASE_NULL,
714+};
709715
716+static TestSuite suites[] = {
717+ { "vector test", 0, 0, vector_tests },
718+ TEST_SUITE_NULL,
719+};
710720
711-void VectorTest_run(void)
712-{
713- printf("\n===== vector test =====\n");
714- VectorTest_test_1_1();
715- VectorTest_test_1_2();
716- VectorTest_test_1_3();
717- VectorTest_test_1_4();
718- VectorTest_test_1_5();
719- VectorTest_test_1_6();
720- VectorTest_test_2_1();
721- VectorTest_test_2_2();
722- VectorTest_test_2_3();
723- VectorTest_test_2_4();
724- VectorTest_test_2_5();
725-}
726721
727-
728-int main(void)
722+int main(int argc, char *argv[])
729723 {
730724 #ifdef MY_MALLOC
731725 Pool_init(&pool, buf, sizeof buf, sizeof buf[0]);
732726 #endif
733- VectorTest_run();
727+ if (argc < 2) {
728+ unittest_run_all(suites);
729+ } else {
730+ unittest_run_interactive(suites);
731+ }
734732 #ifdef MY_MALLOC
735733 POOL_DUMP_LEAK(&pool, 0);
736734 #endif
--- branches/try-vfunc/test/list_test.c (revision 398)
+++ branches/try-vfunc/test/list_test.c (revision 399)
@@ -1,6 +1,6 @@
11 #include <stdio.h>
22 #include <string.h>
3-#include <assert.h>
3+#include "../unittest/UnitTest.h"
44 #include "../cstl/list.h"
55 #include "list_debug.h"
66 #include "Pool.h"
@@ -26,6 +26,9 @@
2626 #include "HogeList.h"
2727 #else
2828
29+/*#undef CSTL_ASSERT*/
30+/*#define CSTL_ASSERT ASSERT_FATAL*/
31+
2932 CSTL_LIST_INTERFACE(IntList, int)
3033 CSTL_LIST_INTERFACE(HogeList, Hoge)
3134 CSTL_LIST_DEBUG_INTERFACE(IntList, int)
@@ -69,22 +72,21 @@
6972 void ListTest_test_1_1(void)
7073 {
7174 Hoge hoge;
72- printf("***** test_1_1 *****\n");
7375 /* 初期状態 */
74- assert(cstl_size(hl) == 0);
75- assert(cstl_empty(hl));
76- assert(cstl_iter_eq(cstl_begin(hl), cstl_end(hl)));
77- assert(cstl_iter_eq(cstl_rbegin(hl), cstl_rend(hl)));
76+ ASSERT(cstl_size(hl) == 0);
77+ ASSERT(cstl_empty(hl));
78+ ASSERT(cstl_iter_eq(cstl_begin(hl), cstl_end(hl)));
79+ ASSERT(cstl_iter_eq(cstl_rbegin(hl), cstl_rend(hl)));
7880 /* clear */
7981 hoge = hogetab[0];
80- assert(cstl_push_back(hl, hoge));
81- assert(cstl_push_back(hl, hoge));
82- assert(cstl_push_back(hl, hoge));
83- assert(HogeList_verify(hl));
82+ ASSERT(cstl_push_back(hl, hoge));
83+ ASSERT(cstl_push_back(hl, hoge));
84+ ASSERT(cstl_push_back(hl, hoge));
85+ ASSERT(HogeList_verify(hl));
8486 cstl_clear(hl);
85- assert(HogeList_verify(hl));
86- assert(cstl_size(hl) == 0);
87- assert(cstl_empty(hl));
87+ ASSERT(HogeList_verify(hl));
88+ ASSERT(cstl_size(hl) == 0);
89+ ASSERT(cstl_empty(hl));
8890 }
8991
9092 void ListTest_test_1_2(void)
@@ -91,53 +93,52 @@
9193 {
9294 Hoge hoge;
9395 int i;
94- printf("***** test_1_2 *****\n");
9596 /* push_back */
9697 for (i = 0; i < NELEMS(hogetab); i++) {
97- assert(cstl_push_back(hl, hogetab[i]));
98- assert(HogeList_verify(hl));
98+ ASSERT(cstl_push_back(hl, hogetab[i]));
99+ ASSERT(HogeList_verify(hl));
99100 }
100- assert(cstl_size(hl) == NELEMS(hogetab));
101- assert(!cstl_empty(hl));
101+ ASSERT(cstl_size(hl) == NELEMS(hogetab));
102+ ASSERT(!cstl_empty(hl));
102103 /* pop_front */
103104 for (i = 0; i < NELEMS(hogetab); i++) {
104105 /* front */
105106 hoge = *cstl_front(hl);
106- assert(!strcmp(hoge.key, hogetab[i].key));
107- assert(hoge.value == hogetab[i].value);
107+ ASSERT(!strcmp(hoge.key, hogetab[i].key));
108+ ASSERT(hoge.value == hogetab[i].value);
108109 /* back */
109110 hoge = *cstl_back(hl);
110- assert(!strcmp(hoge.key, hogetab[NELEMS(hogetab)-1].key));
111- assert(hoge.value == hogetab[NELEMS(hogetab)-1].value);
111+ ASSERT(!strcmp(hoge.key, hogetab[NELEMS(hogetab)-1].key));
112+ ASSERT(hoge.value == hogetab[NELEMS(hogetab)-1].value);
112113 /* pop_front */
113114 cstl_pop_front(hl);
114- assert(HogeList_verify(hl));
115+ ASSERT(HogeList_verify(hl));
115116 }
116- assert(cstl_size(hl) == 0);
117- assert(cstl_empty(hl));
117+ ASSERT(cstl_size(hl) == 0);
118+ ASSERT(cstl_empty(hl));
118119 /* push_front */
119120 for (i = 0; i < NELEMS(hogetab); i++) {
120- assert(cstl_push_front(hl, hogetab[i]));
121- assert(HogeList_verify(hl));
121+ ASSERT(cstl_push_front(hl, hogetab[i]));
122+ ASSERT(HogeList_verify(hl));
122123 }
123- assert(cstl_size(hl) == NELEMS(hogetab));
124- assert(!cstl_empty(hl));
124+ ASSERT(cstl_size(hl) == NELEMS(hogetab));
125+ ASSERT(!cstl_empty(hl));
125126 /* pop_back */
126127 for (i = 0; i < NELEMS(hogetab); i++) {
127128 /* front */
128129 hoge = *cstl_front(hl);
129- assert(!strcmp(hoge.key, hogetab[NELEMS(hogetab)-1].key));
130- assert(hoge.value == hogetab[NELEMS(hogetab)-1].value);
130+ ASSERT(!strcmp(hoge.key, hogetab[NELEMS(hogetab)-1].key));
131+ ASSERT(hoge.value == hogetab[NELEMS(hogetab)-1].value);
131132 /* back */
132133 hoge = *cstl_back(hl);
133- assert(!strcmp(hoge.key, hogetab[i].key));
134- assert(hoge.value == hogetab[i].value);
134+ ASSERT(!strcmp(hoge.key, hogetab[i].key));
135+ ASSERT(hoge.value == hogetab[i].value);
135136 /* pop_back */
136137 cstl_pop_back(hl);
137- assert(HogeList_verify(hl));
138+ ASSERT(HogeList_verify(hl));
138139 }
139- assert(cstl_size(hl) == 0);
140- assert(cstl_empty(hl));
140+ ASSERT(cstl_size(hl) == 0);
141+ ASSERT(cstl_empty(hl));
141142 }
142143
143144 void ListTest_test_1_3(void)
@@ -144,7 +145,6 @@
144145 {
145146 Hoge hoge;
146147 int c = 0;
147- printf("***** test_1_3 *****\n");
148148 /* 大量にpush_back */
149149 hoge = hogetab[0];
150150 while (c < 1000000 && cstl_push_back(hl, hoge)) {
@@ -151,22 +151,22 @@
151151 c++;
152152 }
153153 /* printf("size: %d, c: %d\n", cstl_size(hl), c);*/
154- assert(cstl_size(hl) == c);
155- assert(!cstl_empty(hl));
154+ ASSERT(cstl_size(hl) == c);
155+ ASSERT(!cstl_empty(hl));
156156 /* 大量にpush_front */
157157 cstl_clear(hl);
158- assert(cstl_size(hl) == 0);
159- assert(cstl_empty(hl));
158+ ASSERT(cstl_size(hl) == 0);
159+ ASSERT(cstl_empty(hl));
160160 c = 0;
161161 while (c < 1000000 && cstl_push_front(hl, hoge)) {
162162 c++;
163163 }
164164 /* printf("size: %d, c: %d\n", cstl_size(hl), c);*/
165- assert(cstl_size(hl) == c);
166- assert(!cstl_empty(hl));
165+ ASSERT(cstl_size(hl) == c);
166+ ASSERT(!cstl_empty(hl));
167167 cstl_clear(hl);
168- assert(cstl_size(hl) == 0);
169- assert(cstl_empty(hl));
168+ ASSERT(cstl_size(hl) == 0);
169+ ASSERT(cstl_empty(hl));
170170 }
171171
172172 void ListTest_test_1_4(void)
@@ -174,33 +174,32 @@
174174 Hoge hoge;
175175 int i;
176176 HogeListIterator pos;
177- printf("***** test_1_4 *****\n");
178177 /* push_back */
179178 for (i = 0; i < NELEMS(hogetab); i++) {
180- assert(cstl_push_back(hl, hogetab[i]));
179+ ASSERT(cstl_push_back(hl, hogetab[i]));
181180 }
182- assert(cstl_size(hl) == NELEMS(hogetab));
183- assert(!cstl_empty(hl));
181+ ASSERT(cstl_size(hl) == NELEMS(hogetab));
182+ ASSERT(!cstl_empty(hl));
184183 /* data */
185184 for (i = 0, pos = cstl_begin(hl); cstl_iter_ne(pos, cstl_end(hl)); cstl_iter_inc(&pos), i++) {
186185 hoge = *cstl_iter_data(pos);
187- assert(!strcmp(hoge.key, hogetab[i].key));
188- assert(hoge.value == hogetab[i].value);
186+ ASSERT(!strcmp(hoge.key, hogetab[i].key));
187+ ASSERT(hoge.value == hogetab[i].value);
189188 }
190- assert(i == NELEMS(hogetab));
189+ ASSERT(i == NELEMS(hogetab));
191190 for (i = 0, pos = cstl_begin(hl); cstl_iter_ne(pos, cstl_end(hl)); cstl_iter_inc(&pos), i++) {
192191 *cstl_iter_data(pos) = hogetab[0];
193192 }
194- assert(i == NELEMS(hogetab));
193+ ASSERT(i == NELEMS(hogetab));
195194 for (pos = cstl_begin(hl); cstl_iter_ne(pos, cstl_end(hl)); cstl_iter_inc(&pos)) {
196195 hoge = *cstl_iter_data(pos);
197- assert(!strcmp(hoge.key, hogetab[0].key));
198- assert(hoge.value == hogetab[0].value);
196+ ASSERT(!strcmp(hoge.key, hogetab[0].key));
197+ ASSERT(hoge.value == hogetab[0].value);
199198 }
200199 while (!cstl_empty(hl)) {
201200 cstl_pop_front(hl);
202201 }
203- assert(cstl_size(hl) == 0);
202+ ASSERT(cstl_size(hl) == 0);
204203 }
205204
206205 void ListTest_test_1_5(void)
@@ -210,47 +209,46 @@
210209 int flag = 0;
211210 HogeListIterator pos;
212211 HogeListIterator iter;
213- printf("***** test_1_5 *****\n");
214212 /* beginの位置にinsert */
215213 for (i = 0; i < NELEMS(hogetab); i++) {
216- assert(cstl_insert(hl, cstl_begin(hl), hogetab[i], &iter));
217- assert(cstl_iter_eq(iter, cstl_begin(hl)));
218- assert(HogeList_verify(hl));
214+ ASSERT(cstl_insert(hl, cstl_begin(hl), hogetab[i], &iter));
215+ ASSERT(cstl_iter_eq(iter, cstl_begin(hl)));
216+ ASSERT(HogeList_verify(hl));
219217 }
220218 cstl_clear(hl);
221219 /* endの位置にinsert */
222220 for (i = 0; i < NELEMS(hogetab); i++) {
223- assert(cstl_insert(hl, cstl_end(hl), hogetab[i], &iter));
221+ ASSERT(cstl_insert(hl, cstl_end(hl), hogetab[i], &iter));
224222 cstl_iter_inc(&iter);
225- assert(cstl_iter_eq(iter, cstl_end(hl)));
226- assert(HogeList_verify(hl));
223+ ASSERT(cstl_iter_eq(iter, cstl_end(hl)));
224+ ASSERT(HogeList_verify(hl));
227225 }
228- assert(cstl_size(hl) == NELEMS(hogetab));
229- assert(!cstl_empty(hl));
226+ ASSERT(cstl_size(hl) == NELEMS(hogetab));
227+ ASSERT(!cstl_empty(hl));
230228 /* 真ん中の位置にinsert */
231229 for (i = 0, pos = cstl_begin(hl); cstl_iter_ne(pos, cstl_end(hl)); cstl_iter_inc(&pos), i++) {
232230 hoge = *cstl_iter_data(pos);
233- assert(!strcmp(hoge.key, hogetab[i].key));
234- assert(hoge.value == hogetab[i].value);
231+ ASSERT(!strcmp(hoge.key, hogetab[i].key));
232+ ASSERT(hoge.value == hogetab[i].value);
235233 if (i == NELEMS(hogetab)/2) {
236234 hoge = hogetab[0];
237- assert(cstl_insert(hl, pos, hoge, &iter));
238- assert(cstl_iter_eq(iter, cstl_iter_prev(pos)));
239- assert(HogeList_verify(hl));
235+ ASSERT(cstl_insert(hl, pos, hoge, &iter));
236+ ASSERT(cstl_iter_eq(iter, cstl_iter_prev(pos)));
237+ ASSERT(HogeList_verify(hl));
240238 break;
241239 }
242240 }
243- assert(cstl_size(hl) == NELEMS(hogetab)+1);
241+ ASSERT(cstl_size(hl) == NELEMS(hogetab)+1);
244242 for (i = 0, pos = cstl_begin(hl); cstl_iter_ne(pos, cstl_end(hl)); cstl_iter_inc(&pos), i++) {
245243 hoge = *cstl_iter_data(pos);
246244 if (!flag && i == NELEMS(hogetab)/2) {
247- assert(!strcmp(hoge.key, hogetab[0].key));
248- assert(hoge.value == hogetab[0].value);
245+ ASSERT(!strcmp(hoge.key, hogetab[0].key));
246+ ASSERT(hoge.value == hogetab[0].value);
249247 flag = 1;
250248 i--;
251249 } else {
252- assert(!strcmp(hoge.key, hogetab[i].key));
253- assert(hoge.value == hogetab[i].value);
250+ ASSERT(!strcmp(hoge.key, hogetab[i].key));
251+ ASSERT(hoge.value == hogetab[i].value);
254252 }
255253 }
256254 cstl_clear(hl);
@@ -262,13 +260,12 @@
262260 int i;
263261 HogeListIterator pos;
264262 size_t size;
265- printf("***** test_1_6 *****\n");
266263 /* push_back */
267264 for (i = 0; i < NELEMS(hogetab); i++) {
268- assert(cstl_push_back(hl, hogetab[i]));
265+ ASSERT(cstl_push_back(hl, hogetab[i]));
269266 }
270- assert(cstl_size(hl) == NELEMS(hogetab));
271- assert(!cstl_empty(hl));
267+ ASSERT(cstl_size(hl) == NELEMS(hogetab));
268+ ASSERT(!cstl_empty(hl));
272269 /* beginの位置の要素をerase */
273270 size = cstl_size(hl);
274271 for (i = 0; i < NELEMS(hogetab); i++) {
@@ -275,35 +272,35 @@
275272 HogeListIterator next;
276273 pos = cstl_begin(hl);
277274 next = cstl_iter_next(pos);
278- assert(cstl_iter_eq(next, cstl_erase(hl, pos)));
279- assert(cstl_size(hl) == --size);
280- assert(HogeList_verify(hl));
275+ ASSERT(cstl_iter_eq(next, cstl_erase(hl, pos)));
276+ ASSERT(cstl_size(hl) == --size);
277+ ASSERT(HogeList_verify(hl));
281278 }
282- assert(cstl_size(hl) == 0);
283- assert(cstl_empty(hl));
279+ ASSERT(cstl_size(hl) == 0);
280+ ASSERT(cstl_empty(hl));
284281 /* push_back */
285282 for (i = 0; i < NELEMS(hogetab); i++) {
286- assert(cstl_push_back(hl, hogetab[i]));
283+ ASSERT(cstl_push_back(hl, hogetab[i]));
287284 }
288- assert(cstl_size(hl) == NELEMS(hogetab));
289- assert(!cstl_empty(hl));
285+ ASSERT(cstl_size(hl) == NELEMS(hogetab));
286+ ASSERT(!cstl_empty(hl));
290287 /* endの前の位置の要素をerase */
291288 size = cstl_size(hl);
292289 for (i = 0; i < NELEMS(hogetab); i++) {
293290 pos = cstl_end(hl);
294291 cstl_iter_dec(&pos);
295- assert(cstl_iter_eq(cstl_end(hl), cstl_erase(hl, pos)));
296- assert(cstl_size(hl) == --size);
297- assert(HogeList_verify(hl));
292+ ASSERT(cstl_iter_eq(cstl_end(hl), cstl_erase(hl, pos)));
293+ ASSERT(cstl_size(hl) == --size);
294+ ASSERT(HogeList_verify(hl));
298295 }
299- assert(cstl_size(hl) == 0);
300- assert(cstl_empty(hl));
296+ ASSERT(cstl_size(hl) == 0);
297+ ASSERT(cstl_empty(hl));
301298 /* push_back */
302299 for (i = 0; i < NELEMS(hogetab); i++) {
303- assert(cstl_push_back(hl, hogetab[i]));
300+ ASSERT(cstl_push_back(hl, hogetab[i]));
304301 }
305- assert(cstl_size(hl) == NELEMS(hogetab));
306- assert(!cstl_empty(hl));
302+ ASSERT(cstl_size(hl) == NELEMS(hogetab));
303+ ASSERT(!cstl_empty(hl));
307304 /* 真ん中の位置の要素をerase */
308305 for (i = 0, pos = cstl_begin(hl); cstl_iter_ne(pos, cstl_end(hl)); i++) {
309306 if (i == NELEMS(hogetab)/2) {
@@ -311,24 +308,24 @@
311308 } else {
312309 cstl_iter_inc(&pos);
313310 }
314- assert(HogeList_verify(hl));
311+ ASSERT(HogeList_verify(hl));
315312 }
316- assert(cstl_size(hl) == NELEMS(hogetab)-1);
313+ ASSERT(cstl_size(hl) == NELEMS(hogetab)-1);
317314 for (i = 0, pos = cstl_begin(hl); cstl_iter_ne(pos, cstl_end(hl)); cstl_iter_inc(&pos), i++) {
318315 hoge = *cstl_iter_data(pos);
319316 if (i >= NELEMS(hogetab)/2) {
320- assert(!strcmp(hoge.key, hogetab[i+1].key));
321- assert(hoge.value == hogetab[i+1].value);
317+ ASSERT(!strcmp(hoge.key, hogetab[i+1].key));
318+ ASSERT(hoge.value == hogetab[i+1].value);
322319 } else {
323- assert(!strcmp(hoge.key, hogetab[i].key));
324- assert(hoge.value == hogetab[i].value);
320+ ASSERT(!strcmp(hoge.key, hogetab[i].key));
321+ ASSERT(hoge.value == hogetab[i].value);
325322 }
326323 }
327324 /* erase_range */
328- assert(!cstl_empty(hl));
329- assert(cstl_iter_eq(cstl_end(hl), cstl_erase_range(hl, cstl_begin(hl), cstl_end(hl))));
330- assert(cstl_empty(hl));
331- assert(HogeList_verify(hl));
325+ ASSERT(!cstl_empty(hl));
326+ ASSERT(cstl_iter_eq(cstl_end(hl), cstl_erase_range(hl, cstl_begin(hl), cstl_end(hl))));
327+ ASSERT(cstl_empty(hl));
328+ ASSERT(HogeList_verify(hl));
332329 }
333330
334331 void ListTest_test_1_7(void)
@@ -336,23 +333,22 @@
336333 Hoge hoge;
337334 int i;
338335 HogeListReverseIterator pos;
339- printf("***** test_1_7 *****\n");
340336 /* push_back */
341337 for (i = 0; i < NELEMS(hogetab); i++) {
342- assert(cstl_push_back(hl, hogetab[i]));
338+ ASSERT(cstl_push_back(hl, hogetab[i]));
343339 }
344- assert(cstl_size(hl) == NELEMS(hogetab));
345- assert(!cstl_empty(hl));
340+ ASSERT(cstl_size(hl) == NELEMS(hogetab));
341+ ASSERT(!cstl_empty(hl));
346342 /* rbegin/rend 逆順に走査 */
347343 for (i = 0, pos = cstl_rbegin(hl); cstl_iter_ne(pos, cstl_rend(hl)); cstl_iter_inc(&pos), i++) {
348344 hoge = *cstl_iter_data(pos);
349- assert(!strcmp(hoge.key, hogetab[NELEMS(hogetab)-1 - i].key));
350- assert(hoge.value == hogetab[NELEMS(hogetab)-1 - i].value);
345+ ASSERT(!strcmp(hoge.key, hogetab[NELEMS(hogetab)-1 - i].key));
346+ ASSERT(hoge.value == hogetab[NELEMS(hogetab)-1 - i].value);
351347 }
352- assert(i == NELEMS(hogetab));
348+ ASSERT(i == NELEMS(hogetab));
353349 /* TODO */
354-/* assert(HogeList_next(cstl_rbegin(hl)) == cstl_end(hl));*/
355-/* assert(HogeList_prev(cstl_begin(hl)) == cstl_rend(hl));*/
350+/* ASSERT(HogeList_next(cstl_rbegin(hl)) == cstl_end(hl));*/
351+/* ASSERT(HogeList_prev(cstl_begin(hl)) == cstl_rend(hl));*/
356352 cstl_clear(hl);
357353 }
358354
@@ -399,7 +395,6 @@
399395 int i;
400396 HogeListIterator pos;
401397 HogeList *x;
402- printf("***** test_1_8 *****\n");
403398
404399 /* NOTE: テストのために未公開のメンバを使用する */
405400
@@ -406,7 +401,7 @@
406401 printf("before sort\n");
407402 /* push_back */
408403 for (i = 0; i < NELEMS(hogetab2); i++) {
409- assert(cstl_push_back(hl, hogetab2[i]));
404+ ASSERT(cstl_push_back(hl, hogetab2[i]));
410405 }
411406 hoge.key = "XXX"; hoge.value = 9999;
412407 printf("%s, %4d, prev[%p], p[%p], next[%p]\n", hoge.key, hoge.value, hl->prev, hl, hl->next);
@@ -418,7 +413,7 @@
418413 /* sort less*/
419414 printf("size[%d]\n", cstl_size(hl));
420415 cstl_sort(hl, less);
421- assert(HogeList_verify(hl));
416+ ASSERT(HogeList_verify(hl));
422417 printf("size[%d]\n", cstl_size(hl));
423418 printf("after sort (less)\n");
424419 hoge.key = "XXX"; hoge.value = 9999;
@@ -428,14 +423,14 @@
428423 HogeList *node = (HogeList*)pos.internal.data.data1;
429424 hoge = *cstl_iter_data(pos);
430425 printf("%s, %4d, prev[%p], p[%p], next[%p]\n", hoge.key, hoge.value, node->prev, node, node->next);
431- assert(strcmp(prev.key, hoge.key) <= 0);
432- assert(prev.value <= hoge.value);
426+ ASSERT(strcmp(prev.key, hoge.key) <= 0);
427+ ASSERT(prev.value <= hoge.value);
433428 prev = hoge;
434429 }
435430 /* sort済みをsort */
436431 printf("size[%d]\n", cstl_size(hl));
437432 cstl_sort(hl, less);
438- assert(HogeList_verify(hl));
433+ ASSERT(HogeList_verify(hl));
439434 printf("size[%d]\n", cstl_size(hl));
440435 printf("after sort (less) again\n");
441436 hoge.key = "XXX"; hoge.value = 9999;
@@ -445,14 +440,14 @@
445440 HogeList *node = (HogeList*)pos.internal.data.data1;
446441 hoge = *cstl_iter_data(pos);
447442 printf("%s, %4d, prev[%p], p[%p], next[%p]\n", hoge.key, hoge.value, node->prev, node, node->next);
448- assert(strcmp(prev.key, hoge.key) <= 0);
449- assert(prev.value <= hoge.value);
443+ ASSERT(strcmp(prev.key, hoge.key) <= 0);
444+ ASSERT(prev.value <= hoge.value);
450445 prev = hoge;
451446 }
452447 /* sort greater*/
453448 printf("size[%d]\n", cstl_size(hl));
454449 cstl_sort(hl, greater);
455- assert(HogeList_verify(hl));
450+ ASSERT(HogeList_verify(hl));
456451 printf("size[%d]\n", cstl_size(hl));
457452 printf("after sort (greater)\n");
458453 hoge.key = "XXX"; hoge.value = 9999;
@@ -462,11 +457,11 @@
462457 HogeList *node = (HogeList*)pos.internal.data.data1;
463458 hoge = *cstl_iter_data(pos);
464459 printf("%s, %4d, prev[%p], p[%p], next[%p]\n", hoge.key, hoge.value, node->prev, node, node->next);
465- assert(strcmp(prev.key, hoge.key) >= 0);
460+ ASSERT(strcmp(prev.key, hoge.key) >= 0);
466461 if (strcmp(prev.key, hoge.key) == 0) {
467- assert(prev.value <= hoge.value);
462+ ASSERT(prev.value <= hoge.value);
468463 } else {
469- assert(prev.value >= hoge.value);
464+ ASSERT(prev.value >= hoge.value);
470465 }
471466 prev = hoge;
472467 }
@@ -473,7 +468,7 @@
473468 /* sort済みをsort */
474469 printf("size[%d]\n", cstl_size(hl));
475470 cstl_sort(hl, greater);
476- assert(HogeList_verify(hl));
471+ ASSERT(HogeList_verify(hl));
477472 printf("size[%d]\n", cstl_size(hl));
478473 printf("after sort (greater) again\n");
479474 hoge.key = "XXX"; hoge.value = 9999;
@@ -483,17 +478,17 @@
483478 HogeList *node = (HogeList*)pos.internal.data.data1;
484479 hoge = *cstl_iter_data(pos);
485480 printf("%s, %4d, prev[%p], p[%p], next[%p]\n", hoge.key, hoge.value, node->prev, node, node->next);
486- assert(strcmp(prev.key, hoge.key) >= 0);
481+ ASSERT(strcmp(prev.key, hoge.key) >= 0);
487482 if (strcmp(prev.key, hoge.key) == 0) {
488- assert(prev.value <= hoge.value);
483+ ASSERT(prev.value <= hoge.value);
489484 } else {
490- assert(prev.value >= hoge.value);
485+ ASSERT(prev.value >= hoge.value);
491486 }
492487 prev = hoge;
493488 }
494489 /* reverse */
495490 cstl_reverse(hl);
496- assert(HogeList_verify(hl));
491+ ASSERT(HogeList_verify(hl));
497492 printf("size[%d]\n", cstl_size(hl));
498493 printf("reverse\n");
499494 hoge.key = "XXX"; hoge.value = 9999;
@@ -508,7 +503,7 @@
508503 printf("before merge 1\n");
509504 cstl_clear(hl);
510505 for (i = 0; i < NELEMS(hogetab2); i += 2) {
511- assert(cstl_push_back(hl, hogetab2[i]));
506+ ASSERT(cstl_push_back(hl, hogetab2[i]));
512507 }
513508 cstl_sort(hl, less);
514509 hoge.key = "XXX"; hoge.value = 9999;
@@ -522,7 +517,7 @@
522517 printf("before merge 2\n");
523518 x = HogeList_new();
524519 for (i = 1; i < NELEMS(hogetab2); i += 2) {
525- assert(cstl_push_back(x, hogetab2[i]));
520+ ASSERT(cstl_push_back(x, hogetab2[i]));
526521 }
527522 cstl_sort(x, less);
528523 hoge.key = "XXX"; hoge.value = 9999;
@@ -535,8 +530,8 @@
535530
536531 printf("after merge\n");
537532 cstl_merge(hl, x, less);
538- assert(HogeList_verify(hl));
539- assert(HogeList_verify(x));
533+ ASSERT(HogeList_verify(hl));
534+ ASSERT(HogeList_verify(x));
540535 hoge.key = "XXX"; hoge.value = 9999;
541536 printf("%s, %4d, prev[%p], p[%p], next[%p]\n", hoge.key, hoge.value, hl->prev, hl, hl->next);
542537 for (pos = cstl_begin(hl); cstl_iter_ne(pos, cstl_end(hl)); cstl_iter_inc(&pos)) {
@@ -544,8 +539,8 @@
544539 hoge = *cstl_iter_data(pos);
545540 printf("%s, %4d, prev[%p], p[%p], next[%p]\n", hoge.key, hoge.value, node->prev, node, node->next);
546541 }
547- assert(cstl_empty(x));
548- assert(cstl_size(hl) == NELEMS(hogetab2));
542+ ASSERT(cstl_empty(x));
543+ ASSERT(cstl_size(hl) == NELEMS(hogetab2));
549544
550545 cstl_delete(x);
551546 cstl_clear(hl);
@@ -559,66 +554,65 @@
559554 int buf[32];
560555 int i;
561556 int b[] = {1, 2, 4, 43, 2, 54, 1, 0, 2, 24};
562- printf("***** test_2_1 *****\n");
563557 for (i = 0; i < 32; i++) buf[i] = i;
564558 /* insert_array */
565- assert(cstl_size(il) == 0);
559+ ASSERT(cstl_size(il) == 0);
566560 cstl_clear(il);
567- assert(cstl_insert_array(il, cstl_begin(il), buf, 32));
568- assert(IntList_verify(il));
569- assert(cstl_size(il) == 32);
561+ ASSERT(cstl_insert_array(il, cstl_begin(il), buf, 32));
562+ ASSERT(IntList_verify(il));
563+ ASSERT(cstl_size(il) == 32);
570564 for (pos = cstl_begin(il), i = 0; cstl_iter_ne(pos, cstl_end(il)); cstl_iter_inc(&pos), i++) {
571- assert(*cstl_iter_data(pos) == i);
565+ ASSERT(*cstl_iter_data(pos) == i);
572566 }
573567 /* resize */
574- assert(cstl_resize(il, 64, 100));
575- assert(IntList_verify(il));
576- assert(cstl_size(il) == 64);
568+ ASSERT(cstl_resize(il, 64, 100));
569+ ASSERT(IntList_verify(il));
570+ ASSERT(cstl_size(il) == 64);
577571 for (pos = cstl_begin(il), i = 0; cstl_iter_ne(pos, cstl_end(il)); cstl_iter_inc(&pos), i++) {
578572 if (i < 32) {
579- assert(*cstl_iter_data(pos) == i);
573+ ASSERT(*cstl_iter_data(pos) == i);
580574 } else {
581- assert(*cstl_iter_data(pos) == 100);
575+ ASSERT(*cstl_iter_data(pos) == 100);
582576 }
583577 }
584- assert(cstl_resize(il, 16, 99));
585- assert(IntList_verify(il));
586- assert(cstl_size(il) == 16);
578+ ASSERT(cstl_resize(il, 16, 99));
579+ ASSERT(IntList_verify(il));
580+ ASSERT(cstl_size(il) == 16);
587581 for (pos = cstl_begin(il), i = 0; cstl_iter_ne(pos, cstl_end(il)); cstl_iter_inc(&pos), i++) {
588- assert(*cstl_iter_data(pos) == i);
582+ ASSERT(*cstl_iter_data(pos) == i);
589583 }
590- assert(cstl_resize(il, 0, 99));
591- assert(IntList_verify(il));
592- assert(cstl_size(il) == 0);
593- assert(cstl_resize(il, 100, 99));
584+ ASSERT(cstl_resize(il, 0, 99));
585+ ASSERT(IntList_verify(il));
586+ ASSERT(cstl_size(il) == 0);
587+ ASSERT(cstl_resize(il, 100, 99));
594588 /* swap */
595589 x = IntList_new();
596590 cstl_clear(il);
597- assert(cstl_insert_array(il, cstl_begin(il), buf, 32));
598- assert(cstl_insert_array(x, cstl_begin(x), b, sizeof b / sizeof b[0]));
599- assert(cstl_size(il) == 32);
591+ ASSERT(cstl_insert_array(il, cstl_begin(il), buf, 32));
592+ ASSERT(cstl_insert_array(x, cstl_begin(x), b, sizeof b / sizeof b[0]));
593+ ASSERT(cstl_size(il) == 32);
600594 for (pos = cstl_begin(il), i = 0; cstl_iter_ne(pos, cstl_end(il)); cstl_iter_inc(&pos), i++) {
601- assert(*cstl_iter_data(pos) == i);
595+ ASSERT(*cstl_iter_data(pos) == i);
602596 }
603- assert(cstl_size(x) == sizeof b / sizeof b[0]);
597+ ASSERT(cstl_size(x) == sizeof b / sizeof b[0]);
604598 for (pos = cstl_begin(x), i = 0; cstl_iter_ne(pos, cstl_end(x)); cstl_iter_inc(&pos), i++) {
605- assert(*cstl_iter_data(pos) == b[i]);
599+ ASSERT(*cstl_iter_data(pos) == b[i]);
606600 }
607601 cstl_swap(il, x);
608- assert(IntList_verify(il));
609- assert(IntList_verify(x));
610- assert(cstl_size(x) == 32);
602+ ASSERT(IntList_verify(il));
603+ ASSERT(IntList_verify(x));
604+ ASSERT(cstl_size(x) == 32);
611605 printf("splice\n");
612606 printf("x:\n");
613607 for (pos = cstl_begin(x), i = 0; cstl_iter_ne(pos, cstl_end(x)); cstl_iter_inc(&pos), i++) {
614- assert(*cstl_iter_data(pos) == i);
608+ ASSERT(*cstl_iter_data(pos) == i);
615609 printf("%2d, ", *cstl_iter_data(pos));
616610 }
617611 printf("\n");
618612 printf("il:\n");
619- assert(cstl_size(il) == sizeof b / sizeof b[0]);
613+ ASSERT(cstl_size(il) == sizeof b / sizeof b[0]);
620614 for (pos = cstl_begin(il), i = 0; cstl_iter_ne(pos, cstl_end(il)); cstl_iter_inc(&pos), i++) {
621- assert(*cstl_iter_data(pos) == b[i]);
615+ ASSERT(*cstl_iter_data(pos) == b[i]);
622616 printf("%2d, ", *cstl_iter_data(pos));
623617 }
624618 printf("\n");
@@ -630,11 +624,11 @@
630624 /* cstl_splice(x, cstl_end(x), x, cstl_iter_next(cstl_begin(x)), cstl_end(x));*/
631625 /* pos = cstl_iter_prev(cstl_end(x));*/
632626 /* cstl_splice(x, pos, x, cstl_iter_next(cstl_begin(x)), cstl_iter_prev(pos));*/
633- assert(IntList_verify(il));
634- assert(IntList_verify(x));
627+ ASSERT(IntList_verify(il));
628+ ASSERT(IntList_verify(x));
635629
636- assert(cstl_size(il) == 0);
637- assert(cstl_size(x) == 32 + sizeof b / sizeof b[0]);
630+ ASSERT(cstl_size(il) == 0);
631+ ASSERT(cstl_size(x) == 32 + sizeof b / sizeof b[0]);
638632 printf("x:\n");
639633 for (pos = cstl_begin(x), i = 0; cstl_iter_ne(pos, cstl_end(x)); cstl_iter_inc(&pos), i++) {
640634 printf("%2d, ", *cstl_iter_data(pos));
@@ -649,15 +643,15 @@
649643 /* insert_range */
650644 cstl_clear(il);
651645 cstl_clear(x);
652- assert(cstl_insert_array(il, cstl_begin(il), buf, 32));
653- assert(cstl_insert_array(x, cstl_begin(x), b, sizeof b / sizeof b[0]));
654- assert(cstl_insert_range(il, cstl_begin(il), cstl_begin(x), cstl_end(x)));
646+ ASSERT(cstl_insert_array(il, cstl_begin(il), buf, 32));
647+ ASSERT(cstl_insert_array(x, cstl_begin(x), b, sizeof b / sizeof b[0]));
648+ ASSERT(cstl_insert_range(il, cstl_begin(il), cstl_begin(x), cstl_end(x)));
655649 printf("insert_range, il:\n");
656650 for (pos = cstl_begin(il), i = 0; cstl_iter_ne(pos, cstl_end(il)); cstl_iter_inc(&pos), i++) {
657651 printf("%2d, ", *cstl_iter_data(pos));
658652 }
659- assert(IntList_verify(il));
660- assert(IntList_verify(x));
653+ ASSERT(IntList_verify(il));
654+ ASSERT(IntList_verify(x));
661655 printf("\n");
662656
663657 POOL_DUMP_OVERFLOW(&pool);
@@ -671,8 +665,8 @@
671665 {
672666 printf("\n===== list test =====\n");
673667 hl = HogeList_new();
674- assert(hl);
675- assert(HogeList_verify(hl));
668+ ASSERT(hl);
669+ ASSERT(HogeList_verify(hl));
676670
677671 ListTest_test_1_1();
678672 ListTest_test_1_2();
@@ -690,12 +684,47 @@
690684
691685
692686
693-int main(void)
687+static TestCase list_tests[] = {
688+ { "ListTest_test_1_1", ListTest_test_1_1 },
689+ { "ListTest_test_1_2", ListTest_test_1_2 },
690+ { "ListTest_test_1_3", ListTest_test_1_3 },
691+ { "ListTest_test_1_4", ListTest_test_1_4 },
692+ { "ListTest_test_1_5", ListTest_test_1_5 },
693+ { "ListTest_test_1_6", ListTest_test_1_6 },
694+ { "ListTest_test_1_7", ListTest_test_1_7 },
695+ { "ListTest_test_1_8", ListTest_test_1_8 },
696+ { "ListTest_test_2_1", ListTest_test_2_1 },
697+ TEST_CASE_NULL,
698+};
699+
700+static int setup(void)
694701 {
702+ hl = HogeList_new();
703+ return hl == 0;
704+}
705+
706+static int teardown(void)
707+{
708+ POOL_DUMP_OVERFLOW(&pool);
709+ cstl_delete(hl);
710+ return 0;
711+}
712+
713+static TestSuite suites[] = {
714+ { "list_test", setup, teardown, list_tests },
715+ TEST_SUITE_NULL,
716+};
717+
718+int main(int argc, char *argv[])
719+{
695720 #ifdef MY_MALLOC
696721 Pool_init(&pool, buf, sizeof buf, sizeof buf[0]);
697722 #endif
698- ListTest_run();
723+ if (argc < 2) {
724+ unittest_run_all(suites);
725+ } else {
726+ unittest_run_interactive(suites);
727+ }
699728 #ifdef MY_MALLOC
700729 POOL_DUMP_LEAK(&pool, 0);
701730 #endif
--- branches/try-vfunc/test/map_test.c (revision 398)
+++ branches/try-vfunc/test/map_test.c (revision 399)
@@ -1,6 +1,6 @@
11 #include <stdio.h>
22 #include <string.h>
3-#include <assert.h>
3+#include "../unittest/UnitTest.h"
44 #include <time.h>
55 #include "../cstl/ring.h"
66 #include "../cstl/map.h"
@@ -88,127 +88,126 @@
8888 IntIntMapAIterator pos[SIZE];
8989 IntIntMapAIterator p;
9090 IntIntMapA *x;
91- printf("***** test_1_1 *****\n");
9291 ia = IntIntMapA_new();
9392 /* 初期状態 */
94- assert(cstl_empty(ia));
95- assert(cstl_size(ia) == 0);
96- assert(cstl_iter_eq(cstl_begin(ia), cstl_end(ia)));
97- assert(cstl_iter_eq(cstl_rbegin(ia), cstl_rend(ia)));
93+ ASSERT(cstl_empty(ia));
94+ ASSERT(cstl_size(ia) == 0);
95+ ASSERT(cstl_iter_eq(cstl_begin(ia), cstl_end(ia)));
96+ ASSERT(cstl_iter_eq(cstl_rbegin(ia), cstl_rend(ia)));
9897 /* insert */
9998 for (i = 0; i < SIZE; i++) {
10099 /* pos[i] = cstl_map_insert(ia, hoge_int[i], hoge_int[i], &success[i]);*/
101- assert(cstl_map_insert(ia, hoge_int[i], hoge_int[i], &pos[i], &success[i]));
100+ ASSERT(cstl_map_insert(ia, hoge_int[i], hoge_int[i], &pos[i], &success[i]));
102101 if (i < SIZE/2) {
103- assert(success[i]);
102+ ASSERT(success[i]);
104103 count++;
105104 } else {
106- assert(!success[i]);
105+ ASSERT(!success[i]);
107106 }
108107 }
109108 /* IntIntMapA_print(ia);*/
110- assert(!cstl_empty(ia));
111- assert(cstl_size(ia) == count);
112- assert(count == SIZE/2);
109+ ASSERT(!cstl_empty(ia));
110+ ASSERT(cstl_size(ia) == count);
111+ ASSERT(count == SIZE/2);
113112 /* count, find, lower_bound, upper_bound */
114113 for (i = 0; i < SIZE/2; i++) {
115- assert(cstl_count(ia, hoge_int[i]) == 1);
116- assert(cstl_iter_eq(pos[i], cstl_find(ia, hoge_int[i])));
117- assert(cstl_iter_eq(pos[i], cstl_lower_bound(ia, hoge_int[i])));
118- assert(cstl_iter_eq(pos[i], cstl_upper_bound(ia, hoge_int[i]-1)));
119- assert(cstl_iter_eq(cstl_lower_bound(ia, hoge_int[i]+1), cstl_upper_bound(ia, hoge_int[i])));
114+ ASSERT(cstl_count(ia, hoge_int[i]) == 1);
115+ ASSERT(cstl_iter_eq(pos[i], cstl_find(ia, hoge_int[i])));
116+ ASSERT(cstl_iter_eq(pos[i], cstl_lower_bound(ia, hoge_int[i])));
117+ ASSERT(cstl_iter_eq(pos[i], cstl_upper_bound(ia, hoge_int[i]-1)));
118+ ASSERT(cstl_iter_eq(cstl_lower_bound(ia, hoge_int[i]+1), cstl_upper_bound(ia, hoge_int[i])));
120119 }
121- assert(cstl_iter_eq(cstl_find(ia, *cstl_iter_key(cstl_begin(ia)) -1), cstl_end(ia)));
122- assert(cstl_iter_eq(cstl_lower_bound(ia, *cstl_iter_key(cstl_rbegin(ia)) +1), cstl_end(ia)));
123- assert(cstl_iter_eq(cstl_upper_bound(ia, *cstl_iter_key(cstl_rbegin(ia))), cstl_end(ia)));
120+ ASSERT(cstl_iter_eq(cstl_find(ia, *cstl_iter_key(cstl_begin(ia)) -1), cstl_end(ia)));
121+ ASSERT(cstl_iter_eq(cstl_lower_bound(ia, *cstl_iter_key(cstl_rbegin(ia)) +1), cstl_end(ia)));
122+ ASSERT(cstl_iter_eq(cstl_upper_bound(ia, *cstl_iter_key(cstl_rbegin(ia))), cstl_end(ia)));
124123 /* begin, end, next, key, value, at */
125124 for (p = cstl_begin(ia), i = 0; cstl_iter_ne(p, cstl_end(ia)); cstl_iter_inc(&p), i++) {
126- assert(*cstl_iter_key(p) == i);
127- assert(*cstl_iter_val(p) == i);
128- assert(*cstl_at(ia, *cstl_iter_key(p)) == i);
125+ ASSERT(*cstl_iter_key(p) == i);
126+ ASSERT(*cstl_iter_val(p) == i);
127+ ASSERT(*cstl_at(ia, *cstl_iter_key(p)) == i);
129128 *cstl_iter_val(p) = ~i;
130- assert(*cstl_at(ia, *cstl_iter_key(p)) == ~i);
129+ ASSERT(*cstl_at(ia, *cstl_iter_key(p)) == ~i);
131130 *cstl_at(ia, *cstl_iter_key(p)) = i;
132131 }
133- assert(i == SIZE/2);
134-/* assert(cstl_iter_next(cstl_rbegin(ia)) == cstl_end(ia));*/
135- assert(*cstl_iter_key(cstl_rbegin(ia)) == *cstl_iter_key(cstl_iter_prev(cstl_end(ia))));
136- assert(*cstl_iter_val(cstl_rbegin(ia)) == *cstl_iter_val(cstl_iter_prev(cstl_end(ia))));
132+ ASSERT(i == SIZE/2);
133+/* ASSERT(cstl_iter_next(cstl_rbegin(ia)) == cstl_end(ia));*/
134+ ASSERT(*cstl_iter_key(cstl_rbegin(ia)) == *cstl_iter_key(cstl_iter_prev(cstl_end(ia))));
135+ ASSERT(*cstl_iter_val(cstl_rbegin(ia)) == *cstl_iter_val(cstl_iter_prev(cstl_end(ia))));
137136 /* rbegin, rend, prev, key, value, at */
138137 for (p = cstl_rbegin(ia), i = SIZE/2 -1; cstl_iter_ne(p, cstl_rend(ia)); cstl_iter_inc(&p), i--) {
139- assert(*cstl_iter_key(p) == i);
140- assert(*cstl_iter_val(p) == i);
141- assert(*cstl_at(ia, *cstl_iter_key(p)) == i);
138+ ASSERT(*cstl_iter_key(p) == i);
139+ ASSERT(*cstl_iter_val(p) == i);
140+ ASSERT(*cstl_at(ia, *cstl_iter_key(p)) == i);
142141 *cstl_iter_val(p) = ~i;
143- assert(*cstl_at(ia, *cstl_iter_key(p)) == ~i);
142+ ASSERT(*cstl_at(ia, *cstl_iter_key(p)) == ~i);
144143 *cstl_at(ia, *cstl_iter_key(p)) = i;
145144 }
146- assert(i == -1);
147-/* assert(cstl_iter_prev(cstl_begin(ia)) == cstl_rend(ia));*/
148- assert(*cstl_iter_key(cstl_begin(ia)) == *cstl_iter_key(cstl_iter_prev(cstl_rend(ia))));
149- assert(*cstl_iter_val(cstl_begin(ia)) == *cstl_iter_val(cstl_iter_prev(cstl_rend(ia))));
145+ ASSERT(i == -1);
146+/* ASSERT(cstl_iter_prev(cstl_begin(ia)) == cstl_rend(ia));*/
147+ ASSERT(*cstl_iter_key(cstl_begin(ia)) == *cstl_iter_key(cstl_iter_prev(cstl_rend(ia))));
148+ ASSERT(*cstl_iter_val(cstl_begin(ia)) == *cstl_iter_val(cstl_iter_prev(cstl_rend(ia))));
150149 /* erase */
151150 for (i = 0; i < SIZE; i++) {
152151 if (success[i]) {
153152 IntIntMapAIterator itr = cstl_iter_next(pos[i]);
154- assert(cstl_iter_eq(itr, cstl_erase(ia, pos[i])));
153+ ASSERT(cstl_iter_eq(itr, cstl_erase(ia, pos[i])));
155154 count--;
156155 }
157156 }
158- assert(cstl_empty(ia));
159- assert(cstl_size(ia) == 0);
160- assert(count == 0);
157+ ASSERT(cstl_empty(ia));
158+ ASSERT(cstl_size(ia) == 0);
159+ ASSERT(count == 0);
161160 /* erase_range */
162161 for (i = 0; i < SIZE/2; i++) {
163- assert(cstl_map_insert(ia, hoge_int[i], hoge_int[i], &pos[i], NULL));
162+ ASSERT(cstl_map_insert(ia, hoge_int[i], hoge_int[i], &pos[i], NULL));
164163 /* pos[i] = cstl_map_insert(ia, hoge_int[i], hoge_int[i], NULL);*/
165- assert(cstl_iter_ne(pos[i], cstl_end(ia)));
164+ ASSERT(cstl_iter_ne(pos[i], cstl_end(ia)));
166165 }
167- assert(cstl_size(ia) == SIZE/2);
168- assert(cstl_iter_eq(cstl_find(ia, SIZE/2 -2), cstl_erase_range(ia, cstl_find(ia, 2), cstl_find(ia, SIZE/2 -2))));
169- assert(cstl_size(ia) == 4);
170- assert(cstl_iter_eq(cstl_end(ia), cstl_erase_range(ia, cstl_begin(ia), cstl_end(ia))));
171- assert(cstl_size(ia) == 0);
172- assert(cstl_map_insert(ia, hoge_int[0], hoge_int[0], NULL, NULL));
173- assert(cstl_size(ia) == 1);
166+ ASSERT(cstl_size(ia) == SIZE/2);
167+ ASSERT(cstl_iter_eq(cstl_find(ia, SIZE/2 -2), cstl_erase_range(ia, cstl_find(ia, 2), cstl_find(ia, SIZE/2 -2))));
168+ ASSERT(cstl_size(ia) == 4);
169+ ASSERT(cstl_iter_eq(cstl_end(ia), cstl_erase_range(ia, cstl_begin(ia), cstl_end(ia))));
170+ ASSERT(cstl_size(ia) == 0);
171+ ASSERT(cstl_map_insert(ia, hoge_int[0], hoge_int[0], NULL, NULL));
172+ ASSERT(cstl_size(ia) == 1);
174173 p = cstl_iter_next(cstl_begin(ia));
175- assert(cstl_iter_eq(p, cstl_erase_range(ia, cstl_begin(ia), cstl_iter_next(cstl_begin(ia)))));
176-/* assert(cstl_iter_next(cstl_begin(ia)) == cstl_erase_range(ia, cstl_begin(ia), cstl_iter_next(cstl_begin(ia))));*/
177- assert(cstl_size(ia) == 0);
178- assert(cstl_map_insert(ia, 100, 101, NULL, NULL));
179- assert(cstl_map_insert(ia, 110, 111, NULL, NULL));
180- assert(cstl_size(ia) == 2);
181- assert(cstl_iter_eq(cstl_upper_bound(ia, 110), cstl_erase_range(ia, cstl_lower_bound(ia, 100), cstl_upper_bound(ia, 110))));
182- assert(cstl_size(ia) == 0);
174+ ASSERT(cstl_iter_eq(p, cstl_erase_range(ia, cstl_begin(ia), cstl_iter_next(cstl_begin(ia)))));
175+/* ASSERT(cstl_iter_next(cstl_begin(ia)) == cstl_erase_range(ia, cstl_begin(ia), cstl_iter_next(cstl_begin(ia))));*/
176+ ASSERT(cstl_size(ia) == 0);
177+ ASSERT(cstl_map_insert(ia, 100, 101, NULL, NULL));
178+ ASSERT(cstl_map_insert(ia, 110, 111, NULL, NULL));
179+ ASSERT(cstl_size(ia) == 2);
180+ ASSERT(cstl_iter_eq(cstl_upper_bound(ia, 110), cstl_erase_range(ia, cstl_lower_bound(ia, 100), cstl_upper_bound(ia, 110))));
181+ ASSERT(cstl_size(ia) == 0);
183182 /* erase_key */
184183 for (i = 0; i < SIZE/2; i++) {
185- assert(cstl_map_insert(ia, hoge_int[i], hoge_int[i], &pos[i], NULL));
184+ ASSERT(cstl_map_insert(ia, hoge_int[i], hoge_int[i], &pos[i], NULL));
186185 /* pos[i] = cstl_map_insert(ia, hoge_int[i], hoge_int[i], NULL);*/
187- assert(cstl_iter_ne(pos[i], cstl_end(ia)));
186+ ASSERT(cstl_iter_ne(pos[i], cstl_end(ia)));
188187 }
189- assert(cstl_size(ia) == SIZE/2);
188+ ASSERT(cstl_size(ia) == SIZE/2);
190189 for (i = 0; i < SIZE/2; i++) {
191- assert(cstl_erase_key(ia, hoge_int[i]) == 1);
190+ ASSERT(cstl_erase_key(ia, hoge_int[i]) == 1);
192191 }
193- assert(cstl_size(ia) == 0);
192+ ASSERT(cstl_size(ia) == 0);
194193 /* 大量にinsert */
195194 count = 0;
196195 while (count < 1000000 && cstl_map_insert(ia, count, 9999, NULL, NULL)) {
197196 count++;
198197 }
199- assert(cstl_size(ia) == count);
198+ ASSERT(cstl_size(ia) == count);
200199 printf("count: %d\n", count);
201200 printf("size: %d\n", cstl_size(ia));
202201 /* clear */
203202 cstl_clear(ia);
204203 printf("size: %d\n", cstl_size(ia));
205- assert(cstl_size(ia) == 0);
206- assert(cstl_map_insert(ia, 100, 123, NULL, NULL));
207- assert(cstl_size(ia) == 1);
204+ ASSERT(cstl_size(ia) == 0);
205+ ASSERT(cstl_map_insert(ia, 100, 123, NULL, NULL));
206+ ASSERT(cstl_size(ia) == 1);
208207 cstl_clear(ia);
209- assert(cstl_size(ia) == 0);
208+ ASSERT(cstl_size(ia) == 0);
210209 cstl_clear(ia);
211- assert(cstl_size(ia) == 0);
210+ ASSERT(cstl_size(ia) == 0);
212211
213212 /* at */
214213 /* 挿入 */
@@ -232,17 +231,17 @@
232231 IntIntMapA_swap(ia, x);
233232 /* IntIntMapA_print(ia);*/
234233 /* IntIntMapA_print(x);*/
235- assert(cstl_size(ia) == 3);
236- assert(cstl_size(x) == 5);
234+ ASSERT(cstl_size(ia) == 3);
235+ ASSERT(cstl_size(x) == 5);
237236 /* insert_range */
238237 /* IntIntMapA_print(ia);*/
239238 /* IntIntMapA_print(x);*/
240- assert(cstl_assoc_insert_range(x, cstl_begin(ia), cstl_end(ia)));
239+ ASSERT(cstl_assoc_insert_range(x, cstl_begin(ia), cstl_end(ia)));
241240 /* IntIntMapA_print(ia);*/
242241 /* IntIntMapA_print(x);*/
243- assert(cstl_size(x) == 8);
244- assert(cstl_assoc_insert_range(x, cstl_begin(ia), cstl_end(ia)));
245- assert(cstl_size(x) == 8);
242+ ASSERT(cstl_size(x) == 8);
243+ ASSERT(cstl_assoc_insert_range(x, cstl_begin(ia), cstl_end(ia)));
244+ ASSERT(cstl_size(x) == 8);
246245 IntIntMapA_print(ia);
247246 IntIntMapA_print(x);
248247
@@ -260,128 +259,127 @@
260259 IntIntMMapAIterator pos[SIZE];
261260 IntIntMMapAIterator p;
262261 int flag[SIZE/2] = {0};
263- printf("***** test_1_2 *****\n");
264262 ima = IntIntMMapA_new();
265263 /* 初期状態 */
266- assert(cstl_empty(ima));
267- assert(cstl_size(ima) == 0);
268- assert(cstl_iter_eq(cstl_begin(ima), cstl_end(ima)));
269- assert(cstl_iter_eq(cstl_rbegin(ima), cstl_rend(ima)));
264+ ASSERT(cstl_empty(ima));
265+ ASSERT(cstl_size(ima) == 0);
266+ ASSERT(cstl_iter_eq(cstl_begin(ima), cstl_end(ima)));
267+ ASSERT(cstl_iter_eq(cstl_rbegin(ima), cstl_rend(ima)));
270268 /* insert */
271269 for (i = 0; i < SIZE; i++) {
272270 /* pos[i] = cstl_multimap_insert(ima, hoge_int[i], hoge_int[i]);*/
273-/* assert(pos[i] && cstl_iter_ne(pos[i], cstl_end(ima)));*/
274- assert(cstl_multimap_insert(ima, hoge_int[i], hoge_int[i], &pos[i]));
275- assert(cstl_iter_ne(pos[i], cstl_end(ima)));
271+/* ASSERT(pos[i] && cstl_iter_ne(pos[i], cstl_end(ima)));*/
272+ ASSERT(cstl_multimap_insert(ima, hoge_int[i], hoge_int[i], &pos[i]));
273+ ASSERT(cstl_iter_ne(pos[i], cstl_end(ima)));
276274 count++;
277275 }
278276 /* IntIntMMapA_print(ima);*/
279- assert(!cstl_empty(ima));
280- assert(cstl_size(ima) == count);
281- assert(count == SIZE);
277+ ASSERT(!cstl_empty(ima));
278+ ASSERT(cstl_size(ima) == count);
279+ ASSERT(count == SIZE);
282280 /* count */
283281 for (i = 0; i < SIZE; i++) {
284282 if (i < SIZE/2/2) {
285- assert(cstl_count(ima, i) == 1);
283+ ASSERT(cstl_count(ima, i) == 1);
286284 } else if (i < SIZE/2) {
287- assert(cstl_count(ima, i) == 3);
285+ ASSERT(cstl_count(ima, i) == 3);
288286 } else {
289- assert(cstl_count(ima, i) == 0);
287+ ASSERT(cstl_count(ima, i) == 0);
290288 }
291289 }
292290 /* find, lower_bound, upper_bound */
293291 for (i = 0; i < SIZE; i++) {
294292 if (cstl_count(ima, hoge_int[i]) == 1) {
295- assert(cstl_iter_eq(pos[i], cstl_find(ima, hoge_int[i])));
296- assert(cstl_iter_eq(pos[i], cstl_lower_bound(ima, hoge_int[i])));
297- assert(cstl_iter_eq(pos[i], cstl_upper_bound(ima, hoge_int[i]-1)));
293+ ASSERT(cstl_iter_eq(pos[i], cstl_find(ima, hoge_int[i])));
294+ ASSERT(cstl_iter_eq(pos[i], cstl_lower_bound(ima, hoge_int[i])));
295+ ASSERT(cstl_iter_eq(pos[i], cstl_upper_bound(ima, hoge_int[i]-1)));
298296 } else if (cstl_count(ima, hoge_int[i]) == 3) {
299297 if (!flag[hoge_int[i]]) {
300298 flag[hoge_int[i]] = 1;
301- assert(cstl_iter_eq(pos[i], cstl_lower_bound(ima, hoge_int[i])));
302- assert(cstl_iter_eq(pos[i], cstl_upper_bound(ima, hoge_int[i]-1)));
299+ ASSERT(cstl_iter_eq(pos[i], cstl_lower_bound(ima, hoge_int[i])));
300+ ASSERT(cstl_iter_eq(pos[i], cstl_upper_bound(ima, hoge_int[i]-1)));
303301 }
304302 } else {
305- assert(0);
303+ ASSERT(0);
306304 }
307- assert(cstl_iter_eq(cstl_lower_bound(ima, hoge_int[i]+1), cstl_upper_bound(ima, hoge_int[i])));
305+ ASSERT(cstl_iter_eq(cstl_lower_bound(ima, hoge_int[i]+1), cstl_upper_bound(ima, hoge_int[i])));
308306 }
309- assert(cstl_iter_eq(cstl_find(ima, *cstl_iter_key(cstl_begin(ima)) -1), cstl_end(ima)));
310- assert(cstl_iter_eq(cstl_lower_bound(ima, *cstl_iter_key(cstl_rbegin(ima)) +1), cstl_end(ima)));
311- assert(cstl_iter_eq(cstl_upper_bound(ima, *cstl_iter_key(cstl_rbegin(ima))), cstl_end(ima)));
307+ ASSERT(cstl_iter_eq(cstl_find(ima, *cstl_iter_key(cstl_begin(ima)) -1), cstl_end(ima)));
308+ ASSERT(cstl_iter_eq(cstl_lower_bound(ima, *cstl_iter_key(cstl_rbegin(ima)) +1), cstl_end(ima)));
309+ ASSERT(cstl_iter_eq(cstl_upper_bound(ima, *cstl_iter_key(cstl_rbegin(ima))), cstl_end(ima)));
312310 /* begin, end, next, key, value */
313311 for (p = cstl_begin(ima), i = 0; cstl_iter_ne(p, cstl_end(ima)); cstl_iter_inc(&p), i++) {
314312 /* printf("%d, %d, %d\n", i, *cstl_iter_key(p), *cstl_iter_val(p));*/
315313 }
316- assert(i == SIZE);
317-/* assert(cstl_iter_next(cstl_rbegin(ima)) == cstl_end(ima));*/
318- assert(*cstl_iter_key(cstl_rbegin(ima)) == *cstl_iter_key(cstl_iter_prev(cstl_end(ima))));
319- assert(*cstl_iter_val(cstl_rbegin(ima)) == *cstl_iter_val(cstl_iter_prev(cstl_end(ima))));
314+ ASSERT(i == SIZE);
315+/* ASSERT(cstl_iter_next(cstl_rbegin(ima)) == cstl_end(ima));*/
316+ ASSERT(*cstl_iter_key(cstl_rbegin(ima)) == *cstl_iter_key(cstl_iter_prev(cstl_end(ima))));
317+ ASSERT(*cstl_iter_val(cstl_rbegin(ima)) == *cstl_iter_val(cstl_iter_prev(cstl_end(ima))));
320318 /* rbegin, rend, prev, key, value */
321319 for (p = cstl_rbegin(ima), i = SIZE -1; cstl_iter_ne(p, cstl_rend(ima)); cstl_iter_inc(&p), i--) {
322320 /* printf("%d, %d, %d\n", i, *cstl_iter_key(p), *cstl_iter_val(ima, p));*/
323321 }
324- assert(i == -1);
325-/* assert(cstl_iter_prev(cstl_begin(ima)) == cstl_rend(ima));*/
326- assert(*cstl_iter_key(cstl_begin(ima)) == *cstl_iter_key(cstl_iter_prev(cstl_rend(ima))));
327- assert(*cstl_iter_val(cstl_begin(ima)) == *cstl_iter_val(cstl_iter_prev(cstl_rend(ima))));
322+ ASSERT(i == -1);
323+/* ASSERT(cstl_iter_prev(cstl_begin(ima)) == cstl_rend(ima));*/
324+ ASSERT(*cstl_iter_key(cstl_begin(ima)) == *cstl_iter_key(cstl_iter_prev(cstl_rend(ima))));
325+ ASSERT(*cstl_iter_val(cstl_begin(ima)) == *cstl_iter_val(cstl_iter_prev(cstl_rend(ima))));
328326 /* erase */
329327 for (i = 0; i < SIZE; i++) {
330328 IntIntMMapAIterator itr = cstl_iter_next(pos[i]);
331- assert(cstl_iter_eq(itr, cstl_erase(ima, pos[i])));
329+ ASSERT(cstl_iter_eq(itr, cstl_erase(ima, pos[i])));
332330 count--;
333331 }
334- assert(cstl_empty(ima));
335- assert(cstl_size(ima) == 0);
336- assert(count == 0);
332+ ASSERT(cstl_empty(ima));
333+ ASSERT(cstl_size(ima) == 0);
334+ ASSERT(count == 0);
337335 /* erase_range */
338336 for (i = 0; i < SIZE; i++) {
339- assert(cstl_multimap_insert(ima, hoge_int[i], hoge_int[i], &pos[i]));
337+ ASSERT(cstl_multimap_insert(ima, hoge_int[i], hoge_int[i], &pos[i]));
340338 /* pos[i] = cstl_multimap_insert(ima, hoge_int[i], hoge_int[i]);*/
341- assert(cstl_iter_ne(pos[i], cstl_end(ima)));
339+ ASSERT(cstl_iter_ne(pos[i], cstl_end(ima)));
342340 }
343- assert(cstl_size(ima) == SIZE);
344-/* assert(cstl_iter_next(cstl_find(ima, SIZE/2/2 -1)) == cstl_erase_range(ima, cstl_find(ima, 0), cstl_iter_next(cstl_find(ima, SIZE/2/2 -1))));*/
341+ ASSERT(cstl_size(ima) == SIZE);
342+/* ASSERT(cstl_iter_next(cstl_find(ima, SIZE/2/2 -1)) == cstl_erase_range(ima, cstl_find(ima, 0), cstl_iter_next(cstl_find(ima, SIZE/2/2 -1))));*/
345343 p = cstl_iter_next(cstl_find(ima, SIZE/2/2 -1));
346- assert(cstl_iter_eq(p, cstl_erase_range(ima, cstl_find(ima, 0), cstl_iter_next(cstl_find(ima, SIZE/2/2 -1)))));
347- assert(cstl_size(ima) == SIZE - SIZE/2/2);
348- assert(cstl_iter_eq(cstl_end(ima), cstl_erase_range(ima, cstl_begin(ima), cstl_end(ima))));
349- assert(cstl_size(ima) == 0);
350- assert(cstl_multimap_insert(ima, hoge_int[0], hoge_int[0], NULL));
351- assert(cstl_size(ima) == 1);
352-/* assert(cstl_iter_next(cstl_begin(ima)) == cstl_erase_range(ima, cstl_begin(ima), cstl_iter_next(cstl_begin(ima))));*/
344+ ASSERT(cstl_iter_eq(p, cstl_erase_range(ima, cstl_find(ima, 0), cstl_iter_next(cstl_find(ima, SIZE/2/2 -1)))));
345+ ASSERT(cstl_size(ima) == SIZE - SIZE/2/2);
346+ ASSERT(cstl_iter_eq(cstl_end(ima), cstl_erase_range(ima, cstl_begin(ima), cstl_end(ima))));
347+ ASSERT(cstl_size(ima) == 0);
348+ ASSERT(cstl_multimap_insert(ima, hoge_int[0], hoge_int[0], NULL));
349+ ASSERT(cstl_size(ima) == 1);
350+/* ASSERT(cstl_iter_next(cstl_begin(ima)) == cstl_erase_range(ima, cstl_begin(ima), cstl_iter_next(cstl_begin(ima))));*/
353351 p = cstl_iter_next(cstl_begin(ima));
354- assert(cstl_iter_eq(p, cstl_erase_range(ima, cstl_begin(ima), cstl_iter_next(cstl_begin(ima)))));
355- assert(cstl_size(ima) == 0);
356- assert(cstl_multimap_insert(ima, 100, 100, NULL));
357- assert(cstl_multimap_insert(ima, 100, 100, NULL));
358- assert(cstl_multimap_insert(ima, 100, 100, NULL));
359- assert(cstl_multimap_insert(ima, 110, 110, NULL));
360- assert(cstl_multimap_insert(ima, 110, 110, NULL));
361- assert(cstl_size(ima) == 5);
362- assert(cstl_iter_eq(cstl_upper_bound(ima, 110), cstl_erase_range(ima, cstl_lower_bound(ima, 100), cstl_upper_bound(ima, 110))));
363- assert(cstl_size(ima) == 0);
352+ ASSERT(cstl_iter_eq(p, cstl_erase_range(ima, cstl_begin(ima), cstl_iter_next(cstl_begin(ima)))));
353+ ASSERT(cstl_size(ima) == 0);
354+ ASSERT(cstl_multimap_insert(ima, 100, 100, NULL));
355+ ASSERT(cstl_multimap_insert(ima, 100, 100, NULL));
356+ ASSERT(cstl_multimap_insert(ima, 100, 100, NULL));
357+ ASSERT(cstl_multimap_insert(ima, 110, 110, NULL));
358+ ASSERT(cstl_multimap_insert(ima, 110, 110, NULL));
359+ ASSERT(cstl_size(ima) == 5);
360+ ASSERT(cstl_iter_eq(cstl_upper_bound(ima, 110), cstl_erase_range(ima, cstl_lower_bound(ima, 100), cstl_upper_bound(ima, 110))));
361+ ASSERT(cstl_size(ima) == 0);
364362 /* erase_key */
365363 for (i = 0; i < SIZE; i++) {
366- assert(cstl_multimap_insert(ima, hoge_int[i], hoge_int[i], &pos[i]));
364+ ASSERT(cstl_multimap_insert(ima, hoge_int[i], hoge_int[i], &pos[i]));
367365 /* pos[i] = cstl_multimap_insert(ima, hoge_int[i], hoge_int[i]);*/
368- assert(cstl_iter_ne(pos[i], cstl_end(ima)));
366+ ASSERT(cstl_iter_ne(pos[i], cstl_end(ima)));
369367 }
370- assert(cstl_size(ima) == SIZE);
368+ ASSERT(cstl_size(ima) == SIZE);
371369 for (i = 0; i < SIZE/2/2; i++) {
372- assert(cstl_erase_key(ima, i) == 1);
370+ ASSERT(cstl_erase_key(ima, i) == 1);
373371 }
374- assert(cstl_size(ima) == SIZE - SIZE/2/2);
372+ ASSERT(cstl_size(ima) == SIZE - SIZE/2/2);
375373 for (i = SIZE/2/2; i < SIZE/2; i++) {
376- assert(cstl_erase_key(ima, i) == 3);
374+ ASSERT(cstl_erase_key(ima, i) == 3);
377375 }
378- assert(cstl_size(ima) == 0);
376+ ASSERT(cstl_size(ima) == 0);
379377 /* 大量にinsert */
380378 count = 0;
381379 while (count < 1000000 && cstl_multimap_insert(ima, 0, count, NULL)) {
382380 count++;
383381 }
384- assert(cstl_size(ima) == count);
382+ ASSERT(cstl_size(ima) == count);
385383 printf("count: %d\n", count);
386384
387385 POOL_DUMP_OVERFLOW(&pool);
@@ -390,30 +388,35 @@
390388
391389
392390
391+static TestCase map_tests[] = {
392+ { "MapTest_test_1_1", MapTest_test_1_1 },
393+ { "MapTest_test_1_2", MapTest_test_1_2 },
394+ TEST_CASE_NULL,
395+};
393396
394-
395-
396-
397-
398-
399-
400-
401-void MapTest_run(void)
397+static int setup(void)
402398 {
403- printf("\n===== map test =====\n");
404399 map_init_hoge();
405-
406- MapTest_test_1_1();
407- MapTest_test_1_2();
400+ return 0;
408401 }
409402
403+static TestSuite suites[] = {
404+ { "map test", setup, 0, map_tests },
405+ TEST_SUITE_NULL,
406+};
410407
411-int main(void)
408+
409+
410+int main(int argc, char *argv[])
412411 {
413412 #ifdef MY_MALLOC
414413 Pool_init(&pool, buf, sizeof buf, sizeof buf[0]);
415414 #endif
416- MapTest_run();
415+ if (argc < 2) {
416+ unittest_run_all(suites);
417+ } else {
418+ unittest_run_interactive(suites);
419+ }
417420 #ifdef MY_MALLOC
418421 POOL_DUMP_LEAK(&pool, 0);
419422 #endif
--- branches/try-vfunc/test/set_test.c (revision 398)
+++ branches/try-vfunc/test/set_test.c (revision 399)
@@ -1,6 +1,6 @@
11 #include <stdio.h>
22 #include <string.h>
3-#include <assert.h>
3+#include "../unittest/UnitTest.h"
44 #include <time.h>
55 #include "../cstl/ring.h"
66 #include "../cstl/set.h"
@@ -139,149 +139,148 @@
139139 IntSetAReverseIterator rp;
140140 IntSetA *x;
141141 int b[] = {100, 101, 102, 103, 104, 105, 106, 107, 108, 109};
142- printf("***** test_1_1 *****\n");
143142 ia = IntSetA_new();
144143 /* 初期状態 */
145- assert(cstl_empty(ia));
146- assert(cstl_size(ia) == 0);
147-/* assert(cstl_begin(ia) == cstl_end(ia));*/
148- assert(cstl_iter_eq(cstl_begin(ia), cstl_end(ia)));
149-/* assert(cstl_rbegin(ia) == cstl_rend(ia));*/
150- assert(cstl_iter_eq(cstl_rbegin(ia), cstl_rend(ia)));
144+ ASSERT(cstl_empty(ia));
145+ ASSERT(cstl_size(ia) == 0);
146+/* ASSERT(cstl_begin(ia) == cstl_end(ia));*/
147+ ASSERT(cstl_iter_eq(cstl_begin(ia), cstl_end(ia)));
148+/* ASSERT(cstl_rbegin(ia) == cstl_rend(ia));*/
149+ ASSERT(cstl_iter_eq(cstl_rbegin(ia), cstl_rend(ia)));
151150 /* insert */
152151 for (i = 0; i < SIZE; i++) {
153152 /* pos[i] = cstl_set_insert(ia, hoge_int[i], &success[i]);*/
154- assert(cstl_set_insert(ia, hoge_int[i], &pos[i], &success[i]));
155- assert(IntSetA_verify(ia));
153+ ASSERT(cstl_set_insert(ia, hoge_int[i], &pos[i], &success[i]));
154+ ASSERT(IntSetA_verify(ia));
156155 if (i < SIZE/2) {
157- assert(success[i]);
156+ ASSERT(success[i]);
158157 count++;
159158 } else {
160- assert(!success[i]);
159+ ASSERT(!success[i]);
161160 }
162161 }
163162 /* IntSetA_print(ia);*/
164- assert(!cstl_empty(ia));
165- assert(cstl_size(ia) == count);
166- assert(count == SIZE/2);
163+ ASSERT(!cstl_empty(ia));
164+ ASSERT(cstl_size(ia) == count);
165+ ASSERT(count == SIZE/2);
167166 /* count, find, lower_bound, upper_bound */
168167 for (i = 0; i < SIZE/2; i++) {
169- assert(cstl_count(ia, hoge_int[i]) == 1);
170- assert(cstl_iter_eq(pos[i], cstl_find(ia, hoge_int[i])));
171- assert(cstl_iter_eq(pos[i], cstl_lower_bound(ia, hoge_int[i])));
172- assert(cstl_iter_eq(pos[i], cstl_upper_bound(ia, hoge_int[i]-1)));
173- assert(cstl_iter_eq(cstl_lower_bound(ia, hoge_int[i]+1), cstl_upper_bound(ia, hoge_int[i])));
168+ ASSERT(cstl_count(ia, hoge_int[i]) == 1);
169+ ASSERT(cstl_iter_eq(pos[i], cstl_find(ia, hoge_int[i])));
170+ ASSERT(cstl_iter_eq(pos[i], cstl_lower_bound(ia, hoge_int[i])));
171+ ASSERT(cstl_iter_eq(pos[i], cstl_upper_bound(ia, hoge_int[i]-1)));
172+ ASSERT(cstl_iter_eq(cstl_lower_bound(ia, hoge_int[i]+1), cstl_upper_bound(ia, hoge_int[i])));
174173 }
175- assert(cstl_iter_eq(cstl_find(ia, *cstl_iter_data(cstl_begin(ia)) -1), cstl_end(ia)));
176- assert(cstl_iter_eq(cstl_lower_bound(ia, *cstl_iter_data(cstl_rbegin(ia)) +1), cstl_end(ia)));
177- assert(cstl_iter_eq(cstl_upper_bound(ia, *cstl_iter_data(cstl_rbegin(ia))), cstl_end(ia)));
174+ ASSERT(cstl_iter_eq(cstl_find(ia, *cstl_iter_data(cstl_begin(ia)) -1), cstl_end(ia)));
175+ ASSERT(cstl_iter_eq(cstl_lower_bound(ia, *cstl_iter_data(cstl_rbegin(ia)) +1), cstl_end(ia)));
176+ ASSERT(cstl_iter_eq(cstl_upper_bound(ia, *cstl_iter_data(cstl_rbegin(ia))), cstl_end(ia)));
178177 /* begin, end, next, data */
179178 for (p = cstl_begin(ia), i = 0; cstl_iter_ne(p, cstl_end(ia)); cstl_iter_inc(&p), i++) {
180- assert(*cstl_iter_data(p) == i);
179+ ASSERT(*cstl_iter_data(p) == i);
181180 }
182- assert(i == SIZE/2);
183-/* assert(cstl_iter_eq(cstl_iter_next(cstl_rbegin(ia)), cstl_end(ia)));*/
184- assert(*cstl_iter_data(cstl_rbegin(ia)) == *cstl_iter_data(cstl_iter_prev(cstl_end(ia))));
181+ ASSERT(i == SIZE/2);
182+/* ASSERT(cstl_iter_eq(cstl_iter_next(cstl_rbegin(ia)), cstl_end(ia)));*/
183+ ASSERT(*cstl_iter_data(cstl_rbegin(ia)) == *cstl_iter_data(cstl_iter_prev(cstl_end(ia))));
185184 /* rbegin, rend, prev, data */
186185 for (rp = cstl_rbegin(ia), i = SIZE/2 -1; cstl_iter_ne(rp, cstl_rend(ia)); cstl_iter_inc(&rp), i--) {
187- assert(*cstl_iter_data(rp) == i);
186+ ASSERT(*cstl_iter_data(rp) == i);
188187 }
189- assert(i == -1);
190-/* assert(cstl_iter_eq(cstl_iter_prev(cstl_begin(ia)), cstl_rend(ia)));*/
191- assert(*cstl_iter_data(cstl_begin(ia)) == *cstl_iter_data(cstl_iter_prev(cstl_rend(ia))));
188+ ASSERT(i == -1);
189+/* ASSERT(cstl_iter_eq(cstl_iter_prev(cstl_begin(ia)), cstl_rend(ia)));*/
190+ ASSERT(*cstl_iter_data(cstl_begin(ia)) == *cstl_iter_data(cstl_iter_prev(cstl_rend(ia))));
192191 /* erase */
193192 for (i = 0; i < SIZE; i++) {
194193 /* if (pos[i] && success[i]) {*/
195194 if (success[i]) {
196195 IntSetAIterator itr = cstl_iter_next(pos[i]);
197-/* assert(itr == cstl_erase(ia, pos[i]));*/
198- assert(cstl_iter_eq(itr, cstl_erase(ia, pos[i])));
199- assert(IntSetA_verify(ia));
196+/* ASSERT(itr == cstl_erase(ia, pos[i]));*/
197+ ASSERT(cstl_iter_eq(itr, cstl_erase(ia, pos[i])));
198+ ASSERT(IntSetA_verify(ia));
200199 count--;
201200 }
202201 }
203- assert(cstl_empty(ia));
204- assert(cstl_size(ia) == 0);
205- assert(count == 0);
202+ ASSERT(cstl_empty(ia));
203+ ASSERT(cstl_size(ia) == 0);
204+ ASSERT(count == 0);
206205 /* erase_range */
207206 for (i = 0; i < SIZE/2; i++) {
208207 /* pos[i] = cstl_set_insert(ia, hoge_int[i], NULL);*/
209- assert(cstl_set_insert(ia, hoge_int[i], &pos[i], NULL));
208+ ASSERT(cstl_set_insert(ia, hoge_int[i], &pos[i], NULL));
210209 }
211- assert(cstl_size(ia) == SIZE/2);
212- assert(cstl_iter_eq(cstl_find(ia, SIZE/2 -2), cstl_erase_range(ia, cstl_find(ia, 2), cstl_find(ia, SIZE/2 -2))));
213- assert(IntSetA_verify(ia));
214- assert(cstl_size(ia) == 4);
215-/* assert(cstl_end(ia) == cstl_erase_range(ia, cstl_begin(ia), cstl_end(ia)));*/
216- assert(cstl_iter_eq(cstl_end(ia), cstl_erase_range(ia, cstl_begin(ia), cstl_end(ia))));
217- assert(cstl_size(ia) == 0);
218- assert(cstl_set_insert(ia, hoge_int[0], NULL, NULL));
219- assert(cstl_size(ia) == 1);
210+ ASSERT(cstl_size(ia) == SIZE/2);
211+ ASSERT(cstl_iter_eq(cstl_find(ia, SIZE/2 -2), cstl_erase_range(ia, cstl_find(ia, 2), cstl_find(ia, SIZE/2 -2))));
212+ ASSERT(IntSetA_verify(ia));
213+ ASSERT(cstl_size(ia) == 4);
214+/* ASSERT(cstl_end(ia) == cstl_erase_range(ia, cstl_begin(ia), cstl_end(ia)));*/
215+ ASSERT(cstl_iter_eq(cstl_end(ia), cstl_erase_range(ia, cstl_begin(ia), cstl_end(ia))));
216+ ASSERT(cstl_size(ia) == 0);
217+ ASSERT(cstl_set_insert(ia, hoge_int[0], NULL, NULL));
218+ ASSERT(cstl_size(ia) == 1);
220219 p = cstl_iter_next(cstl_begin(ia));
221- assert(cstl_iter_eq(p, cstl_erase_range(ia, cstl_begin(ia), cstl_iter_next(cstl_begin(ia)))));
222- assert(cstl_size(ia) == 0);
223- assert(cstl_set_insert(ia, 100, NULL, NULL));
224- assert(cstl_set_insert(ia, 110, NULL, NULL));
225- assert(cstl_size(ia) == 2);
226- assert(cstl_iter_eq(cstl_upper_bound(ia, 110), cstl_erase_range(ia, cstl_lower_bound(ia, 100), cstl_upper_bound(ia, 110))));
227- assert(cstl_size(ia) == 0);
220+ ASSERT(cstl_iter_eq(p, cstl_erase_range(ia, cstl_begin(ia), cstl_iter_next(cstl_begin(ia)))));
221+ ASSERT(cstl_size(ia) == 0);
222+ ASSERT(cstl_set_insert(ia, 100, NULL, NULL));
223+ ASSERT(cstl_set_insert(ia, 110, NULL, NULL));
224+ ASSERT(cstl_size(ia) == 2);
225+ ASSERT(cstl_iter_eq(cstl_upper_bound(ia, 110), cstl_erase_range(ia, cstl_lower_bound(ia, 100), cstl_upper_bound(ia, 110))));
226+ ASSERT(cstl_size(ia) == 0);
228227 /* erase_key */
229228 for (i = 0; i < SIZE/2; i++) {
230229 /* pos[i] = cstl_set_insert(ia, hoge_int[i], NULL);*/
231-/* assert(pos[i]);*/
232- assert(cstl_set_insert(ia, hoge_int[i], &pos[i], NULL));
230+/* ASSERT(pos[i]);*/
231+ ASSERT(cstl_set_insert(ia, hoge_int[i], &pos[i], NULL));
233232 }
234- assert(cstl_size(ia) == SIZE/2);
233+ ASSERT(cstl_size(ia) == SIZE/2);
235234 for (i = 0; i < SIZE/2; i++) {
236- assert(cstl_erase_key(ia, hoge_int[i]) == 1);
237- assert(IntSetA_verify(ia));
235+ ASSERT(cstl_erase_key(ia, hoge_int[i]) == 1);
236+ ASSERT(IntSetA_verify(ia));
238237 }
239- assert(cstl_size(ia) == 0);
238+ ASSERT(cstl_size(ia) == 0);
240239 /* 大量にinsert */
241240 count = 0;
242241 while (count < 1000000 && cstl_set_insert(ia, count, NULL, NULL)) {
243242 count++;
244243 }
245- assert(cstl_size(ia) == count);
244+ ASSERT(cstl_size(ia) == count);
246245 printf("count: %d\n", count);
247246 printf("size: %d\n", cstl_size(ia));
248247 /* clear */
249248 cstl_clear(ia);
250249 printf("size: %d\n", cstl_size(ia));
251- assert(cstl_size(ia) == 0);
252- assert(cstl_set_insert(ia, 100, NULL, NULL));
253- assert(cstl_size(ia) == 1);
250+ ASSERT(cstl_size(ia) == 0);
251+ ASSERT(cstl_set_insert(ia, 100, NULL, NULL));
252+ ASSERT(cstl_size(ia) == 1);
254253 cstl_clear(ia);
255- assert(cstl_size(ia) == 0);
254+ ASSERT(cstl_size(ia) == 0);
256255 cstl_clear(ia);
257- assert(cstl_size(ia) == 0);
256+ ASSERT(cstl_size(ia) == 0);
258257 /* swap */
259258 for (i = 0; i < SIZE/2; i++) {
260259 /* pos[i] = cstl_set_insert(ia, hoge_int[i], &success[i]);*/
261-/* assert(pos[i]);*/
262- assert(cstl_set_insert(ia, hoge_int[i], &pos[i], &success[i]));
263- assert(success[i]);
260+/* ASSERT(pos[i]);*/
261+ ASSERT(cstl_set_insert(ia, hoge_int[i], &pos[i], &success[i]));
262+ ASSERT(success[i]);
264263 }
265- assert(cstl_size(ia) == SIZE/2);
264+ ASSERT(cstl_size(ia) == SIZE/2);
266265 x = IntSetA_new();
267266 for (i = 0; i < sizeof b / sizeof b[0]; i++) {
268267 /* pos[i] = cstl_set_insert(x, b[i], &success[i]);*/
269-/* assert(pos[i]);*/
270- assert(cstl_set_insert(x, b[i], &pos[i], &success[i]));
271- assert(success[i]);
268+/* ASSERT(pos[i]);*/
269+ ASSERT(cstl_set_insert(x, b[i], &pos[i], &success[i]));
270+ ASSERT(success[i]);
272271 }
273- assert(cstl_size(x) == sizeof b / sizeof b[0]);
272+ ASSERT(cstl_size(x) == sizeof b / sizeof b[0]);
274273 /* IntSetA_print(ia);*/
275274 /* IntSetA_print(x);*/
276275
277276 cstl_swap(ia, x);
278277
279- assert(IntSetA_verify(ia));
280- assert(IntSetA_verify(x));
278+ ASSERT(IntSetA_verify(ia));
279+ ASSERT(IntSetA_verify(x));
281280 /* IntSetA_print(ia);*/
282281 /* IntSetA_print(x);*/
283- assert(cstl_size(x) == SIZE/2);
284- assert(cstl_size(ia) == sizeof b / sizeof b[0]);
282+ ASSERT(cstl_size(x) == SIZE/2);
283+ ASSERT(cstl_size(ia) == sizeof b / sizeof b[0]);
285284 /* insert_range */
286285 count = cstl_size(x);
287286 cstl_set_insert(x, b[0], 0, 0);
@@ -288,20 +287,20 @@
288287 cstl_set_insert(ia, hoge_int[0], 0, 0);
289288 /* IntSetA_print(ia);*/
290289 /* IntSetA_print(x);*/
291- assert(cstl_assoc_insert_range(x, cstl_begin(ia), cstl_end(ia)));
290+ ASSERT(cstl_assoc_insert_range(x, cstl_begin(ia), cstl_end(ia)));
292291
293292 /* IntSetA_print(ia);*/
294293 /* IntSetA_print(x);*/
295- assert(cstl_size(ia) == sizeof b / sizeof b[0] + 1);
296- assert(cstl_size(x) == count + sizeof b / sizeof b[0]);
297- assert(IntSetA_verify(ia));
298- assert(IntSetA_verify(x));
294+ ASSERT(cstl_size(ia) == sizeof b / sizeof b[0] + 1);
295+ ASSERT(cstl_size(x) == count + sizeof b / sizeof b[0]);
296+ ASSERT(IntSetA_verify(ia));
297+ ASSERT(IntSetA_verify(x));
299298
300- assert(cstl_assoc_insert_range(x, cstl_begin(ia), cstl_end(ia)));
301- assert(cstl_size(ia) == sizeof b / sizeof b[0] + 1);
302- assert(cstl_size(x) == count + sizeof b / sizeof b[0]);
303- assert(IntSetA_verify(ia));
304- assert(IntSetA_verify(x));
299+ ASSERT(cstl_assoc_insert_range(x, cstl_begin(ia), cstl_end(ia)));
300+ ASSERT(cstl_size(ia) == sizeof b / sizeof b[0] + 1);
301+ ASSERT(cstl_size(x) == count + sizeof b / sizeof b[0]);
302+ ASSERT(IntSetA_verify(ia));
303+ ASSERT(IntSetA_verify(x));
305304
306305 POOL_DUMP_OVERFLOW(&pool);
307306 cstl_delete(ia);
@@ -315,103 +314,102 @@
315314 size_t count = 0;
316315 IntSetDIterator pos[SIZE];
317316 IntSetDIterator p;
318- printf("***** test_1_2 *****\n");
319317 id = IntSetD_new();
320318 /* 初期状態 */
321- assert(cstl_empty(id));
322- assert(cstl_size(id) == 0);
323- assert(cstl_iter_eq(cstl_begin(id), cstl_end(id)));
324- assert(cstl_iter_eq(cstl_rbegin(id), cstl_rend(id)));
319+ ASSERT(cstl_empty(id));
320+ ASSERT(cstl_size(id) == 0);
321+ ASSERT(cstl_iter_eq(cstl_begin(id), cstl_end(id)));
322+ ASSERT(cstl_iter_eq(cstl_rbegin(id), cstl_rend(id)));
325323 /* insert */
326324 for (i = 0; i < SIZE; i++) {
327325 /* pos[i] = cstl_set_insert(id, hoge_int[i], &success[i]);*/
328- assert(cstl_set_insert(id, hoge_int[i], &pos[i], &success[i]));
326+ ASSERT(cstl_set_insert(id, hoge_int[i], &pos[i], &success[i]));
329327 if (i < SIZE/2) {
330- assert(success[i]);
328+ ASSERT(success[i]);
331329 count++;
332330 } else {
333- assert(!success[i]);
331+ ASSERT(!success[i]);
334332 }
335333 }
336334 /* IntSetD_print(id);*/
337- assert(!cstl_empty(id));
338- assert(cstl_size(id) == count);
339- assert(count == SIZE/2);
335+ ASSERT(!cstl_empty(id));
336+ ASSERT(cstl_size(id) == count);
337+ ASSERT(count == SIZE/2);
340338 /* count, find, lower_bound, upper_bound */
341339 for (i = 0; i < SIZE/2; i++) {
342- assert(cstl_count(id, hoge_int[i]) == 1);
343- assert(cstl_iter_eq(pos[i], cstl_find(id, hoge_int[i])));
344- assert(cstl_iter_eq(pos[i], cstl_lower_bound(id, hoge_int[i])));
345- assert(cstl_iter_eq(pos[i], cstl_upper_bound(id, hoge_int[i]+1)));
346- assert(cstl_iter_eq(cstl_lower_bound(id, hoge_int[i]-1), cstl_upper_bound(id, hoge_int[i])));
340+ ASSERT(cstl_count(id, hoge_int[i]) == 1);
341+ ASSERT(cstl_iter_eq(pos[i], cstl_find(id, hoge_int[i])));
342+ ASSERT(cstl_iter_eq(pos[i], cstl_lower_bound(id, hoge_int[i])));
343+ ASSERT(cstl_iter_eq(pos[i], cstl_upper_bound(id, hoge_int[i]+1)));
344+ ASSERT(cstl_iter_eq(cstl_lower_bound(id, hoge_int[i]-1), cstl_upper_bound(id, hoge_int[i])));
347345 }
348- assert(cstl_iter_eq(cstl_find(id, *cstl_iter_data(cstl_begin(id)) +1), cstl_end(id)));
349- assert(cstl_iter_eq(cstl_lower_bound(id, *cstl_iter_data(cstl_rbegin(id)) -1), cstl_end(id)));
350- assert(cstl_iter_eq(cstl_upper_bound(id, *cstl_iter_data(cstl_rbegin(id))), cstl_end(id)));
346+ ASSERT(cstl_iter_eq(cstl_find(id, *cstl_iter_data(cstl_begin(id)) +1), cstl_end(id)));
347+ ASSERT(cstl_iter_eq(cstl_lower_bound(id, *cstl_iter_data(cstl_rbegin(id)) -1), cstl_end(id)));
348+ ASSERT(cstl_iter_eq(cstl_upper_bound(id, *cstl_iter_data(cstl_rbegin(id))), cstl_end(id)));
351349 /* begin, end, next, data */
352350 for (p = cstl_begin(id), i = SIZE/2 -1; cstl_iter_ne(p, cstl_end(id)); cstl_iter_inc(&p), i--) {
353- assert(*cstl_iter_data(p) == i);
351+ ASSERT(*cstl_iter_data(p) == i);
354352 }
355- assert(i == -1);
356-/* assert(cstl_iter_next(cstl_rbegin(id)) == cstl_end(id));*/
357- assert(*cstl_iter_data(cstl_rbegin(id)) == *cstl_iter_data(cstl_iter_prev(cstl_end(id))));
353+ ASSERT(i == -1);
354+/* ASSERT(cstl_iter_next(cstl_rbegin(id)) == cstl_end(id));*/
355+ ASSERT(*cstl_iter_data(cstl_rbegin(id)) == *cstl_iter_data(cstl_iter_prev(cstl_end(id))));
358356 /* rbegin, rend, prev, data */
359357 for (p = cstl_rbegin(id), i = 0; cstl_iter_ne(p, cstl_rend(id)); cstl_iter_inc(&p), i++) {
360- assert(*cstl_iter_data(p) == i);
358+ ASSERT(*cstl_iter_data(p) == i);
361359 }
362- assert(i == SIZE/2);
363-/* assert(cstl_iter_prev(cstl_begin(id)) == cstl_rend(id));*/
364- assert(*cstl_iter_data(cstl_begin(id)) == *cstl_iter_data(cstl_iter_prev(cstl_rend(id))));
360+ ASSERT(i == SIZE/2);
361+/* ASSERT(cstl_iter_prev(cstl_begin(id)) == cstl_rend(id));*/
362+ ASSERT(*cstl_iter_data(cstl_begin(id)) == *cstl_iter_data(cstl_iter_prev(cstl_rend(id))));
365363 /* erase */
366364 for (i = 0; i < SIZE; i++) {
367365 if (success[i]) {
368366 IntSetDIterator itr = cstl_iter_next(pos[i]);
369- assert(cstl_iter_eq(itr, cstl_erase(id, pos[i])));
367+ ASSERT(cstl_iter_eq(itr, cstl_erase(id, pos[i])));
370368 count--;
371369 }
372370 }
373- assert(cstl_empty(id));
374- assert(cstl_size(id) == 0);
375- assert(count == 0);
371+ ASSERT(cstl_empty(id));
372+ ASSERT(cstl_size(id) == 0);
373+ ASSERT(count == 0);
376374 /* erase_range */
377375 for (i = 0; i < SIZE/2; i++) {
378- assert(cstl_set_insert(id, hoge_int[i], &pos[i], NULL));
376+ ASSERT(cstl_set_insert(id, hoge_int[i], &pos[i], NULL));
379377 /* pos[i] = cstl_set_insert(id, hoge_int[i], NULL);*/
380-/* assert(pos[i]);*/
378+/* ASSERT(pos[i]);*/
381379 }
382- assert(cstl_size(id) == SIZE/2);
383- assert(cstl_iter_eq(cstl_find(id, 1), cstl_erase_range(id, cstl_find(id, SIZE/2-1 -2), cstl_find(id, 1))));
384- assert(cstl_size(id) == 4);
385- assert(cstl_iter_eq(cstl_end(id), cstl_erase_range(id, cstl_begin(id), cstl_end(id))));
386- assert(cstl_size(id) == 0);
387- assert(cstl_set_insert(id, hoge_int[0], NULL, NULL));
388- assert(cstl_size(id) == 1);
380+ ASSERT(cstl_size(id) == SIZE/2);
381+ ASSERT(cstl_iter_eq(cstl_find(id, 1), cstl_erase_range(id, cstl_find(id, SIZE/2-1 -2), cstl_find(id, 1))));
382+ ASSERT(cstl_size(id) == 4);
383+ ASSERT(cstl_iter_eq(cstl_end(id), cstl_erase_range(id, cstl_begin(id), cstl_end(id))));
384+ ASSERT(cstl_size(id) == 0);
385+ ASSERT(cstl_set_insert(id, hoge_int[0], NULL, NULL));
386+ ASSERT(cstl_size(id) == 1);
389387 p = cstl_iter_next(cstl_begin(id));
390- assert(cstl_iter_eq(p, cstl_erase_range(id, cstl_begin(id), cstl_iter_next(cstl_begin(id)))));
391-/* assert(cstl_iter_next(cstl_begin(id)) == cstl_erase_range(id, cstl_begin(id), cstl_iter_next(cstl_begin(id))));*/
392- assert(cstl_size(id) == 0);
393- assert(cstl_set_insert(id, 100, NULL, NULL));
394- assert(cstl_set_insert(id, 110, NULL, NULL));
395- assert(cstl_size(id) == 2);
396- assert(cstl_iter_eq(cstl_upper_bound(id, 100), cstl_erase_range(id, cstl_lower_bound(id, 110), cstl_upper_bound(id, 100))));
397- assert(cstl_size(id) == 0);
388+ ASSERT(cstl_iter_eq(p, cstl_erase_range(id, cstl_begin(id), cstl_iter_next(cstl_begin(id)))));
389+/* ASSERT(cstl_iter_next(cstl_begin(id)) == cstl_erase_range(id, cstl_begin(id), cstl_iter_next(cstl_begin(id))));*/
390+ ASSERT(cstl_size(id) == 0);
391+ ASSERT(cstl_set_insert(id, 100, NULL, NULL));
392+ ASSERT(cstl_set_insert(id, 110, NULL, NULL));
393+ ASSERT(cstl_size(id) == 2);
394+ ASSERT(cstl_iter_eq(cstl_upper_bound(id, 100), cstl_erase_range(id, cstl_lower_bound(id, 110), cstl_upper_bound(id, 100))));
395+ ASSERT(cstl_size(id) == 0);
398396 /* erase_key */
399397 for (i = 0; i < SIZE/2; i++) {
400- assert(cstl_set_insert(id, hoge_int[i], &pos[i], NULL));
398+ ASSERT(cstl_set_insert(id, hoge_int[i], &pos[i], NULL));
401399 /* pos[i] = cstl_set_insert(id, hoge_int[i], NULL);*/
402-/* assert(pos[i]);*/
400+/* ASSERT(pos[i]);*/
403401 }
404- assert(cstl_size(id) == SIZE/2);
402+ ASSERT(cstl_size(id) == SIZE/2);
405403 for (i = 0; i < SIZE/2; i++) {
406- assert(cstl_erase_key(id, hoge_int[i]) == 1);
404+ ASSERT(cstl_erase_key(id, hoge_int[i]) == 1);
407405 }
408- assert(cstl_size(id) == 0);
406+ ASSERT(cstl_size(id) == 0);
409407 /* 大量にinsert */
410408 count = 0;
411409 while (count < 1000000 && cstl_set_insert(id, count, NULL, NULL)) {
412410 count++;
413411 }
414- assert(cstl_size(id) == count);
412+ ASSERT(cstl_size(id) == count);
415413 printf("count: %d\n", count);
416414
417415 POOL_DUMP_OVERFLOW(&pool);
@@ -427,128 +425,127 @@
427425 IntMSetA *x;
428426 int b[] = {100, 109, 101, 108, 102, 103, 104, 104, 105, 106, 107, 100, 101, 101, 108, 109};
429427 int flag[SIZE/2] = {0};
430- printf("***** test_1_3 *****\n");
431428 ima = IntMSetA_new();
432429 /* 初期状態 */
433- assert(cstl_empty(ima));
434- assert(cstl_size(ima) == 0);
435- assert(cstl_iter_eq(cstl_begin(ima), cstl_end(ima)));
436- assert(cstl_iter_eq(cstl_rbegin(ima), cstl_rend(ima)));
430+ ASSERT(cstl_empty(ima));
431+ ASSERT(cstl_size(ima) == 0);
432+ ASSERT(cstl_iter_eq(cstl_begin(ima), cstl_end(ima)));
433+ ASSERT(cstl_iter_eq(cstl_rbegin(ima), cstl_rend(ima)));
437434 /* insert */
438435 for (i = 0; i < SIZE; i++) {
439436 /* pos[i] = cstl_multiset_insert(ima, hoge_int[i]);*/
440- assert(cstl_multiset_insert(ima, hoge_int[i], &pos[i]));
441-/* assert(pos[i] && pos[i] != cstl_end(ima));*/
442- assert(cstl_iter_ne(pos[i], cstl_end(ima)));
437+ ASSERT(cstl_multiset_insert(ima, hoge_int[i], &pos[i]));
438+/* ASSERT(pos[i] && pos[i] != cstl_end(ima));*/
439+ ASSERT(cstl_iter_ne(pos[i], cstl_end(ima)));
443440 count++;
444441 }
445442 /* IntMSetA_print(ima);*/
446- assert(!cstl_empty(ima));
447- assert(cstl_size(ima) == count);
448- assert(count == SIZE);
443+ ASSERT(!cstl_empty(ima));
444+ ASSERT(cstl_size(ima) == count);
445+ ASSERT(count == SIZE);
449446 /* count */
450447 for (i = 0; i < SIZE; i++) {
451448 if (i < SIZE/2/2) {
452- assert(cstl_count(ima, i) == 1);
449+ ASSERT(cstl_count(ima, i) == 1);
453450 } else if (i < SIZE/2) {
454- assert(cstl_count(ima, i) == 3);
451+ ASSERT(cstl_count(ima, i) == 3);
455452 } else {
456- assert(cstl_count(ima, i) == 0);
453+ ASSERT(cstl_count(ima, i) == 0);
457454 }
458455 }
459456 /* find, lower_bound, upper_bound */
460457 for (i = 0; i < SIZE; i++) {
461458 if (cstl_count(ima, hoge_int[i]) == 1) {
462- assert(cstl_iter_eq(pos[i], cstl_find(ima, hoge_int[i])));
463- assert(cstl_iter_eq(pos[i], cstl_lower_bound(ima, hoge_int[i])));
464- assert(cstl_iter_eq(pos[i], cstl_upper_bound(ima, hoge_int[i]-1)));
459+ ASSERT(cstl_iter_eq(pos[i], cstl_find(ima, hoge_int[i])));
460+ ASSERT(cstl_iter_eq(pos[i], cstl_lower_bound(ima, hoge_int[i])));
461+ ASSERT(cstl_iter_eq(pos[i], cstl_upper_bound(ima, hoge_int[i]-1)));
465462 } else if (cstl_count(ima, hoge_int[i]) == 3) {
466463 if (!flag[hoge_int[i]]) {
467464 flag[hoge_int[i]] = 1;
468- assert(cstl_iter_eq(pos[i], cstl_lower_bound(ima, hoge_int[i])));
469- assert(cstl_iter_eq(pos[i], cstl_upper_bound(ima, hoge_int[i]-1)));
465+ ASSERT(cstl_iter_eq(pos[i], cstl_lower_bound(ima, hoge_int[i])));
466+ ASSERT(cstl_iter_eq(pos[i], cstl_upper_bound(ima, hoge_int[i]-1)));
470467 }
471468 } else {
472- assert(0);
469+ ASSERT(0);
473470 }
474- assert(cstl_iter_eq(cstl_lower_bound(ima, hoge_int[i]+1), cstl_upper_bound(ima, hoge_int[i])));
471+ ASSERT(cstl_iter_eq(cstl_lower_bound(ima, hoge_int[i]+1), cstl_upper_bound(ima, hoge_int[i])));
475472 }
476- assert(cstl_iter_eq(cstl_find(ima, *cstl_iter_data(cstl_begin(ima)) -1), cstl_end(ima)));
477- assert(cstl_iter_eq(cstl_lower_bound(ima, *cstl_iter_data(cstl_rbegin(ima)) +1), cstl_end(ima)));
478- assert(cstl_iter_eq(cstl_upper_bound(ima, *cstl_iter_data(cstl_rbegin(ima))), cstl_end(ima)));
473+ ASSERT(cstl_iter_eq(cstl_find(ima, *cstl_iter_data(cstl_begin(ima)) -1), cstl_end(ima)));
474+ ASSERT(cstl_iter_eq(cstl_lower_bound(ima, *cstl_iter_data(cstl_rbegin(ima)) +1), cstl_end(ima)));
475+ ASSERT(cstl_iter_eq(cstl_upper_bound(ima, *cstl_iter_data(cstl_rbegin(ima))), cstl_end(ima)));
479476 /* begin, end, next, data */
480477 for (p = cstl_begin(ima), i = 0; cstl_iter_ne(p, cstl_end(ima)); cstl_iter_inc(&p), i++) {
481478 /* printf("%d, %d\n", i, *cstl_iter_data(p));*/
482479 }
483- assert(i == SIZE);
484-/* assert(cstl_iter_eq(cstl_iter_next(cstl_rbegin(ia)), cstl_end(ia)));*/
485- assert(*cstl_iter_data(cstl_rbegin(ima)) == *cstl_iter_data(cstl_iter_prev(cstl_end(ima))));
480+ ASSERT(i == SIZE);
481+/* ASSERT(cstl_iter_eq(cstl_iter_next(cstl_rbegin(ia)), cstl_end(ia)));*/
482+ ASSERT(*cstl_iter_data(cstl_rbegin(ima)) == *cstl_iter_data(cstl_iter_prev(cstl_end(ima))));
486483 /* rbegin, rend, prev, data */
487484 for (p = cstl_rbegin(ima), i = SIZE -1; cstl_iter_ne(p, cstl_rend(ima)); cstl_iter_inc(&p), i--) {
488485 /* printf("%d, %d\n", i, *cstl_iter_data(p));*/
489486 }
490- assert(i == -1);
491-/* assert(cstl_iter_prev(cstl_begin(ima)) == cstl_rend(ima));*/
492- assert(*cstl_iter_data(cstl_begin(ima)) == *cstl_iter_data(cstl_iter_prev(cstl_rend(ima))));
487+ ASSERT(i == -1);
488+/* ASSERT(cstl_iter_prev(cstl_begin(ima)) == cstl_rend(ima));*/
489+ ASSERT(*cstl_iter_data(cstl_begin(ima)) == *cstl_iter_data(cstl_iter_prev(cstl_rend(ima))));
493490 /* erase */
494491 for (i = 0; i < SIZE; i++) {
495492 IntMSetAIterator itr = cstl_iter_next(pos[i]);
496- assert(cstl_iter_eq(itr, cstl_erase(ima, pos[i])));
493+ ASSERT(cstl_iter_eq(itr, cstl_erase(ima, pos[i])));
497494 count--;
498495 }
499- assert(cstl_empty(ima));
500- assert(cstl_size(ima) == 0);
501- assert(count == 0);
496+ ASSERT(cstl_empty(ima));
497+ ASSERT(cstl_size(ima) == 0);
498+ ASSERT(count == 0);
502499 /* erase_range */
503500 for (i = 0; i < SIZE; i++) {
504501 /* pos[i] = cstl_multiset_insert(ima, hoge_int[i]);*/
505- assert(cstl_multiset_insert(ima, hoge_int[i], &pos[i]));
506-/* assert(pos[i] && pos[i] != cstl_end(ima));*/
507- assert(cstl_iter_ne(pos[i], cstl_end(ima)));
502+ ASSERT(cstl_multiset_insert(ima, hoge_int[i], &pos[i]));
503+/* ASSERT(pos[i] && pos[i] != cstl_end(ima));*/
504+ ASSERT(cstl_iter_ne(pos[i], cstl_end(ima)));
508505 }
509- assert(cstl_size(ima) == SIZE);
510-/* assert(cstl_iter_eq(cstl_iter_next(cstl_find(ima, SIZE/2/2 -1)), cstl_erase_range(ima, cstl_find(ima, 0), cstl_iter_next(cstl_find(ima, SIZE/2/2 -1)))));*/
506+ ASSERT(cstl_size(ima) == SIZE);
507+/* ASSERT(cstl_iter_eq(cstl_iter_next(cstl_find(ima, SIZE/2/2 -1)), cstl_erase_range(ima, cstl_find(ima, 0), cstl_iter_next(cstl_find(ima, SIZE/2/2 -1)))));*/
511508 p = cstl_iter_next(cstl_find(ima, SIZE/2/2 -1));
512- assert(cstl_iter_eq(p, cstl_erase_range(ima, cstl_find(ima, 0), cstl_iter_next(cstl_find(ima, SIZE/2/2 -1)))));
513- assert(cstl_size(ima) == SIZE - SIZE/2/2);
514- assert(cstl_iter_eq(cstl_end(ima), cstl_erase_range(ima, cstl_begin(ima), cstl_end(ima))));
515- assert(cstl_size(ima) == 0);
516- assert(cstl_multiset_insert(ima, hoge_int[0], NULL));
517- assert(cstl_size(ima) == 1);
509+ ASSERT(cstl_iter_eq(p, cstl_erase_range(ima, cstl_find(ima, 0), cstl_iter_next(cstl_find(ima, SIZE/2/2 -1)))));
510+ ASSERT(cstl_size(ima) == SIZE - SIZE/2/2);
511+ ASSERT(cstl_iter_eq(cstl_end(ima), cstl_erase_range(ima, cstl_begin(ima), cstl_end(ima))));
512+ ASSERT(cstl_size(ima) == 0);
513+ ASSERT(cstl_multiset_insert(ima, hoge_int[0], NULL));
514+ ASSERT(cstl_size(ima) == 1);
518515 p = cstl_iter_next(cstl_begin(ima));
519- assert(cstl_iter_eq(p, cstl_erase_range(ima, cstl_begin(ima), cstl_iter_next(cstl_begin(ima)))));
520-/* assert(cstl_iter_next(cstl_begin(ima)) == cstl_erase_range(ima, cstl_begin(ima), cstl_iter_next(cstl_begin(ima))));*/
521- assert(cstl_size(ima) == 0);
522- assert(cstl_multiset_insert(ima, 100, NULL));
523- assert(cstl_multiset_insert(ima, 100, NULL));
524- assert(cstl_multiset_insert(ima, 100, NULL));
525- assert(cstl_multiset_insert(ima, 110, NULL));
526- assert(cstl_multiset_insert(ima, 110, NULL));
527- assert(cstl_size(ima) == 5);
528- assert(cstl_iter_eq(cstl_upper_bound(ima, 110), cstl_erase_range(ima, cstl_lower_bound(ima, 100), cstl_upper_bound(ima, 110))));
529- assert(cstl_size(ima) == 0);
516+ ASSERT(cstl_iter_eq(p, cstl_erase_range(ima, cstl_begin(ima), cstl_iter_next(cstl_begin(ima)))));
517+/* ASSERT(cstl_iter_next(cstl_begin(ima)) == cstl_erase_range(ima, cstl_begin(ima), cstl_iter_next(cstl_begin(ima))));*/
518+ ASSERT(cstl_size(ima) == 0);
519+ ASSERT(cstl_multiset_insert(ima, 100, NULL));
520+ ASSERT(cstl_multiset_insert(ima, 100, NULL));
521+ ASSERT(cstl_multiset_insert(ima, 100, NULL));
522+ ASSERT(cstl_multiset_insert(ima, 110, NULL));
523+ ASSERT(cstl_multiset_insert(ima, 110, NULL));
524+ ASSERT(cstl_size(ima) == 5);
525+ ASSERT(cstl_iter_eq(cstl_upper_bound(ima, 110), cstl_erase_range(ima, cstl_lower_bound(ima, 100), cstl_upper_bound(ima, 110))));
526+ ASSERT(cstl_size(ima) == 0);
530527 /* erase_key */
531528 for (i = 0; i < SIZE; i++) {
532529 /* pos[i] = cstl_multiset_insert(ima, hoge_int[i]);*/
533- assert(cstl_multiset_insert(ima, hoge_int[i], &pos[i]));
534-/* assert(pos[i] && pos[i] != cstl_end(ima));*/
535- assert(cstl_iter_ne(pos[i], cstl_end(ima)));
530+ ASSERT(cstl_multiset_insert(ima, hoge_int[i], &pos[i]));
531+/* ASSERT(pos[i] && pos[i] != cstl_end(ima));*/
532+ ASSERT(cstl_iter_ne(pos[i], cstl_end(ima)));
536533 }
537- assert(cstl_size(ima) == SIZE);
534+ ASSERT(cstl_size(ima) == SIZE);
538535 for (i = 0; i < SIZE/2/2; i++) {
539- assert(cstl_erase_key(ima, i) == 1);
536+ ASSERT(cstl_erase_key(ima, i) == 1);
540537 }
541- assert(cstl_size(ima) == SIZE - SIZE/2/2);
538+ ASSERT(cstl_size(ima) == SIZE - SIZE/2/2);
542539 for (i = SIZE/2/2; i < SIZE/2; i++) {
543- assert(cstl_erase_key(ima, i) == 3);
540+ ASSERT(cstl_erase_key(ima, i) == 3);
544541 }
545- assert(cstl_size(ima) == 0);
542+ ASSERT(cstl_size(ima) == 0);
546543 /* 大量にinsert */
547544 count = 0;
548545 while (count < 1000000 && cstl_multiset_insert(ima, 0, NULL)) {
549546 count++;
550547 }
551- assert(cstl_size(ima) == count);
548+ ASSERT(cstl_size(ima) == count);
552549 printf("count: %d\n", count);
553550
554551 cstl_clear(ima);
@@ -555,31 +552,31 @@
555552
556553 /* insert_range */
557554 for (i = 0; i < SIZE/2; i++) {
558- assert(cstl_multiset_insert(ima, hoge_int[i], &pos[i]));
555+ ASSERT(cstl_multiset_insert(ima, hoge_int[i], &pos[i]));
559556 /* pos[i] = cstl_multiset_insert(ima, hoge_int[i]);*/
560-/* assert(pos[i]);*/
557+/* ASSERT(pos[i]);*/
561558 }
562- assert(cstl_size(ima) == SIZE/2);
559+ ASSERT(cstl_size(ima) == SIZE/2);
563560 x = IntMSetA_new();
564561 for (i = 0; i < sizeof b / sizeof b[0]; i++) {
565- assert(cstl_multiset_insert(x, b[i], &pos[i]));
562+ ASSERT(cstl_multiset_insert(x, b[i], &pos[i]));
566563 /* pos[i] = cstl_multiset_insert(x, b[i]);*/
567-/* assert(pos[i]);*/
564+/* ASSERT(pos[i]);*/
568565 }
569566 for (i = 0; i < SIZE/2; i++) {
570- assert(cstl_multiset_insert(x, hoge_int[i], &pos[i]));
567+ ASSERT(cstl_multiset_insert(x, hoge_int[i], &pos[i]));
571568 /* pos[i] = cstl_multiset_insert(x, hoge_int[i]);*/
572-/* assert(pos[i]);*/
569+/* ASSERT(pos[i]);*/
573570 }
574- assert(cstl_size(x) == sizeof b / sizeof b[0] + SIZE/2);
571+ ASSERT(cstl_size(x) == sizeof b / sizeof b[0] + SIZE/2);
575572 /* IntMSetA_print(ima);*/
576573 /* IntMSetA_print(x);*/
577- assert(cstl_assoc_insert_range(x, cstl_begin(ima), cstl_end(ima)));
578- assert(IntMSetA_verify(ima));
579- assert(IntMSetA_verify(x));
574+ ASSERT(cstl_assoc_insert_range(x, cstl_begin(ima), cstl_end(ima)));
575+ ASSERT(IntMSetA_verify(ima));
576+ ASSERT(IntMSetA_verify(x));
580577 /* IntMSetA_print(ima);*/
581578 /* IntMSetA_print(x);*/
582- assert(cstl_size(x) == sizeof b / sizeof b[0] + SIZE);
579+ ASSERT(cstl_size(x) == sizeof b / sizeof b[0] + SIZE);
583580
584581
585582 POOL_DUMP_OVERFLOW(&pool);
@@ -594,114 +591,113 @@
594591 size_t count = 0;
595592 DoubleSetAIterator pos[SIZE];
596593 DoubleSetAIterator p;
597- printf("***** test_2_1 *****\n");
598594 da = DoubleSetA_new();
599595 /* 初期状態 */
600- assert(cstl_empty(da));
601- assert(cstl_size(da) == 0);
602- assert(cstl_iter_eq(cstl_begin(da), cstl_end(da)));
603- assert(cstl_iter_eq(cstl_rbegin(da), cstl_rend(da)));
596+ ASSERT(cstl_empty(da));
597+ ASSERT(cstl_size(da) == 0);
598+ ASSERT(cstl_iter_eq(cstl_begin(da), cstl_end(da)));
599+ ASSERT(cstl_iter_eq(cstl_rbegin(da), cstl_rend(da)));
604600 /* insert */
605601 for (i = 0; i < SIZE; i++) {
606602 /* pos[i] = cstl_set_insert(da, hoge_double[i], &success[i]);*/
607- assert(cstl_set_insert(da, hoge_double[i], &pos[i], &success[i]));
603+ ASSERT(cstl_set_insert(da, hoge_double[i], &pos[i], &success[i]));
608604 if (i < SIZE/2) {
609- assert(success[i]);
605+ ASSERT(success[i]);
610606 count++;
611607 } else {
612- assert(!success[i]);
608+ ASSERT(!success[i]);
613609 }
614610 }
615- assert(!cstl_empty(da));
616- assert(cstl_size(da) == count);
617- assert(count == SIZE/2);
611+ ASSERT(!cstl_empty(da));
612+ ASSERT(cstl_size(da) == count);
613+ ASSERT(count == SIZE/2);
618614 /* count, find, lower_bound, upper_bound */
619615 for (i = 0; i < SIZE/2; i++) {
620- assert(cstl_count(da, hoge_double[i]) == 1);
621- assert(cstl_iter_eq(pos[i], cstl_find(da, hoge_double[i])));
622- assert(cstl_iter_eq(pos[i], cstl_lower_bound(da, hoge_double[i])));
623- assert(cstl_iter_eq(pos[i], cstl_upper_bound(da, hoge_double[i]-0.5)));
624- assert(cstl_iter_eq(cstl_lower_bound(da, hoge_double[i]+0.5), cstl_upper_bound(da, hoge_double[i])));
616+ ASSERT(cstl_count(da, hoge_double[i]) == 1);
617+ ASSERT(cstl_iter_eq(pos[i], cstl_find(da, hoge_double[i])));
618+ ASSERT(cstl_iter_eq(pos[i], cstl_lower_bound(da, hoge_double[i])));
619+ ASSERT(cstl_iter_eq(pos[i], cstl_upper_bound(da, hoge_double[i]-0.5)));
620+ ASSERT(cstl_iter_eq(cstl_lower_bound(da, hoge_double[i]+0.5), cstl_upper_bound(da, hoge_double[i])));
625621 }
626- assert(cstl_iter_eq(cstl_find(da, *cstl_iter_data(cstl_begin(da)) -1), cstl_end(da)));
627- assert(cstl_iter_eq(cstl_lower_bound(da, *cstl_iter_data(cstl_rbegin(da)) +1), cstl_end(da)));
628- assert(cstl_iter_eq(cstl_upper_bound(da, *cstl_iter_data(cstl_rbegin(da))), cstl_end(da)));
622+ ASSERT(cstl_iter_eq(cstl_find(da, *cstl_iter_data(cstl_begin(da)) -1), cstl_end(da)));
623+ ASSERT(cstl_iter_eq(cstl_lower_bound(da, *cstl_iter_data(cstl_rbegin(da)) +1), cstl_end(da)));
624+ ASSERT(cstl_iter_eq(cstl_upper_bound(da, *cstl_iter_data(cstl_rbegin(da))), cstl_end(da)));
629625 /* begin, end, next, data */
630626 for (p = cstl_begin(da), i = 0; cstl_iter_ne(p, cstl_end(da)); cstl_iter_inc(&p), i++) {
631- assert(*cstl_iter_data(p) == i*0.5);
627+ ASSERT(*cstl_iter_data(p) == i*0.5);
632628 }
633- assert(i == SIZE/2);
634-/* assert(cstl_iter_next(cstl_rbegin(da)) == cstl_end(da));*/
635- assert(*cstl_iter_data(cstl_rbegin(da)) == *cstl_iter_data(cstl_iter_prev(cstl_end(da))));
629+ ASSERT(i == SIZE/2);
630+/* ASSERT(cstl_iter_next(cstl_rbegin(da)) == cstl_end(da));*/
631+ ASSERT(*cstl_iter_data(cstl_rbegin(da)) == *cstl_iter_data(cstl_iter_prev(cstl_end(da))));
636632 /* rbegin, rend, prev, data */
637633 for (p = cstl_rbegin(da), i = SIZE/2 -1; cstl_iter_ne(p, cstl_rend(da)); cstl_iter_inc(&p), i--) {
638- assert(*cstl_iter_data(p) == i*0.5);
634+ ASSERT(*cstl_iter_data(p) == i*0.5);
639635 }
640- assert(i == -1);
641-/* assert(cstl_iter_prev(cstl_begin(da)) == cstl_rend(da));*/
642- assert(*cstl_iter_data(cstl_begin(da)) == *cstl_iter_data(cstl_iter_prev(cstl_rend(da))));
636+ ASSERT(i == -1);
637+/* ASSERT(cstl_iter_prev(cstl_begin(da)) == cstl_rend(da));*/
638+ ASSERT(*cstl_iter_data(cstl_begin(da)) == *cstl_iter_data(cstl_iter_prev(cstl_rend(da))));
643639 /* erase */
644640 for (i = 0; i < SIZE; i++) {
645641 if (success[i]) {
646642 DoubleSetAIterator itr = cstl_iter_next(pos[i]);
647- assert(cstl_iter_eq(itr, cstl_erase(da, pos[i])));
643+ ASSERT(cstl_iter_eq(itr, cstl_erase(da, pos[i])));
648644 count--;
649645 }
650646 }
651- assert(cstl_empty(da));
652- assert(cstl_size(da) == 0);
653- assert(count == 0);
647+ ASSERT(cstl_empty(da));
648+ ASSERT(cstl_size(da) == 0);
649+ ASSERT(count == 0);
654650 /* erase_range */
655651 for (i = 0; i < SIZE/2; i++) {
656- assert(cstl_set_insert(da, hoge_double[i], &pos[i], NULL));
652+ ASSERT(cstl_set_insert(da, hoge_double[i], &pos[i], NULL));
657653 /* pos[i] = cstl_set_insert(da, hoge_double[i], NULL);*/
658-/* assert(pos[i]);*/
654+/* ASSERT(pos[i]);*/
659655 }
660- assert(cstl_size(da) == SIZE/2);
661- assert(cstl_iter_eq(cstl_find(da, SIZE/2 -2), cstl_erase_range(da, cstl_find(da, 2), cstl_find(da, SIZE/2 -2))));
662- assert(cstl_size(da) == 4);
663- assert(cstl_iter_eq(cstl_end(da), cstl_erase_range(da, cstl_begin(da), cstl_end(da))));
664- assert(cstl_size(da) == 0);
665- assert(cstl_set_insert(da, hoge_double[0], NULL, NULL));
666- assert(cstl_size(da) == 1);
656+ ASSERT(cstl_size(da) == SIZE/2);
657+ ASSERT(cstl_iter_eq(cstl_find(da, SIZE/2 -2), cstl_erase_range(da, cstl_find(da, 2), cstl_find(da, SIZE/2 -2))));
658+ ASSERT(cstl_size(da) == 4);
659+ ASSERT(cstl_iter_eq(cstl_end(da), cstl_erase_range(da, cstl_begin(da), cstl_end(da))));
660+ ASSERT(cstl_size(da) == 0);
661+ ASSERT(cstl_set_insert(da, hoge_double[0], NULL, NULL));
662+ ASSERT(cstl_size(da) == 1);
667663 p = cstl_iter_next(cstl_begin(da));
668- assert(cstl_iter_eq(p, cstl_erase_range(da, cstl_begin(da), cstl_iter_next(cstl_begin(da)))));
669-/* assert(cstl_iter_next(cstl_begin(da)) == cstl_erase_range(da, cstl_begin(da), cstl_iter_next(cstl_begin(da))));*/
670- assert(cstl_size(da) == 0);
671- assert(cstl_set_insert(da, 100.1, NULL, NULL));
672- assert(cstl_set_insert(da, 110.1, NULL, NULL));
673- assert(cstl_size(da) == 2);
674- assert(cstl_iter_eq(cstl_upper_bound(da, 110.1), cstl_erase_range(da, cstl_lower_bound(da, 100.1), cstl_upper_bound(da, 110.1))));
675- assert(cstl_size(da) == 0);
664+ ASSERT(cstl_iter_eq(p, cstl_erase_range(da, cstl_begin(da), cstl_iter_next(cstl_begin(da)))));
665+/* ASSERT(cstl_iter_next(cstl_begin(da)) == cstl_erase_range(da, cstl_begin(da), cstl_iter_next(cstl_begin(da))));*/
666+ ASSERT(cstl_size(da) == 0);
667+ ASSERT(cstl_set_insert(da, 100.1, NULL, NULL));
668+ ASSERT(cstl_set_insert(da, 110.1, NULL, NULL));
669+ ASSERT(cstl_size(da) == 2);
670+ ASSERT(cstl_iter_eq(cstl_upper_bound(da, 110.1), cstl_erase_range(da, cstl_lower_bound(da, 100.1), cstl_upper_bound(da, 110.1))));
671+ ASSERT(cstl_size(da) == 0);
676672 /* erase_key */
677673 for (i = 0; i < SIZE/2; i++) {
678- assert(cstl_set_insert(da, hoge_double[i], &pos[i], NULL));
674+ ASSERT(cstl_set_insert(da, hoge_double[i], &pos[i], NULL));
679675 /* pos[i] = cstl_set_insert(da, hoge_double[i], NULL);*/
680-/* assert(pos[i]);*/
676+/* ASSERT(pos[i]);*/
681677 }
682- assert(cstl_size(da) == SIZE/2);
678+ ASSERT(cstl_size(da) == SIZE/2);
683679 for (i = 0; i < SIZE/2; i++) {
684- assert(cstl_erase_key(da, hoge_double[i]) == 1);
680+ ASSERT(cstl_erase_key(da, hoge_double[i]) == 1);
685681 }
686- assert(cstl_size(da) == 0);
682+ ASSERT(cstl_size(da) == 0);
687683 /* 大量にinsert */
688684 count = 0;
689685 while (count < 1000000 && cstl_set_insert(da, count, NULL, NULL)) {
690686 count++;
691687 }
692- assert(cstl_size(da) == count);
688+ ASSERT(cstl_size(da) == count);
693689 printf("count: %d\n", count);
694690 printf("size: %d\n", cstl_size(da));
695691 /* clear */
696692 cstl_clear(da);
697693 printf("size: %d\n", cstl_size(da));
698- assert(cstl_size(da) == 0);
699- assert(cstl_set_insert(da, 100, NULL, NULL));
700- assert(cstl_size(da) == 1);
694+ ASSERT(cstl_size(da) == 0);
695+ ASSERT(cstl_set_insert(da, 100, NULL, NULL));
696+ ASSERT(cstl_size(da) == 1);
701697 cstl_clear(da);
702- assert(cstl_size(da) == 0);
698+ ASSERT(cstl_size(da) == 0);
703699 cstl_clear(da);
704- assert(cstl_size(da) == 0);
700+ ASSERT(cstl_size(da) == 0);
705701
706702 POOL_DUMP_OVERFLOW(&pool);
707703 cstl_delete(da);
@@ -715,96 +711,95 @@
715711 int *intp = NULL;
716712 PtrSetAIterator pos[SIZE];
717713 PtrSetAIterator p;
718- printf("***** test_3_1 *****\n");
719714 pa = PtrSetA_new();
720715 /* 初期状態 */
721- assert(cstl_empty(pa));
722- assert(cstl_size(pa) == 0);
723- assert(cstl_iter_eq(cstl_begin(pa), cstl_end(pa)));
724- assert(cstl_iter_eq(cstl_rbegin(pa), cstl_rend(pa)));
716+ ASSERT(cstl_empty(pa));
717+ ASSERT(cstl_size(pa) == 0);
718+ ASSERT(cstl_iter_eq(cstl_begin(pa), cstl_end(pa)));
719+ ASSERT(cstl_iter_eq(cstl_rbegin(pa), cstl_rend(pa)));
725720 /* insert */
726721 for (i = 0; i < SIZE; i++) {
727722 /* pos[i] = cstl_set_insert(pa, hoge_ptr[i], &success[i]);*/
728- assert(cstl_set_insert(pa, hoge_ptr[i], &pos[i], &success[i]));
723+ ASSERT(cstl_set_insert(pa, hoge_ptr[i], &pos[i], &success[i]));
729724 if (i < SIZE/2) {
730- assert(success[i]);
725+ ASSERT(success[i]);
731726 count++;
732727 } else {
733- assert(!success[i]);
728+ ASSERT(!success[i]);
734729 }
735730 }
736- assert(!cstl_empty(pa));
737- assert(cstl_size(pa) == count);
738- assert(count == SIZE/2);
731+ ASSERT(!cstl_empty(pa));
732+ ASSERT(cstl_size(pa) == count);
733+ ASSERT(count == SIZE/2);
739734 /* count, find, lower_bound, upper_bound */
740735 for (i = 0; i < SIZE/2; i++) {
741- assert(cstl_count(pa, hoge_ptr[i]) == 1);
742- assert(cstl_iter_eq(pos[i], cstl_find(pa, hoge_ptr[i])));
743- assert(cstl_iter_eq(pos[i], cstl_lower_bound(pa, hoge_ptr[i])));
744- assert(cstl_iter_eq(pos[i], cstl_upper_bound(pa, hoge_ptr[i]-1)));
745- assert(cstl_iter_eq(cstl_lower_bound(pa, hoge_ptr[i]+1), cstl_upper_bound(pa, hoge_ptr[i])));
736+ ASSERT(cstl_count(pa, hoge_ptr[i]) == 1);
737+ ASSERT(cstl_iter_eq(pos[i], cstl_find(pa, hoge_ptr[i])));
738+ ASSERT(cstl_iter_eq(pos[i], cstl_lower_bound(pa, hoge_ptr[i])));
739+ ASSERT(cstl_iter_eq(pos[i], cstl_upper_bound(pa, hoge_ptr[i]-1)));
740+ ASSERT(cstl_iter_eq(cstl_lower_bound(pa, hoge_ptr[i]+1), cstl_upper_bound(pa, hoge_ptr[i])));
746741 }
747- assert(cstl_iter_eq(cstl_find(pa, *cstl_iter_data(cstl_begin(pa)) -1), cstl_end(pa)));
748- assert(cstl_iter_eq(cstl_lower_bound(pa, *cstl_iter_data(cstl_rbegin(pa)) +1), cstl_end(pa)));
749- assert(cstl_iter_eq(cstl_upper_bound(pa, *cstl_iter_data(cstl_rbegin(pa))), cstl_end(pa)));
742+ ASSERT(cstl_iter_eq(cstl_find(pa, *cstl_iter_data(cstl_begin(pa)) -1), cstl_end(pa)));
743+ ASSERT(cstl_iter_eq(cstl_lower_bound(pa, *cstl_iter_data(cstl_rbegin(pa)) +1), cstl_end(pa)));
744+ ASSERT(cstl_iter_eq(cstl_upper_bound(pa, *cstl_iter_data(cstl_rbegin(pa))), cstl_end(pa)));
750745 /* begin, end, next, data */
751746 for (p = cstl_begin(pa), i = 0; cstl_iter_ne(p, cstl_end(pa)); cstl_iter_inc(&p), i++) {
752- assert(*cstl_iter_data(p) == &hoge_int[i]);
747+ ASSERT(*cstl_iter_data(p) == &hoge_int[i]);
753748 }
754- assert(i == SIZE/2);
755-/* assert(cstl_iter_next(cstl_rbegin(pa)) == cstl_end(pa));*/
756- assert(*cstl_iter_data(cstl_rbegin(pa)) == *cstl_iter_data(cstl_iter_prev(cstl_end(pa))));
749+ ASSERT(i == SIZE/2);
750+/* ASSERT(cstl_iter_next(cstl_rbegin(pa)) == cstl_end(pa));*/
751+ ASSERT(*cstl_iter_data(cstl_rbegin(pa)) == *cstl_iter_data(cstl_iter_prev(cstl_end(pa))));
757752 /* rbegin, rend, prev, data */
758753 for (p = cstl_rbegin(pa), i = SIZE/2 -1; cstl_iter_ne(p, cstl_rend(pa)); cstl_iter_inc(&p), i--) {
759- assert(*cstl_iter_data(p) == &hoge_int[i]);
754+ ASSERT(*cstl_iter_data(p) == &hoge_int[i]);
760755 }
761- assert(i == -1);
762-/* assert(cstl_iter_prev(cstl_begin(pa)) == cstl_rend(pa));*/
763- assert(*cstl_iter_data(cstl_begin(pa)) == *cstl_iter_data(cstl_iter_prev(cstl_rend(pa))));
756+ ASSERT(i == -1);
757+/* ASSERT(cstl_iter_prev(cstl_begin(pa)) == cstl_rend(pa));*/
758+ ASSERT(*cstl_iter_data(cstl_begin(pa)) == *cstl_iter_data(cstl_iter_prev(cstl_rend(pa))));
764759 /* erase */
765760 for (i = 0; i < SIZE; i++) {
766761 if (success[i]) {
767762 PtrSetAIterator itr = cstl_iter_next(pos[i]);
768- assert(cstl_iter_eq(itr, cstl_erase(pa, pos[i])));
763+ ASSERT(cstl_iter_eq(itr, cstl_erase(pa, pos[i])));
769764 count--;
770765 }
771766 }
772- assert(cstl_empty(pa));
773- assert(cstl_size(pa) == 0);
774- assert(count == 0);
767+ ASSERT(cstl_empty(pa));
768+ ASSERT(cstl_size(pa) == 0);
769+ ASSERT(count == 0);
775770 /* erase_range */
776771 for (i = 0; i < SIZE/2; i++) {
777- assert(cstl_set_insert(pa, hoge_ptr[i], &pos[i], &success[i]));
772+ ASSERT(cstl_set_insert(pa, hoge_ptr[i], &pos[i], &success[i]));
778773 /* pos[i] = cstl_set_insert(pa, hoge_ptr[i], NULL);*/
779-/* assert(pos[i]);*/
774+/* ASSERT(pos[i]);*/
780775 }
781- assert(cstl_size(pa) == SIZE/2);
782- assert(cstl_iter_eq(cstl_find(pa, &hoge_int[SIZE/2 -2]), cstl_erase_range(pa, cstl_find(pa, &hoge_int[2]), cstl_find(pa, &hoge_int[SIZE/2 -2]))));
783- assert(cstl_size(pa) == 4);
784- assert(cstl_iter_eq(cstl_end(pa), cstl_erase_range(pa, cstl_begin(pa), cstl_end(pa))));
785- assert(cstl_size(pa) == 0);
786- assert(cstl_set_insert(pa, hoge_ptr[0], NULL, NULL));
787- assert(cstl_size(pa) == 1);
776+ ASSERT(cstl_size(pa) == SIZE/2);
777+ ASSERT(cstl_iter_eq(cstl_find(pa, &hoge_int[SIZE/2 -2]), cstl_erase_range(pa, cstl_find(pa, &hoge_int[2]), cstl_find(pa, &hoge_int[SIZE/2 -2]))));
778+ ASSERT(cstl_size(pa) == 4);
779+ ASSERT(cstl_iter_eq(cstl_end(pa), cstl_erase_range(pa, cstl_begin(pa), cstl_end(pa))));
780+ ASSERT(cstl_size(pa) == 0);
781+ ASSERT(cstl_set_insert(pa, hoge_ptr[0], NULL, NULL));
782+ ASSERT(cstl_size(pa) == 1);
788783 p = cstl_iter_next(cstl_begin(pa));
789- assert(cstl_iter_eq(p, cstl_erase_range(pa, cstl_begin(pa), cstl_iter_next(cstl_begin(pa)))));
790-/* assert(cstl_iter_next(cstl_begin(pa)) == cstl_erase_range(pa, cstl_begin(pa), cstl_iter_next(cstl_begin(pa))));*/
791- assert(cstl_size(pa) == 0);
792- assert(cstl_set_insert(pa, (int*)100, NULL, NULL));
793- assert(cstl_set_insert(pa, (int*)100 + 1, NULL, NULL));
794- assert(cstl_size(pa) == 2);
795- assert(cstl_iter_eq(cstl_upper_bound(pa, (int*)100 + 1), cstl_erase_range(pa, cstl_lower_bound(pa, (int*)100), cstl_upper_bound(pa, (int*)100 + 1))));
796- assert(cstl_size(pa) == 0);
784+ ASSERT(cstl_iter_eq(p, cstl_erase_range(pa, cstl_begin(pa), cstl_iter_next(cstl_begin(pa)))));
785+/* ASSERT(cstl_iter_next(cstl_begin(pa)) == cstl_erase_range(pa, cstl_begin(pa), cstl_iter_next(cstl_begin(pa))));*/
786+ ASSERT(cstl_size(pa) == 0);
787+ ASSERT(cstl_set_insert(pa, (int*)100, NULL, NULL));
788+ ASSERT(cstl_set_insert(pa, (int*)100 + 1, NULL, NULL));
789+ ASSERT(cstl_size(pa) == 2);
790+ ASSERT(cstl_iter_eq(cstl_upper_bound(pa, (int*)100 + 1), cstl_erase_range(pa, cstl_lower_bound(pa, (int*)100), cstl_upper_bound(pa, (int*)100 + 1))));
791+ ASSERT(cstl_size(pa) == 0);
797792 /* erase_key */
798793 for (i = 0; i < SIZE/2; i++) {
799- assert(cstl_set_insert(pa, hoge_ptr[i], &pos[i], NULL));
794+ ASSERT(cstl_set_insert(pa, hoge_ptr[i], &pos[i], NULL));
800795 /* pos[i] = cstl_set_insert(pa, hoge_ptr[i], NULL);*/
801-/* assert(pos[i]);*/
796+/* ASSERT(pos[i]);*/
802797 }
803- assert(cstl_size(pa) == SIZE/2);
798+ ASSERT(cstl_size(pa) == SIZE/2);
804799 for (i = 0; i < SIZE/2; i++) {
805- assert(cstl_erase_key(pa, hoge_ptr[i]) == 1);
800+ ASSERT(cstl_erase_key(pa, hoge_ptr[i]) == 1);
806801 }
807- assert(cstl_size(pa) == 0);
802+ ASSERT(cstl_size(pa) == 0);
808803 /* 大量にinsert */
809804 count = 0;
810805 while (count < 1000000 && cstl_set_insert(pa, intp, NULL, NULL)) {
@@ -811,19 +806,19 @@
811806 count++;
812807 intp++;
813808 }
814- assert(cstl_size(pa) == count);
809+ ASSERT(cstl_size(pa) == count);
815810 printf("count: %d\n", count);
816811 printf("size: %d\n", cstl_size(pa));
817812 /* clear */
818813 cstl_clear(pa);
819814 printf("size: %d\n", cstl_size(pa));
820- assert(cstl_size(pa) == 0);
821- assert(cstl_set_insert(pa, intp, NULL, NULL));
822- assert(cstl_size(pa) == 1);
815+ ASSERT(cstl_size(pa) == 0);
816+ ASSERT(cstl_set_insert(pa, intp, NULL, NULL));
817+ ASSERT(cstl_size(pa) == 1);
823818 cstl_clear(pa);
824- assert(cstl_size(pa) == 0);
819+ ASSERT(cstl_size(pa) == 0);
825820 cstl_clear(pa);
826- assert(cstl_size(pa) == 0);
821+ ASSERT(cstl_size(pa) == 0);
827822
828823 POOL_DUMP_OVERFLOW(&pool);
829824 cstl_delete(pa);
@@ -836,117 +831,116 @@
836831 size_t count = 0;
837832 StrSetAIterator pos[SIZE];
838833 StrSetAIterator p;
839- printf("***** test_4_1 *****\n");
840834 sa = StrSetA_new();
841835 /* 初期状態 */
842- assert(cstl_empty(sa));
843- assert(cstl_size(sa) == 0);
844- assert(cstl_iter_eq(cstl_begin(sa), cstl_end(sa)));
845- assert(cstl_iter_eq(cstl_rbegin(sa), cstl_rend(sa)));
836+ ASSERT(cstl_empty(sa));
837+ ASSERT(cstl_size(sa) == 0);
838+ ASSERT(cstl_iter_eq(cstl_begin(sa), cstl_end(sa)));
839+ ASSERT(cstl_iter_eq(cstl_rbegin(sa), cstl_rend(sa)));
846840 /* insert */
847841 for (i = 0; i < SIZE; i++) {
848- assert(cstl_set_insert(sa, hoge_str[i], &pos[i], &success[i]));
842+ ASSERT(cstl_set_insert(sa, hoge_str[i], &pos[i], &success[i]));
849843 /* pos[i] = cstl_set_insert(sa, hoge_str[i], &success[i]);*/
850844 if (i < SIZE/2) {
851- assert(success[i]);
845+ ASSERT(success[i]);
852846 count++;
853847 } else {
854- assert(!success[i]);
848+ ASSERT(!success[i]);
855849 }
856850 }
857851 /* StrSetA_print(sa);*/
858- assert(!cstl_empty(sa));
859- assert(cstl_size(sa) == count);
860- assert(count == SIZE/2);
852+ ASSERT(!cstl_empty(sa));
853+ ASSERT(cstl_size(sa) == count);
854+ ASSERT(count == SIZE/2);
861855 /* count, find, lower_bound, upper_bound */
862856 for (i = 0; i < SIZE/2; i++) {
863- assert(cstl_count(sa, hoge_str[i]) == 1);
864- assert(cstl_iter_eq(pos[i], cstl_find(sa, hoge_str[i])));
865- assert(cstl_iter_eq(pos[i], cstl_lower_bound(sa, hoge_str[i])));
857+ ASSERT(cstl_count(sa, hoge_str[i]) == 1);
858+ ASSERT(cstl_iter_eq(pos[i], cstl_find(sa, hoge_str[i])));
859+ ASSERT(cstl_iter_eq(pos[i], cstl_lower_bound(sa, hoge_str[i])));
866860 if (i != SIZE/2-1) {
867- assert(cstl_iter_eq(pos[i+1], cstl_upper_bound(sa, hoge_str[i])));
868- assert(cstl_iter_eq(cstl_lower_bound(sa, hoge_str[i+1]), cstl_upper_bound(sa, hoge_str[i])));
861+ ASSERT(cstl_iter_eq(pos[i+1], cstl_upper_bound(sa, hoge_str[i])));
862+ ASSERT(cstl_iter_eq(cstl_lower_bound(sa, hoge_str[i+1]), cstl_upper_bound(sa, hoge_str[i])));
869863 }
870864 }
871- assert(cstl_iter_eq(cstl_find(sa, "hoge"), cstl_end(sa)));
872- assert(cstl_iter_eq(cstl_lower_bound(sa, "hoge"), cstl_end(sa)));
873- assert(cstl_iter_eq(cstl_upper_bound(sa, *cstl_iter_data(cstl_rbegin(sa))), cstl_end(sa)));
865+ ASSERT(cstl_iter_eq(cstl_find(sa, "hoge"), cstl_end(sa)));
866+ ASSERT(cstl_iter_eq(cstl_lower_bound(sa, "hoge"), cstl_end(sa)));
867+ ASSERT(cstl_iter_eq(cstl_upper_bound(sa, *cstl_iter_data(cstl_rbegin(sa))), cstl_end(sa)));
874868 /* begin, end, next, data */
875869 for (p = cstl_begin(sa), i = 0; cstl_iter_ne(p, cstl_end(sa)); cstl_iter_inc(&p), i++) {
876- assert(*cstl_iter_data(p) == hoge_str[i]);
870+ ASSERT(*cstl_iter_data(p) == hoge_str[i]);
877871 }
878- assert(i == SIZE/2);
879-/* assert(cstl_iter_next(cstl_rbegin(sa)) == cstl_end(sa));*/
880- assert(*cstl_iter_data(cstl_rbegin(sa)) == *cstl_iter_data(cstl_iter_prev(cstl_end(sa))));
872+ ASSERT(i == SIZE/2);
873+/* ASSERT(cstl_iter_next(cstl_rbegin(sa)) == cstl_end(sa));*/
874+ ASSERT(*cstl_iter_data(cstl_rbegin(sa)) == *cstl_iter_data(cstl_iter_prev(cstl_end(sa))));
881875 /* rbegin, rend, prev, data */
882876 for (p = cstl_rbegin(sa), i = SIZE/2 -1; cstl_iter_ne(p, cstl_rend(sa)); cstl_iter_inc(&p), i--) {
883- assert(*cstl_iter_data(p) == hoge_str[i]);
877+ ASSERT(*cstl_iter_data(p) == hoge_str[i]);
884878 }
885- assert(i == -1);
886-/* assert(cstl_iter_prev(cstl_begin(sa)) == cstl_rend(sa));*/
887- assert(*cstl_iter_data(cstl_begin(sa)) == *cstl_iter_data(cstl_iter_prev(cstl_rend(sa))));
879+ ASSERT(i == -1);
880+/* ASSERT(cstl_iter_prev(cstl_begin(sa)) == cstl_rend(sa));*/
881+ ASSERT(*cstl_iter_data(cstl_begin(sa)) == *cstl_iter_data(cstl_iter_prev(cstl_rend(sa))));
888882 /* erase */
889883 for (i = 0; i < SIZE; i++) {
890884 if (success[i]) {
891885 StrSetAIterator itr = cstl_iter_next(pos[i]);
892- assert(cstl_iter_eq(itr, cstl_erase(sa, pos[i])));
886+ ASSERT(cstl_iter_eq(itr, cstl_erase(sa, pos[i])));
893887 count--;
894888 }
895889 }
896- assert(cstl_empty(sa));
897- assert(cstl_size(sa) == 0);
898- assert(count == 0);
890+ ASSERT(cstl_empty(sa));
891+ ASSERT(cstl_size(sa) == 0);
892+ ASSERT(count == 0);
899893 /* erase_range */
900894 for (i = 0; i < SIZE/2; i++) {
901- assert(cstl_set_insert(sa, hoge_str[i], &pos[i], NULL));
895+ ASSERT(cstl_set_insert(sa, hoge_str[i], &pos[i], NULL));
902896 /* pos[i] = cstl_set_insert(sa, hoge_str[i], NULL);*/
903-/* assert(pos[i]);*/
897+/* ASSERT(pos[i]);*/
904898 }
905- assert(cstl_size(sa) == SIZE/2);
906- assert(cstl_iter_eq(cstl_find(sa, hoge_str[SIZE/2 -2]), cstl_erase_range(sa, cstl_find(sa, hoge_str[2]), cstl_find(sa, hoge_str[SIZE/2 -2]))));
907- assert(cstl_size(sa) == 4);
908- assert(cstl_iter_eq(cstl_end(sa), cstl_erase_range(sa, cstl_begin(sa), cstl_end(sa))));
909- assert(cstl_size(sa) == 0);
910- assert(cstl_set_insert(sa, hoge_str[0], NULL, NULL));
911- assert(cstl_size(sa) == 1);
899+ ASSERT(cstl_size(sa) == SIZE/2);
900+ ASSERT(cstl_iter_eq(cstl_find(sa, hoge_str[SIZE/2 -2]), cstl_erase_range(sa, cstl_find(sa, hoge_str[2]), cstl_find(sa, hoge_str[SIZE/2 -2]))));
901+ ASSERT(cstl_size(sa) == 4);
902+ ASSERT(cstl_iter_eq(cstl_end(sa), cstl_erase_range(sa, cstl_begin(sa), cstl_end(sa))));
903+ ASSERT(cstl_size(sa) == 0);
904+ ASSERT(cstl_set_insert(sa, hoge_str[0], NULL, NULL));
905+ ASSERT(cstl_size(sa) == 1);
912906 p = cstl_iter_next(cstl_begin(sa));
913- assert(cstl_iter_eq(p, cstl_erase_range(sa, cstl_begin(sa), cstl_iter_next(cstl_begin(sa)))));
914-/* assert(cstl_iter_next(cstl_begin(sa)) == cstl_erase_range(sa, cstl_begin(sa), cstl_iter_next(cstl_begin(sa))));*/
915- assert(cstl_size(sa) == 0);
916- assert(cstl_set_insert(sa, "100", NULL, NULL));
917- assert(cstl_set_insert(sa, "110", NULL, NULL));
918- assert(cstl_size(sa) == 2);
919- assert(cstl_iter_eq(cstl_upper_bound(sa, "110"), cstl_erase_range(sa, cstl_lower_bound(sa, "100"), cstl_upper_bound(sa, "110"))));
920- assert(cstl_size(sa) == 0);
907+ ASSERT(cstl_iter_eq(p, cstl_erase_range(sa, cstl_begin(sa), cstl_iter_next(cstl_begin(sa)))));
908+/* ASSERT(cstl_iter_next(cstl_begin(sa)) == cstl_erase_range(sa, cstl_begin(sa), cstl_iter_next(cstl_begin(sa))));*/
909+ ASSERT(cstl_size(sa) == 0);
910+ ASSERT(cstl_set_insert(sa, "100", NULL, NULL));
911+ ASSERT(cstl_set_insert(sa, "110", NULL, NULL));
912+ ASSERT(cstl_size(sa) == 2);
913+ ASSERT(cstl_iter_eq(cstl_upper_bound(sa, "110"), cstl_erase_range(sa, cstl_lower_bound(sa, "100"), cstl_upper_bound(sa, "110"))));
914+ ASSERT(cstl_size(sa) == 0);
921915 /* erase_key */
922916 for (i = 0; i < SIZE/2; i++) {
923- assert(cstl_set_insert(sa, hoge_str[i], &pos[i], NULL));
917+ ASSERT(cstl_set_insert(sa, hoge_str[i], &pos[i], NULL));
924918 /* pos[i] = cstl_set_insert(sa, hoge_str[i], NULL);*/
925-/* assert(pos[i]);*/
919+/* ASSERT(pos[i]);*/
926920 }
927- assert(cstl_size(sa) == SIZE/2);
921+ ASSERT(cstl_size(sa) == SIZE/2);
928922 for (i = 0; i < SIZE/2; i++) {
929- assert(cstl_erase_key(sa, hoge_str[i]) == 1);
923+ ASSERT(cstl_erase_key(sa, hoge_str[i]) == 1);
930924 }
931- assert(cstl_size(sa) == 0);
925+ ASSERT(cstl_size(sa) == 0);
932926 /* clear */
933- assert(cstl_set_insert(sa, "103", NULL, NULL));
934- assert(cstl_set_insert(sa, "101", NULL, NULL));
935- assert(cstl_set_insert(sa, "100", NULL, NULL));
936- assert(cstl_set_insert(sa, "104", NULL, NULL));
937- assert(cstl_set_insert(sa, "106", NULL, NULL));
938- assert(cstl_set_insert(sa, "105", NULL, NULL));
939- assert(cstl_set_insert(sa, "102", NULL, NULL));
927+ ASSERT(cstl_set_insert(sa, "103", NULL, NULL));
928+ ASSERT(cstl_set_insert(sa, "101", NULL, NULL));
929+ ASSERT(cstl_set_insert(sa, "100", NULL, NULL));
930+ ASSERT(cstl_set_insert(sa, "104", NULL, NULL));
931+ ASSERT(cstl_set_insert(sa, "106", NULL, NULL));
932+ ASSERT(cstl_set_insert(sa, "105", NULL, NULL));
933+ ASSERT(cstl_set_insert(sa, "102", NULL, NULL));
940934 printf("size: %d\n", cstl_size(sa));
941935 cstl_clear(sa);
942936 printf("size: %d\n", cstl_size(sa));
943- assert(cstl_size(sa) == 0);
944- assert(cstl_set_insert(sa, "100", NULL, NULL));
945- assert(cstl_size(sa) == 1);
937+ ASSERT(cstl_size(sa) == 0);
938+ ASSERT(cstl_set_insert(sa, "100", NULL, NULL));
939+ ASSERT(cstl_size(sa) == 1);
946940 cstl_clear(sa);
947- assert(cstl_size(sa) == 0);
941+ ASSERT(cstl_size(sa) == 0);
948942 cstl_clear(sa);
949- assert(cstl_size(sa) == 0);
943+ ASSERT(cstl_size(sa) == 0);
950944
951945 POOL_DUMP_OVERFLOW(&pool);
952946 cstl_delete(sa);
@@ -959,120 +953,119 @@
959953 int success[SIZE];
960954 UIntSetAIterator pos[SIZE];
961955 UIntSetAIterator p;
962- printf("***** test_5_1 *****\n");
963956 uia = UIntSetA_new();
964957 /* 初期状態 */
965- assert(cstl_empty(uia));
966- assert(cstl_size(uia) == 0);
967- assert(cstl_iter_eq(cstl_begin(uia), cstl_end(uia)));
968- assert(cstl_iter_eq(cstl_rbegin(uia), cstl_rend(uia)));
958+ ASSERT(cstl_empty(uia));
959+ ASSERT(cstl_size(uia) == 0);
960+ ASSERT(cstl_iter_eq(cstl_begin(uia), cstl_end(uia)));
961+ ASSERT(cstl_iter_eq(cstl_rbegin(uia), cstl_rend(uia)));
969962 /* insert */
970963 for (i = 0; i < SIZE; i++) {
971- assert(cstl_set_insert(uia, hoge_int[i], &pos[i], &success[i]));
964+ ASSERT(cstl_set_insert(uia, hoge_int[i], &pos[i], &success[i]));
972965 /* pos[i] = cstl_set_insert(uia, hoge_int[i], &success[i]);*/
973966 /* UIntSetA_print(uia);*/
974967 if (i < SIZE/2) {
975- assert(success[i]);
968+ ASSERT(success[i]);
976969 count++;
977970 } else {
978- assert(!success[i]);
971+ ASSERT(!success[i]);
979972 }
980973 }
981974 /* UIntSetA_print(uia);*/
982- assert(!cstl_empty(uia));
983- assert(cstl_size(uia) == count);
984- assert(count == SIZE/2);
975+ ASSERT(!cstl_empty(uia));
976+ ASSERT(cstl_size(uia) == count);
977+ ASSERT(count == SIZE/2);
985978 /* count, find, lower_bound, upper_bound */
986979 for (i = 0; i < SIZE/2; i++) {
987- assert(cstl_count(uia, hoge_int[i]) == 1);
988- assert(cstl_iter_eq(pos[i], cstl_find(uia, hoge_int[i])));
989- assert(cstl_iter_eq(pos[i], cstl_lower_bound(uia, hoge_int[i])));
980+ ASSERT(cstl_count(uia, hoge_int[i]) == 1);
981+ ASSERT(cstl_iter_eq(pos[i], cstl_find(uia, hoge_int[i])));
982+ ASSERT(cstl_iter_eq(pos[i], cstl_lower_bound(uia, hoge_int[i])));
990983 if (hoge_int[i] == 0) {
991- assert(cstl_iter_eq(cstl_end(uia), cstl_upper_bound(uia, hoge_int[i]-1)));
984+ ASSERT(cstl_iter_eq(cstl_end(uia), cstl_upper_bound(uia, hoge_int[i]-1)));
992985 } else {
993- assert(cstl_iter_eq(pos[i], cstl_upper_bound(uia, hoge_int[i]-1)));
986+ ASSERT(cstl_iter_eq(pos[i], cstl_upper_bound(uia, hoge_int[i]-1)));
994987 }
995- assert(cstl_iter_eq(cstl_lower_bound(uia, hoge_int[i]+1), cstl_upper_bound(uia, hoge_int[i])));
988+ ASSERT(cstl_iter_eq(cstl_lower_bound(uia, hoge_int[i]+1), cstl_upper_bound(uia, hoge_int[i])));
996989 }
997- assert(cstl_iter_eq(cstl_find(uia, *cstl_iter_data(cstl_begin(uia)) -1), cstl_end(uia)));
998- assert(cstl_iter_eq(cstl_lower_bound(uia, *cstl_iter_data(cstl_rbegin(uia)) +1), cstl_end(uia)));
999- assert(cstl_iter_eq(cstl_upper_bound(uia, *cstl_iter_data(cstl_rbegin(uia))), cstl_end(uia)));
990+ ASSERT(cstl_iter_eq(cstl_find(uia, *cstl_iter_data(cstl_begin(uia)) -1), cstl_end(uia)));
991+ ASSERT(cstl_iter_eq(cstl_lower_bound(uia, *cstl_iter_data(cstl_rbegin(uia)) +1), cstl_end(uia)));
992+ ASSERT(cstl_iter_eq(cstl_upper_bound(uia, *cstl_iter_data(cstl_rbegin(uia))), cstl_end(uia)));
1000993 /* begin, end, next, data */
1001994 for (p = cstl_begin(uia), i = 0; cstl_iter_ne(p, cstl_end(uia)); cstl_iter_inc(&p), i++) {
1002- assert(*cstl_iter_data(p) == i);
995+ ASSERT(*cstl_iter_data(p) == i);
1003996 }
1004- assert(i == SIZE/2);
1005-/* assert(cstl_iter_next(cstl_rbegin(uia)) == cstl_end(uia));*/
1006- assert(*cstl_iter_data(cstl_rbegin(uia)) == *cstl_iter_data(cstl_iter_prev(cstl_end(uia))));
997+ ASSERT(i == SIZE/2);
998+/* ASSERT(cstl_iter_next(cstl_rbegin(uia)) == cstl_end(uia));*/
999+ ASSERT(*cstl_iter_data(cstl_rbegin(uia)) == *cstl_iter_data(cstl_iter_prev(cstl_end(uia))));
10071000 /* rbegin, rend, prev, data */
10081001 for (p = cstl_rbegin(uia), i = SIZE/2 -1; cstl_iter_ne(p, cstl_rend(uia)); cstl_iter_inc(&p), i--) {
1009- assert(*cstl_iter_data(p) == i);
1002+ ASSERT(*cstl_iter_data(p) == i);
10101003 }
1011- assert(i == -1);
1012-/* assert(cstl_iter_prev(cstl_begin(uia)) == cstl_rend(uia));*/
1013- assert(*cstl_iter_data(cstl_begin(uia)) == *cstl_iter_data(cstl_iter_prev(cstl_rend(uia))));
1004+ ASSERT(i == -1);
1005+/* ASSERT(cstl_iter_prev(cstl_begin(uia)) == cstl_rend(uia));*/
1006+ ASSERT(*cstl_iter_data(cstl_begin(uia)) == *cstl_iter_data(cstl_iter_prev(cstl_rend(uia))));
10141007 /* erase */
10151008 for (i = 0; i < SIZE; i++) {
10161009 if (success[i]) {
10171010 UIntSetAIterator itr = cstl_iter_next(pos[i]);
1018- assert(cstl_iter_eq(itr, cstl_erase(uia, pos[i])));
1011+ ASSERT(cstl_iter_eq(itr, cstl_erase(uia, pos[i])));
10191012 count--;
10201013 }
10211014 }
1022- assert(cstl_empty(uia));
1023- assert(cstl_size(uia) == 0);
1024- assert(count == 0);
1015+ ASSERT(cstl_empty(uia));
1016+ ASSERT(cstl_size(uia) == 0);
1017+ ASSERT(count == 0);
10251018 /* erase_range */
10261019 for (i = 0; i < SIZE/2; i++) {
1027- assert(cstl_set_insert(uia, hoge_int[i], &pos[i], NULL));
1020+ ASSERT(cstl_set_insert(uia, hoge_int[i], &pos[i], NULL));
10281021 /* pos[i] = cstl_set_insert(uia, hoge_int[i], NULL);*/
1029-/* assert(pos[i]);*/
1022+/* ASSERT(pos[i]);*/
10301023 }
1031- assert(cstl_size(uia) == SIZE/2);
1032- assert(cstl_iter_eq(cstl_find(uia, SIZE/2 -2), cstl_erase_range(uia, cstl_find(uia, 2), cstl_find(uia, SIZE/2 -2))));
1033- assert(cstl_size(uia) == 4);
1034- assert(cstl_iter_eq(cstl_end(uia), cstl_erase_range(uia, cstl_begin(uia), cstl_end(uia))));
1035- assert(cstl_size(uia) == 0);
1036- assert(cstl_set_insert(uia, hoge_int[0], NULL, NULL));
1037- assert(cstl_size(uia) == 1);
1024+ ASSERT(cstl_size(uia) == SIZE/2);
1025+ ASSERT(cstl_iter_eq(cstl_find(uia, SIZE/2 -2), cstl_erase_range(uia, cstl_find(uia, 2), cstl_find(uia, SIZE/2 -2))));
1026+ ASSERT(cstl_size(uia) == 4);
1027+ ASSERT(cstl_iter_eq(cstl_end(uia), cstl_erase_range(uia, cstl_begin(uia), cstl_end(uia))));
1028+ ASSERT(cstl_size(uia) == 0);
1029+ ASSERT(cstl_set_insert(uia, hoge_int[0], NULL, NULL));
1030+ ASSERT(cstl_size(uia) == 1);
10381031 p = cstl_iter_next(cstl_begin(uia));
1039- assert(cstl_iter_eq(p, cstl_erase_range(uia, cstl_begin(uia), cstl_iter_next(cstl_begin(uia)))));
1040-/* assert(cstl_iter_next(cstl_begin(uia)) == cstl_erase_range(uia, cstl_begin(uia), cstl_iter_next(cstl_begin(uia))));*/
1041- assert(cstl_size(uia) == 0);
1042- assert(cstl_set_insert(uia, 100, NULL, NULL));
1043- assert(cstl_set_insert(uia, 110, NULL, NULL));
1044- assert(cstl_size(uia) == 2);
1045- assert(cstl_iter_eq(cstl_upper_bound(uia, 110), cstl_erase_range(uia, cstl_lower_bound(uia, 100), cstl_upper_bound(uia, 110))));
1046- assert(cstl_size(uia) == 0);
1032+ ASSERT(cstl_iter_eq(p, cstl_erase_range(uia, cstl_begin(uia), cstl_iter_next(cstl_begin(uia)))));
1033+/* ASSERT(cstl_iter_next(cstl_begin(uia)) == cstl_erase_range(uia, cstl_begin(uia), cstl_iter_next(cstl_begin(uia))));*/
1034+ ASSERT(cstl_size(uia) == 0);
1035+ ASSERT(cstl_set_insert(uia, 100, NULL, NULL));
1036+ ASSERT(cstl_set_insert(uia, 110, NULL, NULL));
1037+ ASSERT(cstl_size(uia) == 2);
1038+ ASSERT(cstl_iter_eq(cstl_upper_bound(uia, 110), cstl_erase_range(uia, cstl_lower_bound(uia, 100), cstl_upper_bound(uia, 110))));
1039+ ASSERT(cstl_size(uia) == 0);
10471040 /* erase_key */
10481041 for (i = 0; i < SIZE/2; i++) {
1049- assert(cstl_set_insert(uia, hoge_int[i], &pos[i], NULL));
1042+ ASSERT(cstl_set_insert(uia, hoge_int[i], &pos[i], NULL));
10501043 /* pos[i] = cstl_set_insert(uia, hoge_int[i], NULL);*/
1051-/* assert(pos[i]);*/
1044+/* ASSERT(pos[i]);*/
10521045 }
1053- assert(cstl_size(uia) == SIZE/2);
1046+ ASSERT(cstl_size(uia) == SIZE/2);
10541047 for (i = 0; i < SIZE/2; i++) {
1055- assert(cstl_erase_key(uia, hoge_int[i]) == 1);
1048+ ASSERT(cstl_erase_key(uia, hoge_int[i]) == 1);
10561049 }
1057- assert(cstl_size(uia) == 0);
1050+ ASSERT(cstl_size(uia) == 0);
10581051 /* 大量にinsert */
10591052 count = 0;
10601053 while (count < 1000000 && cstl_set_insert(uia, count, NULL, NULL)) {
10611054 count++;
10621055 }
1063- assert(cstl_size(uia) == count);
1056+ ASSERT(cstl_size(uia) == count);
10641057 printf("count: %d\n", count);
10651058 printf("size: %d\n", cstl_size(uia));
10661059 /* clear */
10671060 cstl_clear(uia);
10681061 printf("size: %d\n", cstl_size(uia));
1069- assert(cstl_size(uia) == 0);
1070- assert(cstl_set_insert(uia, 100, NULL, NULL));
1071- assert(cstl_size(uia) == 1);
1062+ ASSERT(cstl_size(uia) == 0);
1063+ ASSERT(cstl_set_insert(uia, 100, NULL, NULL));
1064+ ASSERT(cstl_size(uia) == 1);
10721065 cstl_clear(uia);
1073- assert(cstl_size(uia) == 0);
1066+ ASSERT(cstl_size(uia) == 0);
10741067 cstl_clear(uia);
1075- assert(cstl_size(uia) == 0);
1068+ ASSERT(cstl_size(uia) == 0);
10761069
10771070 POOL_DUMP_OVERFLOW(&pool);
10781071 cstl_delete(uia);
@@ -1079,28 +1072,39 @@
10791072 }
10801073
10811074
1075+static TestCase set_tests[] = {
1076+ { "SetTest_test_1_1", SetTest_test_1_1 },
1077+ { "SetTest_test_1_2", SetTest_test_1_2 },
1078+ { "SetTest_test_1_3", SetTest_test_1_3 },
1079+ { "SetTest_test_2_1", SetTest_test_2_1 },
1080+ { "SetTest_test_3_1", SetTest_test_3_1 },
1081+ { "SetTest_test_4_1", SetTest_test_4_1 },
1082+ { "SetTest_test_5_1", SetTest_test_5_1 },
1083+ TEST_CASE_NULL,
1084+};
10821085
1083-void SetTest_run(void)
1086+static int setup(void)
10841087 {
1085- printf("\n===== set test =====\n");
10861088 set_init_hoge();
1087-
1088- SetTest_test_1_1();
1089- SetTest_test_1_2();
1090- SetTest_test_1_3();
1091- SetTest_test_2_1();
1092- SetTest_test_3_1();
1093- SetTest_test_4_1();
1094- SetTest_test_5_1();
1089+ return 0;
10951090 }
10961091
1092+static TestSuite suites[] = {
1093+ { "set test", setup, 0, set_tests },
1094+ TEST_SUITE_NULL,
1095+};
10971096
1098-int main(void)
1097+
1098+int main(int argc, char *argv[])
10991099 {
11001100 #ifdef MY_MALLOC
11011101 Pool_init(&pool, buf, sizeof buf, sizeof buf[0]);
11021102 #endif
1103- SetTest_run();
1103+ if (argc < 2) {
1104+ unittest_run_all(suites);
1105+ } else {
1106+ unittest_run_interactive(suites);
1107+ }
11041108 #ifdef MY_MALLOC
11051109 POOL_DUMP_LEAK(&pool, 0);
11061110 #endif
--- branches/try-vfunc/test/Makefile (revision 398)
+++ branches/try-vfunc/test/Makefile (revision 399)
@@ -2,6 +2,7 @@
22 # MEMORY=-DPOOL_DEBUG -DMY_MALLOC
33 # CSTLGEN=-DCSTLGEN
44 CFLAGS=-Wall -I.. -g -DCSTL_DEBUG $(MEMORY) #-fprofile-arcs -ftest-coverage
5+LFLAGS=-L../unittest -lunittest
56 ifneq ($(MEMORY),)
67 POOL="pool"
78 endif
@@ -23,9 +24,9 @@
2324 sh cstlgen.sh vector IntVector "int" false false false . $(POOL)
2425 sh cstlgen.sh vector HogeVector "Hoge" false hoge.h false . $(POOL)
2526 sh cstlgen.sh vector HogepVector "Hoge*" false hoge.h false . $(POOL)
26- $(CC) $(CFLAGS) -o $@.exe vector_test.c Pool.o UCharVector.c IntVector.c $(CSTLGEN)
27+ $(CC) $(CFLAGS) -o $@.exe vector_test.c Pool.o UCharVector.c IntVector.c $(CSTLGEN) $(LFLAGS)
2728 else
28- $(CC) $(CFLAGS) -o $@.exe vector_test.c Pool.o
29+ $(CC) $(CFLAGS) -o $@.exe vector_test.c Pool.o $(LFLAGS)
2930 endif
3031 ./$@.exe
3132
@@ -58,9 +59,9 @@
5859 sh cstlgen.sh list IntList "int" false false '%d' . $(POOL)
5960 sh cstlgen.sh list HogeList "Hoge" false hoge.h '%d' . $(POOL)
6061 sh cstlgen.sh list HogepList "Hoge*" false hoge.h '%p' . $(POOL)
61- $(CC) $(CFLAGS) -o $@.exe list_test.c Pool.o IntList.c HogeList.c $(CSTLGEN)
62+ $(CC) $(CFLAGS) -o $@.exe list_test.c Pool.o IntList.c HogeList.c $(CSTLGEN) $(LFLAGS)
6263 else
63- $(CC) $(CFLAGS) -o $@.exe list_test.c Pool.o
64+ $(CC) $(CFLAGS) -o $@.exe list_test.c Pool.o $(LFLAGS)
6465 endif
6566 ./$@.exe
6667
@@ -75,9 +76,9 @@
7576 sh cstlgen.sh set UIntSetA "unsigned int" CSTL_LESS false '%d' . $(POOL)
7677 sh cstlgen.sh set HogeSetA "Hoge" HOGE_COMP hoge.h '%d' . $(POOL)
7778 sh cstlgen.sh set HogepSetA "Hoge*" HOGEP_COMP hoge.h '%p' . $(POOL)
78- $(CC) $(CFLAGS) -o $@.exe set_test.c Pool.o IntSetA.c IntSetD.c IntMSetA.c DoubleSetA.c PtrSetA.c StrSetA.c UIntSetA.c $(CSTLGEN)
79+ $(CC) $(CFLAGS) -o $@.exe set_test.c Pool.o IntSetA.c IntSetD.c IntMSetA.c DoubleSetA.c PtrSetA.c StrSetA.c UIntSetA.c $(CSTLGEN) $(LFLAGS)
7980 else
80- $(CC) $(CFLAGS) -o $@.exe set_test.c Pool.o
81+ $(CC) $(CFLAGS) -o $@.exe set_test.c Pool.o $(LFLAGS)
8182 endif
8283 ./$@.exe
8384
@@ -87,9 +88,9 @@
8788 sh cstlgen.sh map HogeIntMapA "Hoge" "int" HOGE_COMP hoge.h '%d' '%d' . $(POOL)
8889 sh cstlgen.sh map HogepIntMapA "Hoge*" "int" HOGEP_COMP hoge.h '%p' '%d' . $(POOL)
8990 sh cstlgen.sh multimap IntIntMMapA "int" "int" CSTL_LESS false '%d' '%d' . $(POOL)
90- $(CC) $(CFLAGS) -o $@.exe map_test.c Pool.o IntIntMapA.c IntIntMMapA.c $(CSTLGEN)
91+ $(CC) $(CFLAGS) -o $@.exe map_test.c Pool.o IntIntMapA.c IntIntMMapA.c $(CSTLGEN) $(LFLAGS)
9192 else
92- $(CC) $(CFLAGS) -o $@.exe map_test.c Pool.o
93+ $(CC) $(CFLAGS) -o $@.exe map_test.c Pool.o $(LFLAGS)
9394 endif
9495 ./$@.exe
9596
Show on old repository browser