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

Method TestOverflowCheck

cpp/src/arrow/array/array_binary_test.cc:744–762  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

742 }
743
744 void TestOverflowCheck() {
745 auto max_size = builder_->memory_limit();
746
747 ASSERT_OK(builder_->ValidateOverflow(1));
748 ASSERT_OK(builder_->ValidateOverflow(max_size));
749 ASSERT_RAISES(CapacityError, builder_->ValidateOverflow(max_size + 1));
750
751 ASSERT_OK(builder_->Append("bb"));
752 ASSERT_OK(builder_->ValidateOverflow(max_size - 2));
753 ASSERT_RAISES(CapacityError, builder_->ValidateOverflow(max_size - 1));
754
755 ASSERT_OK(builder_->AppendNull());
756 ASSERT_OK(builder_->ValidateOverflow(max_size - 2));
757 ASSERT_RAISES(CapacityError, builder_->ValidateOverflow(max_size - 1));
758
759 ASSERT_OK(builder_->Append("ccc"));
760 ASSERT_OK(builder_->ValidateOverflow(max_size - 5));
761 ASSERT_RAISES(CapacityError, builder_->ValidateOverflow(max_size - 4));
762 }
763
764 void TestZeroLength() {
765 // All buffers are null

Callers 1

TYPED_TESTFunction · 0.45

Calls 4

memory_limitMethod · 0.80
ValidateOverflowMethod · 0.45
AppendMethod · 0.45
AppendNullMethod · 0.45

Tested by

no test coverage detected