29 #include <stdio.h> |
29 #include <stdio.h> |
30 #include <stdlib.h> |
30 #include <stdlib.h> |
31 |
31 |
32 #include "../util/writer.h" |
32 #include "../util/writer.h" |
33 |
33 |
34 #include <ucx/buffer.h> |
34 #include <cx/buffer.h> |
35 |
35 |
36 #include "writer.h" |
36 #include "writer.h" |
37 #include "testutils.h" |
37 #include "testutils.h" |
38 |
38 |
39 UCX_TEST(test_writer_putc) { |
39 UCX_TEST(test_writer_putc) { |
40 Session *sn = testutil_session(); |
40 Session *sn = testutil_session(); |
41 TestIOStream *st = testutil_iostream(2048, TRUE); |
41 TestIOStream *st = testutil_iostream(2048, TRUE); |
42 UcxBuffer *buf = st->buf; |
42 CxBuffer *buf = st->buf; |
43 |
43 |
44 UCX_TEST_BEGIN; |
44 UCX_TEST_BEGIN; |
45 |
45 |
46 Writer writer; |
46 Writer writer; |
47 char wbuf[1024]; |
47 char wbuf[1024]; |
133 UCX_TEST_ASSERT(!memcmp(wbuf, "xx", 2), "4: wrong content"); |
133 UCX_TEST_ASSERT(!memcmp(wbuf, "xx", 2), "4: wrong content"); |
134 UCX_TEST_ASSERT(writer.pos == 2, "4: wrong pos"); |
134 UCX_TEST_ASSERT(writer.pos == 2, "4: wrong pos"); |
135 UCX_TEST_ASSERT(!memcmp(buf->space, "abcdefgh12345678", 16), "4: wrong UcxBuffer content"); |
135 UCX_TEST_ASSERT(!memcmp(buf->space, "abcdefgh12345678", 16), "4: wrong UcxBuffer content"); |
136 UCX_TEST_ASSERT(buf->pos == 16, "4: wrong UcxBuffer pos"); |
136 UCX_TEST_ASSERT(buf->pos == 16, "4: wrong UcxBuffer pos"); |
137 |
137 |
138 writer_puts(out, S("345678abcdefgh12345678end.")); |
138 writer_puts(out, cx_str("345678abcdefgh12345678end.")); |
139 UCX_TEST_ASSERT(!memcmp(wbuf, "end.", 4), "5: wrong content"); |
139 UCX_TEST_ASSERT(!memcmp(wbuf, "end.", 4), "5: wrong content"); |
140 UCX_TEST_ASSERT(writer.pos == 4, "5: wrong pos"); |
140 UCX_TEST_ASSERT(writer.pos == 4, "5: wrong pos"); |
141 UCX_TEST_ASSERT(!memcmp( |
141 UCX_TEST_ASSERT(!memcmp( |
142 buf->space, |
142 buf->space, |
143 "abcdefgh12345678xx345678abcdefgh12345678", |
143 "abcdefgh12345678xx345678abcdefgh12345678", |