MCPcopy Create free account
hub / github.com/d99kris/rapidcsv / main

Function main

tests/test047.cpp:6–40  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4#include "unittest.h"
5
6int 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}

Callers

nothing calls this directly

Calls 5

TempPathFunction · 0.85
WriteFileFunction · 0.85
LabelParamsClass · 0.85
DeleteFileFunction · 0.85
whatMethod · 0.80

Tested by

no test coverage detected