mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Test DM4 import
Signed-off-by: Miika Turkia <miika.turkia@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
3f0fb84fc2
commit
5d4f81206d
2 changed files with 29 additions and 0 deletions
|
@ -1,6 +1,7 @@
|
||||||
#include "testparse.h"
|
#include "testparse.h"
|
||||||
#include "dive.h"
|
#include "dive.h"
|
||||||
#include "file.h"
|
#include "file.h"
|
||||||
|
#include "divelist.h"
|
||||||
#include <QTextStream>
|
#include <QTextStream>
|
||||||
|
|
||||||
void TestParse::testParseCSV()
|
void TestParse::testParseCSV()
|
||||||
|
@ -57,6 +58,32 @@ void TestParse::testParseCompareOutput()
|
||||||
QString readin = orgS.readAll();
|
QString readin = orgS.readAll();
|
||||||
QString written = outS.readAll();
|
QString written = outS.readAll();
|
||||||
QCOMPARE(readin, written);
|
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)
|
QTEST_MAIN(TestParse)
|
||||||
|
|
|
@ -11,6 +11,8 @@ private slots:
|
||||||
void testParseV2NoQuestion();
|
void testParseV2NoQuestion();
|
||||||
void testParseV3();
|
void testParseV3();
|
||||||
void testParseCompareOutput();
|
void testParseCompareOutput();
|
||||||
|
void testParseDM4();
|
||||||
|
void testParseCompareDM4Output();
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue