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

Method TestOverflowCheck

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

Source from the content-addressed store, hash-verified

752 }
753
754 void TestOverflowCheck() {
755 auto max_size = builder_->memory_limit();
756
757 ASSERT_OK(builder_->ValidateOverflow(1));
758 ASSERT_OK(builder_->ValidateOverflow(max_size));
759 ASSERT_RAISES(CapacityError, builder_->ValidateOverflow(max_size + 1));
760
761 ASSERT_OK(builder_->Append("bb"));
762 ASSERT_OK(builder_->ValidateOverflow(max_size - 2));
763 ASSERT_RAISES(CapacityError, builder_->ValidateOverflow(max_size - 1));
764
765 ASSERT_OK(builder_->AppendNull());
766 ASSERT_OK(builder_->ValidateOverflow(max_size - 2));
767 ASSERT_RAISES(CapacityError, builder_->ValidateOverflow(max_size - 1));
768
769 ASSERT_OK(builder_->Append("ccc"));
770 ASSERT_OK(builder_->ValidateOverflow(max_size - 5));
771 ASSERT_RAISES(CapacityError, builder_->ValidateOverflow(max_size - 4));
772 }
773
774 void TestZeroLength() {
775 // 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