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

Method TestBufferStream

util/stream/ios_ut.cpp:257–278  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

255}
256
257void TStreamsTest::TestBufferStream() {
258 TBufferStream stream;
259 TString s = "test";
260
261 stream.Write(s.data(), s.size());
262 char buf[5];
263 size_t bytesRead = stream.Read(buf, 4);
264 UNIT_ASSERT_EQUAL(4, bytesRead);
265 UNIT_ASSERT_EQUAL(0, strncmp(s.data(), buf, 4));
266
267 stream.Write(s.data(), s.size());
268 bytesRead = stream.Read(buf, 2);
269 UNIT_ASSERT_EQUAL(2, bytesRead);
270 UNIT_ASSERT_EQUAL(0, strncmp("te", buf, 2));
271
272 bytesRead = stream.Read(buf, 2);
273 UNIT_ASSERT_EQUAL(2, bytesRead);
274 UNIT_ASSERT_EQUAL(0, strncmp("st", buf, 2));
275
276 bytesRead = stream.Read(buf, 2);
277 UNIT_ASSERT_EQUAL(0, bytesRead);
278}
279
280namespace {
281 class TStringListInput: public IWalkInput {

Callers

nothing calls this directly

Calls 4

WriteMethod · 0.45
dataMethod · 0.45
sizeMethod · 0.45
ReadMethod · 0.45

Tested by

no test coverage detected