MCPcopy Create free account
hub / github.com/bytedance/bolt / readDataAsyncForWirteBuffers

Function readDataAsyncForWirteBuffers

bolt/common/file/tests/AsyncFileTest.cpp:80–96  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

78}
79
80void readDataAsyncForWirteBuffers(
81 ReadFile* readFile,
82 bool checkFileSize = true) {
83 if (checkFileSize) {
84 ASSERT_EQ(readFile->size(), 150);
85 }
86 char buffer[150];
87 readFile->submitRead(reinterpret_cast<char*>(&buffer), 0, 150);
88 readFile->waitForComplete();
89 std::string a;
90 for (int i = 0; i < 150; i++)
91 a += 'a' + i % 26;
92 ASSERT_EQ(std::string_view(buffer, 150), a);
93 if (checkFileSize) {
94 ASSERT_EQ(readFile->size(), 150);
95 }
96}
97
98TEST(AsyncLocalFile, writeAndRead) {
99 auto tempFile = ::exec::test::TempFilePath::create();

Callers 1

TESTFunction · 0.85

Calls 3

sizeMethod · 0.45
submitReadMethod · 0.45
waitForCompleteMethod · 0.45

Tested by

no test coverage detected