mirror of
https://github.com/subsurface/subsurface.git
synced 2025-01-31 22:33:24 +00:00
Change parseCSV to support unit and file selection
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
This commit is contained in:
parent
1c03cb259e
commit
a0ed0ff823
2 changed files with 5 additions and 5 deletions
|
@ -50,7 +50,7 @@ char *intdup(int index)
|
||||||
return strdup(tmpbuf);
|
return strdup(tmpbuf);
|
||||||
}
|
}
|
||||||
|
|
||||||
int TestParse::parseCSV()
|
int TestParse::parseCSV(int units, std::string file)
|
||||||
{
|
{
|
||||||
// some basic file parsing tests
|
// some basic file parsing tests
|
||||||
//
|
//
|
||||||
|
@ -90,7 +90,7 @@ int TestParse::parseCSV()
|
||||||
params[pnr++] = strdup("separatorIndex");
|
params[pnr++] = strdup("separatorIndex");
|
||||||
params[pnr++] = intdup(0);
|
params[pnr++] = intdup(0);
|
||||||
params[pnr++] = strdup("units");
|
params[pnr++] = strdup("units");
|
||||||
params[pnr++] = intdup(0);
|
params[pnr++] = intdup(units);
|
||||||
params[pnr++] = strdup("datefmt");
|
params[pnr++] = strdup("datefmt");
|
||||||
params[pnr++] = intdup(1);
|
params[pnr++] = intdup(1);
|
||||||
params[pnr++] = strdup("durationfmt");
|
params[pnr++] = strdup("durationfmt");
|
||||||
|
@ -111,7 +111,7 @@ int TestParse::parseCSV()
|
||||||
params[pnr++] = intdup(-1);
|
params[pnr++] = intdup(-1);
|
||||||
params[pnr++] = NULL;
|
params[pnr++] = NULL;
|
||||||
|
|
||||||
return parse_manual_file(SUBSURFACE_TEST_DATA "/dives/test41.csv", params, pnr - 1);
|
return parse_manual_file(file.c_str(), params, pnr - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
int TestParse::parseDivingLog()
|
int TestParse::parseDivingLog()
|
||||||
|
@ -143,7 +143,7 @@ int TestParse::parseV3()
|
||||||
|
|
||||||
void TestParse::testParse()
|
void TestParse::testParse()
|
||||||
{
|
{
|
||||||
QCOMPARE(parseCSV(), 0);
|
QCOMPARE(parseCSV(0, SUBSURFACE_TEST_DATA "/dives/test41.csv"), 0);
|
||||||
fprintf(stderr, "number of dives %d \n", dive_table.nr);
|
fprintf(stderr, "number of dives %d \n", dive_table.nr);
|
||||||
|
|
||||||
QCOMPARE(parseDivingLog(), 0);
|
QCOMPARE(parseDivingLog(), 0);
|
||||||
|
|
|
@ -11,7 +11,7 @@ private slots:
|
||||||
void init();
|
void init();
|
||||||
void cleanup();
|
void cleanup();
|
||||||
|
|
||||||
int parseCSV();
|
int parseCSV(int, std::string);
|
||||||
int parseDivingLog();
|
int parseDivingLog();
|
||||||
int parseV2NoQuestion();
|
int parseV2NoQuestion();
|
||||||
int parseV3();
|
int parseV3();
|
||||||
|
|
Loading…
Add table
Reference in a new issue