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

Method TestRawPread

util/system/file_ut.cpp:284–306  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

282}
283
284void TFileTest::TestRawPread() {
285 TTempFile tmp("tmp");
286
287 {
288 TFile file(tmp.Name(), OpenAlways | WrOnly);
289 file.Write("1234567", 7);
290 file.Flush();
291 file.Close();
292 }
293
294 {
295 TFile file(tmp.Name(), OpenExisting | RdOnly);
296 char buf[7];
297 i32 reallyRead = file.RawPread(buf, 3, 1);
298 Y_ENSURE(0 <= reallyRead && reallyRead <= 3);
299 Y_ENSURE(TStringBuf(buf, reallyRead) == TStringBuf("234").Head(reallyRead));
300
301 memset(buf, 0, sizeof(buf));
302 reallyRead = file.RawPread(buf, 2, 5);
303 Y_ENSURE(0 <= reallyRead && reallyRead <= 2);
304 Y_ENSURE(TStringBuf(buf, reallyRead) == TStringBuf("67").Head(reallyRead));
305 }
306}
307
308void TFileTest::TestPread() {
309 TTempFile tmp("tmp");

Callers

nothing calls this directly

Calls 6

NameMethod · 0.45
WriteMethod · 0.45
FlushMethod · 0.45
CloseMethod · 0.45
RawPreadMethod · 0.45
HeadMethod · 0.45

Tested by

no test coverage detected