Test case: HUDC import

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Miika Turkia 2015-07-27 16:13:33 +03:00 committed by Dirk Hohndel
parent ffa45b9d24
commit 80fe9f8c0d
2 changed files with 48 additions and 0 deletions

View file

@ -86,4 +86,50 @@ void TestParse::testParseCompareDM4Output()
clear_dive_file_data();
}
void TestParse::testParseHUDC()
{
QCOMPARE(parse_csv_file(SUBSURFACE_SOURCE "/dives/TestDiveSeabearHUDC.csv",
0, // sample time
1, // sample depth
5, // sample temperature
-1, // sample pO₂
-1, // sample sensor1 pO₂
-1, // sample sensor2 pO₂
-1, // sample sensor3 pO₂
-1, // sample cns
2, // sample ndl
-1, // sample tts
-1, // sample stopdepth
-1, // sample pressure
-1, // smaple setpoint
2, // separator index
"csv", // XSLT template
0, // units
"\"DC text\""), 0);
/*
* CSV import uses time and date stamps relative to current
* time, thus we need to use a static (random) timestamp
*/
struct dive *dive = dive_table.dives[dive_table.nr - 1];
dive->when = 1255152761;
dive->dc.when = 1255152761;
}
void TestParse::testParseCompareHUDCOutput()
{
QCOMPARE(save_dives("./testhudcout.ssrf"), 0);
QFile org(SUBSURFACE_SOURCE "/dives/TestDiveSeabearHUDC.xml");
org.open(QFile::ReadOnly);
QFile out("./testhudcout.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)

View file

@ -13,6 +13,8 @@ private slots:
void testParseCompareOutput();
void testParseDM4();
void testParseCompareDM4Output();
void testParseHUDC();
void testParseCompareHUDCOutput();
};
#endif