Lines Matching refs:buf

52     struct alloc_buffer buf = refbuf;  in test_empty_array()  local
53 TEST_VERIFY ((alloc_buffer_alloc_bytes (&buf, 0) == NULL) in test_empty_array()
55 TEST_VERIFY (alloc_buffer_has_failed (&buf) == refbuf_failed); in test_empty_array()
58 struct alloc_buffer buf = refbuf; in test_empty_array() local
59 TEST_VERIFY ((alloc_buffer_alloc_array (&buf, char, 0) == NULL) in test_empty_array()
61 TEST_VERIFY (alloc_buffer_has_failed (&buf) == refbuf_failed); in test_empty_array()
66 struct alloc_buffer buf = refbuf; in test_empty_array() local
68 || !IS_ALIGNED (alloc_buffer_next (&buf, void), double); in test_empty_array()
69 double *ptr = alloc_buffer_alloc_array (&buf, double, 0); in test_empty_array()
72 TEST_VERIFY (alloc_buffer_has_failed (&buf) == expect_failure); in test_empty_array()
75 struct alloc_buffer buf = refbuf; in test_empty_array() local
77 || !IS_ALIGNED (alloc_buffer_next (&buf, void), struct twelve); in test_empty_array()
78 struct twelve *ptr = alloc_buffer_alloc_array (&buf, struct twelve, 0); in test_empty_array()
81 TEST_VERIFY (alloc_buffer_has_failed (&buf) == expect_failure); in test_empty_array()
103 struct alloc_buffer buf = refbuf; in test_impossible_array() local
104 TEST_VERIFY (alloc_buffer_alloc_bytes (&buf, count) == NULL); in test_impossible_array()
105 TEST_VERIFY (alloc_buffer_has_failed (&buf)); in test_impossible_array()
108 struct alloc_buffer buf = refbuf; in test_impossible_array() local
109 TEST_VERIFY (alloc_buffer_alloc_array (&buf, char, count) == NULL); in test_impossible_array()
110 TEST_VERIFY (alloc_buffer_has_failed (&buf)); in test_impossible_array()
113 struct alloc_buffer buf = refbuf; in test_impossible_array() local
114 TEST_VERIFY (alloc_buffer_alloc_array (&buf, short, count) == NULL); in test_impossible_array()
115 TEST_VERIFY (alloc_buffer_has_failed (&buf)); in test_impossible_array()
118 struct alloc_buffer buf = refbuf; in test_impossible_array() local
119 TEST_VERIFY (alloc_buffer_alloc_array (&buf, double, count) == NULL); in test_impossible_array()
120 TEST_VERIFY (alloc_buffer_has_failed (&buf)); in test_impossible_array()
123 struct alloc_buffer buf = refbuf; in test_impossible_array() local
124 TEST_VERIFY (alloc_buffer_alloc_array (&buf, struct twelve, count) in test_impossible_array()
126 TEST_VERIFY (alloc_buffer_has_failed (&buf)); in test_impossible_array()
141 struct alloc_buffer buf = refbuf; in test_after_failure() local
142 alloc_buffer_add_byte (&buf, 17); in test_after_failure()
143 TEST_VERIFY (alloc_buffer_has_failed (&buf)); in test_after_failure()
146 struct alloc_buffer buf = refbuf; in test_after_failure() local
147 TEST_VERIFY (alloc_buffer_alloc (&buf, char) == NULL); in test_after_failure()
148 TEST_VERIFY (alloc_buffer_has_failed (&buf)); in test_after_failure()
151 struct alloc_buffer buf = refbuf; in test_after_failure() local
152 TEST_VERIFY (alloc_buffer_alloc (&buf, double) == NULL); in test_after_failure()
153 TEST_VERIFY (alloc_buffer_has_failed (&buf)); in test_after_failure()
156 struct alloc_buffer buf = refbuf; in test_after_failure() local
157 TEST_VERIFY (alloc_buffer_alloc (&buf, struct twelve) == NULL); in test_after_failure()
158 TEST_VERIFY (alloc_buffer_has_failed (&buf)); in test_after_failure()
165 struct alloc_buffer buf = refbuf; in test_after_failure() local
166 TEST_VERIFY (alloc_buffer_alloc_bytes (&buf, count) == NULL); in test_after_failure()
167 TEST_VERIFY (alloc_buffer_has_failed (&buf)); in test_after_failure()
170 struct alloc_buffer buf = refbuf; in test_after_failure() local
171 TEST_VERIFY (alloc_buffer_alloc_array (&buf, char, count) == NULL); in test_after_failure()
172 TEST_VERIFY (alloc_buffer_has_failed (&buf)); in test_after_failure()
175 struct alloc_buffer buf = refbuf; in test_after_failure() local
176 TEST_VERIFY (alloc_buffer_alloc_array (&buf, double, count) == NULL); in test_after_failure()
177 TEST_VERIFY (alloc_buffer_has_failed (&buf)); in test_after_failure()
180 struct alloc_buffer buf = refbuf; in test_after_failure() local
181 TEST_VERIFY (alloc_buffer_alloc_array (&buf, struct twelve, count) in test_after_failure()
183 TEST_VERIFY (alloc_buffer_has_failed (&buf)); in test_after_failure()
199 struct alloc_buffer buf = refbuf; in test_empty() local
200 alloc_buffer_add_byte (&buf, 17); in test_empty()
201 test_after_failure (buf); in test_empty()
204 struct alloc_buffer buf = refbuf; in test_empty() local
205 TEST_VERIFY (alloc_buffer_alloc (&buf, char) == NULL); in test_empty()
206 test_after_failure (buf); in test_empty()
209 struct alloc_buffer buf = refbuf; in test_empty() local
210 TEST_VERIFY (alloc_buffer_alloc (&buf, double) == NULL); in test_empty()
211 test_after_failure (buf); in test_empty()
214 struct alloc_buffer buf = refbuf; in test_empty() local
215 TEST_VERIFY (alloc_buffer_alloc (&buf, struct twelve) == NULL); in test_empty()
216 test_after_failure (buf); in test_empty()
219 struct alloc_buffer buf = refbuf; in test_empty() local
220 TEST_VERIFY (alloc_buffer_alloc_array (&buf, char, 1) == NULL); in test_empty()
221 test_after_failure (buf); in test_empty()
224 struct alloc_buffer buf = refbuf; in test_empty() local
225 TEST_VERIFY (alloc_buffer_alloc_array (&buf, double, 1) == NULL); in test_empty()
226 test_after_failure (buf); in test_empty()
229 struct alloc_buffer buf = refbuf; in test_empty() local
230 TEST_VERIFY (alloc_buffer_alloc_array (&buf, struct twelve, 1) == NULL); in test_empty()
231 test_after_failure (buf); in test_empty()
245 struct alloc_buffer buf = refbuf; in test_size_1() local
246 alloc_buffer_add_byte (&buf, 17); in test_size_1()
247 TEST_VERIFY (!alloc_buffer_has_failed (&buf)); in test_size_1()
248 test_empty (buf); in test_size_1()
252 struct alloc_buffer buf = refbuf; in test_size_1() local
253 signed char *ptr = alloc_buffer_alloc (&buf, signed char); in test_size_1()
255 TEST_VERIFY (!alloc_buffer_has_failed (&buf)); in test_size_1()
257 test_empty (buf); in test_size_1()
261 struct alloc_buffer buf = refbuf; in test_size_1() local
262 char *ptr = alloc_buffer_alloc_array (&buf, char, 1); in test_size_1()
264 TEST_VERIFY (!alloc_buffer_has_failed (&buf)); in test_size_1()
266 test_empty (buf); in test_size_1()
272 struct alloc_buffer buf = refbuf; in test_size_1() local
273 TEST_VERIFY (alloc_buffer_alloc (&buf, short) == NULL); in test_size_1()
274 test_after_failure (buf); in test_size_1()
277 struct alloc_buffer buf = refbuf; in test_size_1() local
278 TEST_VERIFY (alloc_buffer_alloc (&buf, double) == NULL); in test_size_1()
279 test_after_failure (buf); in test_size_1()
282 struct alloc_buffer buf = refbuf; in test_size_1() local
283 TEST_VERIFY (alloc_buffer_alloc (&buf, struct twelve) == NULL); in test_size_1()
284 test_after_failure (buf); in test_size_1()
287 struct alloc_buffer buf = refbuf; in test_size_1() local
288 TEST_VERIFY (alloc_buffer_alloc_array (&buf, short, 1) == NULL); in test_size_1()
289 test_after_failure (buf); in test_size_1()
292 struct alloc_buffer buf = refbuf; in test_size_1() local
293 TEST_VERIFY (alloc_buffer_alloc_array (&buf, double, 1) == NULL); in test_size_1()
294 test_after_failure (buf); in test_size_1()
297 struct alloc_buffer buf = refbuf; in test_size_1() local
298 TEST_VERIFY (alloc_buffer_alloc_array (&buf, struct twelve, 1) == NULL); in test_size_1()
299 test_after_failure (buf); in test_size_1()
314 struct alloc_buffer buf = refbuf; in test_size_2() local
315 alloc_buffer_add_byte (&buf, '@'); in test_size_2()
316 TEST_VERIFY (!alloc_buffer_has_failed (&buf)); in test_size_2()
317 test_size_1 (buf); in test_size_2()
321 struct alloc_buffer buf = refbuf; in test_size_2() local
322 signed char *ptr = alloc_buffer_alloc (&buf, signed char); in test_size_2()
324 TEST_VERIFY (!alloc_buffer_has_failed (&buf)); in test_size_2()
326 test_size_1 (buf); in test_size_2()
330 struct alloc_buffer buf = refbuf; in test_size_2() local
331 char *ptr = alloc_buffer_alloc_array (&buf, char, 1); in test_size_2()
333 TEST_VERIFY (!alloc_buffer_has_failed (&buf)); in test_size_2()
335 test_size_1 (buf); in test_size_2()
339 struct alloc_buffer buf = refbuf; in test_size_2() local
340 unsigned short *ptr = alloc_buffer_alloc (&buf, unsigned short); in test_size_2()
343 TEST_VERIFY (!alloc_buffer_has_failed (&buf)); in test_size_2()
345 test_empty (buf); in test_size_2()
349 struct alloc_buffer buf = refbuf; in test_size_2() local
350 unsigned short *ptr = alloc_buffer_alloc_array (&buf, unsigned short, 1); in test_size_2()
353 TEST_VERIFY (!alloc_buffer_has_failed (&buf)); in test_size_2()
355 test_empty (buf); in test_size_2()
359 struct alloc_buffer buf = refbuf; in test_size_2() local
360 char *ptr = alloc_buffer_alloc_array (&buf, char, 2); in test_size_2()
362 TEST_VERIFY (!alloc_buffer_has_failed (&buf)); in test_size_2()
364 test_empty (buf); in test_size_2()
379 struct alloc_buffer buf = refbuf; in test_misaligned() local
380 short *ptr = alloc_buffer_alloc_array (&buf, short, SIZE / sizeof (short)); in test_misaligned()
383 TEST_VERIFY (!alloc_buffer_has_failed (&buf)); in test_misaligned()
392 struct alloc_buffer buf = refbuf; in test_misaligned() local
394 (&buf, uint32_t, SIZE / sizeof (uint32_t)); in test_misaligned()
397 TEST_VERIFY (!alloc_buffer_has_failed (&buf)); in test_misaligned()
406 struct alloc_buffer buf = refbuf; in test_misaligned() local
407 struct twelve *ptr = alloc_buffer_alloc (&buf, struct twelve); in test_misaligned()
410 TEST_VERIFY (!alloc_buffer_has_failed (&buf)); in test_misaligned()
421 struct alloc_buffer buf = refbuf; in test_misaligned() local
422 double *ptr = alloc_buffer_alloc_array (&buf, double, 2); in test_misaligned()
425 TEST_VERIFY (!alloc_buffer_has_failed (&buf)); in test_misaligned()
452 struct alloc_buffer buf = refbuf; in test_large_misaligned() local
453 TEST_VERIFY (alloc_buffer_alloc (&buf, struct align256) == NULL); in test_large_misaligned()
454 test_after_failure (buf); in test_large_misaligned()
458 struct alloc_buffer buf = refbuf; in test_large_misaligned() local
459 TEST_VERIFY (alloc_buffer_alloc_array (&buf, struct align256, count) in test_large_misaligned()
461 test_after_failure (buf); in test_large_misaligned()
471 struct alloc_buffer buf = { 1, SIZE_MAX }; in test_large() local
472 TEST_VERIFY (alloc_buffer_alloc_array (&buf, char, SIZE_MAX) == NULL); in test_large()
473 TEST_VERIFY (alloc_buffer_has_failed (&buf)); in test_large()
478 struct alloc_buffer buf = { 1, SIZE_MAX }; in test_large() local
480 (&buf, char, SIZE_MAX - 1); in test_large()
482 TEST_VERIFY (!alloc_buffer_has_failed (&buf)); in test_large()
483 test_empty (buf); in test_large()
490 struct alloc_buffer buf = { 1, SIZE_MAX }; in test_large() local
491 TEST_VERIFY (alloc_buffer_alloc_array (&buf, char2, SIZE_MAX - 1) == NULL); in test_large()
492 TEST_VERIFY (alloc_buffer_has_failed (&buf)); in test_large()
495 buf = (struct alloc_buffer) { 1, SIZE_MAX }; in test_large()
497 (&buf, char2, SIZE_MAX - 2); in test_large()
499 test_empty (buf); in test_large()
502 buf = (struct alloc_buffer) { SIZE_MAX, SIZE_MAX }; in test_large()
503 TEST_VERIFY (alloc_buffer_next (&buf, char2) == NULL); in test_large()
504 TEST_VERIFY (alloc_buffer_has_failed (&buf)); in test_large()
505 buf = (struct alloc_buffer) { SIZE_MAX, SIZE_MAX }; in test_large()
506 TEST_VERIFY (alloc_buffer_alloc_array (&buf, char2, 0) == NULL); in test_large()
507 TEST_VERIFY (alloc_buffer_has_failed (&buf)); in test_large()
514 struct alloc_buffer buf = { 1, SIZE_MAX }; in test_large() local
515 TEST_VERIFY (alloc_buffer_alloc_array (&buf, short2, SIZE_MAX / 2) in test_large()
517 TEST_VERIFY (alloc_buffer_has_failed (&buf)); in test_large()
520 buf = (struct alloc_buffer) { 2, SIZE_MAX - 1 }; in test_large()
522 (&buf, short2, SIZE_MAX / 2 - 1); in test_large()
524 test_empty (buf); in test_large()
534 struct alloc_buffer buf = alloc_buffer_create (backing, sizeof (backing)); in test_copy_bytes() local
535 alloc_buffer_copy_bytes (&buf, "1", 1); in test_copy_bytes()
536 TEST_VERIFY (!alloc_buffer_has_failed (&buf)); in test_copy_bytes()
537 TEST_VERIFY (alloc_buffer_size (&buf) == 3); in test_copy_bytes()
542 struct alloc_buffer buf = alloc_buffer_create (backing, sizeof (backing)); in test_copy_bytes() local
543 alloc_buffer_copy_bytes (&buf, "12", 3); in test_copy_bytes()
544 TEST_VERIFY (!alloc_buffer_has_failed (&buf)); in test_copy_bytes()
545 TEST_VERIFY (alloc_buffer_size (&buf) == 1); in test_copy_bytes()
550 struct alloc_buffer buf = alloc_buffer_create (backing, sizeof (backing)); in test_copy_bytes() local
551 alloc_buffer_copy_bytes (&buf, "1234", 4); in test_copy_bytes()
552 TEST_VERIFY (!alloc_buffer_has_failed (&buf)); in test_copy_bytes()
553 TEST_VERIFY (alloc_buffer_size (&buf) == 0); in test_copy_bytes()
558 struct alloc_buffer buf = alloc_buffer_create (backing, sizeof (backing)); in test_copy_bytes() local
559 alloc_buffer_copy_bytes (&buf, "1234", 5); in test_copy_bytes()
560 TEST_VERIFY (alloc_buffer_has_failed (&buf)); in test_copy_bytes()
565 struct alloc_buffer buf = alloc_buffer_create (backing, sizeof (backing)); in test_copy_bytes() local
566 alloc_buffer_copy_bytes (&buf, "1234", -1); in test_copy_bytes()
567 TEST_VERIFY (alloc_buffer_has_failed (&buf)); in test_copy_bytes()
578 struct alloc_buffer buf = alloc_buffer_create (backing, sizeof (backing)); in test_copy_string() local
579 const char *p = alloc_buffer_copy_string (&buf, ""); in test_copy_string()
582 TEST_VERIFY (!alloc_buffer_has_failed (&buf)); in test_copy_string()
583 TEST_VERIFY (alloc_buffer_size (&buf) == 3); in test_copy_string()
588 struct alloc_buffer buf = alloc_buffer_create (backing, sizeof (backing)); in test_copy_string() local
589 const char *p = alloc_buffer_copy_string (&buf, "1"); in test_copy_string()
592 TEST_VERIFY (!alloc_buffer_has_failed (&buf)); in test_copy_string()
593 TEST_VERIFY (alloc_buffer_size (&buf) == 2); in test_copy_string()
598 struct alloc_buffer buf = alloc_buffer_create (backing, sizeof (backing)); in test_copy_string() local
599 const char *p = alloc_buffer_copy_string (&buf, "12"); in test_copy_string()
602 TEST_VERIFY (!alloc_buffer_has_failed (&buf)); in test_copy_string()
603 TEST_VERIFY (alloc_buffer_size (&buf) == 1); in test_copy_string()
608 struct alloc_buffer buf = alloc_buffer_create (backing, sizeof (backing)); in test_copy_string() local
609 const char *p = alloc_buffer_copy_string (&buf, "123"); in test_copy_string()
612 TEST_VERIFY (!alloc_buffer_has_failed (&buf)); in test_copy_string()
613 TEST_VERIFY (alloc_buffer_size (&buf) == 0); in test_copy_string()
618 struct alloc_buffer buf = alloc_buffer_create (backing, sizeof (backing)); in test_copy_string() local
619 TEST_VERIFY (alloc_buffer_copy_string (&buf, "1234") == NULL); in test_copy_string()
620 TEST_VERIFY (alloc_buffer_has_failed (&buf)); in test_copy_string()
625 struct alloc_buffer buf = alloc_buffer_create (backing, sizeof (backing)); in test_copy_string() local
626 TEST_VERIFY (alloc_buffer_copy_string (&buf, "12345") == NULL); in test_copy_string()
627 TEST_VERIFY (alloc_buffer_has_failed (&buf)); in test_copy_string()
641 struct alloc_buffer buf = alloc_buffer_allocate (1, &ptr); in do_test() local
642 test_size_1 (buf); in do_test()
648 struct alloc_buffer buf = alloc_buffer_allocate (2, &ptr); in do_test() local
649 test_size_2 (buf); in do_test()