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

Method TestExtendCurrent

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

Source from the content-addressed store, hash-verified

591 }
592
593 void TestExtendCurrent() {
594 std::vector<std::string> strings = {"", "bbbb", "aaaaa", "", "ccc"};
595 std::vector<uint8_t> is_valid = {1, 1, 1, 0, 1};
596
597 int N = static_cast<int>(strings.size());
598 int reps = 10;
599
600 for (int j = 0; j < reps; ++j) {
601 for (int i = 0; i < N; ++i) {
602 if (!is_valid[i]) {
603 ASSERT_OK(builder_->AppendNull());
604 } else if (strings[i].length() > 3) {
605 ASSERT_OK(builder_->Append(strings[i].substr(0, 3)));
606 ASSERT_OK(builder_->ExtendCurrent(strings[i].substr(3)));
607 } else {
608 ASSERT_OK(builder_->Append(strings[i]));
609 }
610 }
611 }
612 Done();
613
614 ASSERT_EQ(reps * N, result_->length());
615 ASSERT_EQ(reps, result_->null_count());
616 ASSERT_EQ(reps * 12, result_->value_data()->size());
617
618 CheckStringArray(*result_, strings, is_valid, reps);
619 }
620
621 void TestExtendCurrentUnsafe() {
622 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