summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2015-08-30 10:32:38 -0700
committerGravatar Dirk Hohndel <dirk@hohndel.org>2015-08-30 10:32:38 -0700
commit1b37e0f1a4e4225026e7c5b2c15f178a9c75b2ad (patch)
tree3cdb1dc255de940ac2e1d5ef34c9348daafc2472
parente0587cb6dfbc56feb9fd1edfc7bcdd64b7142653 (diff)
downloadsubsurface-1b37e0f1a4e4225026e7c5b2c15f178a9c75b2ad.tar.gz
Add test for dive site duplication bug
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
-rw-r--r--CMakeLists.txt1
-rw-r--r--dives/TwoTimesTwo.ssrf32
-rw-r--r--tests/testdivesiteduplication.cpp11
-rw-r--r--tests/testdivesiteduplication.h13
4 files changed, 57 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index d52098a96..c0374f1e0 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -573,6 +573,7 @@ if(NOT NO_TESTS)
TEST(TestParse testparse.cpp)
TEST(TestGitStorage testgitstorage.cpp)
TEST(TestPlan testplan.cpp)
+ TEST(TestDiveSiteDuplication testdivesiteduplication.cpp)
endif()
# install a few things so that one can run Subsurface from the build
diff --git a/dives/TwoTimesTwo.ssrf b/dives/TwoTimesTwo.ssrf
new file mode 100644
index 000000000..6385f37dd
--- /dev/null
+++ b/dives/TwoTimesTwo.ssrf
@@ -0,0 +1,32 @@
+<divelog program='subsurface' version='2'>
+<dives>
+<dive number='1' date='2014-03-15' time='21:44:06' duration='52:20 min'>
+ <location gps='7.132557 134.224213'>Blue Corner</location>
+ <notes>First dive with this location</notes>
+ <divecomputer model='manually added dive'>
+ <depth max='15.0 m' mean='9.908 m' />
+ </divecomputer>
+</dive>
+<dive number='2' date='2014-03-16' time='21:44:06' duration='52:20 min'>
+ <location gps='7.132557 134.224213'>Blue Corner, Palau</location>
+ <notes>Second dive with this location</notes>
+ <divecomputer model='manually added dive'>
+ <depth max='15.0 m' mean='9.908 m' />
+ </divecomputer>
+</dive>
+<dive number='3' date='2014-03-17' time='21:44:06' duration='52:20 min'>
+ <location gps='7.132557 134.224213'>Blue Corner</location>
+ <notes>First dive with this location</notes>
+ <divecomputer model='manually added dive'>
+ <depth max='15.0 m' mean='9.908 m' />
+ </divecomputer>
+</dive>
+<dive number='4' date='2014-03-18' time='21:44:06' duration='52:20 min'>
+ <location gps='7.132557 134.224213'>Blue Corner, Palau</location>
+ <notes>Second dive with this location</notes>
+ <divecomputer model='manually added dive'>
+ <depth max='15.0 m' mean='9.908 m' />
+ </divecomputer>
+</dive>
+</dives>
+</divelog>
diff --git a/tests/testdivesiteduplication.cpp b/tests/testdivesiteduplication.cpp
new file mode 100644
index 000000000..fc8ba0a1e
--- /dev/null
+++ b/tests/testdivesiteduplication.cpp
@@ -0,0 +1,11 @@
+#include "testdivesiteduplication.h"
+#include "dive.h"
+#include "divesite.h"
+
+void TestDiveSiteDuplication::testReadV2()
+{
+ QCOMPARE(parse_file(SUBSURFACE_SOURCE "/dives/TwoTimesTwo.ssrf"), 0);
+ QCOMPARE(dive_site_table.nr, 2);
+}
+
+QTEST_MAIN(TestDiveSiteDuplication)
diff --git a/tests/testdivesiteduplication.h b/tests/testdivesiteduplication.h
new file mode 100644
index 000000000..5fb625568
--- /dev/null
+++ b/tests/testdivesiteduplication.h
@@ -0,0 +1,13 @@
+#ifndef TESTDIVESITEDUPLICATION_H
+#define TESTDIVESITEDUPLICATION_H
+
+#include <QTest>
+
+class TestDiveSiteDuplication : public QObject
+{
+ Q_OBJECT
+private slots:
+ void testReadV2();
+};
+
+#endif // TESTDIVESITEDUPLICATION_H