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

Function TEST_P

bolt/common/memory/tests/ByteStreamTest.cpp:373–395  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

371};
372
373TEST_P(InputByteStreamTest, inputStream) {
374 uint8_t kFakeBuffer[8192];
375 std::vector<ByteRange> byteRanges;
376 size_t totalBytes{0};
377 for (int32_t i = 0; i < 32; ++i) {
378 byteRanges.push_back(ByteRange{kFakeBuffer, 4096 + i, 0});
379 totalBytes += 4096 + i;
380 }
381 auto byteStream = createStream(byteRanges);
382 ASSERT_EQ(byteStream->size(), totalBytes);
383 ASSERT_FALSE(byteStream->atEnd());
384 byteStream->skip(totalBytes);
385 ASSERT_TRUE(byteStream->atEnd());
386 if (GetParam()) {
387 BOLT_ASSERT_THROW(
388 byteStream->skip(1), "Reading past end of ByteInputStream");
389 } else {
390 BOLT_ASSERT_THROW(
391 byteStream->skip(1),
392 "(1 vs. 0) Skip past the end of FileInputStream: 131568");
393 }
394 ASSERT_TRUE(byteStream->atEnd());
395}
396
397TEST_P(InputByteStreamTest, remainingSize) {
398 const int32_t kSize = 100;

Callers

nothing calls this directly

Calls 14

backMethod · 0.80
push_backMethod · 0.45
sizeMethod · 0.45
atEndMethod · 0.45
skipMethod · 0.45
allocateMethod · 0.45
remainingSizeMethod · 0.45
readBytesMethod · 0.45
freeMethod · 0.45
toStringMethod · 0.45
reserveMethod · 0.45
nextViewMethod · 0.45

Tested by

no test coverage detected