summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorGravatar Miika Turkia <miika.turkia@gmail.com>2015-07-24 19:53:22 +0300
committerGravatar Dirk Hohndel <dirk@hohndel.org>2015-07-24 13:21:19 -0700
commitc19f4869afdb874045bce2ae39eba8c9521bade1 (patch)
treeee6d3e36d8800782e115ec7c16ee60cd3e9124e2 /tests
parent76fe262a0ffac68cf61da470772d2e370d9e019d (diff)
downloadsubsurface-c19f4869afdb874045bce2ae39eba8c9521bade1.tar.gz
Create test case for DivingLog SQLite 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.cpp15
-rw-r--r--tests/testparse.h1
2 files changed, 16 insertions, 0 deletions
diff --git a/tests/testparse.cpp b/tests/testparse.cpp
index 7b6efa104..2bedc88bd 100644
--- a/tests/testparse.cpp
+++ b/tests/testparse.cpp
@@ -1,5 +1,6 @@
#include "testparse.h"
#include "dive.h"
+#include "file.h"
#include <QTextStream>
void TestParse::testParseCSV()
@@ -18,6 +19,20 @@ void TestParse::testParseCSV()
fprintf(stderr, "number of dives %d \n", dive_table.nr);
}
+void TestParse::testParseDivingLog()
+{
+ // Parsing of DivingLog import from SQLite database
+ sqlite3 *handle;
+
+ struct dive_site *ds = alloc_dive_site(0xdeadbeef);
+ ds->name = copy_string("Suomi - - Hälvälä");
+
+ QCOMPARE(sqlite3_open(SUBSURFACE_SOURCE "/dives/TestDivingLog4.1.1.sql", &handle), 0);
+ QCOMPARE(parse_divinglog_buffer(handle, 0, 0, 0, &dive_table), 0);
+
+ sqlite3_close(handle);
+}
+
void TestParse::testParseV2NoQuestion()
{
// parsing of a V2 file should work
diff --git a/tests/testparse.h b/tests/testparse.h
index 2e24ec844..5e1dc03d2 100644
--- a/tests/testparse.h
+++ b/tests/testparse.h
@@ -7,6 +7,7 @@ class TestParse : public QObject{
Q_OBJECT
private slots:
void testParseCSV();
+ void testParseDivingLog();
void testParseV2NoQuestion();
void testParseV3();
void testParseCompareOutput();