| 4 | #include "unittest.h" |
| 5 | |
| 6 | int main() |
| 7 | { |
| 8 | int rv = 0; |
| 9 | |
| 10 | std::string csvref = |
| 11 | "B,C\n" |
| 12 | "4,16\n" |
| 13 | "9,81\n" |
| 14 | "16,256\n" |
| 15 | "25,625\n" |
| 16 | ; |
| 17 | |
| 18 | std::string csv = |
| 19 | "A,B,C,D\n" |
| 20 | "2,4,16,256\n" |
| 21 | "3,9,81,6561\n" |
| 22 | "4,16,256,65536\n" |
| 23 | "5,25,625,390625\n" |
| 24 | ; |
| 25 | |
| 26 | std::string path = unittest::TempPath(); |
| 27 | unittest::WriteFile(path, csv); |
| 28 | |
| 29 | try |
| 30 | { |
| 31 | rapidcsv::Document doc(path); |
| 32 | |
| 33 | doc.RemoveColumn("D"); |
| 34 | doc.RemoveColumn(0); |
| 35 | |
| 36 | doc.Save(); |
| 37 | |
| 38 | std::string csvread = unittest::ReadFile(path); |
| 39 | |
| 40 | unittest::ExpectEqual(std::string, csvref, csvread); |
| 41 | } |
| 42 | catch (const std::exception& ex) |
| 43 | { |
| 44 | std::cout << "exception: " << ex.what() << std::endl; |
| 45 | rv = 1; |
| 46 | } |
| 47 | |
| 48 | unittest::DeleteFile(path); |
| 49 | |
| 50 | return rv; |
| 51 | } |
nothing calls this directly
no test coverage detected