summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorGravatar Miika Turkia <miika.turkia@gmail.com>2017-05-09 22:28:04 +0300
committerGravatar Dirk Hohndel <dirk@hohndel.org>2017-05-12 14:05:33 -0700
commit726c9e859c60d6506b4b7c9a5a8bd909486ca9f7 (patch)
tree31332897e378973264e5679a9c5bd5d46161b377 /tests
parentf2e23e7815bef678b78ba205c3014c0b97a811ba (diff)
downloadsubsurface-726c9e859c60d6506b4b7c9a5a8bd909486ca9f7.tar.gz
Test case for CSV profile export to imperial and back
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/testparse.cpp48
-rw-r--r--tests/testparse.h2
2 files changed, 50 insertions, 0 deletions
diff --git a/tests/testparse.cpp b/tests/testparse.cpp
index 9cea8c6c8..9d2f4dea7 100644
--- a/tests/testparse.cpp
+++ b/tests/testparse.cpp
@@ -370,6 +370,53 @@ void TestParse::exportCSVDiveDetails()
clear_dive_file_data();
}
+int TestParse::parseCSVprofile(int units, std::string file)
+{
+ verbose = 1;
+ char *params[55];
+ int pnr = 0;
+
+ params[pnr++] = strdup("dateField");
+ params[pnr++] = intdup(1);
+ params[pnr++] = strdup("datefmt");
+ params[pnr++] = intdup(2);
+ params[pnr++] = strdup("starttimeField");
+ params[pnr++] = intdup(2);
+ params[pnr++] = strdup("numberField");
+ params[pnr++] = intdup(0);
+ params[pnr++] = strdup("timeField");
+ params[pnr++] = intdup(3);
+ params[pnr++] = strdup("depthField");
+ params[pnr++] = intdup(4);
+ params[pnr++] = strdup("tempField");
+ params[pnr++] = intdup(5);
+ params[pnr++] = strdup("pressureField");
+ params[pnr++] = intdup(6);
+ params[pnr++] = strdup("units");
+ params[pnr++] = intdup(units);
+ params[pnr++] = NULL;
+
+ return parse_csv_file(file.c_str(), params, pnr - 1, "csv");
+}
+
+void TestParse::exportCSVDiveProfile()
+{
+ parse_file(SUBSURFACE_TEST_DATA "/dives/test40.xml");
+
+ export_dives_xslt("testcsvexportprofile.csv", 0, 0, "xml2csv.xslt");
+ export_dives_xslt("testcsvexportprofileimperial.csv", 0, 1, "xml2csv.xslt");
+
+ clear_dive_file_data();
+
+ parseCSVprofile(1, "testcsvexportprofileimperial.csv");
+ export_dives_xslt("testcsvexportprofile2.csv", 0, 0, "xml2csv.xslt");
+
+ FILE_COMPARE("testcsvexportprofile2.csv",
+ "testcsvexportprofile.csv");
+
+ clear_dive_file_data();
+}
+
void TestParse::exportUDDF()
{
parse_file(SUBSURFACE_TEST_DATA "/dives/test40.xml");
@@ -390,6 +437,7 @@ void TestParse::exportUDDF()
void TestParse::testExport()
{
exportCSVDiveDetails();
+ exportCSVDiveProfile();
exportUDDF();
}
diff --git a/tests/testparse.h b/tests/testparse.h
index 80c4dacfb..8c64c83ce 100644
--- a/tests/testparse.h
+++ b/tests/testparse.h
@@ -26,6 +26,8 @@ private slots:
int parseCSVmanual(int, std::string);
void exportCSVDiveDetails();
+ int parseCSVprofile(int, std::string);
+ void exportCSVDiveProfile();
void exportUDDF();
void testExport();