Seems that I messed up with the file names when I changed them to make
more sense :(

This patch should be used instead.

miika

On Sun, Jul 26, 2015 at 4:37 PM, Miika Turkia <[email protected]> wrote:

> +       QCOMPARE(save_dives("./testsd4out.ssrf"), 0);
> +       QFile out("./testdm4out.ssrf");
From b8b60be37407ded7c57c35620133b3c5c773ae29 Mon Sep 17 00:00:00 2001
From: Miika Turkia <[email protected]>
Date: Sun, 26 Jul 2015 15:08:11 +0300
Subject: [PATCH] Test DM4 import

Signed-off-by: Miika Turkia <[email protected]>
---
 tests/testparse.cpp | 27 +++++++++++++++++++++++++++
 tests/testparse.h   |  2 ++
 2 files changed, 29 insertions(+)

diff --git a/tests/testparse.cpp b/tests/testparse.cpp
index 2bedc88..81e1ba5 100644
--- a/tests/testparse.cpp
+++ b/tests/testparse.cpp
@@ -1,6 +1,7 @@
 #include "testparse.h"
 #include "dive.h"
 #include "file.h"
+#include "divelist.h"
 #include <QTextStream>
 
 void TestParse::testParseCSV()
@@ -57,6 +58,32 @@ void TestParse::testParseCompareOutput()
 	QString readin = orgS.readAll();
 	QString written = outS.readAll();
 	QCOMPARE(readin, written);
+	clear_dive_file_data();
+}
+
+void TestParse::testParseDM4()
+{
+	sqlite3 *handle;
+
+	QCOMPARE(sqlite3_open(SUBSURFACE_SOURCE "/dives/TestDiveDM4.db", &handle), 0);
+	QCOMPARE(parse_dm4_buffer(handle, 0, 0, 0, &dive_table), 0);
+
+	sqlite3_close(handle);
+}
+
+void TestParse::testParseCompareDM4Output()
+{
+	QCOMPARE(save_dives("./testdm4out.ssrf"), 0);
+	QFile org(SUBSURFACE_SOURCE "/dives/TestDiveDM4.xml");
+	org.open(QFile::ReadOnly);
+	QFile out("./testdm4out.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 5e1dc03..23a7c49 100644
--- a/tests/testparse.h
+++ b/tests/testparse.h
@@ -11,6 +11,8 @@ private slots:
 	void testParseV2NoQuestion();
 	void testParseV3();
 	void testParseCompareOutput();
+	void testParseDM4();
+	void testParseCompareDM4Output();
 };
 
 #endif
-- 
2.1.4

_______________________________________________
subsurface mailing list
[email protected]
http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface

Reply via email to