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

Function main

tests/test032.cpp:6–46  ·  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 csvref =
11 "2,4,16,256\n"
12 "3,9,81,6561\n"
13 "4,16,256,65536\n"
14 "5,25,625,390625\n"
15 ;
16
17 std::string path = unittest::TempPath();
18
19 try
20 {
21 rapidcsv::Document doc("", rapidcsv::LabelParams(-1, -1), rapidcsv::SeparatorParams(',', false, false));
22
23 doc.SetColumn<int>(0, std::vector<int>({ 2, 3 }));
24 doc.SetColumn<int>(1, std::vector<int>({ 4, 9, 16, 25 }));
25 doc.SetColumn<int>(2, std::vector<int>({ 16, 81, 256, 625 }));
26 doc.SetColumn<int>(3, std::vector<int>({ 256, 6561, 65536, 390625 }));
27
28 doc.SetCell<int>(0, 2, 4);
29 doc.SetCell<int>(0, 3, 5);
30
31 doc.Save(path);
32
33 std::string csvread = unittest::ReadFile(path);
34
35 unittest::ExpectEqual(std::string, csvref, csvread);
36 }
37 catch (const std::exception& ex)
38 {
39 std::cout << "exception: " << ex.what() << std::endl;
40 rv = 1;
41 }
42
43 unittest::DeleteFile(path);
44
45 return rv;
46}

Callers

nothing calls this directly

Calls 7

TempPathFunction · 0.85
LabelParamsClass · 0.85
SeparatorParamsClass · 0.85
ReadFileFunction · 0.85
DeleteFileFunction · 0.85
SaveMethod · 0.80
whatMethod · 0.80

Tested by

no test coverage detected