179 |
179 |
180 const char *h = "Hello"; |
180 const char *h = "Hello"; |
181 |
181 |
182 cxmutstr r[13]; |
182 cxmutstr r[13]; |
183 size_t specimen_count = cx_nmemb(r); |
183 size_t specimen_count = cx_nmemb(r); |
184 int specimen = 0; |
184 size_t specimen = 0; |
185 |
185 |
186 CX_TEST_DO { |
186 CX_TEST_DO { |
187 r[specimen] = cx_asprintf_a(alloc, "teststring"); |
187 r[specimen] = cx_asprintf_a(alloc, "teststring"); |
188 CX_TEST_ASSERT(r[specimen].length == 10); |
188 CX_TEST_ASSERT(r[specimen].length == 10); |
189 ASSERT_ZERO_TERMINATED(r[specimen]); |
189 ASSERT_ZERO_TERMINATED(r[specimen]); |
262 CX_TEST_ASSERT(0 == strcmp(r[specimen].ptr, "'x '")); |
262 CX_TEST_ASSERT(0 == strcmp(r[specimen].ptr, "'x '")); |
263 specimen++; |
263 specimen++; |
264 |
264 |
265 CX_TEST_ASSERT(specimen == specimen_count); // self-test |
265 CX_TEST_ASSERT(specimen == specimen_count); // self-test |
266 |
266 |
267 for (int i = 0; i < specimen_count; i++) { |
267 for (size_t i = 0; i < specimen_count; i++) { |
268 cx_strfree_a(alloc, &r[i]); |
268 cx_strfree_a(alloc, &r[i]); |
269 } |
269 } |
270 CX_TEST_ASSERT(cx_testing_allocator_verify(&talloc)); |
270 CX_TEST_ASSERT(cx_testing_allocator_verify(&talloc)); |
271 } |
271 } |
272 cx_testing_allocator_destroy(&talloc); |
272 cx_testing_allocator_destroy(&talloc); |