--- a/test/memstream_tests.c Tue Oct 09 16:46:29 2012 +0200 +++ b/test/memstream_tests.c Wed Oct 10 09:32:06 2012 +0200 @@ -62,7 +62,6 @@ ucx_memputc(m, 48); ucx_memputc(m, 48); ucx_memputc(m, 48); UCX_TEST_ASSERT(ucx_memtell(m) == 16, "pos wrong after last 3 puts"); UCX_TEST_ASSERT(ucx_memeof(m), "eof not set"); - UCX_TEST_ASSERT(!ucx_memoverflow(m), "overflow shall not be set"); UCX_TEST_ASSERT(ucx_memputc(m, 48) == EOF, "put shall return EOF on memof"); UCX_TEST_ASSERT(memcmp(buffer, "000 000", 16) == 0, "buffer contains incorrect content"); @@ -121,7 +120,6 @@ UCX_TEST_ASSERT(memcmp(buffer, teststring, 16) == 0, "buffer data incorrect"); UCX_TEST_ASSERT(ucx_memeof(m), "eof shall be set"); - UCX_TEST_ASSERT(!ucx_memoverflow(m), "no overflow shall be caused"); ucx_memseek(m, 8, SEEK_SET); r = ucx_memwrite("not", 1, 3, m); @@ -186,46 +184,3 @@ ucx_memclose(m); free(buffer); } - -UCX_TEST_IMPLEMENT(test_ucx_memprintf) { - char *buffer = malloc(32); - UcxMemstream *m = ucx_memopen(buffer, 16); - - UCX_TEST_BEGIN - int r = ucx_memprintf(m, "number: %d char: %c", 15, '6'); - UCX_TEST_ASSERT(r == 18, "incorrect number of bytes written"); - UCX_TEST_ASSERT(ucx_memoverflow(m), "overflow shall be detected"); - UCX_TEST_ASSERT(memcmp(buffer, "number: 15 char:", 16) == 0, - "incorrect buffer content"); - - ucx_memseek(m, 0, SEEK_SET); - ucx_memprintf(m, "a: %d - b: %d", 1, 2); - UCX_TEST_ASSERT(!ucx_memoverflow(m), "no overflow shall be deteceted"); - UCX_TEST_ASSERT(memcmp(buffer, "a: 1 - b: 2char:", 16), - "incorrect modified buffer content"); - UCX_TEST_ASSERT(ucx_memtell(m) == 11, "incorrect position"); - - UCX_TEST_END - - ucx_memclose(m); - free(buffer); -} - -UCX_TEST_IMPLEMENT(test_ucx_memscanf) { - char *buffer = "string 3.5 1 stuff"; - UcxMemstream *m = ucx_memopen(buffer, 16); - - char s[6]; - float f; - int d; - UCX_TEST_BEGIN - int r = ucx_memscanf(m, "%s %f %d", s, &f, &d); - UCX_TEST_ASSERT(r == 3, "3 arguments shall be read"); - UCX_TEST_ASSERT(strncmp(s, "string", 6) == 0, "incorrect string"); - UCX_TEST_ASSERT(f == 3.5, "incorrect float"); - UCX_TEST_ASSERT(d == 1, "incorrect integer"); - UCX_TEST_ASSERT(ucx_memtell(m) == 12, "incorrect position"); - UCX_TEST_END - - ucx_memclose(m); -}