summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorGravatar Miika Turkia <miika.turkia@gmail.com>2015-07-27 16:13:33 +0300
committerGravatar Dirk Hohndel <dirk@hohndel.org>2015-07-27 06:35:19 -0700
commit80fe9f8c0dfd6118ecb3d1c56fd3128a84c1c563 (patch)
tree65f0c270d8990480cdb763502d9e0e08e9e5d999 /tests
parentffa45b9d244620e27683bb4109b15f0f414487e8 (diff)
downloadsubsurface-80fe9f8c0dfd6118ecb3d1c56fd3128a84c1c563.tar.gz
Test case: HUDC import
Signed-off-by: Miika Turkia <miika.turkia@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'tests')
-rw-r--r--tests/testparse.cpp46
-rw-r--r--tests/testparse.h2
2 files changed, 48 insertions, 0 deletions
diff --git a/tests/testparse.cpp b/tests/testparse.cpp
index 81e1ba575..21c9facf4 100644
--- a/tests/testparse.cpp
+++ b/tests/testparse.cpp
@@ -86,4 +86,50 @@ void TestParse::testParseCompareDM4Output()
clear_dive_file_data();
}
+void TestParse::testParseHUDC()
+{
+ QCOMPARE(parse_csv_file(SUBSURFACE_SOURCE "/dives/TestDiveSeabearHUDC.csv",
+ 0, // sample time
+ 1, // sample depth
+ 5, // sample temperature
+ -1, // sample pO₂
+ -1, // sample sensor1 pO₂
+ -1, // sample sensor2 pO₂
+ -1, // sample sensor3 pO₂
+ -1, // sample cns
+ 2, // sample ndl
+ -1, // sample tts
+ -1, // sample stopdepth
+ -1, // sample pressure
+ -1, // smaple setpoint
+ 2, // separator index
+ "csv", // XSLT template
+ 0, // units
+ "\"DC text\""), 0);
+
+ /*
+ * CSV import uses time and date stamps relative to current
+ * time, thus we need to use a static (random) timestamp
+ */
+
+ struct dive *dive = dive_table.dives[dive_table.nr - 1];
+ dive->when = 1255152761;
+ dive->dc.when = 1255152761;
+}
+
+void TestParse::testParseCompareHUDCOutput()
+{
+ QCOMPARE(save_dives("./testhudcout.ssrf"), 0);
+ QFile org(SUBSURFACE_SOURCE "/dives/TestDiveSeabearHUDC.xml");
+ org.open(QFile::ReadOnly);
+ QFile out("./testhudcout.ssrf");
+ out.open(QFile::ReadOnly);
+ QTextStream orgS(&org);
+ QTextStream outS(&out);
+ QString readin = orgS.readAll();
+ QString written = outS.readAll();
+ QCOMPARE(readin, written);
+ clear_dive_file_data();
+}
+
QTEST_MAIN(TestParse)
diff --git a/tests/testparse.h b/tests/testparse.h
index 23a7c4901..ae6131090 100644
--- a/tests/testparse.h
+++ b/tests/testparse.h
@@ -13,6 +13,8 @@ private slots:
void testParseCompareOutput();
void testParseDM4();
void testParseCompareDM4Output();
+ void testParseHUDC();
+ void testParseCompareHUDCOutput();
};
#endif