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

Function CheckStringArray

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

Source from the content-addressed store, hash-verified

53
54template <typename ArrayType>
55void CheckStringArray(const ArrayType& array, const std::vector<std::string>& strings,
56 const std::vector<uint8_t>& is_valid, int repeats = 1) {
57 int64_t length = array.length();
58 int64_t base_length = static_cast<int64_t>(strings.size());
59 ASSERT_EQ(base_length, static_cast<int64_t>(is_valid.size()));
60 ASSERT_EQ(base_length * repeats, length);
61
62 int32_t value_pos = 0;
63 for (int i = 0; i < length; ++i) {
64 auto j = i % base_length;
65 if (is_valid[j]) {
66 ASSERT_FALSE(array.IsNull(i));
67 auto view = array.GetView(i);
68 ASSERT_EQ(value_pos, array.value_offset(i));
69 ASSERT_EQ(strings[j].size(), view.size());
70 ASSERT_EQ(std::string_view(strings[j]), view);
71 value_pos += static_cast<int32_t>(view.size());
72 } else {
73 ASSERT_TRUE(array.IsNull(i));
74 }
75 }
76}
77
78template <typename T>
79class TestStringArray : public ::testing::Test {

Calls 5

lengthMethod · 0.45
sizeMethod · 0.45
IsNullMethod · 0.45
GetViewMethod · 0.45
value_offsetMethod · 0.45

Tested by

no test coverage detected