For the S_COMMENT column, some of the columns must be modified to contain "Customer...Complaints" or "Customer...Recommends". This function counts the number of good and bad comments.
| 324 | // "Customer...Complaints" or "Customer...Recommends". This function counts the number of |
| 325 | // good and bad comments. |
| 326 | void CountModifiedComments(const Datum& d, int* good_count, int* bad_count) { |
| 327 | int64_t length = d.length(); |
| 328 | const int32_t* offsets = |
| 329 | reinterpret_cast<const int32_t*>(d.array()->buffers[1]->data()); |
| 330 | const char* str = reinterpret_cast<const char*>(d.array()->buffers[2]->data()); |
| 331 | for (int64_t i = 0; i < length; i++) { |
| 332 | const char* row = str + offsets[i]; |
| 333 | int32_t row_length = offsets[i + 1] - offsets[i]; |
| 334 | std::string_view view(row, row_length); |
| 335 | bool customer = view.find("Customer") != std::string_view::npos; |
| 336 | bool recommends = view.find("Recommends") != std::string_view::npos; |
| 337 | bool complaints = view.find("Complaints") != std::string_view::npos; |
| 338 | if (customer) { |
| 339 | ASSERT_TRUE(recommends ^ complaints); |
| 340 | if (recommends) *good_count += 1; |
| 341 | if (complaints) *bad_count += 1; |
| 342 | } |
| 343 | } |
| 344 | } |
| 345 | |
| 346 | void VerifySupplier(const std::vector<ExecBatch>& batches, |
| 347 | double scale_factor = kDefaultScaleFactor) { |
no test coverage detected