src/server/test/writer.c

Sat, 22 Nov 2025 14:27:01 +0100

author
Olaf Wintermann <olaf.wintermann@gmail.com>
date
Sat, 22 Nov 2025 14:27:01 +0100
changeset 633
392ec9026b07
parent 415
d938228c382e
permissions
-rw-r--r--

port old ucx2 tests to ucx3

232
499711b2a970 add xml writer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1 /*
499711b2a970 add xml writer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
2 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
499711b2a970 add xml writer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
3 *
499711b2a970 add xml writer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
4 * Copyright 2020 Olaf Wintermann. All rights reserved.
499711b2a970 add xml writer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
5 *
499711b2a970 add xml writer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
6 * Redistribution and use in source and binary forms, with or without
499711b2a970 add xml writer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
7 * modification, are permitted provided that the following conditions are met:
499711b2a970 add xml writer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
8 *
499711b2a970 add xml writer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
9 * 1. Redistributions of source code must retain the above copyright
499711b2a970 add xml writer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
10 * notice, this list of conditions and the following disclaimer.
499711b2a970 add xml writer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
11 *
499711b2a970 add xml writer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
12 * 2. Redistributions in binary form must reproduce the above copyright
499711b2a970 add xml writer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
13 * notice, this list of conditions and the following disclaimer in the
499711b2a970 add xml writer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
14 * documentation and/or other materials provided with the distribution.
499711b2a970 add xml writer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
15 *
499711b2a970 add xml writer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
16 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
499711b2a970 add xml writer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
17 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
499711b2a970 add xml writer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
18 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
499711b2a970 add xml writer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
19 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
499711b2a970 add xml writer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
20 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
499711b2a970 add xml writer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
21 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
499711b2a970 add xml writer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
22 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
499711b2a970 add xml writer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
23 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
499711b2a970 add xml writer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
24 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
499711b2a970 add xml writer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
25 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
499711b2a970 add xml writer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
26 * POSSIBILITY OF SUCH DAMAGE.
499711b2a970 add xml writer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
27 */
499711b2a970 add xml writer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
28
499711b2a970 add xml writer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
29 #include <stdio.h>
499711b2a970 add xml writer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
30 #include <stdlib.h>
499711b2a970 add xml writer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
31
499711b2a970 add xml writer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
32 #include "../util/writer.h"
499711b2a970 add xml writer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
33
415
d938228c382e switch from ucx 2 to 3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 232
diff changeset
34 #include <cx/buffer.h>
232
499711b2a970 add xml writer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
35
499711b2a970 add xml writer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
36 #include "writer.h"
499711b2a970 add xml writer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
37 #include "testutils.h"
499711b2a970 add xml writer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
38
633
392ec9026b07 port old ucx2 tests to ucx3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 415
diff changeset
39 CX_TEST(test_writer_putc) {
232
499711b2a970 add xml writer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
40 Session *sn = testutil_session();
499711b2a970 add xml writer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
41 TestIOStream *st = testutil_iostream(2048, TRUE);
415
d938228c382e switch from ucx 2 to 3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 232
diff changeset
42 CxBuffer *buf = st->buf;
232
499711b2a970 add xml writer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
43
633
392ec9026b07 port old ucx2 tests to ucx3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 415
diff changeset
44 CX_TEST_DO {
232
499711b2a970 add xml writer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
45
633
392ec9026b07 port old ucx2 tests to ucx3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 415
diff changeset
46 Writer writer;
392ec9026b07 port old ucx2 tests to ucx3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 415
diff changeset
47 char wbuf[1024];
392ec9026b07 port old ucx2 tests to ucx3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 415
diff changeset
48 writer_init(&writer, st, wbuf, 4);
392ec9026b07 port old ucx2 tests to ucx3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 415
diff changeset
49 Writer *out = &writer;
392ec9026b07 port old ucx2 tests to ucx3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 415
diff changeset
50
392ec9026b07 port old ucx2 tests to ucx3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 415
diff changeset
51 writer_putc(out, 'a');
392ec9026b07 port old ucx2 tests to ucx3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 415
diff changeset
52 CX_TEST_ASSERT(wbuf[0] == 'a');
392ec9026b07 port old ucx2 tests to ucx3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 415
diff changeset
53 CX_TEST_ASSERT(writer.pos == 1);
392ec9026b07 port old ucx2 tests to ucx3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 415
diff changeset
54
392ec9026b07 port old ucx2 tests to ucx3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 415
diff changeset
55 writer_putc(out, 'b');
392ec9026b07 port old ucx2 tests to ucx3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 415
diff changeset
56 CX_TEST_ASSERT(wbuf[1] == 'b');
392ec9026b07 port old ucx2 tests to ucx3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 415
diff changeset
57 CX_TEST_ASSERT(writer.pos == 2);
392ec9026b07 port old ucx2 tests to ucx3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 415
diff changeset
58
392ec9026b07 port old ucx2 tests to ucx3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 415
diff changeset
59 writer_putc(out, 'c');
392ec9026b07 port old ucx2 tests to ucx3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 415
diff changeset
60 writer_putc(out, 'd');
392ec9026b07 port old ucx2 tests to ucx3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 415
diff changeset
61 CX_TEST_ASSERT(wbuf[2] == 'c');
392ec9026b07 port old ucx2 tests to ucx3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 415
diff changeset
62 CX_TEST_ASSERT(wbuf[3] == 'd');
392ec9026b07 port old ucx2 tests to ucx3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 415
diff changeset
63
392ec9026b07 port old ucx2 tests to ucx3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 415
diff changeset
64 writer_putc(out, 'f'); // should flush the buffer
392ec9026b07 port old ucx2 tests to ucx3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 415
diff changeset
65 CX_TEST_ASSERT(wbuf[0] == 'f');
392ec9026b07 port old ucx2 tests to ucx3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 415
diff changeset
66 CX_TEST_ASSERT(writer.pos == 1);
392ec9026b07 port old ucx2 tests to ucx3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 415
diff changeset
67 CX_TEST_ASSERT(buf->space[0] == 'a');
392ec9026b07 port old ucx2 tests to ucx3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 415
diff changeset
68 CX_TEST_ASSERT(buf->space[1] == 'b');
392ec9026b07 port old ucx2 tests to ucx3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 415
diff changeset
69 CX_TEST_ASSERT(buf->pos == 4);
232
499711b2a970 add xml writer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
70
633
392ec9026b07 port old ucx2 tests to ucx3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 415
diff changeset
71 }
232
499711b2a970 add xml writer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
72 testutil_iostream_destroy(st);
499711b2a970 add xml writer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
73 testutil_destroy_session(sn);
499711b2a970 add xml writer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
74 }
499711b2a970 add xml writer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
75
633
392ec9026b07 port old ucx2 tests to ucx3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 415
diff changeset
76 CX_TEST(test_writer_flush) {
232
499711b2a970 add xml writer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
77 Session *sn = testutil_session();
499711b2a970 add xml writer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
78 TestIOStream *st = testutil_iostream(2048, TRUE);
415
d938228c382e switch from ucx 2 to 3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 232
diff changeset
79 CxBuffer *buf = st->buf;
232
499711b2a970 add xml writer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
80
633
392ec9026b07 port old ucx2 tests to ucx3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 415
diff changeset
81 CX_TEST_DO {
232
499711b2a970 add xml writer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
82
633
392ec9026b07 port old ucx2 tests to ucx3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 415
diff changeset
83 Writer writer;
392ec9026b07 port old ucx2 tests to ucx3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 415
diff changeset
84 char wbuf[1024];
392ec9026b07 port old ucx2 tests to ucx3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 415
diff changeset
85 writer_init(&writer, st, wbuf, 4);
392ec9026b07 port old ucx2 tests to ucx3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 415
diff changeset
86 Writer *out = &writer;
392ec9026b07 port old ucx2 tests to ucx3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 415
diff changeset
87
392ec9026b07 port old ucx2 tests to ucx3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 415
diff changeset
88 writer_putc(out, 'a');
392ec9026b07 port old ucx2 tests to ucx3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 415
diff changeset
89 CX_TEST_ASSERT(wbuf[0] == 'a');
392ec9026b07 port old ucx2 tests to ucx3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 415
diff changeset
90 CX_TEST_ASSERT(writer.pos == 1);
392ec9026b07 port old ucx2 tests to ucx3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 415
diff changeset
91
392ec9026b07 port old ucx2 tests to ucx3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 415
diff changeset
92 writer_flush(out);
392ec9026b07 port old ucx2 tests to ucx3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 415
diff changeset
93 CX_TEST_ASSERT(writer.pos == 0);
392ec9026b07 port old ucx2 tests to ucx3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 415
diff changeset
94 CX_TEST_ASSERT(buf->space[0] == 'a');
392ec9026b07 port old ucx2 tests to ucx3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 415
diff changeset
95 CX_TEST_ASSERT(buf->pos == 1);
392ec9026b07 port old ucx2 tests to ucx3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 415
diff changeset
96
392ec9026b07 port old ucx2 tests to ucx3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 415
diff changeset
97 writer_putc(out, 'b');
392ec9026b07 port old ucx2 tests to ucx3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 415
diff changeset
98 CX_TEST_ASSERT(wbuf[0] == 'b');
392ec9026b07 port old ucx2 tests to ucx3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 415
diff changeset
99 CX_TEST_ASSERT(writer.pos == 1);
232
499711b2a970 add xml writer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
100
633
392ec9026b07 port old ucx2 tests to ucx3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 415
diff changeset
101 }
232
499711b2a970 add xml writer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
102 testutil_iostream_destroy(st);
499711b2a970 add xml writer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
103 testutil_destroy_session(sn);
499711b2a970 add xml writer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
104 }
499711b2a970 add xml writer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
105
633
392ec9026b07 port old ucx2 tests to ucx3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 415
diff changeset
106 CX_TEST(test_writer_put) {
232
499711b2a970 add xml writer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
107 Session *sn = testutil_session();
499711b2a970 add xml writer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
108 TestIOStream *st = testutil_iostream(2048, TRUE);
415
d938228c382e switch from ucx 2 to 3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 232
diff changeset
109 CxBuffer *buf = st->buf;
232
499711b2a970 add xml writer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
110
633
392ec9026b07 port old ucx2 tests to ucx3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 415
diff changeset
111 CX_TEST_DO {
232
499711b2a970 add xml writer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
112
633
392ec9026b07 port old ucx2 tests to ucx3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 415
diff changeset
113 Writer writer;
392ec9026b07 port old ucx2 tests to ucx3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 415
diff changeset
114 char wbuf[1024];
392ec9026b07 port old ucx2 tests to ucx3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 415
diff changeset
115 writer_init(&writer, st, wbuf, 8);
392ec9026b07 port old ucx2 tests to ucx3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 415
diff changeset
116 Writer *out = &writer;
392ec9026b07 port old ucx2 tests to ucx3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 415
diff changeset
117
392ec9026b07 port old ucx2 tests to ucx3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 415
diff changeset
118 writer_put(out, "abcd", 4);
392ec9026b07 port old ucx2 tests to ucx3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 415
diff changeset
119 CX_TEST_ASSERT(!memcmp(wbuf, "abcd", 4));
392ec9026b07 port old ucx2 tests to ucx3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 415
diff changeset
120 CX_TEST_ASSERT(writer.pos == 4);
392ec9026b07 port old ucx2 tests to ucx3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 415
diff changeset
121
392ec9026b07 port old ucx2 tests to ucx3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 415
diff changeset
122 writer_put(out, "efgh", 4);
392ec9026b07 port old ucx2 tests to ucx3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 415
diff changeset
123 CX_TEST_ASSERT(!memcmp(wbuf, "abcdefgh", 8));
392ec9026b07 port old ucx2 tests to ucx3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 415
diff changeset
124 CX_TEST_ASSERT(writer.pos == 8);
392ec9026b07 port old ucx2 tests to ucx3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 415
diff changeset
125
392ec9026b07 port old ucx2 tests to ucx3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 415
diff changeset
126 writer_put(out, "1234", 4);
392ec9026b07 port old ucx2 tests to ucx3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 415
diff changeset
127 CX_TEST_ASSERT(!memcmp(wbuf, "1234", 4));
392ec9026b07 port old ucx2 tests to ucx3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 415
diff changeset
128 CX_TEST_ASSERT(writer.pos == 4);
392ec9026b07 port old ucx2 tests to ucx3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 415
diff changeset
129 CX_TEST_ASSERT(!memcmp(buf->space, "abcdefgh", 8));
392ec9026b07 port old ucx2 tests to ucx3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 415
diff changeset
130 CX_TEST_ASSERT(buf->pos == 8);
392ec9026b07 port old ucx2 tests to ucx3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 415
diff changeset
131
392ec9026b07 port old ucx2 tests to ucx3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 415
diff changeset
132 writer_put(out, "5678xx", 6);
392ec9026b07 port old ucx2 tests to ucx3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 415
diff changeset
133 CX_TEST_ASSERT(!memcmp(wbuf, "xx", 2));
392ec9026b07 port old ucx2 tests to ucx3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 415
diff changeset
134 CX_TEST_ASSERT(writer.pos == 2);
392ec9026b07 port old ucx2 tests to ucx3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 415
diff changeset
135 CX_TEST_ASSERT(!memcmp(buf->space, "abcdefgh12345678", 16));
392ec9026b07 port old ucx2 tests to ucx3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 415
diff changeset
136 CX_TEST_ASSERT(buf->pos == 16);
392ec9026b07 port old ucx2 tests to ucx3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 415
diff changeset
137
392ec9026b07 port old ucx2 tests to ucx3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 415
diff changeset
138 writer_puts(out, cx_str("345678abcdefgh12345678end."));
392ec9026b07 port old ucx2 tests to ucx3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 415
diff changeset
139 CX_TEST_ASSERT(!memcmp(wbuf, "end.", 4));
392ec9026b07 port old ucx2 tests to ucx3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 415
diff changeset
140 CX_TEST_ASSERT(writer.pos == 4);
392ec9026b07 port old ucx2 tests to ucx3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 415
diff changeset
141 CX_TEST_ASSERT(!memcmp(buf->space, "abcdefgh12345678xx345678abcdefgh12345678", 40));
392ec9026b07 port old ucx2 tests to ucx3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 415
diff changeset
142 CX_TEST_ASSERT(buf->pos == 40);
232
499711b2a970 add xml writer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
143
633
392ec9026b07 port old ucx2 tests to ucx3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 415
diff changeset
144 }
232
499711b2a970 add xml writer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
145 testutil_iostream_destroy(st);
499711b2a970 add xml writer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
146 testutil_destroy_session(sn);
499711b2a970 add xml writer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
147 }

mercurial