MCPcopy Create free account
hub / github.com/catboost/catboost / TestBufferedIO

Method TestBufferedIO

util/stream/ios_ut.cpp:201–255  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

199};
200
201void TStreamsTest::TestBufferedIO() {
202 TString s;
203
204 {
205 const size_t buflen = 7;
206 TBuffered<TMyStringOutput> bo(buflen, s, buflen);
207
208 for (size_t i = 0; i < 1000; ++i) {
209 TString str(" ");
210 str += ToString(i % 10);
211
212 bo.Write(str.data(), str.size());
213 }
214
215 bo.Finish();
216 }
217
218 UNIT_ASSERT_EQUAL(s.size(), 2000);
219
220 {
221 const size_t buflen = 11;
222 TBuffered<TStringInput> bi(buflen, s);
223
224 for (size_t i = 0; i < 1000; ++i) {
225 TString str(" ");
226 str += ToString(i % 10);
227
228 char buf[3];
229
230 UNIT_ASSERT_EQUAL(bi.Load(buf, 2), 2);
231
232 buf[2] = 0;
233
234 UNIT_ASSERT_EQUAL(str, buf);
235 }
236 }
237
238 s.clear();
239
240 {
241 const size_t buflen = 13;
242 TBuffered<TMyStringOutput> bo(buflen, s, buflen);
243 TString f = "1234567890";
244
245 for (size_t i = 0; i < 10; ++i) {
246 f += f;
247 }
248
249 for (size_t i = 0; i < 1000; ++i) {
250 bo.Write(f.data(), i);
251 }
252
253 bo.Finish();
254 }
255}
256
257void TStreamsTest::TestBufferStream() {
258 TBufferStream stream;

Callers

nothing calls this directly

Calls 7

ToStringFunction · 0.50
WriteMethod · 0.45
dataMethod · 0.45
sizeMethod · 0.45
FinishMethod · 0.45
LoadMethod · 0.45
clearMethod · 0.45

Tested by

no test coverage detected