MCPcopy Create free account
hub / github.com/comaps/comaps / UNIT_TEST

Function UNIT_TEST

libs/coding/coding_tests/csv_reader_test.cpp:27–49  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

25} // namespace
26
27UNIT_TEST(CSVReaderSmoke)
28{
29 auto const fileName = "test.csv";
30 ScopedFile sf(fileName, kCSV1);
31 {
32 FileReader fileReader(sf.GetFullPath());
33 coding::CSVReader reader(fileReader, false /* hasHeader */);
34 auto const file = reader.ReadAll();
35 TEST_EQUAL(file.size(), 2, ());
36 Row const firstRow = {"a", "b", "c", "d"};
37 TEST_EQUAL(file[0], firstRow, ());
38 Row const secondRow = {"e", "f", "g h"};
39 TEST_EQUAL(file[1], secondRow, ());
40 }
41 {
42 FileReader fileReader(sf.GetFullPath());
43 coding::CSVReader reader(fileReader, true /* hasHeader */);
44 auto const file = reader.ReadAll();
45 TEST_EQUAL(file.size(), 1, ());
46 Row const headerRow = {"a", "b", "c", "d"};
47 TEST_EQUAL(reader.GetHeader(), headerRow, ());
48 }
49}
50
51UNIT_TEST(CSVReaderReadLine)
52{

Callers

nothing calls this directly

Calls 10

TESTFunction · 0.85
CSVReaderClass · 0.85
CSVRunnerClass · 0.85
ReadAllMethod · 0.80
GetHeaderMethod · 0.80
ReadRowMethod · 0.80
ForEachRowMethod · 0.80
sizeMethod · 0.45
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected