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

Method TestPread

util/system/file_ut.cpp:308–328  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

306}
307
308void TFileTest::TestPread() {
309 TTempFile tmp("tmp");
310
311 {
312 TFile file(tmp.Name(), OpenAlways | WrOnly);
313 file.Write("1234567", 7);
314 file.Flush();
315 file.Close();
316 }
317
318 {
319 TFile file(tmp.Name(), OpenExisting | RdOnly);
320 char buf[7];
321 Y_ENSURE(file.Pread(buf, 3, 1) == 3);
322 Y_ENSURE(TStringBuf(buf, 3) == "234");
323
324 memset(buf, 0, sizeof(buf));
325 Y_ENSURE(file.Pread(buf, 2, 5) == 2);
326 Y_ENSURE(TStringBuf(buf, 2) == "67");
327 }
328}
329
330#ifdef _linux_
331 #include <sys/statfs.h>

Callers

nothing calls this directly

Calls 5

NameMethod · 0.45
WriteMethod · 0.45
FlushMethod · 0.45
CloseMethod · 0.45
PreadMethod · 0.45

Tested by

no test coverage detected