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

Function TEST_F

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

Source from the content-addressed store, hash-verified

832};
833
834TEST_F(TestChunkedBinaryBuilder, BasicOperation) {
835 const int32_t chunksize = 1000;
836 Init(chunksize);
837
838 const int elem_size = 10;
839 uint8_t buf[elem_size];
840
841 BinaryBuilder unchunked_builder;
842
843 const int iterations = 1000;
844 for (int i = 0; i < iterations; ++i) {
845 random_bytes(elem_size, i, buf);
846
847 ASSERT_OK(unchunked_builder.Append(buf, elem_size));
848 ASSERT_OK(builder_->Append(buf, elem_size));
849 }
850
851 std::shared_ptr<Array> unchunked;
852 ASSERT_OK(unchunked_builder.Finish(&unchunked));
853
854 ArrayVector chunks;
855 ASSERT_OK(builder_->Finish(&chunks));
856
857 // This assumes that everything is evenly divisible
858 ArrayVector expected_chunks;
859 const int elems_per_chunk = chunksize / elem_size;
860 for (int i = 0; i < iterations / elems_per_chunk; ++i) {
861 expected_chunks.emplace_back(unchunked->Slice(i * elems_per_chunk, elems_per_chunk));
862 }
863
864 ASSERT_EQ(expected_chunks.size(), chunks.size());
865 for (size_t i = 0; i < chunks.size(); ++i) {
866 AssertArraysEqual(*expected_chunks[i], *chunks[i]);
867 }
868}
869
870TEST_F(TestChunkedBinaryBuilder, Reserve) {
871 // ARROW-6060

Callers

nothing calls this directly

Calls 13

AssertArraysEqualFunction · 0.85
default_memory_poolFunction · 0.85
emplace_backMethod · 0.80
random_bytesFunction · 0.50
AppendMethod · 0.45
FinishMethod · 0.45
SliceMethod · 0.45
sizeMethod · 0.45
ReserveMethod · 0.45
bytes_allocatedMethod · 0.45
lengthMethod · 0.45
GetViewMethod · 0.45

Tested by

no test coverage detected