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