test/memstream_tests.c

changeset 58
733f22fca61a
parent 56
76caac0da4a0
     1.1 --- a/test/memstream_tests.c	Tue Oct 09 16:46:29 2012 +0200
     1.2 +++ b/test/memstream_tests.c	Wed Oct 10 09:32:06 2012 +0200
     1.3 @@ -62,7 +62,6 @@
     1.4      ucx_memputc(m, 48); ucx_memputc(m, 48); ucx_memputc(m, 48);
     1.5      UCX_TEST_ASSERT(ucx_memtell(m) == 16, "pos wrong after last 3 puts");
     1.6      UCX_TEST_ASSERT(ucx_memeof(m), "eof not set");
     1.7 -    UCX_TEST_ASSERT(!ucx_memoverflow(m), "overflow shall not be set");
     1.8      UCX_TEST_ASSERT(ucx_memputc(m, 48) == EOF, "put shall return EOF on memof");
     1.9      UCX_TEST_ASSERT(memcmp(buffer, "000          000", 16) == 0,
    1.10              "buffer contains incorrect content");
    1.11 @@ -121,7 +120,6 @@
    1.12      UCX_TEST_ASSERT(memcmp(buffer, teststring, 16) == 0,
    1.13              "buffer data incorrect");
    1.14      UCX_TEST_ASSERT(ucx_memeof(m), "eof shall be set");
    1.15 -    UCX_TEST_ASSERT(!ucx_memoverflow(m), "no overflow shall be caused");
    1.16  
    1.17      ucx_memseek(m, 8, SEEK_SET);
    1.18      r = ucx_memwrite("not", 1, 3, m);
    1.19 @@ -186,46 +184,3 @@
    1.20      ucx_memclose(m);
    1.21      free(buffer);
    1.22  }
    1.23 -
    1.24 -UCX_TEST_IMPLEMENT(test_ucx_memprintf) {
    1.25 -    char *buffer = malloc(32);
    1.26 -    UcxMemstream *m = ucx_memopen(buffer, 16);
    1.27 -
    1.28 -    UCX_TEST_BEGIN
    1.29 -    int r = ucx_memprintf(m, "number: %d char: %c", 15, '6');
    1.30 -    UCX_TEST_ASSERT(r == 18, "incorrect number of bytes written");
    1.31 -    UCX_TEST_ASSERT(ucx_memoverflow(m), "overflow shall be detected");
    1.32 -    UCX_TEST_ASSERT(memcmp(buffer, "number: 15 char:", 16) == 0,
    1.33 -            "incorrect buffer content");
    1.34 -
    1.35 -    ucx_memseek(m, 0, SEEK_SET);
    1.36 -    ucx_memprintf(m, "a: %d - b: %d", 1, 2);
    1.37 -    UCX_TEST_ASSERT(!ucx_memoverflow(m), "no overflow shall be deteceted");
    1.38 -    UCX_TEST_ASSERT(memcmp(buffer, "a: 1 - b: 2char:", 16),
    1.39 -            "incorrect modified buffer content");
    1.40 -    UCX_TEST_ASSERT(ucx_memtell(m) == 11, "incorrect position");
    1.41 -
    1.42 -    UCX_TEST_END
    1.43 -
    1.44 -    ucx_memclose(m);
    1.45 -    free(buffer);
    1.46 -}
    1.47 -
    1.48 -UCX_TEST_IMPLEMENT(test_ucx_memscanf) {
    1.49 -    char *buffer = "string 3.5 1 stuff";
    1.50 -    UcxMemstream *m = ucx_memopen(buffer, 16);
    1.51 -
    1.52 -    char s[6];
    1.53 -    float f;
    1.54 -    int d;
    1.55 -    UCX_TEST_BEGIN
    1.56 -    int r = ucx_memscanf(m, "%s %f %d", s, &f, &d);
    1.57 -    UCX_TEST_ASSERT(r == 3, "3 arguments shall be read");
    1.58 -    UCX_TEST_ASSERT(strncmp(s, "string", 6) == 0, "incorrect string");
    1.59 -    UCX_TEST_ASSERT(f == 3.5, "incorrect float");
    1.60 -    UCX_TEST_ASSERT(d == 1, "incorrect integer");
    1.61 -    UCX_TEST_ASSERT(ucx_memtell(m) == 12, "incorrect position");
    1.62 -    UCX_TEST_END
    1.63 -
    1.64 -    ucx_memclose(m);
    1.65 -}

mercurial