diff options
author | Miika Turkia <miika.turkia@gmail.com> | 2017-03-13 21:53:44 +0200 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2017-04-01 08:06:09 -0700 |
commit | a0ed0ff8234ce43c84ac4e03cc513037c5bff8eb (patch) | |
tree | 453469b0057030b7290b6c77e2f083c21ddc2c98 /tests | |
parent | 1c03cb259e648d68c3e2d38d281128619600bac9 (diff) | |
download | subsurface-a0ed0ff8234ce43c84ac4e03cc513037c5bff8eb.tar.gz |
Change parseCSV to support unit and file selection
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/testparse.cpp | 8 | ||||
-rw-r--r-- | 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(); |