tests/test_buffer.c

Mon, 01 Jan 2024 16:42:37 +0100

author
Mike Becker <universe@uap-core.de>
date
Mon, 01 Jan 2024 16:42:37 +0100
changeset 789
9b2f5661bebd
child 792
3ca984931e1d
permissions
-rw-r--r--

begin migration of buffer tests - relates to #342

universe@789 1 /*
universe@789 2 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
universe@789 3 *
universe@789 4 * Copyright 2023 Mike Becker, Olaf Wintermann All rights reserved.
universe@789 5 *
universe@789 6 * Redistribution and use in source and binary forms, with or without
universe@789 7 * modification, are permitted provided that the following conditions are met:
universe@789 8 *
universe@789 9 * 1. Redistributions of source code must retain the above copyright
universe@789 10 * notice, this list of conditions and the following disclaimer.
universe@789 11 *
universe@789 12 * 2. Redistributions in binary form must reproduce the above copyright
universe@789 13 * notice, this list of conditions and the following disclaimer in the
universe@789 14 * documentation and/or other materials provided with the distribution.
universe@789 15 *
universe@789 16 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
universe@789 17 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
universe@789 18 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
universe@789 19 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
universe@789 20 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
universe@789 21 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
universe@789 22 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
universe@789 23 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
universe@789 24 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
universe@789 25 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
universe@789 26 * POSSIBILITY OF SUCH DAMAGE.
universe@789 27 */
universe@789 28
universe@789 29 #include "cx/test.h"
universe@789 30 #include "util_allocator.h"
universe@789 31
universe@789 32 #include "cx/buffer.h"
universe@789 33
universe@789 34 static CX_TEST_SUBROUTINE(expect_default_flush_config, CxBuffer *buf) {
universe@789 35 CX_TEST_ASSERT(buf->flush_blkmax == 0);
universe@789 36 CX_TEST_ASSERT(buf->flush_blksize == 4096);
universe@789 37 CX_TEST_ASSERT(buf->flush_threshold == SIZE_MAX);
universe@789 38 CX_TEST_ASSERT(buf->flush_func == NULL);
universe@789 39 CX_TEST_ASSERT(buf->flush_target == NULL);
universe@789 40 }
universe@789 41
universe@789 42 CX_TEST(test_buffer_init_wrap_space) {
universe@789 43 CxTestingAllocator talloc;
universe@789 44 cx_testing_allocator_init(&talloc);
universe@789 45 CxAllocator *alloc = &talloc.base;
universe@789 46 CX_TEST_DO {
universe@789 47 CxBuffer buf;
universe@789 48 void *space = cxMalloc(alloc, 16);
universe@789 49 cxBufferInit(&buf, space, 16, alloc, CX_BUFFER_DEFAULT);
universe@789 50 CX_TEST_CALL_SUBROUTINE(expect_default_flush_config, &buf);
universe@789 51 CX_TEST_ASSERT(buf.space == space);
universe@789 52 CX_TEST_ASSERT((buf.flags & CX_BUFFER_AUTO_EXTEND) == 0);
universe@789 53 CX_TEST_ASSERT((buf.flags & CX_BUFFER_FREE_CONTENTS) == 0);
universe@789 54 CX_TEST_ASSERT(buf.pos == 0);
universe@789 55 CX_TEST_ASSERT(buf.size == 0);
universe@789 56 CX_TEST_ASSERT(buf.capacity == 16);
universe@789 57 CX_TEST_ASSERT(buf.allocator == alloc);
universe@789 58 cxBufferDestroy(&buf);
universe@789 59 CX_TEST_ASSERT(!cx_testing_allocator_verify(&talloc));
universe@789 60 cxFree(alloc, space);
universe@789 61 CX_TEST_ASSERT(cx_testing_allocator_verify(&talloc));
universe@789 62 }
universe@789 63 cx_testing_allocator_destroy(&talloc);
universe@789 64 }
universe@789 65
universe@789 66 CX_TEST(test_buffer_init_wrap_space_auto_extend) {
universe@789 67 CxTestingAllocator talloc;
universe@789 68 cx_testing_allocator_init(&talloc);
universe@789 69 CxAllocator *alloc = &talloc.base;
universe@789 70 CX_TEST_DO {
universe@789 71 CxBuffer buf;
universe@789 72 void *space = cxMalloc(alloc, 16);
universe@789 73 cxBufferInit(&buf, space, 16, alloc, CX_BUFFER_AUTO_EXTEND);
universe@789 74 CX_TEST_CALL_SUBROUTINE(expect_default_flush_config, &buf);
universe@789 75 CX_TEST_ASSERT(buf.space == space);
universe@789 76 CX_TEST_ASSERT((buf.flags & CX_BUFFER_AUTO_EXTEND) == CX_BUFFER_AUTO_EXTEND);
universe@789 77 CX_TEST_ASSERT((buf.flags & CX_BUFFER_FREE_CONTENTS) == 0);
universe@789 78 CX_TEST_ASSERT(buf.pos == 0);
universe@789 79 CX_TEST_ASSERT(buf.size == 0);
universe@789 80 CX_TEST_ASSERT(buf.capacity == 16);
universe@789 81 CX_TEST_ASSERT(buf.allocator == alloc);
universe@789 82 cxBufferDestroy(&buf);
universe@789 83 CX_TEST_ASSERT(!cx_testing_allocator_verify(&talloc));
universe@789 84 cxFree(alloc, space);
universe@789 85 CX_TEST_ASSERT(cx_testing_allocator_verify(&talloc));
universe@789 86 }
universe@789 87 cx_testing_allocator_destroy(&talloc);
universe@789 88 }
universe@789 89
universe@789 90 CX_TEST(test_buffer_init_wrap_space_auto_free) {
universe@789 91 CxTestingAllocator talloc;
universe@789 92 cx_testing_allocator_init(&talloc);
universe@789 93 CxAllocator *alloc = &talloc.base;
universe@789 94 CX_TEST_DO {
universe@789 95 CxBuffer buf;
universe@789 96 void *space = cxMalloc(alloc, 16);
universe@789 97 cxBufferInit(&buf, space, 16, alloc, CX_BUFFER_FREE_CONTENTS);
universe@789 98 CX_TEST_CALL_SUBROUTINE(expect_default_flush_config, &buf);
universe@789 99 CX_TEST_ASSERT(buf.space == space);
universe@789 100 CX_TEST_ASSERT((buf.flags & CX_BUFFER_AUTO_EXTEND) == 0);
universe@789 101 CX_TEST_ASSERT((buf.flags & CX_BUFFER_FREE_CONTENTS) == CX_BUFFER_FREE_CONTENTS);
universe@789 102 CX_TEST_ASSERT(buf.pos == 0);
universe@789 103 CX_TEST_ASSERT(buf.size == 0);
universe@789 104 CX_TEST_ASSERT(buf.capacity == 16);
universe@789 105 CX_TEST_ASSERT(buf.allocator == alloc);
universe@789 106 CX_TEST_ASSERT(!cx_testing_allocator_verify(&talloc));
universe@789 107 cxBufferDestroy(&buf);
universe@789 108 CX_TEST_ASSERT(cx_testing_allocator_verify(&talloc));
universe@789 109 }
universe@789 110 cx_testing_allocator_destroy(&talloc);
universe@789 111 }
universe@789 112
universe@789 113 CX_TEST(test_buffer_init_fresh_space) {
universe@789 114 CxTestingAllocator talloc;
universe@789 115 cx_testing_allocator_init(&talloc);
universe@789 116 CxAllocator *alloc = &talloc.base;
universe@789 117 CX_TEST_DO {
universe@789 118 CxBuffer buf;
universe@789 119 cxBufferInit(&buf, NULL, 8, alloc, CX_BUFFER_DEFAULT);
universe@789 120 CX_TEST_CALL_SUBROUTINE(expect_default_flush_config, &buf);
universe@789 121 CX_TEST_ASSERT(buf.space != NULL);
universe@789 122 CX_TEST_ASSERT((buf.flags & CX_BUFFER_AUTO_EXTEND) == 0);
universe@789 123 CX_TEST_ASSERT((buf.flags & CX_BUFFER_FREE_CONTENTS) == CX_BUFFER_FREE_CONTENTS);
universe@789 124 CX_TEST_ASSERT(buf.pos == 0);
universe@789 125 CX_TEST_ASSERT(buf.size == 0);
universe@789 126 CX_TEST_ASSERT(buf.capacity == 8);
universe@789 127 CX_TEST_ASSERT(buf.allocator == alloc);
universe@789 128 CX_TEST_ASSERT(!cx_testing_allocator_verify(&talloc)); // space is still allocated
universe@789 129 cxBufferDestroy(&buf);
universe@789 130 CX_TEST_ASSERT(cx_testing_allocator_verify(&talloc));
universe@789 131 }
universe@789 132 cx_testing_allocator_destroy(&talloc);
universe@789 133 }
universe@789 134
universe@789 135 CX_TEST(test_buffer_init_on_heap) {
universe@789 136 CxTestingAllocator talloc;
universe@789 137 cx_testing_allocator_init(&talloc);
universe@789 138 CxAllocator *alloc = &talloc.base;
universe@789 139 CX_TEST_DO {
universe@789 140 CxBuffer *buf;
universe@789 141 void *space = cxMalloc(alloc, 16);
universe@789 142 buf = cxBufferCreate(space, 16, alloc, CX_BUFFER_FREE_CONTENTS);
universe@789 143 CX_TEST_ASSERT(buf != NULL);
universe@789 144 CX_TEST_CALL_SUBROUTINE(expect_default_flush_config, buf);
universe@789 145 CX_TEST_ASSERT(buf->space == space);
universe@789 146 CX_TEST_ASSERT((buf->flags & CX_BUFFER_AUTO_EXTEND) == 0);
universe@789 147 CX_TEST_ASSERT((buf->flags & CX_BUFFER_FREE_CONTENTS) == CX_BUFFER_FREE_CONTENTS);
universe@789 148 CX_TEST_ASSERT(buf->pos == 0);
universe@789 149 CX_TEST_ASSERT(buf->size == 0);
universe@789 150 CX_TEST_ASSERT(buf->capacity == 16);
universe@789 151 CX_TEST_ASSERT(buf->allocator == alloc);
universe@789 152 cxBufferFree(buf);
universe@789 153 CX_TEST_ASSERT(cx_testing_allocator_verify(&talloc));
universe@789 154 }
universe@789 155 cx_testing_allocator_destroy(&talloc);
universe@789 156 }
universe@789 157
universe@789 158 CX_TEST(test_buffer_minimum_capacity_sufficient) {
universe@789 159 CxTestingAllocator talloc;
universe@789 160 cx_testing_allocator_init(&talloc);
universe@789 161 CxAllocator *alloc = &talloc.base;
universe@789 162 CX_TEST_DO {
universe@789 163 void *space = cxMalloc(alloc, 8);
universe@789 164 CxBuffer buf;
universe@789 165 cxBufferInit(&buf, space, 8, alloc, CX_BUFFER_FREE_CONTENTS);
universe@789 166 memcpy(space, "Testing", 8);
universe@789 167 buf.size = 8;
universe@789 168 cxBufferMinimumCapacity(&buf, 6);
universe@789 169 CX_TEST_ASSERT(buf.capacity == 8);
universe@789 170 CX_TEST_ASSERT(buf.size == 8);
universe@789 171 CX_TEST_ASSERT(memcmp(buf.space, "Testing", 8) == 0);
universe@789 172 cxBufferDestroy(&buf);
universe@789 173 CX_TEST_ASSERT(cx_testing_allocator_verify(&talloc));
universe@789 174 }
universe@789 175 cx_testing_allocator_destroy(&talloc);
universe@789 176 }
universe@789 177
universe@789 178 CX_TEST(test_buffer_minimum_capacity_extend) {
universe@789 179 CxTestingAllocator talloc;
universe@789 180 cx_testing_allocator_init(&talloc);
universe@789 181 CxAllocator *alloc = &talloc.base;
universe@789 182 CX_TEST_DO {
universe@789 183 void *space = cxMalloc(alloc, 8);
universe@789 184 CxBuffer buf;
universe@789 185 cxBufferInit(&buf, space, 8, alloc, CX_BUFFER_FREE_CONTENTS); // NO auto extend!
universe@789 186 memcpy(space, "Testing", 8);
universe@789 187 buf.size = 8;
universe@789 188 cxBufferMinimumCapacity(&buf, 16);
universe@789 189 CX_TEST_ASSERT(buf.capacity == 16);
universe@789 190 CX_TEST_ASSERT(buf.size == 8);
universe@789 191 CX_TEST_ASSERT(memcmp(buf.space, "Testing", 8) == 0);
universe@789 192 cxBufferDestroy(&buf);
universe@789 193 CX_TEST_ASSERT(cx_testing_allocator_verify(&talloc));
universe@789 194 }
universe@789 195 cx_testing_allocator_destroy(&talloc);
universe@789 196 }
universe@789 197
universe@789 198 CX_TEST(test_buffer_clear) {
universe@789 199 char space[16];
universe@789 200 strcpy(space, "clear test");
universe@789 201 CxBuffer buf;
universe@789 202 cxBufferInit(&buf, space, 16, cxDefaultAllocator, CX_BUFFER_DEFAULT);
universe@789 203 CX_TEST_DO {
universe@789 204 CX_TEST_ASSERT(buf.size == 0);
universe@789 205 // only clear the used part of the buffer
universe@789 206 cxBufferClear(&buf);
universe@789 207 CX_TEST_ASSERT(0 == memcmp(space, "clear test", 10));
universe@789 208 buf.size = 5;
universe@789 209 buf.pos = 3;
universe@789 210 cxBufferClear(&buf);
universe@789 211 CX_TEST_ASSERT(0 == memcmp(space, "\0\0\0\0\0 test", 10));
universe@789 212 CX_TEST_ASSERT(buf.size == 0);
universe@789 213 CX_TEST_ASSERT(buf.pos == 0);
universe@789 214 }
universe@789 215 cxBufferDestroy(&buf);
universe@789 216 }
universe@789 217
universe@789 218 CX_TEST(test_buffer_reset) {
universe@789 219 char space[16];
universe@789 220 strcpy(space, "reset test");
universe@789 221 CxBuffer buf;
universe@789 222 cxBufferInit(&buf, space, 16, cxDefaultAllocator, CX_BUFFER_DEFAULT);
universe@789 223 CX_TEST_DO {
universe@789 224 buf.size = 5;
universe@789 225 buf.pos = 3;
universe@789 226 cxBufferReset(&buf);
universe@789 227 CX_TEST_ASSERT(0 == memcmp(space, "reset test", 10));
universe@789 228 CX_TEST_ASSERT(buf.size == 0);
universe@789 229 CX_TEST_ASSERT(buf.pos == 0);
universe@789 230 }
universe@789 231 cxBufferDestroy(&buf);
universe@789 232 }
universe@789 233
universe@789 234 CX_TEST(test_buffer_seek_set_zero) {
universe@789 235 CxBuffer buf;
universe@789 236 cxBufferInit(&buf, NULL, 16, cxDefaultAllocator, CX_BUFFER_DEFAULT);
universe@789 237 buf.size = 6;
universe@789 238 buf.pos = 3;
universe@789 239 CX_TEST_DO {
universe@789 240 int result = cxBufferSeek(&buf, 0, SEEK_SET);
universe@789 241 CX_TEST_ASSERT(result == 0);
universe@789 242 CX_TEST_ASSERT(buf.pos == 0);
universe@789 243 }
universe@789 244 cxBufferDestroy(&buf);
universe@789 245 }
universe@789 246
universe@789 247 CX_TEST(test_buffer_seek_set_valid) {
universe@789 248 CxBuffer buf;
universe@789 249 cxBufferInit(&buf, NULL, 16, cxDefaultAllocator, CX_BUFFER_DEFAULT);
universe@789 250 buf.size = 6;
universe@789 251 buf.pos = 3;
universe@789 252 CX_TEST_DO {
universe@789 253 int result = cxBufferSeek(&buf, 5, SEEK_SET);
universe@789 254 CX_TEST_ASSERT(result == 0);
universe@789 255 CX_TEST_ASSERT(buf.pos == 5);
universe@789 256 }
universe@789 257 cxBufferDestroy(&buf);
universe@789 258 }
universe@789 259
universe@789 260 CX_TEST(test_buffer_seek_set_invalid) {
universe@789 261 CxBuffer buf;
universe@789 262 cxBufferInit(&buf, NULL, 16, cxDefaultAllocator, CX_BUFFER_DEFAULT);
universe@789 263 buf.size = 6;
universe@789 264 buf.pos = 3;
universe@789 265 CX_TEST_DO {
universe@789 266 int result = cxBufferSeek(&buf, 6, SEEK_SET);
universe@789 267 CX_TEST_ASSERT(result != 0);
universe@789 268 CX_TEST_ASSERT(buf.pos == 3);
universe@789 269 }
universe@789 270 cxBufferDestroy(&buf);
universe@789 271 }
universe@789 272
universe@789 273 CX_TEST(test_buffer_seek_cur_zero) {
universe@789 274 CxBuffer buf;
universe@789 275 cxBufferInit(&buf, NULL, 16, cxDefaultAllocator, CX_BUFFER_DEFAULT);
universe@789 276 buf.size = 6;
universe@789 277 buf.pos = 3;
universe@789 278 CX_TEST_DO {
universe@789 279 int result = cxBufferSeek(&buf, 0, SEEK_CUR);
universe@789 280 CX_TEST_ASSERT(result == 0);
universe@789 281 CX_TEST_ASSERT(buf.pos == 3);
universe@789 282 }
universe@789 283 cxBufferDestroy(&buf);
universe@789 284 }
universe@789 285
universe@789 286 CX_TEST(test_buffer_seek_cur_valid_positive) {
universe@789 287 CxBuffer buf;
universe@789 288 cxBufferInit(&buf, NULL, 16, cxDefaultAllocator, CX_BUFFER_DEFAULT);
universe@789 289 buf.size = 6;
universe@789 290 buf.pos = 3;
universe@789 291 CX_TEST_DO {
universe@789 292 int result = cxBufferSeek(&buf, 2, SEEK_CUR);
universe@789 293 CX_TEST_ASSERT(result == 0);
universe@789 294 CX_TEST_ASSERT(buf.pos == 5);
universe@789 295 }
universe@789 296 cxBufferDestroy(&buf);
universe@789 297 }
universe@789 298
universe@789 299 CX_TEST(test_buffer_seek_cur_valid_negative) {
universe@789 300 CxBuffer buf;
universe@789 301 cxBufferInit(&buf, NULL, 16, cxDefaultAllocator, CX_BUFFER_DEFAULT);
universe@789 302 buf.size = 6;
universe@789 303 buf.pos = 3;
universe@789 304 CX_TEST_DO {
universe@789 305 int result = cxBufferSeek(&buf, -3, SEEK_CUR);
universe@789 306 CX_TEST_ASSERT(result == 0);
universe@789 307 CX_TEST_ASSERT(buf.pos == 0);
universe@789 308 }
universe@789 309 cxBufferDestroy(&buf);
universe@789 310 }
universe@789 311
universe@789 312 CX_TEST(test_buffer_seek_cur_invalid_positive) {
universe@789 313 CxBuffer buf;
universe@789 314 cxBufferInit(&buf, NULL, 16, cxDefaultAllocator, CX_BUFFER_DEFAULT);
universe@789 315 buf.size = 6;
universe@789 316 buf.pos = 3;
universe@789 317 CX_TEST_DO {
universe@789 318 int result = cxBufferSeek(&buf, 3, SEEK_CUR);
universe@789 319 CX_TEST_ASSERT(result != 0);
universe@789 320 CX_TEST_ASSERT(buf.pos == 3);
universe@789 321 }
universe@789 322 cxBufferDestroy(&buf);
universe@789 323 }
universe@789 324
universe@789 325 CX_TEST(test_buffer_seek_cur_invalid_negative) {
universe@789 326 CxBuffer buf;
universe@789 327 cxBufferInit(&buf, NULL, 16, cxDefaultAllocator, CX_BUFFER_DEFAULT);
universe@789 328 buf.size = 6;
universe@789 329 buf.pos = 3;
universe@789 330 CX_TEST_DO {
universe@789 331 int result = cxBufferSeek(&buf, -4, SEEK_CUR);
universe@789 332 CX_TEST_ASSERT(result != 0);
universe@789 333 CX_TEST_ASSERT(buf.pos == 3);
universe@789 334 }
universe@789 335 cxBufferDestroy(&buf);
universe@789 336 }
universe@789 337
universe@789 338 CX_TEST(test_buffer_seek_end_zero) {
universe@789 339 CxBuffer buf;
universe@789 340 cxBufferInit(&buf, NULL, 16, cxDefaultAllocator, CX_BUFFER_DEFAULT);
universe@789 341 buf.size = 6;
universe@789 342 buf.pos = 3;
universe@789 343 CX_TEST_DO {
universe@789 344 int result = cxBufferSeek(&buf, 0, SEEK_END);
universe@789 345 // the (past-the-)end position is always invalid
universe@789 346 CX_TEST_ASSERT(result != 0);
universe@789 347 CX_TEST_ASSERT(buf.pos == 3);
universe@789 348 }
universe@789 349 cxBufferDestroy(&buf);
universe@789 350 }
universe@789 351
universe@789 352 CX_TEST(test_buffer_seek_end_valid) {
universe@789 353 CxBuffer buf;
universe@789 354 cxBufferInit(&buf, NULL, 16, cxDefaultAllocator, CX_BUFFER_DEFAULT);
universe@789 355 buf.size = 6;
universe@789 356 buf.pos = 3;
universe@789 357 CX_TEST_DO {
universe@789 358 int result = cxBufferSeek(&buf, -6, SEEK_END);
universe@789 359 CX_TEST_ASSERT(result == 0);
universe@789 360 CX_TEST_ASSERT(buf.pos == 0);
universe@789 361 }
universe@789 362 cxBufferDestroy(&buf);
universe@789 363 }
universe@789 364
universe@789 365 CX_TEST(test_buffer_seek_end_invalid) {
universe@789 366 CxBuffer buf;
universe@789 367 cxBufferInit(&buf, NULL, 16, cxDefaultAllocator, CX_BUFFER_DEFAULT);
universe@789 368 buf.size = 6;
universe@789 369 buf.pos = 3;
universe@789 370 CX_TEST_DO {
universe@789 371 int result = cxBufferSeek(&buf, 1, SEEK_END);
universe@789 372 CX_TEST_ASSERT(result != 0);
universe@789 373 CX_TEST_ASSERT(buf.pos == 3);
universe@789 374 }
universe@789 375 cxBufferDestroy(&buf);
universe@789 376 }
universe@789 377
universe@789 378 CX_TEST(test_buffer_seek_whence_invalid) {
universe@789 379 CxBuffer buf;
universe@789 380 cxBufferInit(&buf, NULL, 16, cxDefaultAllocator, CX_BUFFER_DEFAULT);
universe@789 381 buf.size = 6;
universe@789 382 buf.pos = 3;
universe@789 383 CX_TEST_DO {
universe@789 384 int result = cxBufferSeek(&buf, 2, 9000);
universe@789 385 CX_TEST_ASSERT(result != 0);
universe@789 386 CX_TEST_ASSERT(buf.size == 6);
universe@789 387 CX_TEST_ASSERT(buf.pos == 3);
universe@789 388 }
universe@789 389 cxBufferDestroy(&buf);
universe@789 390 }
universe@789 391
universe@789 392 CxTestSuite *cx_test_suite_buffer(void) {
universe@789 393 CxTestSuite *suite = cx_test_suite_new("buffer");
universe@789 394
universe@789 395 cx_test_register(suite, test_buffer_init_wrap_space);
universe@789 396 cx_test_register(suite, test_buffer_init_wrap_space_auto_extend);
universe@789 397 cx_test_register(suite, test_buffer_init_wrap_space_auto_free);
universe@789 398 cx_test_register(suite, test_buffer_init_fresh_space);
universe@789 399 cx_test_register(suite, test_buffer_init_on_heap);
universe@789 400 cx_test_register(suite, test_buffer_minimum_capacity_sufficient);
universe@789 401 cx_test_register(suite, test_buffer_minimum_capacity_extend);
universe@789 402 cx_test_register(suite, test_buffer_clear);
universe@789 403 cx_test_register(suite, test_buffer_reset);
universe@789 404 cx_test_register(suite, test_buffer_seek_set_zero);
universe@789 405 cx_test_register(suite, test_buffer_seek_set_valid);
universe@789 406 cx_test_register(suite, test_buffer_seek_set_invalid);
universe@789 407 cx_test_register(suite, test_buffer_seek_cur_zero);
universe@789 408 cx_test_register(suite, test_buffer_seek_cur_valid_positive);
universe@789 409 cx_test_register(suite, test_buffer_seek_cur_valid_negative);
universe@789 410 cx_test_register(suite, test_buffer_seek_cur_invalid_positive);
universe@789 411 cx_test_register(suite, test_buffer_seek_cur_invalid_negative);
universe@789 412 cx_test_register(suite, test_buffer_seek_end_zero);
universe@789 413 cx_test_register(suite, test_buffer_seek_end_valid);
universe@789 414 cx_test_register(suite, test_buffer_seek_end_invalid);
universe@789 415 cx_test_register(suite, test_buffer_seek_whence_invalid);
universe@789 416
universe@789 417 return suite;
universe@789 418 }

mercurial