1082 CxBufferFlushConfig flush; |
1082 CxBufferFlushConfig flush; |
1083 flush.threshold = 0; |
1083 flush.threshold = 0; |
1084 flush.blksize = 32; |
1084 flush.blksize = 32; |
1085 flush.blkmax = 1; |
1085 flush.blkmax = 1; |
1086 flush.target = ⌖ |
1086 flush.target = ⌖ |
1087 flush.wfunc = (cx_write_func)cxBufferWrite; |
1087 flush.wfunc = cxBufferWriteFunc; |
1088 CX_TEST_ASSERT(0 == cxBufferEnableFlushing(&buf, flush)); |
1088 CX_TEST_ASSERT(0 == cxBufferEnableFlushing(&buf, flush)); |
1089 size_t written = cxBufferWrite("foo", 1, 3, &buf); |
1089 size_t written = cxBufferWrite("foo", 1, 3, &buf); |
1090 CX_TEST_ASSERT(written == 3); |
1090 CX_TEST_ASSERT(written == 3); |
1091 CX_TEST_ASSERT(buf.pos == 7); |
1091 CX_TEST_ASSERT(buf.pos == 7); |
1092 CX_TEST_ASSERT(buf.size == 7); |
1092 CX_TEST_ASSERT(buf.size == 7); |
1115 CxBufferFlushConfig flush; |
1115 CxBufferFlushConfig flush; |
1116 flush.threshold = 12; |
1116 flush.threshold = 12; |
1117 flush.blksize = 32; |
1117 flush.blksize = 32; |
1118 flush.blkmax = 1; |
1118 flush.blkmax = 1; |
1119 flush.target = ⌖ |
1119 flush.target = ⌖ |
1120 flush.wfunc = (cx_write_func)cxBufferWrite; |
1120 flush.wfunc = cxBufferWriteFunc; |
1121 CX_TEST_ASSERT(0 == cxBufferEnableFlushing(&buf, flush)); |
1121 CX_TEST_ASSERT(0 == cxBufferEnableFlushing(&buf, flush)); |
1122 size_t written = cxBufferWrite("foobar", 1, 6, &buf); |
1122 size_t written = cxBufferWrite("foobar", 1, 6, &buf); |
1123 CX_TEST_ASSERT(written == 6); |
1123 CX_TEST_ASSERT(written == 6); |
1124 CX_TEST_ASSERT(buf.pos == 10); |
1124 CX_TEST_ASSERT(buf.pos == 10); |
1125 CX_TEST_ASSERT(buf.size == 10); |
1125 CX_TEST_ASSERT(buf.size == 10); |
1189 CxBufferFlushConfig flush; |
1189 CxBufferFlushConfig flush; |
1190 flush.threshold = 0; |
1190 flush.threshold = 0; |
1191 flush.blksize = 2; |
1191 flush.blksize = 2; |
1192 flush.blkmax = 2; |
1192 flush.blkmax = 2; |
1193 flush.target = ⌖ |
1193 flush.target = ⌖ |
1194 flush.wfunc = (cx_write_func)cxBufferWrite; |
1194 flush.wfunc = cxBufferWriteFunc; |
1195 CX_TEST_ASSERT(0 == cxBufferEnableFlushing(&buf, flush)); |
1195 CX_TEST_ASSERT(0 == cxBufferEnableFlushing(&buf, flush)); |
1196 CX_TEST_ASSERT(buf.size == 7); |
1196 CX_TEST_ASSERT(buf.size == 7); |
1197 buf.pos = 5; |
1197 buf.pos = 5; |
1198 size_t flushed = cxBufferFlush(&buf); |
1198 size_t flushed = cxBufferFlush(&buf); |
1199 CX_TEST_ASSERT(flushed == flush.blkmax * flush.blksize); |
1199 CX_TEST_ASSERT(flushed == flush.blkmax * flush.blksize); |