diff options
author | Miika Turkia <miika.turkia@gmail.com> | 2015-09-13 21:30:25 +0300 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2015-09-13 15:27:54 -0700 |
commit | 0160e58e7d36615ad60b76277d7679a781cfed55 (patch) | |
tree | de7240f7d8b6c68e07cb5335328b2d8f3cdc2322 | |
parent | 3fb017a1c38c95b21890904b2570e9b7a611ca3f (diff) | |
download | subsurface-0160e58e7d36615ad60b76277d7679a781cfed55.tar.gz |
Test case: reading zip and DLD parsing
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
-rw-r--r-- | file.c | 2 | ||||
-rw-r--r-- | file.h | 1 | ||||
-rw-r--r-- | tests/testparse.cpp | 12 | ||||
-rw-r--r-- | tests/testparse.h | 1 |
4 files changed, 15 insertions, 1 deletions
@@ -85,7 +85,7 @@ static void zip_read(struct zip_file *file, const char *filename) free(mem); } -static int try_to_open_zip(const char *filename, struct memblock *mem) +int try_to_open_zip(const char *filename, struct memblock *mem) { int success = 0; /* Grr. libzip needs to re-open the file, it can't take a buffer */ @@ -16,6 +16,7 @@ extern "C" { #endif extern int readfile(const char *filename, struct memblock *mem); extern timestamp_t parse_date(const char *date); +extern int try_to_open_zip(const char *filename, struct memblock *mem); #ifdef __cplusplus } #endif diff --git a/tests/testparse.cpp b/tests/testparse.cpp index 7d892fab4..3490ad8cb 100644 --- a/tests/testparse.cpp +++ b/tests/testparse.cpp @@ -357,4 +357,16 @@ void TestParse::testParseCompareNewFormatOutput() clear_dive_file_data(); } +void TestParse::testParseDLD() +{ + struct memblock mem; + int ret, success = 0; + QString filename = SUBSURFACE_SOURCE "/dives/TestDiveDivelogsDE.DLD"; + + QVERIFY(readfile(filename.toLatin1().data(), &mem) > 0); + QVERIFY(try_to_open_zip(filename.toLatin1().data(), &mem) > 0); + + fprintf(stderr, "number of dives from DLD: %d \n", dive_table.nr); +} + QTEST_MAIN(TestParse) diff --git a/tests/testparse.h b/tests/testparse.h index 53cc07afb..147c0e13a 100644 --- a/tests/testparse.h +++ b/tests/testparse.h @@ -17,6 +17,7 @@ private slots: void testParseCompareHUDCOutput(); void testParseNewFormat(); void testParseCompareNewFormatOutput(); + void testParseDLD(); }; #endif |