MCPcopy Create free account
hub / github.com/apache/arrow / TestStressChunked

Method TestStressChunked

cpp/src/arrow/io/memory_test.cc:570–585  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

568 }
569
570 void TestStressChunked() {
571 ASSERT_OK_AND_ASSIGN(auto unique_src, AllocateBuffer(1000));
572 auto src = std::shared_ptr<Buffer>(std::move(unique_src));
573 random_bytes(src->size(), /*seed=*/42, src->mutable_data());
574
575 ASSERT_OK_AND_ASSIGN(auto expected, this->transform()(src));
576
577 std::default_random_engine gen(42);
578 std::uniform_int_distribution<int> chunk_sizes(0, 20);
579
580 auto stream = std::make_shared<TransformInputStream>(
581 std::make_shared<BufferReader>(src), this->transform());
582 std::shared_ptr<Buffer> actual;
583 AccumulateReads(stream, [&]() -> int64_t { return chunk_sizes(gen); }, &actual);
584 AssertBufferEqual(*actual, *expected);
585 }
586
587 void AccumulateReads(const std::shared_ptr<InputStream>& stream,
588 std::function<int64_t()> gen_chunk_sizes,

Callers 1

TYPED_TESTFunction · 0.80

Calls 5

transformMethod · 0.95
AssertBufferEqualFunction · 0.85
random_bytesFunction · 0.50
sizeMethod · 0.45
mutable_dataMethod · 0.45

Tested by

no test coverage detected