| 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) { |
no test coverage detected