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

Method TestExtendCurrent

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

Source from the content-addressed store, hash-verified

581 }
582
583 void TestExtendCurrent() {
584 std::vector<std::string> strings = {"", "bbbb", "aaaaa", "", "ccc"};
585 std::vector<uint8_t> is_valid = {1, 1, 1, 0, 1};
586
587 int N = static_cast<int>(strings.size());
588 int reps = 10;
589
590 for (int j = 0; j < reps; ++j) {
591 for (int i = 0; i < N; ++i) {
592 if (!is_valid[i]) {
593 ASSERT_OK(builder_->AppendNull());
594 } else if (strings[i].length() > 3) {
595 ASSERT_OK(builder_->Append(strings[i].substr(0, 3)));
596 ASSERT_OK(builder_->ExtendCurrent(strings[i].substr(3)));
597 } else {
598 ASSERT_OK(builder_->Append(strings[i]));
599 }
600 }
601 }
602 Done();
603
604 ASSERT_EQ(reps * N, result_->length());
605 ASSERT_EQ(reps, result_->null_count());
606 ASSERT_EQ(reps * 12, result_->value_data()->size());
607
608 CheckStringArray(*result_, strings, is_valid, reps);
609 }
610
611 void TestExtendCurrentUnsafe() {
612 std::vector<std::string> strings = {"", "bbbb", "aaaaa", "", "ccc"};

Callers 1

TYPED_TESTFunction · 0.80

Calls 9

CheckStringArrayFunction · 0.85
substrMethod · 0.80
ExtendCurrentMethod · 0.80
sizeMethod · 0.45
AppendNullMethod · 0.45
lengthMethod · 0.45
AppendMethod · 0.45
null_countMethod · 0.45
value_dataMethod · 0.45

Tested by

no test coverage detected