test/buffer_tests.c

changeset 218
b20d6088795c
parent 192
1e51558b9d09
child 219
2df780a4482b
     1.1 --- a/test/buffer_tests.c	Fri Feb 26 16:22:20 2016 +0100
     1.2 +++ b/test/buffer_tests.c	Fri Feb 26 16:33:04 2016 +0100
     1.3 @@ -27,7 +27,6 @@
     1.4   */
     1.5  
     1.6  #include "buffer_tests.h"
     1.7 -#include <stdint.h>
     1.8  
     1.9  UCX_TEST(test_ucx_buffer_new) {
    1.10      UcxBuffer *b = ucx_buffer_new(NULL, 16, UCX_BUFFER_AUTOEXTEND);
    1.11 @@ -88,7 +87,8 @@
    1.12      int r;
    1.13      
    1.14      UCX_TEST_BEGIN
    1.15 -    size_t bigpos = SIZE_MAX - 5000;
    1.16 +    const size_t sizemax = (size_t)-1;
    1.17 +    size_t bigpos = sizemax - 5000;
    1.18      b->pos = bigpos;
    1.19      r = ucx_buffer_seek(b, 5016, SEEK_CUR);
    1.20      UCX_TEST_ASSERT(r != 0, "seek cur overflow");
    1.21 @@ -96,8 +96,8 @@
    1.22              "failed seek shall leave pos unchanged");
    1.23      
    1.24      b->pos = 0;
    1.25 -    b->size = SIZE_MAX / 2 + 32;
    1.26 -    off_t bigoff = SIZE_MAX / 2 - 16;
    1.27 +    b->size = sizemax / 2 + 32;
    1.28 +    off_t bigoff = sizemax / 2 - 16;
    1.29      r = ucx_buffer_seek(b, -bigoff, SEEK_CUR);
    1.30      UCX_TEST_ASSERT(r != 0, "seek cur underflow");
    1.31      UCX_TEST_ASSERT(b->pos == 0,
    1.32 @@ -593,7 +593,7 @@
    1.33      UCX_TEST_ASSERT((b->size == 0 && b->pos == 0),
    1.34          "pos and size shall remain unchanged");
    1.35      
    1.36 -    UCX_TEST_ASSERT(ucx_buffer_extend(b, SIZE_MAX - 60) != 0,
    1.37 +    UCX_TEST_ASSERT(ucx_buffer_extend(b, (size_t) - 61) != 0,
    1.38          "shall fail and return a non-zero value on overflow");
    1.39      
    1.40      UCX_TEST_END

mercurial