From a0ed0ff8234ce43c84ac4e03cc513037c5bff8eb Mon Sep 17 00:00:00 2001 From: Miika Turkia Date: Mon, 13 Mar 2017 21:53:44 +0200 Subject: Change parseCSV to support unit and file selection Signed-off-by: Miika Turkia --- tests/testparse.cpp | 8 ++++---- tests/testparse.h | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/testparse.cpp b/tests/testparse.cpp index 78e86d0e2..4c458eeb2 100644 --- a/tests/testparse.cpp +++ b/tests/testparse.cpp @@ -50,7 +50,7 @@ char *intdup(int index) return strdup(tmpbuf); } -int TestParse::parseCSV() +int TestParse::parseCSV(int units, std::string file) { // some basic file parsing tests // @@ -90,7 +90,7 @@ int TestParse::parseCSV() params[pnr++] = strdup("separatorIndex"); params[pnr++] = intdup(0); params[pnr++] = strdup("units"); - params[pnr++] = intdup(0); + params[pnr++] = intdup(units); params[pnr++] = strdup("datefmt"); params[pnr++] = intdup(1); params[pnr++] = strdup("durationfmt"); @@ -111,7 +111,7 @@ int TestParse::parseCSV() params[pnr++] = intdup(-1); 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() @@ -143,7 +143,7 @@ int TestParse::parseV3() 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); QCOMPARE(parseDivingLog(), 0); diff --git a/tests/testparse.h b/tests/testparse.h index a79ce5a38..ae76c0337 100644 --- a/tests/testparse.h +++ b/tests/testparse.h @@ -11,7 +11,7 @@ private slots: void init(); void cleanup(); - int parseCSV(); + int parseCSV(int, std::string); int parseDivingLog(); int parseV2NoQuestion(); int parseV3(); -- cgit v1.2.3-70-g09d2