| 4 | #include "unittest.h" |
| 5 | |
| 6 | int main() |
| 7 | { |
| 8 | int rv = 0; |
| 9 | |
| 10 | std::string csv = |
| 11 | "-,A,B,C\n" |
| 12 | "1,,x,#\n" |
| 13 | "2,,y,$\n" |
| 14 | ; |
| 15 | |
| 16 | std::string path = unittest::TempPath(); |
| 17 | unittest::WriteFile(path, csv); |
| 18 | |
| 19 | try |
| 20 | { |
| 21 | rapidcsv::Document doc(path, rapidcsv::LabelParams(0, 0)); |
| 22 | |
| 23 | ExpectException(doc.GetCell<int>(0, 0), std::invalid_argument); |
| 24 | ExpectException(doc.GetCell<int>(1, 0), std::invalid_argument); |
| 25 | ExpectException(doc.GetCell<int>(2, 0), std::invalid_argument); |
| 26 | |
| 27 | ExpectException(doc.GetCell<double>(0, 1), std::invalid_argument); |
| 28 | ExpectException(doc.GetCell<double>(1, 1), std::invalid_argument); |
| 29 | ExpectException(doc.GetCell<double>(2, 1), std::invalid_argument); |
| 30 | } |
| 31 | catch (const std::exception& ex) |
| 32 | { |
| 33 | std::cout << "exception: " << ex.what() << std::endl; |
| 34 | rv = 1; |
| 35 | } |
| 36 | |
| 37 | unittest::DeleteFile(path); |
| 38 | |
| 39 | return rv; |
| 40 | } |
nothing calls this directly
no test coverage detected