| 552 | void SetUp() { CreateExample(/*bounded=*/true); } |
| 553 | |
| 554 | void CreateExample(bool bounded = true) { |
| 555 | // Create a buffer larger than source size, to check that the |
| 556 | // stream end is respected |
| 557 | ASSERT_OK_AND_ASSIGN(auto buf, AllocateResizableBuffer(source_size_ + 10)); |
| 558 | ASSERT_LT(source_size_, buf->size()); |
| 559 | for (int i = 0; i < source_size_; i++) { |
| 560 | buf->mutable_data()[i] = static_cast<uint8_t>(i); |
| 561 | } |
| 562 | source_ = std::make_shared<BufferReader>(std::move(buf)); |
| 563 | ASSERT_OK(source_->Advance(stream_offset_)); |
| 564 | ASSERT_OK_AND_ASSIGN( |
| 565 | stream_, BufferedInputStream::Create(chunk_size_, default_memory_pool(), source_, |
| 566 | bounded ? stream_size_ : -1)); |
| 567 | } |
| 568 | |
| 569 | protected: |
| 570 | int64_t source_size_ = 256; |
nothing calls this directly
no test coverage detected