summaryrefslogtreecommitdiffstats
path: root/tests/testparse.cpp
diff options
context:
space:
mode:
authorGravatar Miika Turkia <miika.turkia@gmail.com>2020-05-16 13:04:18 +0300
committerGravatar Dirk Hohndel <dirk@hohndel.org>2020-05-18 09:32:58 -0700
commit86f003b21c1cc5a26c05817fdd06f58ab3b6a3a0 (patch)
treef26fdb25ef1ce45d10aba730623c4dd0868524c6 /tests/testparse.cpp
parent0525f31510dd140aab494767e097a2eb4a015b7a (diff)
downloadsubsurface-86f003b21c1cc5a26c05817fdd06f58ab3b6a3a0.tar.gz
TestParse to support SAC
Take into account the added SAC field in dive detail CSV export. Note that we do a test of: - export to CSV file - import the written CSV file - export the newly read data to second file - compare these two exported files As SAC information is not currently read from any import, this adds the SAC value to the imported data before exporting again. Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Diffstat (limited to 'tests/testparse.cpp')
-rw-r--r--tests/testparse.cpp48
1 files changed, 29 insertions, 19 deletions
diff --git a/tests/testparse.cpp b/tests/testparse.cpp
index f4d335665..36ece77f2 100644
--- a/tests/testparse.cpp
+++ b/tests/testparse.cpp
@@ -306,7 +306,7 @@ void TestParse::testParseMerge()
int TestParse::parseCSVmanual(int units, std::string file)
{
verbose = 1;
- char *params[57];
+ char *params[59];
int pnr = 0;
// Numbers are column numbers
@@ -318,42 +318,43 @@ int TestParse::parseCSVmanual(int units, std::string file)
params[pnr++] = intdup(2);
params[pnr++] = strdup("durationField");
params[pnr++] = intdup(3);
+ // 4 Will be SAC, once we add support for reading it
params[pnr++] = strdup("maxDepthField");
- params[pnr++] = intdup(4);
- params[pnr++] = strdup("meanDepthField");
params[pnr++] = intdup(5);
- params[pnr++] = strdup("modeField");
+ params[pnr++] = strdup("meanDepthField");
params[pnr++] = intdup(6);
- params[pnr++] = strdup("airtempField");
+ params[pnr++] = strdup("modeField");
params[pnr++] = intdup(7);
- params[pnr++] = strdup("watertempField");
+ params[pnr++] = strdup("airtempField");
params[pnr++] = intdup(8);
- params[pnr++] = strdup("cylindersizeField");
+ params[pnr++] = strdup("watertempField");
params[pnr++] = intdup(9);
- params[pnr++] = strdup("startpressureField");
+ params[pnr++] = strdup("cylindersizeField");
params[pnr++] = intdup(10);
- params[pnr++] = strdup("endpressureField");
+ params[pnr++] = strdup("startpressureField");
params[pnr++] = intdup(11);
- params[pnr++] = strdup("o2Field");
+ params[pnr++] = strdup("endpressureField");
params[pnr++] = intdup(12);
- params[pnr++] = strdup("heField");
+ params[pnr++] = strdup("o2Field");
params[pnr++] = intdup(13);
- params[pnr++] = strdup("locationField");
+ params[pnr++] = strdup("heField");
params[pnr++] = intdup(14);
- params[pnr++] = strdup("gpsField");
+ params[pnr++] = strdup("locationField");
params[pnr++] = intdup(15);
- params[pnr++] = strdup("divemasterField");
+ params[pnr++] = strdup("gpsField");
params[pnr++] = intdup(16);
- params[pnr++] = strdup("buddyField");
+ params[pnr++] = strdup("divemasterField");
params[pnr++] = intdup(17);
- params[pnr++] = strdup("suitField");
+ params[pnr++] = strdup("buddyField");
params[pnr++] = intdup(18);
+ params[pnr++] = strdup("suitField");
+ params[pnr++] = intdup(19);
params[pnr++] = strdup("notesField");
- params[pnr++] = intdup(21);
- params[pnr++] = strdup("weightField");
params[pnr++] = intdup(22);
- params[pnr++] = strdup("tagsField");
+ params[pnr++] = strdup("weightField");
params[pnr++] = intdup(23);
+ params[pnr++] = strdup("tagsField");
+ params[pnr++] = intdup(24);
// Numbers are indices of possible options
params[pnr++] = strdup("separatorIndex");
params[pnr++] = intdup(0);
@@ -378,6 +379,15 @@ void TestParse::exportCSVDiveDetails()
clear_dive_file_data();
parseCSVmanual(1, "testcsvexportmanualimperial.csv");
+
+ // We do not currently support reading SAC, thus faking it
+ if (dive_table.nr > 0) {
+ struct dive *dive = dive_table.dives[dive_table.nr - 1];
+ dive->sac = 1049;
+ }
+
+
+
export_dives_xslt("testcsvexportmanual2.csv", 0, 0, "xml2manualcsv.xslt", false);
FILE_COMPARE("testcsvexportmanual2.csv",