We can't validate the buffer addresses exactly because they are unpredictable pointer values. However, when multiple ranges come from the same buffer we can validate that the buffers are the same.
| 145 | // values. However, when multiple ranges come from the same buffer we can validate that |
| 146 | // the buffers are the same. |
| 147 | void CheckBufferRangeStarts(const std::shared_ptr<Array>& starts, |
| 148 | const std::vector<ExpectedRange>& expected) { |
| 149 | const std::shared_ptr<UInt64Array>& starts_uint64 = |
| 150 | checked_pointer_cast<UInt64Array>(starts); |
| 151 | std::unordered_map<int, uint64_t> previous_buffer_starts; |
| 152 | ASSERT_NE(nullptr, starts_uint64); |
| 153 | const uint64_t* starts_data = starts_uint64->raw_values(); |
| 154 | for (std::size_t i = 0; i < expected.size(); i++) { |
| 155 | const auto& previous_buffer_start = previous_buffer_starts.find(expected[i].index); |
| 156 | if (previous_buffer_start == previous_buffer_starts.end()) { |
| 157 | previous_buffer_starts.insert({expected[i].index, starts_data[i]}); |
| 158 | } else { |
| 159 | ASSERT_EQ(starts_data[i], previous_buffer_start->second); |
| 160 | } |
| 161 | } |
| 162 | } |
| 163 | |
| 164 | void CheckBufferRanges(const std::shared_ptr<Array>& input, |
| 165 | const std::vector<ExpectedRange>& expected) { |
no test coverage detected