Mon, 05 May 2014 13:53:27 +0200
added allocator tests + started refactoring UcxBuffer tests (HINT: don't fix issues yet, complete tests first)
test/Makefile | file | annotate | diff | comparison | revisions | |
test/allocator_tests.c | file | annotate | diff | comparison | revisions | |
test/allocator_tests.h | file | annotate | diff | comparison | revisions | |
test/buffer_tests.c | file | annotate | diff | comparison | revisions | |
test/buffer_tests.h | file | annotate | diff | comparison | revisions | |
test/main.c | file | annotate | diff | comparison | revisions |
1.1 --- a/test/Makefile Thu Apr 17 14:33:06 2014 +0200 1.2 +++ b/test/Makefile Mon May 05 13:53:27 2014 +0200 1.3 @@ -29,6 +29,7 @@ 1.4 include ../$(CONF).mk 1.5 1.6 SRC = main.c 1.7 +SRC += allocator_tests.c 1.8 SRC += list_tests.c 1.9 SRC += mpool_tests.c 1.10 SRC += map_tests.c
2.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 2.2 +++ b/test/allocator_tests.c Mon May 05 13:53:27 2014 +0200 2.3 @@ -0,0 +1,41 @@ 2.4 +/* 2.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. 2.6 + * 2.7 + * Copyright 2013 Olaf Wintermann. All rights reserved. 2.8 + * 2.9 + * Redistribution and use in source and binary forms, with or without 2.10 + * modification, are permitted provided that the following conditions are met: 2.11 + * 2.12 + * 1. Redistributions of source code must retain the above copyright 2.13 + * notice, this list of conditions and the following disclaimer. 2.14 + * 2.15 + * 2. Redistributions in binary form must reproduce the above copyright 2.16 + * notice, this list of conditions and the following disclaimer in the 2.17 + * documentation and/or other materials provided with the distribution. 2.18 + * 2.19 + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 2.20 + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 2.21 + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 2.22 + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 2.23 + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 2.24 + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 2.25 + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 2.26 + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 2.27 + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 2.28 + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 2.29 + * POSSIBILITY OF SUCH DAMAGE. 2.30 + */ 2.31 + 2.32 +#include "allocator_tests.h" 2.33 + 2.34 +UCX_TEST(test_ucx_default_allocator) { 2.35 + UcxAllocator *alloc = ucx_default_allocator(); 2.36 + 2.37 + UCX_TEST_BEGIN 2.38 + UCX_TEST_ASSERT(alloc->pool == NULL, "pool must be NULL"); 2.39 + UCX_TEST_ASSERT(alloc->malloc == ucx_default_malloc, "wrong malloc"); 2.40 + UCX_TEST_ASSERT(alloc->calloc == ucx_default_calloc, "wrong calloc"); 2.41 + UCX_TEST_ASSERT(alloc->realloc == ucx_default_realloc, "wrong realloc"); 2.42 + UCX_TEST_ASSERT(alloc->free == ucx_default_free, "wrong free"); 2.43 + UCX_TEST_END 2.44 +}
3.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 3.2 +++ b/test/allocator_tests.h Mon May 05 13:53:27 2014 +0200 3.3 @@ -0,0 +1,46 @@ 3.4 +/* 3.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. 3.6 + * 3.7 + * Copyright 2013 Olaf Wintermann. All rights reserved. 3.8 + * 3.9 + * Redistribution and use in source and binary forms, with or without 3.10 + * modification, are permitted provided that the following conditions are met: 3.11 + * 3.12 + * 1. Redistributions of source code must retain the above copyright 3.13 + * notice, this list of conditions and the following disclaimer. 3.14 + * 3.15 + * 2. Redistributions in binary form must reproduce the above copyright 3.16 + * notice, this list of conditions and the following disclaimer in the 3.17 + * documentation and/or other materials provided with the distribution. 3.18 + * 3.19 + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 3.20 + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 3.21 + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 3.22 + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 3.23 + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 3.24 + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 3.25 + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 3.26 + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 3.27 + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 3.28 + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 3.29 + * POSSIBILITY OF SUCH DAMAGE. 3.30 + */ 3.31 + 3.32 +#ifndef ALLOCATOR_TEST_H 3.33 +#define ALLOCATOR_TEST_H 3.34 + 3.35 +#include "ucx/test.h" 3.36 +#include "ucx/allocator.h" 3.37 + 3.38 +#ifdef __cplusplus 3.39 +extern "C" { 3.40 +#endif 3.41 + 3.42 +UCX_TEST(test_ucx_default_allocator); 3.43 + 3.44 +#ifdef __cplusplus 3.45 +} 3.46 +#endif 3.47 + 3.48 +#endif /* ALLOCATOR_TEST_H */ 3.49 +
4.1 --- a/test/buffer_tests.c Thu Apr 17 14:33:06 2014 +0200 4.2 +++ b/test/buffer_tests.c Mon May 05 13:53:27 2014 +0200 4.3 @@ -29,9 +29,120 @@ 4.4 #include "buffer_tests.h" 4.5 #include "ucx/utils.h" 4.6 4.7 -UCX_TEST(test_ucx_buffer_seek) { 4.8 +/* 4.9 + * TODO: refactor tests 4.10 + * 4.11 + * ucx_buffer_extend 4.12 + * ucx_buffer_extract 4.13 + * ucx_buffer_free 4.14 + * ucx_buffer_getc 4.15 + * ucx_buffer_new 4.16 + * ucx_buffer_puts 4.17 + * ucx_buffer_read 4.18 + * ucx_buffer_write 4.19 + * 4.20 + */ 4.21 + 4.22 +UCX_TEST(test_ucx_buffer_eof) { 4.23 + char *test = "0123456789ABCDEF"; 4.24 + UcxBuffer *b = ucx_buffer_new(test, 16, UCX_BUFFER_DEFAULT); 4.25 + UCX_TEST_BEGIN 4.26 + b->pos = 9; b->size = 10; 4.27 + UCX_TEST_ASSERT(!ucx_buffer_eof(b), "false positive"); 4.28 + b->pos = 10; b->size = 10; 4.29 + UCX_TEST_ASSERT(ucx_buffer_eof(b), "pos == size should be EOF"); 4.30 + b->pos = 11; b->size = 10; 4.31 + UCX_TEST_ASSERT(ucx_buffer_eof(b), "false negative"); 4.32 + UCX_TEST_END 4.33 +} 4.34 + 4.35 +UCX_TEST(test_ucx_buffer_seek_overflow) { 4.36 + UcxBuffer *b = ucx_buffer_new(NULL, 32, UCX_BUFFER_DEFAULT); 4.37 + b->size = 32; 4.38 + int r; 4.39 + 4.40 + UCX_TEST_BEGIN 4.41 + size_t bigpos = SIZE_MAX - 5000; 4.42 + b->pos = bigpos; 4.43 + r = ucx_buffer_seek(b, 5016, SEEK_CUR); 4.44 + UCX_TEST_ASSERT(r != 0, "seek cur overflow"); 4.45 + UCX_TEST_ASSERT(b->pos == bigpos, 4.46 + "failed seek shall leave pos unchanged"); 4.47 + 4.48 + b->pos = 0; 4.49 + b->size = SIZE_MAX / 2 + 32; 4.50 + off_t bigoff = SIZE_MAX / 2 - 16; 4.51 + r = ucx_buffer_seek(b, -bigoff, SEEK_CUR); 4.52 + UCX_TEST_ASSERT(r != 0, "seek cur underflow"); 4.53 + UCX_TEST_ASSERT(b->pos == 0, 4.54 + "failed seek shall leave pos unchanged"); 4.55 + 4.56 + UCX_TEST_END 4.57 + 4.58 + ucx_buffer_free(b); 4.59 +} 4.60 + 4.61 +UCX_TEST(test_ucx_buffer_seek_invalid) { 4.62 + UcxBuffer *b = ucx_buffer_new(NULL, 32, UCX_BUFFER_DEFAULT); 4.63 + b->pos = 7; 4.64 + int r; 4.65 + 4.66 + UCX_TEST_BEGIN 4.67 + r = ucx_buffer_seek(b, 0, ~(SEEK_SET|SEEK_CUR|SEEK_END)); 4.68 + UCX_TEST_ASSERT(r != 0, "invalid whence shall fail"); 4.69 + UCX_TEST_ASSERT(b->pos == 7, 4.70 + "failed seek shall leave pos unchanged"); 4.71 + UCX_TEST_END 4.72 + 4.73 + ucx_buffer_free(b); 4.74 +} 4.75 + 4.76 +UCX_TEST(test_ucx_buffer_seek_oob) { 4.77 UcxBuffer *b = ucx_buffer_new(NULL, 32, UCX_BUFFER_DEFAULT); 4.78 b->size = 16; // less than capacity 4.79 + b->pos = 7; 4.80 + int r; 4.81 + 4.82 + UCX_TEST_BEGIN 4.83 + 4.84 + r = ucx_buffer_seek(b, -1, SEEK_SET); 4.85 + UCX_TEST_ASSERT(r != 0, "seek SET below bounds shall fail"); 4.86 + UCX_TEST_ASSERT(b->pos == 7, 4.87 + "failed seek shall leave pos unchanged"); 4.88 + 4.89 + r = ucx_buffer_seek(b, 16, SEEK_SET); 4.90 + UCX_TEST_ASSERT(r != 0, "seek SET above bounds shall fail"); 4.91 + UCX_TEST_ASSERT(b->pos == 7, 4.92 + "failed seek shall leave pos unchanged"); 4.93 + 4.94 + r = ucx_buffer_seek(b, -8, SEEK_CUR); 4.95 + UCX_TEST_ASSERT(r != 0, "seek CUR below bounds shall fail"); 4.96 + UCX_TEST_ASSERT(b->pos == 7, 4.97 + "failed seek shall leave pos unchanged"); 4.98 + 4.99 + r = ucx_buffer_seek(b, 9, SEEK_CUR); 4.100 + UCX_TEST_ASSERT(r != 0, "seek CUR above bounds shall fail"); 4.101 + UCX_TEST_ASSERT(b->pos == 7, 4.102 + "failed seek shall leave pos unchanged"); 4.103 + 4.104 + r = ucx_buffer_seek(b, -17, SEEK_END); 4.105 + UCX_TEST_ASSERT(r != 0, "seek END below bounds shall fail"); 4.106 + UCX_TEST_ASSERT(b->pos == 7, 4.107 + "failed seek shall leave pos unchanged"); 4.108 + 4.109 + r = ucx_buffer_seek(b, 1, SEEK_END); 4.110 + UCX_TEST_ASSERT(r != 0, "seek END above bounds shall fail"); 4.111 + UCX_TEST_ASSERT(b->pos == 7, 4.112 + "failed seek shall leave pos unchanged"); 4.113 + 4.114 + UCX_TEST_END 4.115 + 4.116 + ucx_buffer_free(b); 4.117 +} 4.118 + 4.119 +UCX_TEST(test_ucx_buffer_seek_set) { 4.120 + UcxBuffer *b = ucx_buffer_new(NULL, 32, UCX_BUFFER_DEFAULT); 4.121 + b->size = 16; 4.122 int r; 4.123 4.124 UCX_TEST_BEGIN 4.125 @@ -39,29 +150,45 @@ 4.126 r = ucx_buffer_seek(b, 5, SEEK_SET); 4.127 UCX_TEST_ASSERT(r == 0, "seek SET+5 failed"); 4.128 UCX_TEST_ASSERT(b->pos == 5, "seek SET+5 set wrong position"); 4.129 + 4.130 + 4.131 + r = ucx_buffer_seek(b, 10, SEEK_SET); 4.132 + UCX_TEST_ASSERT(r == 0, "seek SET+10 failed"); 4.133 + UCX_TEST_ASSERT(b->pos == 10, "seek SET+10 set wrong position"); 4.134 4.135 - r = ucx_buffer_seek(b, 20, SEEK_SET); 4.136 - UCX_TEST_ASSERT(r != 0, "seek beyond bounds shall fail"); 4.137 - UCX_TEST_ASSERT(b->pos == 5, 4.138 - "failed seek shall leave pos unchanged"); 4.139 + UCX_TEST_END 4.140 4.141 + ucx_buffer_free(b); 4.142 +} 4.143 + 4.144 +UCX_TEST(test_ucx_buffer_seek_cur) { 4.145 + UcxBuffer *b = ucx_buffer_new(NULL, 32, UCX_BUFFER_DEFAULT); 4.146 + b->size = 16; 4.147 + int r; 4.148 + 4.149 + UCX_TEST_BEGIN 4.150 + 4.151 + b->pos = 7; 4.152 r = ucx_buffer_seek(b, 5, SEEK_CUR); 4.153 UCX_TEST_ASSERT(r == 0, "seek CUR+5 failed"); 4.154 - UCX_TEST_ASSERT(b->pos == 10, "seek CUR+5 set wrong position"); 4.155 + UCX_TEST_ASSERT(b->pos == 12, "seek CUR+5 set wrong position"); 4.156 4.157 - r = ucx_buffer_seek(b, 10, SEEK_CUR); 4.158 - UCX_TEST_ASSERT(r != 0, "seek CUR beyond bounds shall fail"); 4.159 - UCX_TEST_ASSERT(b->pos == 10, 4.160 - "failed seek shall leave pos unchanged"); 4.161 + UCX_TEST_END 4.162 4.163 + ucx_buffer_free(b); 4.164 +} 4.165 + 4.166 +UCX_TEST(test_ucx_buffer_seek_end) { 4.167 + UcxBuffer *b = ucx_buffer_new(NULL, 32, UCX_BUFFER_DEFAULT); 4.168 + b->size = 16; 4.169 + int r; 4.170 + 4.171 + UCX_TEST_BEGIN 4.172 + 4.173 r = ucx_buffer_seek(b, -5, SEEK_END); 4.174 UCX_TEST_ASSERT(r == 0, "seek END-5 failed"); 4.175 UCX_TEST_ASSERT(b->pos == 11, "seek END-5 set wrong position"); 4.176 4.177 - r = ucx_buffer_seek(b, -20, SEEK_END); 4.178 - UCX_TEST_ASSERT(r != 0, "seek END beyond bounds shall fail"); 4.179 - UCX_TEST_ASSERT(b->pos == 11, 4.180 - "failed seek shall leave pos unchanged"); 4.181 4.182 UCX_TEST_END 4.183 4.184 @@ -77,7 +204,9 @@ 4.185 4.186 UCX_TEST_BEGIN 4.187 4.188 - ucx_buffer_putc(b, '0'); 4.189 + ucx_buffer_seek(b, 0, SEEK_SET); 4.190 + UCX_TEST_ASSERT(ucx_buffer_putc(b, '0'|~0xFF) == '0', 4.191 + "putc shall return (arg & 0xFF)"); 4.192 ucx_buffer_putc(b, '0'); 4.193 ucx_buffer_putc(b, '0'); 4.194 4.195 @@ -89,49 +218,89 @@ 4.196 ucx_buffer_putc(b, '0'); 4.197 4.198 UCX_TEST_ASSERT(b->pos == 16, "pos wrong after last 3 puts"); 4.199 - UCX_TEST_ASSERT(ucx_buffer_eof(b), "eof not set"); 4.200 - UCX_TEST_ASSERT(ucx_buffer_putc(b, 48) == EOF, 4.201 - "put shall return EOF when buffer is full"); 4.202 4.203 - ucx_buffer_seek(b, 3, SEEK_SET); 4.204 - ucx_buffer_putc(b, 'a'); 4.205 - ucx_buffer_putc(b, 'b'); 4.206 - ucx_buffer_putc(b, 'c'); 4.207 + UCX_TEST_ASSERT(!memcmp(b->space, "000 000", 16), 4.208 + "buffer content wrong") 4.209 + UCX_TEST_END 4.210 + ucx_buffer_free(b); 4.211 + free(buffer); 4.212 +} 4.213 4.214 - UCX_TEST_ASSERT(b->size == 16, "wrong size after seek and puts"); 4.215 - UCX_TEST_ASSERT(memcmp(buffer, "000abc 000", 16) == 0, 4.216 - "buffer contains incorrect content"); 4.217 +UCX_TEST(test_ucx_buffer_putc_oob) { 4.218 + UcxBuffer *b = ucx_buffer_new(NULL, 2, UCX_BUFFER_DEFAULT); 4.219 + 4.220 + UCX_TEST_BEGIN 4.221 + b->pos = b->size = b->capacity = 1; 4.222 + b->space[1] = 'X'; 4.223 + 4.224 + UCX_TEST_ASSERT(ucx_buffer_putc(b, 48) == EOF, "put shall return EOF " 4.225 + "when buffer is full and auto extend is disabled"); 4.226 + UCX_TEST_ASSERT(!memcmp(b->space, "\0X", 2), 4.227 + "wrong buffer content after failed putc"); 4.228 4.229 UCX_TEST_END 4.230 4.231 ucx_buffer_free(b); 4.232 - free(buffer); 4.233 } 4.234 4.235 -UCX_TEST(test_ucx_buffer_putc_ax) { 4.236 + 4.237 +UCX_TEST(test_ucx_buffer_putc_ae) { 4.238 UcxBuffer *b = ucx_buffer_new(NULL, 2, UCX_BUFFER_AUTOEXTEND); 4.239 + ucx_buffer_putc(b, '0'); 4.240 + ucx_buffer_putc(b, '1'); 4.241 4.242 UCX_TEST_BEGIN 4.243 4.244 + UCX_TEST_ASSERT(b->pos == 2, "pos wrong after first 2 puts"); 4.245 + UCX_TEST_ASSERT(b->size == 2, "size wrong after first 2 puts"); 4.246 + UCX_TEST_ASSERT(b->capacity == 2, "buffer erroneously extended"); 4.247 + UCX_TEST_ASSERT(!memcmp(b->space,"01", 2), "wrong content"); 4.248 + 4.249 + UCX_TEST_END 4.250 + 4.251 + ucx_buffer_free(b); 4.252 +} 4.253 + 4.254 +UCX_TEST(test_ucx_buffer_putc_oobae) { 4.255 + UcxBuffer *b = ucx_buffer_new(NULL, 2, UCX_BUFFER_AUTOEXTEND); 4.256 ucx_buffer_putc(b, '0'); 4.257 ucx_buffer_putc(b, '1'); 4.258 4.259 - UCX_TEST_ASSERT(b->pos == 2, "pos wrong after first 2 puts"); 4.260 - UCX_TEST_ASSERT(b->capacity == 2, "buffer erroneously extended"); 4.261 + UCX_TEST_BEGIN 4.262 4.263 ucx_buffer_putc(b, 'a'); 4.264 4.265 - UCX_TEST_ASSERT(b->pos == 3, "pos wrong after 1 put"); 4.266 + UCX_TEST_ASSERT(b->pos == 3, "pos wrong after put"); 4.267 UCX_TEST_ASSERT(b->capacity == 4, "buffer not properly extended"); 4.268 UCX_TEST_ASSERT(b->size == 3, "wrong buffer size"); 4.269 4.270 - UCX_TEST_ASSERT(b->space[2] == 'a', "wrong content"); 4.271 + UCX_TEST_ASSERT(!memcmp(b->space,"01a\0", 4), "wrong content"); 4.272 4.273 UCX_TEST_END 4.274 4.275 ucx_buffer_free(b); 4.276 } 4.277 4.278 +UCX_TEST(test_ucx_buffer_putc_size) { 4.279 + UcxBuffer *b = ucx_buffer_new(NULL, 4, UCX_BUFFER_DEFAULT); 4.280 + 4.281 + UCX_TEST_BEGIN 4.282 + 4.283 + UCX_TEST_ASSERT(b->size == 0, "wrong initial size"); 4.284 + ucx_buffer_putc(b, 'a'); 4.285 + ucx_buffer_putc(b, 'b'); 4.286 + ucx_buffer_putc(b, 'c'); 4.287 + UCX_TEST_ASSERT(b->size == 3, "size does not increase"); 4.288 + ucx_buffer_seek(b, 1, SEEK_SET); 4.289 + ucx_buffer_putc(b, 'd'); 4.290 + UCX_TEST_ASSERT(b->size == 3, "size shall not decrease"); 4.291 + UCX_TEST_ASSERT(b->pos == 2, "wrong position after seek and putc"); 4.292 + 4.293 + UCX_TEST_END 4.294 + 4.295 + ucx_buffer_free(b); 4.296 +} 4.297 + 4.298 UCX_TEST(test_ucx_buffer_getc) { 4.299 char *buffer = (char*) malloc(16); 4.300 memset(buffer, 32, 8);
5.1 --- a/test/buffer_tests.h Thu Apr 17 14:33:06 2014 +0200 5.2 +++ b/test/buffer_tests.h Mon May 05 13:53:27 2014 +0200 5.3 @@ -26,8 +26,8 @@ 5.4 * POSSIBILITY OF SUCH DAMAGE. 5.5 */ 5.6 5.7 -#ifndef MEMSTREAM_TEST_H 5.8 -#define MEMSTREAM_TEST_H 5.9 +#ifndef BUFFER_TEST_H 5.10 +#define BUFFER_TEST_H 5.11 5.12 #include "ucx/test.h" 5.13 #include "ucx/buffer.h" 5.14 @@ -36,9 +36,19 @@ 5.15 extern "C" { 5.16 #endif 5.17 5.18 -UCX_TEST(test_ucx_buffer_seek); 5.19 +UCX_TEST(test_ucx_buffer_eof); 5.20 +UCX_TEST(test_ucx_buffer_seek_set); 5.21 +UCX_TEST(test_ucx_buffer_seek_end); 5.22 +UCX_TEST(test_ucx_buffer_seek_cur); 5.23 +UCX_TEST(test_ucx_buffer_seek_oob); 5.24 +UCX_TEST(test_ucx_buffer_seek_invalid); 5.25 +UCX_TEST(test_ucx_buffer_seek_overflow); 5.26 UCX_TEST(test_ucx_buffer_putc); 5.27 -UCX_TEST(test_ucx_buffer_putc_ax); 5.28 +UCX_TEST(test_ucx_buffer_putc_ae); 5.29 +UCX_TEST(test_ucx_buffer_putc_oob); 5.30 +UCX_TEST(test_ucx_buffer_putc_oobae); 5.31 +UCX_TEST(test_ucx_buffer_putc_size); 5.32 + 5.33 UCX_TEST(test_ucx_buffer_getc); 5.34 UCX_TEST(test_ucx_buffer_write); 5.35 UCX_TEST(test_ucx_buffer_write_ax); 5.36 @@ -50,5 +60,5 @@ 5.37 } 5.38 #endif 5.39 5.40 -#endif /* MEMSTREAM_TEST_H */ 5.41 +#endif /* BUFFER_TEST_H */ 5.42
6.1 --- a/test/main.c Thu Apr 17 14:33:06 2014 +0200 6.2 +++ b/test/main.c Mon May 05 13:53:27 2014 +0200 6.3 @@ -33,6 +33,7 @@ 6.4 6.5 #include "main.h" 6.6 6.7 +#include "allocator_tests.h" 6.8 #include "logging_tests.h" 6.9 #include "list_tests.h" 6.10 #include "string_tests.h" 6.11 @@ -112,6 +113,9 @@ 6.12 6.13 printf("\nLibrary function tests\n"); 6.14 suite = ucx_test_suite_new(); 6.15 + /* UcxAllocator Tests */ 6.16 + ucx_test_register(suite, test_ucx_default_allocator); 6.17 + 6.18 /* sstring Tests */ 6.19 ucx_test_register(suite, test_sstr); 6.20 ucx_test_register(suite, test_sstr_len_cat); 6.21 @@ -173,9 +177,18 @@ 6.22 ucx_test_register(suite, test_ucx_properties_store); 6.23 6.24 /* UcxBuffer Tests */ 6.25 - ucx_test_register(suite, test_ucx_buffer_seek); 6.26 + ucx_test_register(suite, test_ucx_buffer_eof); 6.27 + ucx_test_register(suite, test_ucx_buffer_seek_set); 6.28 + ucx_test_register(suite, test_ucx_buffer_seek_cur); 6.29 + ucx_test_register(suite, test_ucx_buffer_seek_end); 6.30 + ucx_test_register(suite, test_ucx_buffer_seek_oob); 6.31 + ucx_test_register(suite, test_ucx_buffer_seek_invalid); 6.32 + ucx_test_register(suite, test_ucx_buffer_seek_overflow); 6.33 ucx_test_register(suite, test_ucx_buffer_putc); 6.34 - ucx_test_register(suite, test_ucx_buffer_putc_ax); 6.35 + ucx_test_register(suite, test_ucx_buffer_putc_ae); 6.36 + ucx_test_register(suite, test_ucx_buffer_putc_oob); 6.37 + ucx_test_register(suite, test_ucx_buffer_putc_oobae); 6.38 + ucx_test_register(suite, test_ucx_buffer_putc_size); 6.39 ucx_test_register(suite, test_ucx_buffer_getc); 6.40 ucx_test_register(suite, test_ucx_buffer_write); 6.41 ucx_test_register(suite, test_ucx_buffer_write_ax);