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

Function MismatchingNumColumns

cpp/src/arrow/csv/parser_test.cc:591–611  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

589}
590
591std::vector<std::string> MismatchingNumColumns(int32_t num_cols, int32_t mismatch,
592 int64_t extra_lines = 0) {
593 auto write_line = [](int32_t num_cols, std::string_view prefix, std::ostream* out) {
594 for (int32_t i = 0; i < num_cols; ++i) {
595 *out << prefix << i << ",";
596 }
597 out->seekp(-1, std::ios_base::cur);
598 *out << "\n";
599 };
600
601 std::stringstream csv_data;
602 // Output first line with `num_cols` columns
603 write_line(num_cols, "a", &csv_data);
604 // Output second line with mismatching number of columns
605 write_line(num_cols + mismatch, "b", &csv_data);
606 // Output extra lines with `num_cols` columns each
607 for (int64_t i = 0; i < extra_lines; ++i) {
608 write_line(num_cols, "c", &csv_data);
609 }
610 return {csv_data.str()};
611}
612
613TEST(BlockParser, MismatchingNumColumns) {
614 uint32_t out_size;

Callers 1

TESTFunction · 0.85

Calls 1

strMethod · 0.80

Tested by

no test coverage detected