117 |
117 |
118 TEST(LinkedList_LowLevel, link_unlink) { |
118 TEST(LinkedList_LowLevel, link_unlink) { |
119 node a, b, c; |
119 node a, b, c; |
120 |
120 |
121 cx_linked_list_link(&a, &b, loc_prev, loc_next); |
121 cx_linked_list_link(&a, &b, loc_prev, loc_next); |
122 EXPECT_EQ(a.prev, nullptr); |
122 CX_TEST_ASSERT(a.prev == NULL); |
123 EXPECT_EQ(a.next, &b); |
123 CX_TEST_ASSERT(a.next == &b); |
124 EXPECT_EQ(b.prev, &a); |
124 CX_TEST_ASSERT(b.prev == &a); |
125 EXPECT_EQ(b.next, nullptr); |
125 CX_TEST_ASSERT(b.next == NULL); |
126 |
126 |
127 cx_linked_list_unlink(&a, &b, loc_prev, loc_next); |
127 cx_linked_list_unlink(&a, &b, loc_prev, loc_next); |
128 EXPECT_EQ(a.prev, nullptr); |
128 CX_TEST_ASSERT(a.prev == NULL); |
129 EXPECT_EQ(a.next, nullptr); |
129 CX_TEST_ASSERT(a.next == NULL); |
130 EXPECT_EQ(b.prev, nullptr); |
130 CX_TEST_ASSERT(b.prev == NULL); |
131 EXPECT_EQ(b.next, nullptr); |
131 CX_TEST_ASSERT(b.next == NULL); |
132 |
132 |
133 cx_linked_list_link(&b, &c, loc_prev, loc_next); |
133 cx_linked_list_link(&b, &c, loc_prev, loc_next); |
134 cx_linked_list_link(&a, &b, loc_prev, loc_next); |
134 cx_linked_list_link(&a, &b, loc_prev, loc_next); |
135 cx_linked_list_unlink(&b, &c, loc_prev, loc_next); |
135 cx_linked_list_unlink(&b, &c, loc_prev, loc_next); |
136 EXPECT_EQ(a.prev, nullptr); |
136 CX_TEST_ASSERT(a.prev == NULL); |
137 EXPECT_EQ(a.next, &b); |
137 CX_TEST_ASSERT(a.next == &b); |
138 EXPECT_EQ(b.prev, &a); |
138 CX_TEST_ASSERT(b.prev == &a); |
139 EXPECT_EQ(b.next, nullptr); |
139 CX_TEST_ASSERT(b.next == NULL); |
140 EXPECT_EQ(c.prev, nullptr); |
140 CX_TEST_ASSERT(c.prev == NULL); |
141 EXPECT_EQ(c.next, nullptr); |
141 CX_TEST_ASSERT(c.next == NULL); |
142 } |
142 } |
143 |
143 |
144 TEST(LinkedList_LowLevel, cx_linked_list_at) { |
144 TEST(LinkedList_LowLevel, cx_linked_list_at) { |
145 node a, b, c, d; |
145 node a, b, c, d; |
146 cx_linked_list_link(&a, &b, loc_prev, loc_next); |
146 cx_linked_list_link(&a, &b, loc_prev, loc_next); |
149 |
149 |
150 EXPECT_EQ(cx_linked_list_at(&a, 0, loc_next, 0), &a); |
150 EXPECT_EQ(cx_linked_list_at(&a, 0, loc_next, 0), &a); |
151 EXPECT_EQ(cx_linked_list_at(&a, 0, loc_next, 1), &b); |
151 EXPECT_EQ(cx_linked_list_at(&a, 0, loc_next, 1), &b); |
152 EXPECT_EQ(cx_linked_list_at(&a, 0, loc_next, 2), &c); |
152 EXPECT_EQ(cx_linked_list_at(&a, 0, loc_next, 2), &c); |
153 EXPECT_EQ(cx_linked_list_at(&a, 0, loc_next, 3), &d); |
153 EXPECT_EQ(cx_linked_list_at(&a, 0, loc_next, 3), &d); |
154 EXPECT_EQ(cx_linked_list_at(&a, 0, loc_next, 4), nullptr); |
154 EXPECT_EQ(cx_linked_list_at(&a, 0, loc_next, 4), NULL); |
155 |
155 |
156 EXPECT_EQ(cx_linked_list_at(&b, 1, loc_prev, 0), &a); |
156 EXPECT_EQ(cx_linked_list_at(&b, 1, loc_prev, 0), &a); |
157 EXPECT_EQ(cx_linked_list_at(&b, 1, loc_next, 1), &b); |
157 EXPECT_EQ(cx_linked_list_at(&b, 1, loc_next, 1), &b); |
158 EXPECT_EQ(cx_linked_list_at(&b, 1, loc_next, 2), &c); |
158 EXPECT_EQ(cx_linked_list_at(&b, 1, loc_next, 2), &c); |
159 EXPECT_EQ(cx_linked_list_at(&b, 1, loc_next, 3), &d); |
159 EXPECT_EQ(cx_linked_list_at(&b, 1, loc_next, 3), &d); |
160 EXPECT_EQ(cx_linked_list_at(&b, 1, loc_next, 4), nullptr); |
160 EXPECT_EQ(cx_linked_list_at(&b, 1, loc_next, 4), NULL); |
161 |
161 |
162 EXPECT_EQ(cx_linked_list_at(&d, 3, loc_prev, 0), &a); |
162 EXPECT_EQ(cx_linked_list_at(&d, 3, loc_prev, 0), &a); |
163 EXPECT_EQ(cx_linked_list_at(&d, 3, loc_prev, 1), &b); |
163 EXPECT_EQ(cx_linked_list_at(&d, 3, loc_prev, 1), &b); |
164 } |
164 } |
165 |
165 |
197 |
197 |
198 TEST(LinkedList_LowLevel, cx_linked_list_add) { |
198 TEST(LinkedList_LowLevel, cx_linked_list_add) { |
199 // test with begin, end / prev, next |
199 // test with begin, end / prev, next |
200 { |
200 { |
201 node nodes[4]; |
201 node nodes[4]; |
202 void *begin = nullptr, *end = nullptr; |
202 void *begin = NULL, *end = NULL; |
203 |
203 |
204 cx_linked_list_add(&begin, &end, loc_prev, loc_next, &nodes[0]); |
204 cx_linked_list_add(&begin, &end, loc_prev, loc_next, &nodes[0]); |
205 EXPECT_EQ(begin, &nodes[0]); |
205 CX_TEST_ASSERT(begin == &nodes[0]); |
206 EXPECT_EQ(end, &nodes[0]); |
206 CX_TEST_ASSERT(end == &nodes[0]); |
207 EXPECT_EQ(nodes[0].prev, nullptr); |
207 CX_TEST_ASSERT(nodes[0].prev == NULL); |
208 EXPECT_EQ(nodes[0].next, nullptr); |
208 CX_TEST_ASSERT(nodes[0].next == NULL); |
209 |
209 |
210 cx_linked_list_add(&begin, &end, loc_prev, loc_next, &nodes[1]); |
210 cx_linked_list_add(&begin, &end, loc_prev, loc_next, &nodes[1]); |
211 EXPECT_EQ(begin, &nodes[0]); |
211 CX_TEST_ASSERT(begin == &nodes[0]); |
212 EXPECT_EQ(end, &nodes[1]); |
212 CX_TEST_ASSERT(end == &nodes[1]); |
213 EXPECT_EQ(nodes[0].next, &nodes[1]); |
213 CX_TEST_ASSERT(nodes[0].next == &nodes[1]); |
214 EXPECT_EQ(nodes[1].prev, &nodes[0]); |
214 CX_TEST_ASSERT(nodes[1].prev == &nodes[0]); |
215 } |
215 } |
216 |
216 |
217 // test with begin only / prev, next |
217 // test with begin only / prev, next |
218 { |
218 { |
219 node nodes[4]; |
219 node nodes[4]; |
220 void *begin = nullptr; |
220 void *begin = NULL; |
221 |
221 |
222 cx_linked_list_add(&begin, nullptr, loc_prev, loc_next, &nodes[0]); |
222 cx_linked_list_add(&begin, NULL, loc_prev, loc_next, &nodes[0]); |
223 EXPECT_EQ(begin, &nodes[0]); |
223 CX_TEST_ASSERT(begin == &nodes[0]); |
224 cx_linked_list_add(&begin, nullptr, loc_prev, loc_next, &nodes[1]); |
224 cx_linked_list_add(&begin, NULL, loc_prev, loc_next, &nodes[1]); |
225 EXPECT_EQ(begin, &nodes[0]); |
225 CX_TEST_ASSERT(begin == &nodes[0]); |
226 EXPECT_EQ(nodes[0].next, &nodes[1]); |
226 CX_TEST_ASSERT(nodes[0].next == &nodes[1]); |
227 EXPECT_EQ(nodes[1].prev, &nodes[0]); |
227 CX_TEST_ASSERT(nodes[1].prev == &nodes[0]); |
228 |
228 |
229 cx_linked_list_add(&begin, nullptr, loc_prev, loc_next, &nodes[2]); |
229 cx_linked_list_add(&begin, NULL, loc_prev, loc_next, &nodes[2]); |
230 EXPECT_EQ(nodes[1].next, &nodes[2]); |
230 CX_TEST_ASSERT(nodes[1].next == &nodes[2]); |
231 EXPECT_EQ(nodes[2].prev, &nodes[1]); |
231 CX_TEST_ASSERT(nodes[2].prev == &nodes[1]); |
232 } |
232 } |
233 |
233 |
234 // test with end only / prev, next |
234 // test with end only / prev, next |
235 { |
235 { |
236 node nodes[4]; |
236 node nodes[4]; |
237 void *end = nullptr; |
237 void *end = NULL; |
238 |
238 |
239 cx_linked_list_add(nullptr, &end, loc_prev, loc_next, &nodes[0]); |
239 cx_linked_list_add(NULL, &end, loc_prev, loc_next, &nodes[0]); |
240 EXPECT_EQ(end, &nodes[0]); |
240 CX_TEST_ASSERT(end == &nodes[0]); |
241 cx_linked_list_add(nullptr, &end, loc_prev, loc_next, &nodes[1]); |
241 cx_linked_list_add(NULL, &end, loc_prev, loc_next, &nodes[1]); |
242 EXPECT_EQ(end, &nodes[1]); |
242 CX_TEST_ASSERT(end == &nodes[1]); |
243 EXPECT_EQ(nodes[0].next, &nodes[1]); |
243 CX_TEST_ASSERT(nodes[0].next == &nodes[1]); |
244 EXPECT_EQ(nodes[1].prev, &nodes[0]); |
244 CX_TEST_ASSERT(nodes[1].prev == &nodes[0]); |
245 |
245 |
246 cx_linked_list_add(nullptr, &end, loc_prev, loc_next, &nodes[2]); |
246 cx_linked_list_add(NULL, &end, loc_prev, loc_next, &nodes[2]); |
247 EXPECT_EQ(end, &nodes[2]); |
247 CX_TEST_ASSERT(end == &nodes[2]); |
248 EXPECT_EQ(nodes[1].next, &nodes[2]); |
248 CX_TEST_ASSERT(nodes[1].next == &nodes[2]); |
249 EXPECT_EQ(nodes[2].prev, &nodes[1]); |
249 CX_TEST_ASSERT(nodes[2].prev == &nodes[1]); |
250 } |
250 } |
251 |
251 |
252 // test with begin, end / next |
252 // test with begin, end / next |
253 { |
253 { |
254 node nodes[4]; |
254 node nodes[4]; |
255 void *begin = nullptr, *end = nullptr; |
255 void *begin = NULL, *end = NULL; |
256 |
256 |
257 cx_linked_list_add(&begin, &end, -1, loc_next, &nodes[0]); |
257 cx_linked_list_add(&begin, &end, -1, loc_next, &nodes[0]); |
258 EXPECT_EQ(begin, &nodes[0]); |
258 CX_TEST_ASSERT(begin == &nodes[0]); |
259 EXPECT_EQ(end, &nodes[0]); |
259 CX_TEST_ASSERT(end == &nodes[0]); |
260 cx_linked_list_add(&begin, &end, -1, loc_next, &nodes[1]); |
260 cx_linked_list_add(&begin, &end, -1, loc_next, &nodes[1]); |
261 EXPECT_EQ(end, &nodes[1]); |
261 CX_TEST_ASSERT(end == &nodes[1]); |
262 EXPECT_EQ(nodes[0].next, &nodes[1]); |
262 CX_TEST_ASSERT(nodes[0].next == &nodes[1]); |
263 EXPECT_EQ(nodes[1].prev, nullptr); |
263 CX_TEST_ASSERT(nodes[1].prev == NULL); |
264 } |
264 } |
265 } |
265 } |
266 |
266 |
267 TEST(LinkedList_LowLevel, cx_linked_list_prepend) { |
267 TEST(LinkedList_LowLevel, cx_linked_list_prepend) { |
268 // test with begin, end / prev, next |
268 // test with begin, end / prev, next |
269 { |
269 { |
270 node nodes[4]; |
270 node nodes[4]; |
271 void *begin = nullptr, *end = nullptr; |
271 void *begin = NULL, *end = NULL; |
272 |
272 |
273 cx_linked_list_prepend(&begin, &end, loc_prev, loc_next, &nodes[0]); |
273 cx_linked_list_prepend(&begin, &end, loc_prev, loc_next, &nodes[0]); |
274 EXPECT_EQ(begin, &nodes[0]); |
274 CX_TEST_ASSERT(begin == &nodes[0]); |
275 EXPECT_EQ(end, &nodes[0]); |
275 CX_TEST_ASSERT(end == &nodes[0]); |
276 EXPECT_EQ(nodes[0].prev, nullptr); |
276 CX_TEST_ASSERT(nodes[0].prev == NULL); |
277 EXPECT_EQ(nodes[0].next, nullptr); |
277 CX_TEST_ASSERT(nodes[0].next == NULL); |
278 |
278 |
279 cx_linked_list_prepend(&begin, &end, loc_prev, loc_next, &nodes[1]); |
279 cx_linked_list_prepend(&begin, &end, loc_prev, loc_next, &nodes[1]); |
280 EXPECT_EQ(begin, &nodes[1]); |
280 CX_TEST_ASSERT(begin == &nodes[1]); |
281 EXPECT_EQ(end, &nodes[0]); |
281 CX_TEST_ASSERT(end == &nodes[0]); |
282 EXPECT_EQ(nodes[1].next, &nodes[0]); |
282 CX_TEST_ASSERT(nodes[1].next == &nodes[0]); |
283 EXPECT_EQ(nodes[0].prev, &nodes[1]); |
283 CX_TEST_ASSERT(nodes[0].prev == &nodes[1]); |
284 } |
284 } |
285 |
285 |
286 // test with begin only / prev, next |
286 // test with begin only / prev, next |
287 { |
287 { |
288 node nodes[4]; |
288 node nodes[4]; |
289 void *begin = nullptr; |
289 void *begin = NULL; |
290 |
290 |
291 cx_linked_list_prepend(&begin, nullptr, loc_prev, loc_next, &nodes[0]); |
291 cx_linked_list_prepend(&begin, NULL, loc_prev, loc_next, &nodes[0]); |
292 EXPECT_EQ(begin, &nodes[0]); |
292 CX_TEST_ASSERT(begin == &nodes[0]); |
293 cx_linked_list_prepend(&begin, nullptr, loc_prev, loc_next, &nodes[1]); |
293 cx_linked_list_prepend(&begin, NULL, loc_prev, loc_next, &nodes[1]); |
294 EXPECT_EQ(begin, &nodes[1]); |
294 CX_TEST_ASSERT(begin == &nodes[1]); |
295 EXPECT_EQ(nodes[1].next, &nodes[0]); |
295 CX_TEST_ASSERT(nodes[1].next == &nodes[0]); |
296 EXPECT_EQ(nodes[0].prev, &nodes[1]); |
296 CX_TEST_ASSERT(nodes[0].prev == &nodes[1]); |
297 |
297 |
298 cx_linked_list_prepend(&begin, nullptr, loc_prev, loc_next, &nodes[2]); |
298 cx_linked_list_prepend(&begin, NULL, loc_prev, loc_next, &nodes[2]); |
299 EXPECT_EQ(begin, &nodes[2]); |
299 CX_TEST_ASSERT(begin == &nodes[2]); |
300 EXPECT_EQ(nodes[2].next, &nodes[1]); |
300 CX_TEST_ASSERT(nodes[2].next == &nodes[1]); |
301 EXPECT_EQ(nodes[1].prev, &nodes[2]); |
301 CX_TEST_ASSERT(nodes[1].prev == &nodes[2]); |
302 } |
302 } |
303 |
303 |
304 // test with end only / prev, next |
304 // test with end only / prev, next |
305 { |
305 { |
306 node nodes[4]; |
306 node nodes[4]; |
307 void *end = nullptr; |
307 void *end = NULL; |
308 |
308 |
309 cx_linked_list_prepend(nullptr, &end, loc_prev, loc_next, &nodes[0]); |
309 cx_linked_list_prepend(NULL, &end, loc_prev, loc_next, &nodes[0]); |
310 EXPECT_EQ(end, &nodes[0]); |
310 CX_TEST_ASSERT(end == &nodes[0]); |
311 cx_linked_list_prepend(nullptr, &end, loc_prev, loc_next, &nodes[1]); |
311 cx_linked_list_prepend(NULL, &end, loc_prev, loc_next, &nodes[1]); |
312 EXPECT_EQ(end, &nodes[0]); |
312 CX_TEST_ASSERT(end == &nodes[0]); |
313 EXPECT_EQ(nodes[1].next, &nodes[0]); |
313 CX_TEST_ASSERT(nodes[1].next == &nodes[0]); |
314 EXPECT_EQ(nodes[0].prev, &nodes[1]); |
314 CX_TEST_ASSERT(nodes[0].prev == &nodes[1]); |
315 |
315 |
316 cx_linked_list_prepend(nullptr, &end, loc_prev, loc_next, &nodes[2]); |
316 cx_linked_list_prepend(NULL, &end, loc_prev, loc_next, &nodes[2]); |
317 EXPECT_EQ(end, &nodes[0]); |
317 CX_TEST_ASSERT(end == &nodes[0]); |
318 EXPECT_EQ(nodes[2].next, &nodes[1]); |
318 CX_TEST_ASSERT(nodes[2].next == &nodes[1]); |
319 EXPECT_EQ(nodes[1].prev, &nodes[2]); |
319 CX_TEST_ASSERT(nodes[1].prev == &nodes[2]); |
320 } |
320 } |
321 |
321 |
322 // test with begin, end / next |
322 // test with begin, end / next |
323 { |
323 { |
324 node nodes[4]; |
324 node nodes[4]; |
325 void *begin = nullptr, *end = nullptr; |
325 void *begin = NULL, *end = NULL; |
326 |
326 |
327 cx_linked_list_prepend(&begin, &end, -1, loc_next, &nodes[0]); |
327 cx_linked_list_prepend(&begin, &end, -1, loc_next, &nodes[0]); |
328 EXPECT_EQ(begin, &nodes[0]); |
328 CX_TEST_ASSERT(begin == &nodes[0]); |
329 EXPECT_EQ(end, &nodes[0]); |
329 CX_TEST_ASSERT(end == &nodes[0]); |
330 cx_linked_list_prepend(&begin, &end, -1, loc_next, &nodes[1]); |
330 cx_linked_list_prepend(&begin, &end, -1, loc_next, &nodes[1]); |
331 cx_linked_list_prepend(&begin, &end, -1, loc_next, &nodes[2]); |
331 cx_linked_list_prepend(&begin, &end, -1, loc_next, &nodes[2]); |
332 EXPECT_EQ(begin, &nodes[2]); |
332 CX_TEST_ASSERT(begin == &nodes[2]); |
333 EXPECT_EQ(end, &nodes[0]); |
333 CX_TEST_ASSERT(end == &nodes[0]); |
334 EXPECT_EQ(nodes[1].next, &nodes[0]); |
334 CX_TEST_ASSERT(nodes[1].next == &nodes[0]); |
335 EXPECT_EQ(nodes[2].next, &nodes[1]); |
335 CX_TEST_ASSERT(nodes[2].next == &nodes[1]); |
336 EXPECT_EQ(nodes[1].prev, nullptr); |
336 CX_TEST_ASSERT(nodes[1].prev == NULL); |
337 EXPECT_EQ(nodes[0].prev, nullptr); |
337 CX_TEST_ASSERT(nodes[0].prev == NULL); |
338 } |
338 } |
339 } |
339 } |
340 |
340 |
341 TEST(LinkedList_LowLevel, cx_linked_list_insert) { |
341 TEST(LinkedList_LowLevel, cx_linked_list_insert) { |
342 // insert mid list |
342 // insert mid list |
363 |
363 |
364 cx_linked_list_link(&nodes[0], &nodes[1], loc_prev, loc_next); |
364 cx_linked_list_link(&nodes[0], &nodes[1], loc_prev, loc_next); |
365 cx_linked_list_link(&nodes[1], &nodes[2], loc_prev, loc_next); |
365 cx_linked_list_link(&nodes[1], &nodes[2], loc_prev, loc_next); |
366 |
366 |
367 cx_linked_list_insert(&begin, &end, loc_prev, loc_next, &nodes[2], &nodes[3]); |
367 cx_linked_list_insert(&begin, &end, loc_prev, loc_next, &nodes[2], &nodes[3]); |
368 EXPECT_EQ(begin, &nodes[0]); |
368 CX_TEST_ASSERT(begin == &nodes[0]); |
369 EXPECT_EQ(end, &nodes[3]); |
369 CX_TEST_ASSERT(end == &nodes[3]); |
370 EXPECT_EQ(nodes[2].next, &nodes[3]); |
370 CX_TEST_ASSERT(nodes[2].next == &nodes[3]); |
371 EXPECT_EQ(nodes[3].prev, &nodes[2]); |
371 CX_TEST_ASSERT(nodes[3].prev == &nodes[2]); |
372 EXPECT_EQ(nodes[3].next, nullptr); |
372 CX_TEST_ASSERT(nodes[3].next == NULL); |
373 } |
373 } |
374 |
374 |
375 // insert begin |
375 // insert begin |
376 { |
376 { |
377 node nodes[4]; |
377 node nodes[4]; |
378 void *begin = &nodes[0], *end = &nodes[2]; |
378 void *begin = &nodes[0], *end = &nodes[2]; |
379 |
379 |
380 cx_linked_list_link(&nodes[0], &nodes[1], loc_prev, loc_next); |
380 cx_linked_list_link(&nodes[0], &nodes[1], loc_prev, loc_next); |
381 cx_linked_list_link(&nodes[1], &nodes[2], loc_prev, loc_next); |
381 cx_linked_list_link(&nodes[1], &nodes[2], loc_prev, loc_next); |
382 |
382 |
383 cx_linked_list_insert(&begin, &end, loc_prev, loc_next, nullptr, &nodes[3]); |
383 cx_linked_list_insert(&begin, &end, loc_prev, loc_next, NULL, &nodes[3]); |
384 EXPECT_EQ(begin, &nodes[3]); |
384 CX_TEST_ASSERT(begin == &nodes[3]); |
385 EXPECT_EQ(end, &nodes[2]); |
385 CX_TEST_ASSERT(end == &nodes[2]); |
386 EXPECT_EQ(nodes[0].prev, &nodes[3]); |
386 CX_TEST_ASSERT(nodes[0].prev == &nodes[3]); |
387 EXPECT_EQ(nodes[3].prev, nullptr); |
387 CX_TEST_ASSERT(nodes[3].prev == NULL); |
388 EXPECT_EQ(nodes[3].next, &nodes[0]); |
388 CX_TEST_ASSERT(nodes[3].next == &nodes[0]); |
389 } |
389 } |
390 } |
390 } |
391 |
391 |
392 TEST(LinkedList_LowLevel, cx_linked_list_insert_chain) { |
392 TEST(LinkedList_LowLevel, cx_linked_list_insert_chain) { |
393 // insert mid list |
393 // insert mid list |
475 auto second = first->next; |
475 auto second = first->next; |
476 auto third = second->next; |
476 auto third = second->next; |
477 auto end = reinterpret_cast<void *>(third); |
477 auto end = reinterpret_cast<void *>(third); |
478 |
478 |
479 cx_linked_list_remove(&begin, &end, loc_prev, loc_next, second); |
479 cx_linked_list_remove(&begin, &end, loc_prev, loc_next, second); |
480 EXPECT_EQ(begin, first); |
480 CX_TEST_ASSERT(begin == first); |
481 EXPECT_EQ(end, third); |
481 CX_TEST_ASSERT(end == third); |
482 EXPECT_EQ(first->prev, nullptr); |
482 CX_TEST_ASSERT(first->prev == NULL); |
483 EXPECT_EQ(first->next, third); |
483 CX_TEST_ASSERT(first->next == third); |
484 EXPECT_EQ(third->prev, first); |
484 CX_TEST_ASSERT(third->prev == first); |
485 EXPECT_EQ(third->next, nullptr); |
485 CX_TEST_ASSERT(third->next == NULL); |
486 |
486 |
487 cx_linked_list_remove(&begin, &end, loc_prev, loc_next, third); |
487 cx_linked_list_remove(&begin, &end, loc_prev, loc_next, third); |
488 EXPECT_EQ(begin, first); |
488 CX_TEST_ASSERT(begin == first); |
489 EXPECT_EQ(end, first); |
489 CX_TEST_ASSERT(end == first); |
490 EXPECT_EQ(first->prev, nullptr); |
490 CX_TEST_ASSERT(first->prev == NULL); |
491 EXPECT_EQ(first->next, nullptr); |
491 CX_TEST_ASSERT(first->next == NULL); |
492 |
492 |
493 cx_linked_list_remove(&begin, &end, loc_prev, loc_next, first); |
493 cx_linked_list_remove(&begin, &end, loc_prev, loc_next, first); |
494 EXPECT_EQ(begin, nullptr); |
494 CX_TEST_ASSERT(begin == NULL); |
495 EXPECT_EQ(end, nullptr); |
495 CX_TEST_ASSERT(end == NULL); |
496 } |
496 } |
497 |
497 |
498 TEST(LinkedList_LowLevel, cx_linked_list_size) { |
498 TEST(LinkedList_LowLevel, cx_linked_list_size) { |
499 EXPECT_EQ(cx_linked_list_size(nullptr, loc_next), 0); |
499 EXPECT_EQ(cx_linked_list_size(NULL, loc_next), 0); |
500 |
500 |
501 { |
501 { |
502 auto testdata = create_nodes_test_data(5); |
502 auto testdata = create_nodes_test_data(5); |
503 EXPECT_EQ(cx_linked_list_size(testdata.begin, loc_next), 5); |
503 EXPECT_EQ(cx_linked_list_size(testdata.begin, loc_next), 5); |
504 } |
504 } |
655 if (pointers) { |
655 if (pointers) { |
656 inserted = cxListInsertArray(list, 0, aptr, 5); |
656 inserted = cxListInsertArray(list, 0, aptr, 5); |
657 } else { |
657 } else { |
658 inserted = cxListInsertArray(list, 0, a, 5); |
658 inserted = cxListInsertArray(list, 0, a, 5); |
659 } |
659 } |
660 EXPECT_EQ(inserted, 5); |
660 CX_TEST_ASSERT(inserted == 5); |
661 EXPECT_EQ(*(int *) cxListAt(list, 0), 5); |
661 EXPECT_EQ(*(int *) cxListAt(list, 0), 5); |
662 EXPECT_EQ(*(int *) cxListAt(list, 1), 47); |
662 EXPECT_EQ(*(int *) cxListAt(list, 1), 47); |
663 EXPECT_EQ(*(int *) cxListAt(list, 2), 11); |
663 EXPECT_EQ(*(int *) cxListAt(list, 2), 11); |
664 EXPECT_EQ(*(int *) cxListAt(list, 3), 13); |
664 EXPECT_EQ(*(int *) cxListAt(list, 3), 13); |
665 EXPECT_EQ(*(int *) cxListAt(list, 4), 42); |
665 EXPECT_EQ(*(int *) cxListAt(list, 4), 42); |
666 if (pointers) { |
666 if (pointers) { |
667 inserted = cxListInsertArray(list, 3, bptr, 5); |
667 inserted = cxListInsertArray(list, 3, bptr, 5); |
668 } else { |
668 } else { |
669 inserted = cxListInsertArray(list, 3, b, 5); |
669 inserted = cxListInsertArray(list, 3, b, 5); |
670 } |
670 } |
671 EXPECT_EQ(inserted, 5); |
671 CX_TEST_ASSERT(inserted == 5); |
672 EXPECT_EQ(*(int *) cxListAt(list, 0), 5); |
672 EXPECT_EQ(*(int *) cxListAt(list, 0), 5); |
673 EXPECT_EQ(*(int *) cxListAt(list, 1), 47); |
673 EXPECT_EQ(*(int *) cxListAt(list, 1), 47); |
674 EXPECT_EQ(*(int *) cxListAt(list, 2), 11); |
674 EXPECT_EQ(*(int *) cxListAt(list, 2), 11); |
675 EXPECT_EQ(*(int *) cxListAt(list, 3), 9); |
675 EXPECT_EQ(*(int *) cxListAt(list, 3), 9); |
676 EXPECT_EQ(*(int *) cxListAt(list, 4), 18); |
676 EXPECT_EQ(*(int *) cxListAt(list, 4), 18); |
870 |
870 |
871 void verifySort(CxList *list) const { |
871 void verifySort(CxList *list) const { |
872 std::array<int, testdata_len> expected{}; |
872 std::array<int, testdata_len> expected{}; |
873 std::partial_sort_copy(testdata.data.begin(), testdata.data.end(), expected.begin(), expected.end()); |
873 std::partial_sort_copy(testdata.data.begin(), testdata.data.end(), expected.begin(), expected.end()); |
874 cxListSort(list); |
874 cxListSort(list); |
875 cx_for_n (i, testdata_len) ASSERT_EQ(*(int *) cxListAt(list, i), expected[i]); |
875 cx_for_n (i, testdata_len) CX_TEST_ASSERT(*(int *) cxListAt(list, i) == expected[i]); |
876 } |
876 } |
877 |
877 |
878 void verifyIterator(CxList *list) const { |
878 void verifyIterator(CxList *list) const { |
879 auto iter = cxListIterator(list); |
879 auto iter = cxListIterator(list); |
880 size_t i = 0; |
880 size_t i = 0; |
881 cx_foreach(int*, x, iter) { |
881 cx_foreach(int*, x, iter) { |
882 ASSERT_EQ(i, iter.index); |
882 CX_TEST_ASSERT(i == iter.index); |
883 EXPECT_EQ(*x, testdata.data[iter.index]); |
883 EXPECT_EQ(*x, testdata.data[iter.index]); |
884 i++; |
884 i++; |
885 } |
885 } |
886 ASSERT_EQ(i, cxListSize(list)); |
886 CX_TEST_ASSERT(i == cxListSize(list)); |
887 iter = cxListBackwardsIterator(list); |
887 iter = cxListBackwardsIterator(list); |
888 cx_foreach(int*, x, iter) { |
888 cx_foreach(int*, x, iter) { |
889 ASSERT_EQ(i - 1, iter.index); |
889 CX_TEST_ASSERT(i - 1 == iter.index); |
890 EXPECT_EQ(*x, testdata.data[iter.index]); |
890 EXPECT_EQ(*x, testdata.data[iter.index]); |
891 i--; |
891 i--; |
892 } |
892 } |
893 ASSERT_EQ(i, 0); |
893 CX_TEST_ASSERT(i == 0); |
894 auto len = testdata_len; |
894 auto len = testdata_len; |
895 i = len / 2; |
895 i = len / 2; |
896 auto mut_iter = cxListMutIteratorAt(list, i); |
896 auto mut_iter = cxListMutIteratorAt(list, i); |
897 size_t j = 0; |
897 size_t j = 0; |
898 cx_foreach(int*, x, mut_iter) { |
898 cx_foreach(int*, x, mut_iter) { |
899 ASSERT_EQ(mut_iter.index, len / 2 + j / 2); |
899 CX_TEST_ASSERT(mut_iter.index == len / 2 + j / 2); |
900 ASSERT_EQ(*x, testdata.data[i]); |
900 CX_TEST_ASSERT(*x == testdata.data[i]); |
901 if (i % 2 == 1) cxIteratorFlagRemoval(mut_iter); |
901 if (i % 2 == 1) cxIteratorFlagRemoval(mut_iter); |
902 i++; |
902 i++; |
903 j++; |
903 j++; |
904 } |
904 } |
905 ASSERT_EQ(i, len); |
905 CX_TEST_ASSERT(i == len); |
906 i = len / 2; |
906 i = len / 2; |
907 j = 0; |
907 j = 0; |
908 mut_iter = cxListMutBackwardsIteratorAt(list, i - 1); |
908 mut_iter = cxListMutBackwardsIteratorAt(list, i - 1); |
909 cx_foreach(int*, x, mut_iter) { |
909 cx_foreach(int*, x, mut_iter) { |
910 ASSERT_EQ(mut_iter.index, len / 2 - 1 - j); |
910 CX_TEST_ASSERT(mut_iter.index == len / 2 - 1 - j); |
911 ASSERT_EQ(*x, testdata.data[i - 1]); |
911 CX_TEST_ASSERT(*x == testdata.data[i - 1]); |
912 if (i % 2 == 0) cxIteratorFlagRemoval(mut_iter); |
912 if (i % 2 == 0) cxIteratorFlagRemoval(mut_iter); |
913 i--; |
913 i--; |
914 j++; |
914 j++; |
915 } |
915 } |
916 ASSERT_EQ(i, 0); |
916 CX_TEST_ASSERT(i == 0); |
917 ASSERT_EQ(cxListSize(list), len / 2); |
917 CX_TEST_ASSERT(cxListSize(list) == len / 2); |
918 cx_for_n(j, len / 2) ASSERT_EQ(*(int *) cxListAt(list, j), testdata.data[j * 2]); |
918 cx_for_n(j, len / 2) ASSERT_EQ(*(int *) cxListAt(list, j), testdata.data[j * 2]); |
919 } |
919 } |
920 |
920 |
921 static void verifyInsertViaIterator(CxList *list) { |
921 static void verifyInsertViaIterator(CxList *list) { |
922 int newdata[] = {10, 20, 30, 40, 50}; |
922 int newdata[] = {10, 20, 30, 40, 50}; |
923 |
923 |
924 auto iter = cxListMutIteratorAt(list, 2); |
924 auto iter = cxListMutIteratorAt(list, 2); |
925 EXPECT_TRUE(cxIteratorValid(iter)); |
925 CX_TEST_ASSERT(cxIteratorValid(iter)); |
926 EXPECT_EQ(iter.index, 2); |
926 EXPECT_EQ(iter.index, 2); |
927 EXPECT_EQ(*(int *) cxIteratorCurrent(iter), 2); |
927 EXPECT_EQ(*(int *) cxIteratorCurrent(iter), 2); |
928 cxListInsertAfter(&iter, &newdata[0]); |
928 cxListInsertAfter(&iter, &newdata[0]); |
929 EXPECT_TRUE(cxIteratorValid(iter)); |
929 CX_TEST_ASSERT(cxIteratorValid(iter)); |
930 EXPECT_EQ(iter.index, 2); |
930 EXPECT_EQ(iter.index, 2); |
931 EXPECT_EQ(*(int *) cxIteratorCurrent(iter), 2); |
931 EXPECT_EQ(*(int *) cxIteratorCurrent(iter), 2); |
932 cxListInsertBefore(&iter, &newdata[1]); |
932 cxListInsertBefore(&iter, &newdata[1]); |
933 EXPECT_TRUE(cxIteratorValid(iter)); |
933 CX_TEST_ASSERT(cxIteratorValid(iter)); |
934 EXPECT_EQ(iter.index, 3); |
934 EXPECT_EQ(iter.index, 3); |
935 EXPECT_EQ(*(int *) cxIteratorCurrent(iter), 2); |
935 EXPECT_EQ(*(int *) cxIteratorCurrent(iter), 2); |
936 |
936 |
937 iter = cxListMutIterator(list); |
937 iter = cxListMutIterator(list); |
938 cxListInsertBefore(&iter, &newdata[2]); |
938 cxListInsertBefore(&iter, &newdata[2]); |
939 EXPECT_TRUE(cxIteratorValid(iter)); |
939 CX_TEST_ASSERT(cxIteratorValid(iter)); |
940 EXPECT_EQ(iter.index, 1); |
940 EXPECT_EQ(iter.index, 1); |
941 EXPECT_EQ(*(int *) cxIteratorCurrent(iter), 0); |
941 EXPECT_EQ(*(int *) cxIteratorCurrent(iter), 0); |
942 iter = cxListMutIteratorAt(list, cxListSize(list)); |
942 iter = cxListMutIteratorAt(list, cxListSize(list)); |
943 cxListInsertBefore(&iter, &newdata[3]); |
943 cxListInsertBefore(&iter, &newdata[3]); |
944 EXPECT_FALSE(cxIteratorValid(iter)); |
944 CX_TEST_ASSERT(!cxIteratorValid(iter)); |
945 EXPECT_EQ(iter.index, 9); |
945 EXPECT_EQ(iter.index, 9); |
946 iter = cxListMutIteratorAt(list, cxListSize(list)); |
946 iter = cxListMutIteratorAt(list, cxListSize(list)); |
947 cxListInsertAfter(&iter, &newdata[4]); |
947 cxListInsertAfter(&iter, &newdata[4]); |
948 EXPECT_FALSE(cxIteratorValid(iter)); |
948 CX_TEST_ASSERT(!cxIteratorValid(iter)); |
949 EXPECT_EQ(iter.index, 10); |
949 EXPECT_EQ(iter.index, 10); |
950 |
950 |
951 int expdata[] = {30, 0, 1, 20, 2, 10, 3, 4, 40, 50}; |
951 int expdata[] = {30, 0, 1, 20, 2, 10, 3, 4, 40, 50}; |
952 cx_for_n (j, 10) EXPECT_EQ(*(int *) cxListAt(list, j), expdata[j]); |
952 cx_for_n (j, 10) EXPECT_EQ(*(int *) cxListAt(list, j), expdata[j]); |
953 } |
953 } |
998 class PointerArrayList : public HighLevelTest { |
998 class PointerArrayList : public HighLevelTest { |
999 }; |
999 }; |
1000 |
1000 |
1001 TEST_F(PointerLinkedList, cxListStorePointers) { |
1001 TEST_F(PointerLinkedList, cxListStorePointers) { |
1002 auto list = autofree(cxLinkedListCreate(&testingAllocator, cx_cmp_int, 47)); |
1002 auto list = autofree(cxLinkedListCreate(&testingAllocator, cx_cmp_int, 47)); |
1003 EXPECT_FALSE(cxListIsStoringPointers(list)); |
1003 CX_TEST_ASSERT(!cxListIsStoringPointers(list)); |
1004 cxListStorePointers(list); |
1004 cxListStorePointers(list); |
1005 EXPECT_EQ(list->item_size, sizeof(void *)); |
1005 EXPECT_EQ(list->item_size, sizeof(void *)); |
1006 EXPECT_NE(list->cl, nullptr); |
1006 CX_TEST_ASSERT(list->cl != NULL); |
1007 EXPECT_NE(list->climpl, nullptr); |
1007 CX_TEST_ASSERT(list->climpl != NULL); |
1008 EXPECT_TRUE(cxListIsStoringPointers(list)); |
1008 CX_TEST_ASSERT(cxListIsStoringPointers(list)); |
1009 cxListStoreObjects(list); |
1009 cxListStoreObjects(list); |
1010 EXPECT_NE(list->cl, nullptr); |
1010 CX_TEST_ASSERT(list->cl != NULL); |
1011 EXPECT_EQ(list->climpl, nullptr); |
1011 EXPECT_EQ(list->climpl, NULL); |
1012 EXPECT_FALSE(cxListIsStoringPointers(list)); |
1012 CX_TEST_ASSERT(!cxListIsStoringPointers(list)); |
1013 } |
1013 } |
1014 |
1014 |
1015 TEST_F(LinkedList, cxLinkedListCreate) { |
1015 TEST_F(LinkedList, cxLinkedListCreate) { |
1016 CxList *list = autofree(cxLinkedListCreate(&testingAllocator, cx_cmp_int, sizeof(int))); |
1016 CxList *list = autofree(cxLinkedListCreate(&testingAllocator, cx_cmp_int, sizeof(int))); |
1017 ASSERT_NE(list, nullptr); |
1017 ASSERT_NE(list, NULL); |
1018 EXPECT_EQ(list->item_size, sizeof(int)); |
1018 EXPECT_EQ(list->item_size, sizeof(int)); |
1019 EXPECT_EQ(list->simple_destructor, nullptr); |
1019 EXPECT_EQ(list->simple_destructor, NULL); |
1020 EXPECT_EQ(list->advanced_destructor, nullptr); |
1020 EXPECT_EQ(list->advanced_destructor, NULL); |
1021 EXPECT_EQ(list->destructor_data, nullptr); |
1021 EXPECT_EQ(list->destructor_data, NULL); |
1022 EXPECT_EQ(cxListSize(list), 0); |
1022 EXPECT_EQ(cxListSize(list), 0); |
1023 EXPECT_EQ(list->allocator, &testingAllocator); |
1023 EXPECT_EQ(list->allocator, &testingAllocator); |
1024 EXPECT_EQ(list->cmpfunc, cx_cmp_int); |
1024 EXPECT_EQ(list->cmpfunc, cx_cmp_int); |
1025 EXPECT_FALSE(cxListIsStoringPointers(list)); |
1025 CX_TEST_ASSERT(!cxListIsStoringPointers(list)); |
1026 } |
1026 } |
1027 |
1027 |
1028 TEST_F(LinkedList, cxLinkedListCreateSimple) { |
1028 TEST_F(LinkedList, cxLinkedListCreateSimple) { |
1029 CxList *list = autofree(cxLinkedListCreateSimple(sizeof(int))); |
1029 CxList *list = autofree(cxLinkedListCreateSimple(sizeof(int))); |
1030 ASSERT_NE(list, nullptr); |
1030 ASSERT_NE(list, NULL); |
1031 EXPECT_EQ(list->item_size, sizeof(int)); |
1031 EXPECT_EQ(list->item_size, sizeof(int)); |
1032 EXPECT_EQ(list->cmpfunc, nullptr); |
1032 EXPECT_EQ(list->cmpfunc, NULL); |
1033 EXPECT_EQ(list->allocator, cxDefaultAllocator); |
1033 EXPECT_EQ(list->allocator, cxDefaultAllocator); |
1034 EXPECT_EQ(list->simple_destructor, nullptr); |
1034 EXPECT_EQ(list->simple_destructor, NULL); |
1035 EXPECT_EQ(list->advanced_destructor, nullptr); |
1035 EXPECT_EQ(list->advanced_destructor, NULL); |
1036 EXPECT_EQ(list->destructor_data, nullptr); |
1036 EXPECT_EQ(list->destructor_data, NULL); |
1037 EXPECT_EQ(cxListSize(list), 0); |
1037 EXPECT_EQ(cxListSize(list), 0); |
1038 EXPECT_FALSE(cxListIsStoringPointers(list)); |
1038 CX_TEST_ASSERT(!cxListIsStoringPointers(list)); |
1039 } |
1039 } |
1040 |
1040 |
1041 TEST_F(PointerLinkedList, cxLinkedListCreateSimpleForPointers) { |
1041 TEST_F(PointerLinkedList, cxLinkedListCreateSimpleForPointers) { |
1042 CxList *list = autofree(cxLinkedListCreateSimple(CX_STORE_POINTERS)); |
1042 CxList *list = autofree(cxLinkedListCreateSimple(CX_STORE_POINTERS)); |
1043 ASSERT_NE(list, nullptr); |
1043 ASSERT_NE(list, NULL); |
1044 EXPECT_EQ(list->item_size, sizeof(void *)); |
1044 EXPECT_EQ(list->item_size, sizeof(void *)); |
1045 EXPECT_EQ(list->cmpfunc, cx_cmp_ptr); |
1045 EXPECT_EQ(list->cmpfunc, cx_cmp_ptr); |
1046 EXPECT_EQ(list->allocator, cxDefaultAllocator); |
1046 EXPECT_EQ(list->allocator, cxDefaultAllocator); |
1047 EXPECT_EQ(list->simple_destructor, nullptr); |
1047 EXPECT_EQ(list->simple_destructor, NULL); |
1048 EXPECT_EQ(list->advanced_destructor, nullptr); |
1048 EXPECT_EQ(list->advanced_destructor, NULL); |
1049 EXPECT_EQ(list->destructor_data, nullptr); |
1049 EXPECT_EQ(list->destructor_data, NULL); |
1050 EXPECT_EQ(cxListSize(list), 0); |
1050 EXPECT_EQ(cxListSize(list), 0); |
1051 EXPECT_TRUE(cxListIsStoringPointers(list)); |
1051 CX_TEST_ASSERT(cxListIsStoringPointers(list)); |
1052 } |
1052 } |
1053 |
1053 |
1054 TEST_F(ArrayList, cxArrayListCreate) { |
1054 TEST_F(ArrayList, cxArrayListCreate) { |
1055 CxList *list = autofree(cxArrayListCreate(&testingAllocator, cx_cmp_int, sizeof(int), 8)); |
1055 CxList *list = autofree(cxArrayListCreate(&testingAllocator, cx_cmp_int, sizeof(int), 8)); |
1056 ASSERT_NE(list, nullptr); |
1056 ASSERT_NE(list, NULL); |
1057 EXPECT_EQ(list->item_size, sizeof(int)); |
1057 EXPECT_EQ(list->item_size, sizeof(int)); |
1058 EXPECT_EQ(list->simple_destructor, nullptr); |
1058 EXPECT_EQ(list->simple_destructor, NULL); |
1059 EXPECT_EQ(list->advanced_destructor, nullptr); |
1059 EXPECT_EQ(list->advanced_destructor, NULL); |
1060 EXPECT_EQ(list->destructor_data, nullptr); |
1060 EXPECT_EQ(list->destructor_data, NULL); |
1061 EXPECT_EQ(cxListSize(list), 0); |
1061 EXPECT_EQ(cxListSize(list), 0); |
1062 EXPECT_EQ(list->allocator, &testingAllocator); |
1062 EXPECT_EQ(list->allocator, &testingAllocator); |
1063 EXPECT_EQ(list->cmpfunc, cx_cmp_int); |
1063 EXPECT_EQ(list->cmpfunc, cx_cmp_int); |
1064 EXPECT_FALSE(cxListIsStoringPointers(list)); |
1064 CX_TEST_ASSERT(!cxListIsStoringPointers(list)); |
1065 } |
1065 } |
1066 |
1066 |
1067 TEST_F(ArrayList, cxArrayListCreateSimple) { |
1067 TEST_F(ArrayList, cxArrayListCreateSimple) { |
1068 CxList *list = autofree(cxArrayListCreateSimple(sizeof(int), 8)); |
1068 CxList *list = autofree(cxArrayListCreateSimple(sizeof(int), 8)); |
1069 ASSERT_NE(list, nullptr); |
1069 ASSERT_NE(list, NULL); |
1070 EXPECT_EQ(list->cmpfunc, nullptr); |
1070 EXPECT_EQ(list->cmpfunc, NULL); |
1071 EXPECT_EQ(list->allocator, cxDefaultAllocator); |
1071 EXPECT_EQ(list->allocator, cxDefaultAllocator); |
1072 EXPECT_EQ(list->item_size, sizeof(int)); |
1072 EXPECT_EQ(list->item_size, sizeof(int)); |
1073 EXPECT_EQ(list->simple_destructor, nullptr); |
1073 EXPECT_EQ(list->simple_destructor, NULL); |
1074 EXPECT_EQ(list->advanced_destructor, nullptr); |
1074 EXPECT_EQ(list->advanced_destructor, NULL); |
1075 EXPECT_EQ(list->destructor_data, nullptr); |
1075 EXPECT_EQ(list->destructor_data, NULL); |
1076 EXPECT_EQ(cxListSize(list), 0); |
1076 EXPECT_EQ(cxListSize(list), 0); |
1077 EXPECT_FALSE(cxListIsStoringPointers(list)); |
1077 CX_TEST_ASSERT(!cxListIsStoringPointers(list)); |
1078 } |
1078 } |
1079 |
1079 |
1080 TEST_F(PointerArrayList, cxArrayListCreateSimpleForPointers) { |
1080 TEST_F(PointerArrayList, cxArrayListCreateSimpleForPointers) { |
1081 CxList *list = autofree(cxArrayListCreateSimple(CX_STORE_POINTERS, 8)); |
1081 CxList *list = autofree(cxArrayListCreateSimple(CX_STORE_POINTERS, 8)); |
1082 ASSERT_NE(list, nullptr); |
1082 ASSERT_NE(list, NULL); |
1083 EXPECT_EQ(list->cmpfunc, cx_cmp_ptr); |
1083 EXPECT_EQ(list->cmpfunc, cx_cmp_ptr); |
1084 EXPECT_EQ(list->allocator, cxDefaultAllocator); |
1084 EXPECT_EQ(list->allocator, cxDefaultAllocator); |
1085 EXPECT_EQ(list->item_size, sizeof(void *)); |
1085 EXPECT_EQ(list->item_size, sizeof(void *)); |
1086 EXPECT_TRUE(cxListIsStoringPointers(list)); |
1086 CX_TEST_ASSERT(cxListIsStoringPointers(list)); |
1087 } |
1087 } |
1088 |
1088 |
1089 TEST_F(LinkedList, cxListAdd) { |
1089 TEST_F(LinkedList, cxListAdd) { |
1090 auto list = autofree(cxLinkedListCreate(&testingAllocator, cx_cmp_int, sizeof(int))); |
1090 auto list = autofree(cxLinkedListCreate(&testingAllocator, cx_cmp_int, sizeof(int))); |
1091 verifyAdd(list, false); |
1091 verifyAdd(list, false); |