[PATCH 3/3] Test case: compare DLD log with a saved one

Miika Turkia miika.turkia at gmail.com
Sun Sep 13 11:30:27 PDT 2015


Signed-off-by: Miika Turkia <miika.turkia at gmail.com>
---
 tests/testparse.cpp | 21 +++++++++++++++++++++
 tests/testparse.h   |  1 +
 2 files changed, 22 insertions(+)

diff --git a/tests/testparse.cpp b/tests/testparse.cpp
index 3490ad8..1a4c0ea 100644
--- a/tests/testparse.cpp
+++ b/tests/testparse.cpp
@@ -369,4 +369,25 @@ void TestParse::testParseDLD()
 	fprintf(stderr, "number of dives from DLD: %d \n", dive_table.nr);
 }
 
+void TestParse::testParseCompareDLDOutput()
+{
+	/*
+	 * DC is not cleared from previous tests with the
+	 * clear_dive_file_data(), so we do have an additional DC nick
+	 * name field on the log.
+	 */
+
+	QCOMPARE(save_dives("./testdldout.ssrf"), 0);
+	QFile org(SUBSURFACE_SOURCE "/dives/TestDiveDivelogsDE.xml");
+	org.open(QFile::ReadOnly);
+	QFile out("./testdldout.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 147c0e1..5616f07 100644
--- a/tests/testparse.h
+++ b/tests/testparse.h
@@ -18,6 +18,7 @@ private slots:
 	void testParseNewFormat();
 	void testParseCompareNewFormatOutput();
 	void testParseDLD();
+	void testParseCompareDLDOutput();
 };
 
 #endif
-- 
2.1.4



More information about the subsurface mailing list