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

Function TestHugeFile

util/system/direct_io_ut.cpp:55–77  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

53 }
54
55 void TestHugeFile(size_t size) {
56 TTempFile tmpFile("test.file");
57
58 {
59 TDirectIOBufferedFile directIOFile(tmpFile.Name(), WrOnly | CreateAlways | Direct);
60 TVector<ui8> data(size, 'x');
61 directIOFile.Write(&data[0], data.size());
62 }
63
64 {
65 TDirectIOBufferedFile directIOFile(tmpFile.Name(), RdOnly | Direct);
66 TVector<ui8> data(size + 1, 'y');
67
68 const size_t readResult = directIOFile.Read(&data[0], data.size());
69
70 UNIT_ASSERT_VALUES_EQUAL(readResult, size);
71
72 UNIT_ASSERT_VALUES_EQUAL(data[0], 'x');
73 UNIT_ASSERT_VALUES_EQUAL(data[size / 2], 'x');
74 UNIT_ASSERT_VALUES_EQUAL(data[size - 1], 'x');
75 UNIT_ASSERT_VALUES_EQUAL(data[size], 'y');
76 }
77 }
78
79 Y_UNIT_TEST(TestHugeFile1) {
80 if constexpr (sizeof(size_t) > 4) {

Callers 1

Y_UNIT_TESTFunction · 0.85

Calls 4

NameMethod · 0.45
WriteMethod · 0.45
sizeMethod · 0.45
ReadMethod · 0.45

Tested by

no test coverage detected