File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -196,6 +196,7 @@ if(RAPIDCSV_BUILD_TESTS)
196196 add_unit_test (test104 )
197197 add_unit_test (test105 )
198198 add_unit_test (test106 )
199+ add_unit_test (test107 )
199200
200201 # perf tests
201202 add_perf_test (ptest001 )
Original file line number Diff line number Diff line change 1+ // test107.cpp - get column labels of empty label row
2+
3+ #include < rapidcsv.h>
4+ #include " unittest.h"
5+
6+ int main ()
7+ {
8+ int rv = 0 ;
9+
10+ try
11+ {
12+ // Empty document, specify column and row labels available
13+ std::string csv = " " ;
14+ std::istringstream s (csv);
15+ rapidcsv::Document doc (s, rapidcsv::LabelParams (0 , 0 ));
16+
17+ // InsertRow create a row with 0 columns
18+ doc.InsertRow <std::string>(0 );
19+
20+ // Get column names
21+ std::vector<std::string> names = doc.GetColumnNames ();
22+ unittest::ExpectEqual (size_t , names.size (), size_t (0 ));
23+ }
24+ catch (const std::exception& ex)
25+ {
26+ std::cout << " exception: " << ex.what () << std::endl;
27+ rv = 1 ;
28+ }
29+
30+ return rv;
31+ }
You can’t perform that action at this time.
0 commit comments