| 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"}; |
no test coverage detected