mirror of
https://github.com/subsurface/subsurface.git
synced 2025-01-19 06:15:26 +00:00
Whitespace cleanup tests
Again, entirely script based. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
128fc5f4b8
commit
afe7e847d6
27 changed files with 321 additions and 313 deletions
|
@ -4,8 +4,7 @@
|
|||
|
||||
#include <QTest>
|
||||
|
||||
class TestDiveSiteDuplication : public QObject
|
||||
{
|
||||
class TestDiveSiteDuplication : public QObject {
|
||||
Q_OBJECT
|
||||
private slots:
|
||||
void testReadV2();
|
||||
|
|
|
@ -4,8 +4,7 @@
|
|||
|
||||
#include <QTest>
|
||||
|
||||
class TestGitStorage : public QObject
|
||||
{
|
||||
class TestGitStorage : public QObject {
|
||||
Q_OBJECT
|
||||
private slots:
|
||||
void initTestCase();
|
||||
|
|
|
@ -8,113 +8,113 @@ extern bool parseGpsText(const QString &gps_text, double *latitude, double *long
|
|||
void TestGpsCoords::testISO6709DParse()
|
||||
{
|
||||
testParseOK("52°49'02.388\"N 1°36'17.388\"E",
|
||||
coord2double(52, 49, 2.388), coord2double(1, 36, 17.388));
|
||||
coord2double(52, 49, 2.388), coord2double(1, 36, 17.388));
|
||||
}
|
||||
|
||||
void TestGpsCoords::testNegativeISO6709DParse()
|
||||
{
|
||||
testParseOK("52°49'02.388\"S 1°36'17.388\"W",
|
||||
coord2double(-52, -49, -2.388), coord2double(-1, -36, -17.388));
|
||||
coord2double(-52, -49, -2.388), coord2double(-1, -36, -17.388));
|
||||
}
|
||||
|
||||
void TestGpsCoords::testSpaceISO6709DParse()
|
||||
{
|
||||
testParseOK("52 ° 49 ' 02.388 \" N 1 ° 36 ' 17.388 \" E",
|
||||
coord2double(52, 49, 2.388), coord2double(1, 36, 17.388));
|
||||
coord2double(52, 49, 2.388), coord2double(1, 36, 17.388));
|
||||
}
|
||||
|
||||
void TestGpsCoords::testSecondsParse()
|
||||
{
|
||||
testParseOK("N52°49'02.388\" E1°36'17.388\"",
|
||||
coord2double(52, 49, 2.388), coord2double(1, 36, 17.388));
|
||||
coord2double(52, 49, 2.388), coord2double(1, 36, 17.388));
|
||||
}
|
||||
|
||||
void TestGpsCoords::testSpaceSecondsParse()
|
||||
{
|
||||
testParseOK(" N 52 ° 49 ' 02.388 \" E 1 ° 36 ' 17.388 \"",
|
||||
coord2double(52, 49, 2.388), coord2double(1, 36, 17.388));
|
||||
coord2double(52, 49, 2.388), coord2double(1, 36, 17.388));
|
||||
}
|
||||
|
||||
void TestGpsCoords::testNegativeSecondsParse()
|
||||
{
|
||||
testParseOK("-52°49'02.388\" -1°36'17.388\"",
|
||||
coord2double(-52, -49, -2.388), coord2double(-1, -36, -17.388));
|
||||
coord2double(-52, -49, -2.388), coord2double(-1, -36, -17.388));
|
||||
}
|
||||
|
||||
void TestGpsCoords::testMinutesParse()
|
||||
{
|
||||
testParseOK("N52°49.03' E1d36.23'",
|
||||
coord2double(52, 49.03), coord2double(1, 36.23));
|
||||
coord2double(52, 49.03), coord2double(1, 36.23));
|
||||
}
|
||||
|
||||
void TestGpsCoords::testSpaceMinutesParse()
|
||||
{
|
||||
testParseOK(" N 52 ° 49.03 ' E 1 ° 36.23 ' ",
|
||||
coord2double(52, 49.03), coord2double(1, 36.23));
|
||||
coord2double(52, 49.03), coord2double(1, 36.23));
|
||||
}
|
||||
|
||||
void TestGpsCoords::testMinutesInversedParse()
|
||||
{
|
||||
testParseOK("2° 53.836' N 73° 32.839' E",
|
||||
coord2double(2, 53.836), coord2double(73, 32.839));
|
||||
coord2double(2, 53.836), coord2double(73, 32.839));
|
||||
}
|
||||
|
||||
void TestGpsCoords::testDecimalParse()
|
||||
{
|
||||
testParseOK("N52.83° E1.61",
|
||||
coord2double(52.83), coord2double(1.61));
|
||||
coord2double(52.83), coord2double(1.61));
|
||||
}
|
||||
|
||||
void TestGpsCoords::testDecimalInversedParse()
|
||||
{
|
||||
testParseOK("52.83N 1.61E",
|
||||
coord2double(52.83), coord2double(1.61));
|
||||
coord2double(52.83), coord2double(1.61));
|
||||
}
|
||||
|
||||
void TestGpsCoords::testSpaceDecimalParse()
|
||||
{
|
||||
testParseOK(" N 52.83 E 1.61 ",
|
||||
coord2double(52.83), coord2double(1.61));
|
||||
coord2double(52.83), coord2double(1.61));
|
||||
}
|
||||
|
||||
void TestGpsCoords::testXmlFormatParse()
|
||||
{
|
||||
testParseOK("46.473881 6.784696",
|
||||
coord2double(46.473881), coord2double(6.784696));
|
||||
coord2double(46.473881), coord2double(6.784696));
|
||||
}
|
||||
|
||||
void TestGpsCoords::testNegativeXmlFormatParse()
|
||||
{
|
||||
testParseOK("46.473881 -6.784696",
|
||||
coord2double(46.473881), -coord2double(6.784696));
|
||||
coord2double(46.473881), -coord2double(6.784696));
|
||||
}
|
||||
|
||||
void TestGpsCoords::testNoUnitParse()
|
||||
{
|
||||
testParseOK("48 51.491n 2 17.677e",
|
||||
coord2double(48, 51.491), coord2double(2, 17.677));
|
||||
coord2double(48, 51.491), coord2double(2, 17.677));
|
||||
}
|
||||
|
||||
void TestGpsCoords::testPrefixNoUnitParse()
|
||||
{
|
||||
testParseOK("n48 51.491 w2 17.677",
|
||||
coord2double(48, 51.491), -coord2double(2, 17.677));
|
||||
coord2double(48, 51.491), -coord2double(2, 17.677));
|
||||
}
|
||||
|
||||
void TestGpsCoords::testOurWeb()
|
||||
{
|
||||
testParseOK("12° 8' 0.24\" , -68° 16' 58.44\"",
|
||||
coord2double(12, 8, 0.24 ), -coord2double(68, 16, 58.44));
|
||||
coord2double(12, 8, 0.24), -coord2double(68, 16, 58.44));
|
||||
}
|
||||
|
||||
void TestGpsCoords::testGoogle()
|
||||
{
|
||||
testParseOK("12.133400, -68.282900",
|
||||
coord2double(12, 8, 0.24 ), -coord2double(68, 16, 58.44));
|
||||
coord2double(12, 8, 0.24), -coord2double(68, 16, 58.44));
|
||||
}
|
||||
|
||||
void TestGpsCoords::testParseOK(const QString &txt, double expectedLat,
|
||||
double expectedLon)
|
||||
double expectedLon)
|
||||
{
|
||||
double actualLat, actualLon;
|
||||
QVERIFY(parseGpsText(txt, &actualLat, &actualLon));
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
#include <QtTest>
|
||||
|
||||
class TestGpsCoords : public QObject {
|
||||
Q_OBJECT
|
||||
Q_OBJECT
|
||||
private slots:
|
||||
void testISO6709DParse();
|
||||
void testNegativeISO6709DParse();
|
||||
|
@ -28,7 +28,7 @@ private slots:
|
|||
|
||||
private:
|
||||
static void testParseOK(const QString &txt, double expectedLat,
|
||||
double expectedLon);
|
||||
double expectedLon);
|
||||
static double coord2double(double deg, double min = 0.0, double sec = 0.0);
|
||||
};
|
||||
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
// SPDX-License-Identifier: GPL-2.0
|
||||
#include "testmerge.h"
|
||||
#include "core/dive.h"
|
||||
#include "core/file.h"
|
||||
#include "core/divelist.h"
|
||||
#include "core/file.h"
|
||||
#include <QTextStream>
|
||||
|
||||
void TestMerge::initTestCase()
|
||||
|
@ -34,7 +34,7 @@ void TestMerge::testMergeEmpty()
|
|||
QTextStream outS(&out);
|
||||
QStringList readin = orgS.readAll().split("\n");
|
||||
QStringList written = outS.readAll().split("\n");
|
||||
while(readin.size() && written.size()){
|
||||
while (readin.size() && written.size()) {
|
||||
QCOMPARE(written.takeFirst().trimmed(), readin.takeFirst().trimmed());
|
||||
}
|
||||
}
|
||||
|
@ -57,7 +57,7 @@ void TestMerge::testMergeBackwards()
|
|||
QTextStream outS(&out);
|
||||
QStringList readin = orgS.readAll().split("\n");
|
||||
QStringList written = outS.readAll().split("\n");
|
||||
while(readin.size() && written.size()){
|
||||
while (readin.size() && written.size()) {
|
||||
QCOMPARE(written.takeFirst().trimmed(), readin.takeFirst().trimmed());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
#include <QtTest>
|
||||
|
||||
class TestMerge : public QObject{
|
||||
class TestMerge : public QObject {
|
||||
Q_OBJECT
|
||||
private slots:
|
||||
void initTestCase();
|
||||
|
|
|
@ -1,30 +1,30 @@
|
|||
// SPDX-License-Identifier: GPL-2.0
|
||||
#include "testparse.h"
|
||||
#include "core/dive.h"
|
||||
#include "core/subsurface-string.h"
|
||||
#include "core/parse.h"
|
||||
#include "core/file.h"
|
||||
#include "core/divelist.h"
|
||||
#include <QTextStream>
|
||||
#include "core/file.h"
|
||||
#include "core/parse.h"
|
||||
#include "core/qthelper.h"
|
||||
#include "core/subsurface-string.h"
|
||||
#include <QTextStream>
|
||||
|
||||
/* We have to use a macro since QCOMPARE
|
||||
* can only be called from a test method
|
||||
* invoked by the QTest framework
|
||||
*/
|
||||
#define FILE_COMPARE(actual, expected) \
|
||||
QFile org(expected); \
|
||||
org.open(QFile::ReadOnly); \
|
||||
QFile out(actual); \
|
||||
out.open(QFile::ReadOnly); \
|
||||
QTextStream orgS(&org); \
|
||||
QTextStream outS(&out); \
|
||||
QStringList readin = orgS.readAll().split("\n"); \
|
||||
QStringList written = outS.readAll().split("\n"); \
|
||||
while(readin.size() && written.size()){ \
|
||||
QCOMPARE(written.takeFirst().trimmed(), \
|
||||
readin.takeFirst().trimmed()); \
|
||||
} \
|
||||
#define FILE_COMPARE(actual, expected) \
|
||||
QFile org(expected); \
|
||||
org.open(QFile::ReadOnly); \
|
||||
QFile out(actual); \
|
||||
out.open(QFile::ReadOnly); \
|
||||
QTextStream orgS(&org); \
|
||||
QTextStream outS(&out); \
|
||||
QStringList readin = orgS.readAll().split("\n"); \
|
||||
QStringList written = outS.readAll().split("\n"); \
|
||||
while (readin.size() && written.size()) { \
|
||||
QCOMPARE(written.takeFirst().trimmed(), \
|
||||
readin.takeFirst().trimmed()); \
|
||||
}
|
||||
|
||||
void TestParse::initTestCase()
|
||||
{
|
||||
|
@ -116,7 +116,7 @@ int TestParse::parseDivingLog()
|
|||
ds->name = copy_string("Suomi - - Hälvälä");
|
||||
|
||||
int ret = sqlite3_open(SUBSURFACE_TEST_DATA "/dives/TestDivingLog4.1.1.sql", &_sqlite3_handle);
|
||||
if ( ret == 0 )
|
||||
if (ret == 0)
|
||||
ret = parse_divinglog_buffer(_sqlite3_handle, 0, 0, 0, &dive_table);
|
||||
else
|
||||
fprintf(stderr, "Can't open sqlite3 db: " SUBSURFACE_TEST_DATA "/dives/TestDivingLog4.1.1.sql");
|
||||
|
@ -152,7 +152,7 @@ void TestParse::testParse()
|
|||
|
||||
QCOMPARE(save_dives("./testout.ssrf"), 0);
|
||||
FILE_COMPARE("./testout.ssrf",
|
||||
SUBSURFACE_TEST_DATA "/dives/test40-42.xml");
|
||||
SUBSURFACE_TEST_DATA "/dives/test40-42.xml");
|
||||
}
|
||||
|
||||
void TestParse::testParseDM4()
|
||||
|
@ -162,7 +162,7 @@ void TestParse::testParseDM4()
|
|||
|
||||
QCOMPARE(save_dives("./testdm4out.ssrf"), 0);
|
||||
FILE_COMPARE("./testdm4out.ssrf",
|
||||
SUBSURFACE_TEST_DATA "/dives/TestDiveDM4.xml");
|
||||
SUBSURFACE_TEST_DATA "/dives/TestDiveDM4.xml");
|
||||
}
|
||||
|
||||
void TestParse::testParseDM5()
|
||||
|
@ -172,7 +172,7 @@ void TestParse::testParseDM5()
|
|||
|
||||
QCOMPARE(save_dives("./testdm5out.ssrf"), 0);
|
||||
FILE_COMPARE("./testdm5out.ssrf",
|
||||
SUBSURFACE_TEST_DATA "/dives/TestDiveDM5.xml");
|
||||
SUBSURFACE_TEST_DATA "/dives/TestDiveDM5.xml");
|
||||
}
|
||||
|
||||
void TestParse::testParseHUDC()
|
||||
|
@ -215,7 +215,8 @@ void TestParse::testParseHUDC()
|
|||
params[pnr++] = NULL;
|
||||
|
||||
QCOMPARE(parse_csv_file(SUBSURFACE_TEST_DATA "/dives/TestDiveSeabearHUDC.csv",
|
||||
params, pnr - 1, "csv"), 0);
|
||||
params, pnr - 1, "csv"),
|
||||
0);
|
||||
|
||||
QCOMPARE(dive_table.nr, 1);
|
||||
|
||||
|
@ -231,7 +232,7 @@ void TestParse::testParseHUDC()
|
|||
|
||||
QCOMPARE(save_dives("./testhudcout.ssrf"), 0);
|
||||
FILE_COMPARE("./testhudcout.ssrf",
|
||||
SUBSURFACE_TEST_DATA "/dives/TestDiveSeabearHUDC.xml");
|
||||
SUBSURFACE_TEST_DATA "/dives/TestDiveSeabearHUDC.xml");
|
||||
}
|
||||
|
||||
void TestParse::testParseNewFormat()
|
||||
|
@ -256,7 +257,11 @@ void TestParse::testParseNewFormat()
|
|||
for (int i = 0; i < files.size(); ++i) {
|
||||
|
||||
QCOMPARE(parse_seabear_log(QString::fromLatin1(SUBSURFACE_TEST_DATA
|
||||
"/dives/").append(files.at(i)).toLatin1().data()), 0);
|
||||
"/dives/")
|
||||
.append(files.at(i))
|
||||
.toLatin1()
|
||||
.data()),
|
||||
0);
|
||||
QCOMPARE(dive_table.nr, i + 1);
|
||||
}
|
||||
|
||||
|
@ -265,7 +270,7 @@ void TestParse::testParseNewFormat()
|
|||
|
||||
// Currently the CSV parse fails
|
||||
FILE_COMPARE("./testsbnewout.ssrf",
|
||||
SUBSURFACE_TEST_DATA "/dives/TestDiveSeabearNewFormat.xml");
|
||||
SUBSURFACE_TEST_DATA "/dives/TestDiveSeabearNewFormat.xml");
|
||||
}
|
||||
|
||||
void TestParse::testParseDLD()
|
||||
|
@ -286,7 +291,7 @@ void TestParse::testParseDLD()
|
|||
*/
|
||||
QCOMPARE(save_dives("./testdldout.ssrf"), 0);
|
||||
FILE_COMPARE("./testdldout.ssrf",
|
||||
SUBSURFACE_TEST_DATA "/dives/TestDiveDivelogsDE.xml")
|
||||
SUBSURFACE_TEST_DATA "/dives/TestDiveDivelogsDE.xml")
|
||||
}
|
||||
|
||||
void TestParse::testParseMerge()
|
||||
|
@ -298,7 +303,7 @@ void TestParse::testParseMerge()
|
|||
QCOMPARE(parse_file(SUBSURFACE_TEST_DATA "/dives/vyper.xml"), 0);
|
||||
QCOMPARE(save_dives("./testmerge.ssrf"), 0);
|
||||
FILE_COMPARE("./testmerge.ssrf",
|
||||
SUBSURFACE_TEST_DATA "/dives/mergedVyperOstc.xml");
|
||||
SUBSURFACE_TEST_DATA "/dives/mergedVyperOstc.xml");
|
||||
}
|
||||
|
||||
int TestParse::parseCSVmanual(int units, std::string file)
|
||||
|
@ -377,7 +382,7 @@ void TestParse::exportCSVDiveDetails()
|
|||
export_dives_xslt("testcsvexportmanual2.csv", 0, 0, "xml2manualcsv.xslt");
|
||||
|
||||
FILE_COMPARE("testcsvexportmanual2.csv",
|
||||
"testcsvexportmanual.csv");
|
||||
"testcsvexportmanual.csv");
|
||||
|
||||
clear_dive_file_data();
|
||||
}
|
||||
|
@ -426,7 +431,7 @@ void TestParse::exportCSVDiveProfile()
|
|||
export_dives_xslt("testcsvexportprofile2.csv", 0, 0, "xml2csv.xslt");
|
||||
|
||||
FILE_COMPARE("testcsvexportprofile2.csv",
|
||||
"testcsvexportprofile.csv");
|
||||
"testcsvexportprofile.csv");
|
||||
|
||||
clear_dive_file_data();
|
||||
}
|
||||
|
@ -443,7 +448,7 @@ void TestParse::exportUDDF()
|
|||
export_dives_xslt("testuddfexport2.uddf", 0, 1, "uddf-export.xslt");
|
||||
|
||||
FILE_COMPARE("testuddfexport.uddf",
|
||||
"testuddfexport2.uddf");
|
||||
"testuddfexport2.uddf");
|
||||
|
||||
clear_dive_file_data();
|
||||
}
|
||||
|
@ -504,12 +509,13 @@ void TestParse::parseDL7()
|
|||
|
||||
clear_dive_file_data();
|
||||
QCOMPARE(parse_csv_file(SUBSURFACE_TEST_DATA "/dives/DL7.zxu",
|
||||
params, pnr - 1 , "DL7"), 0);
|
||||
params, pnr - 1, "DL7"),
|
||||
0);
|
||||
QCOMPARE(dive_table.nr, 3);
|
||||
|
||||
QCOMPARE(save_dives("./testdl7out.ssrf"), 0);
|
||||
FILE_COMPARE("./testdl7out.ssrf",
|
||||
SUBSURFACE_TEST_DATA "/dives/DL7.xml");
|
||||
SUBSURFACE_TEST_DATA "/dives/DL7.xml");
|
||||
clear_dive_file_data();
|
||||
}
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
#include <QtTest>
|
||||
#include <sqlite3.h>
|
||||
|
||||
class TestParse : public QObject{
|
||||
class TestParse : public QObject {
|
||||
Q_OBJECT
|
||||
private slots:
|
||||
void initTestCase();
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
// SPDX-License-Identifier: GPL-2.0
|
||||
#include "testpicture.h"
|
||||
#include "core/dive.h"
|
||||
#include "core/file.h"
|
||||
#include "core/divelist.h"
|
||||
#include "core/file.h"
|
||||
#include <QString>
|
||||
#include <core/qthelper.h>
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
#include <QtTest>
|
||||
|
||||
class TestPicture : public QObject{
|
||||
class TestPicture : public QObject {
|
||||
Q_OBJECT
|
||||
private slots:
|
||||
void initTestCase();
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
// SPDX-License-Identifier: GPL-2.0
|
||||
#include "core/dive.h"
|
||||
#include "testplan.h"
|
||||
#include "core/dive.h"
|
||||
#include "core/planner.h"
|
||||
#include "core/units.h"
|
||||
#include "core/subsurfacestartup.h"
|
||||
#include "core/qthelper.h"
|
||||
#include "core/subsurfacestartup.h"
|
||||
#include "core/units.h"
|
||||
#include <QDebug>
|
||||
|
||||
#define DEBUG 1
|
||||
#define DEBUG 1
|
||||
|
||||
// testing the dive plan algorithm
|
||||
struct decostop stoptable[60];
|
||||
|
@ -45,10 +45,10 @@ void setupPlan(struct diveplan *dp)
|
|||
dp->bottomsac = prefs.bottomsac;
|
||||
dp->decosac = prefs.decosac;
|
||||
|
||||
struct gasmix bottomgas = { {150}, {450} };
|
||||
struct gasmix ean36 = { {360}, {0} };
|
||||
struct gasmix oxygen = { {1000}, {0} };
|
||||
pressure_t po2 = { 1600 };
|
||||
struct gasmix bottomgas = {{150}, {450}};
|
||||
struct gasmix ean36 = {{360}, {0}};
|
||||
struct gasmix oxygen = {{1000}, {0}};
|
||||
pressure_t po2 = {1600};
|
||||
displayed_dive.cylinder[0].gasmix = bottomgas;
|
||||
displayed_dive.cylinder[0].type.size.mliter = 36000;
|
||||
displayed_dive.cylinder[0].type.workingpressure.mbar = 232000;
|
||||
|
@ -58,10 +58,10 @@ void setupPlan(struct diveplan *dp)
|
|||
free_dps(dp);
|
||||
|
||||
int droptime = M_OR_FT(79, 260) * 60 / M_OR_FT(23, 75);
|
||||
plan_add_segment(dp, 0, gas_mod(&ean36, po2, &displayed_dive, M_OR_FT(3,10)).mm, 1, 0, 1, OC);
|
||||
plan_add_segment(dp, 0, gas_mod(&oxygen, po2, &displayed_dive, M_OR_FT(3,10)).mm, 2, 0, 1, OC);
|
||||
plan_add_segment(dp, 0, gas_mod(&ean36, po2, &displayed_dive, M_OR_FT(3, 10)).mm, 1, 0, 1, OC);
|
||||
plan_add_segment(dp, 0, gas_mod(&oxygen, po2, &displayed_dive, M_OR_FT(3, 10)).mm, 2, 0, 1, OC);
|
||||
plan_add_segment(dp, droptime, M_OR_FT(79, 260), 0, 0, 1, OC);
|
||||
plan_add_segment(dp, 30*60 - droptime, M_OR_FT(79, 260), 0, 0, 1, OC);
|
||||
plan_add_segment(dp, 30 * 60 - droptime, M_OR_FT(79, 260), 0, 0, 1, OC);
|
||||
}
|
||||
|
||||
void setupPlanVpmb45m30mTx(struct diveplan *dp)
|
||||
|
@ -73,10 +73,10 @@ void setupPlanVpmb45m30mTx(struct diveplan *dp)
|
|||
dp->bottomsac = prefs.bottomsac;
|
||||
dp->decosac = prefs.decosac;
|
||||
|
||||
struct gasmix bottomgas = { {210}, {350} };
|
||||
struct gasmix ean50 = { {500}, {0} };
|
||||
struct gasmix oxygen = { {1000}, {0} };
|
||||
pressure_t po2 = { 1600 };
|
||||
struct gasmix bottomgas = {{210}, {350}};
|
||||
struct gasmix ean50 = {{500}, {0}};
|
||||
struct gasmix oxygen = {{1000}, {0}};
|
||||
pressure_t po2 = {1600};
|
||||
displayed_dive.cylinder[0].gasmix = bottomgas;
|
||||
displayed_dive.cylinder[0].type.size.mliter = 24000;
|
||||
displayed_dive.cylinder[0].type.workingpressure.mbar = 232000;
|
||||
|
@ -86,10 +86,10 @@ void setupPlanVpmb45m30mTx(struct diveplan *dp)
|
|||
free_dps(dp);
|
||||
|
||||
int droptime = M_OR_FT(45, 150) * 60 / M_OR_FT(23, 75);
|
||||
plan_add_segment(dp, 0, gas_mod(&ean50, po2, &displayed_dive, M_OR_FT(3,10)).mm, 1, 0, 1, OC);
|
||||
plan_add_segment(dp, 0, gas_mod(&oxygen, po2, &displayed_dive, M_OR_FT(3,10)).mm, 2, 0, 1, OC);
|
||||
plan_add_segment(dp, 0, gas_mod(&ean50, po2, &displayed_dive, M_OR_FT(3, 10)).mm, 1, 0, 1, OC);
|
||||
plan_add_segment(dp, 0, gas_mod(&oxygen, po2, &displayed_dive, M_OR_FT(3, 10)).mm, 2, 0, 1, OC);
|
||||
plan_add_segment(dp, droptime, M_OR_FT(45, 150), 0, 0, 1, OC);
|
||||
plan_add_segment(dp, 30*60 - droptime, M_OR_FT(45, 150), 0, 0, 1, OC);
|
||||
plan_add_segment(dp, 30 * 60 - droptime, M_OR_FT(45, 150), 0, 0, 1, OC);
|
||||
}
|
||||
|
||||
void setupPlanVpmb60m10mTx(struct diveplan *dp)
|
||||
|
@ -101,10 +101,10 @@ void setupPlanVpmb60m10mTx(struct diveplan *dp)
|
|||
dp->bottomsac = prefs.bottomsac;
|
||||
dp->decosac = prefs.decosac;
|
||||
|
||||
struct gasmix bottomgas = { {180}, {450} };
|
||||
struct gasmix tx50_15 = { {500}, {150} };
|
||||
struct gasmix oxygen = { {1000}, {0} };
|
||||
pressure_t po2 = { 1600 };
|
||||
struct gasmix bottomgas = {{180}, {450}};
|
||||
struct gasmix tx50_15 = {{500}, {150}};
|
||||
struct gasmix oxygen = {{1000}, {0}};
|
||||
pressure_t po2 = {1600};
|
||||
displayed_dive.cylinder[0].gasmix = bottomgas;
|
||||
displayed_dive.cylinder[0].type.size.mliter = 24000;
|
||||
displayed_dive.cylinder[0].type.workingpressure.mbar = 232000;
|
||||
|
@ -114,10 +114,10 @@ void setupPlanVpmb60m10mTx(struct diveplan *dp)
|
|||
free_dps(dp);
|
||||
|
||||
int droptime = M_OR_FT(60, 200) * 60 / M_OR_FT(23, 75);
|
||||
plan_add_segment(dp, 0, gas_mod(&tx50_15, po2, &displayed_dive, M_OR_FT(3,10)).mm, 1, 0, 1, OC);
|
||||
plan_add_segment(dp, 0, gas_mod(&oxygen, po2, &displayed_dive, M_OR_FT(3,10)).mm, 2, 0, 1, OC);
|
||||
plan_add_segment(dp, 0, gas_mod(&tx50_15, po2, &displayed_dive, M_OR_FT(3, 10)).mm, 1, 0, 1, OC);
|
||||
plan_add_segment(dp, 0, gas_mod(&oxygen, po2, &displayed_dive, M_OR_FT(3, 10)).mm, 2, 0, 1, OC);
|
||||
plan_add_segment(dp, droptime, M_OR_FT(60, 200), 0, 0, 1, OC);
|
||||
plan_add_segment(dp, 10*60 - droptime, M_OR_FT(60, 200), 0, 0, 1, OC);
|
||||
plan_add_segment(dp, 10 * 60 - droptime, M_OR_FT(60, 200), 0, 0, 1, OC);
|
||||
}
|
||||
|
||||
void setupPlanVpmb60m30minAir(struct diveplan *dp)
|
||||
|
@ -127,7 +127,7 @@ void setupPlanVpmb60m30minAir(struct diveplan *dp)
|
|||
dp->bottomsac = prefs.bottomsac;
|
||||
dp->decosac = prefs.decosac;
|
||||
|
||||
struct gasmix bottomgas = { {210}, {0} };
|
||||
struct gasmix bottomgas = {{210}, {0}};
|
||||
displayed_dive.cylinder[0].gasmix = bottomgas;
|
||||
displayed_dive.cylinder[0].type.size.mliter = 100000;
|
||||
displayed_dive.cylinder[0].type.workingpressure.mbar = 232000;
|
||||
|
@ -137,7 +137,7 @@ void setupPlanVpmb60m30minAir(struct diveplan *dp)
|
|||
|
||||
int droptime = M_OR_FT(60, 200) * 60 / M_OR_FT(99, 330);
|
||||
plan_add_segment(dp, droptime, M_OR_FT(60, 200), 0, 0, 1, OC);
|
||||
plan_add_segment(dp, 30*60 - droptime, M_OR_FT(60, 200), 0, 0, 1, OC);
|
||||
plan_add_segment(dp, 30 * 60 - droptime, M_OR_FT(60, 200), 0, 0, 1, OC);
|
||||
}
|
||||
|
||||
void setupPlanVpmb60m30minEan50(struct diveplan *dp)
|
||||
|
@ -147,9 +147,9 @@ void setupPlanVpmb60m30minEan50(struct diveplan *dp)
|
|||
dp->bottomsac = prefs.bottomsac;
|
||||
dp->decosac = prefs.decosac;
|
||||
|
||||
struct gasmix bottomgas = { {210}, {0} };
|
||||
struct gasmix ean50 = { {500}, {0} };
|
||||
pressure_t po2 = { 1600 };
|
||||
struct gasmix bottomgas = {{210}, {0}};
|
||||
struct gasmix ean50 = {{500}, {0}};
|
||||
pressure_t po2 = {1600};
|
||||
displayed_dive.cylinder[0].gasmix = bottomgas;
|
||||
displayed_dive.cylinder[0].type.size.mliter = 36000;
|
||||
displayed_dive.cylinder[0].type.workingpressure.mbar = 232000;
|
||||
|
@ -159,9 +159,9 @@ void setupPlanVpmb60m30minEan50(struct diveplan *dp)
|
|||
free_dps(dp);
|
||||
|
||||
int droptime = M_OR_FT(60, 200) * 60 / M_OR_FT(99, 330);
|
||||
plan_add_segment(dp, 0, gas_mod(&ean50, po2, &displayed_dive, M_OR_FT(3,10)).mm, 1, 0, 1, OC);
|
||||
plan_add_segment(dp, 0, gas_mod(&ean50, po2, &displayed_dive, M_OR_FT(3, 10)).mm, 1, 0, 1, OC);
|
||||
plan_add_segment(dp, droptime, M_OR_FT(60, 200), 0, 0, 1, OC);
|
||||
plan_add_segment(dp, 30*60 - droptime, M_OR_FT(60, 200), 0, 0, 1, OC);
|
||||
plan_add_segment(dp, 30 * 60 - droptime, M_OR_FT(60, 200), 0, 0, 1, OC);
|
||||
}
|
||||
|
||||
void setupPlanVpmb60m30minTx(struct diveplan *dp)
|
||||
|
@ -171,9 +171,9 @@ void setupPlanVpmb60m30minTx(struct diveplan *dp)
|
|||
dp->bottomsac = prefs.bottomsac;
|
||||
dp->decosac = prefs.decosac;
|
||||
|
||||
struct gasmix bottomgas = { {180}, {450} };
|
||||
struct gasmix ean50 = { {500}, {0} };
|
||||
pressure_t po2 = { 1600 };
|
||||
struct gasmix bottomgas = {{180}, {450}};
|
||||
struct gasmix ean50 = {{500}, {0}};
|
||||
pressure_t po2 = {1600};
|
||||
displayed_dive.cylinder[0].gasmix = bottomgas;
|
||||
displayed_dive.cylinder[0].type.size.mliter = 36000;
|
||||
displayed_dive.cylinder[0].type.workingpressure.mbar = 232000;
|
||||
|
@ -183,9 +183,9 @@ void setupPlanVpmb60m30minTx(struct diveplan *dp)
|
|||
free_dps(dp);
|
||||
|
||||
int droptime = M_OR_FT(60, 200) * 60 / M_OR_FT(99, 330);
|
||||
plan_add_segment(dp, 0, gas_mod(&ean50, po2, &displayed_dive, M_OR_FT(3,10)).mm, 1, 0, 1, OC);
|
||||
plan_add_segment(dp, 0, gas_mod(&ean50, po2, &displayed_dive, M_OR_FT(3, 10)).mm, 1, 0, 1, OC);
|
||||
plan_add_segment(dp, droptime, M_OR_FT(60, 200), 0, 0, 1, OC);
|
||||
plan_add_segment(dp, 30*60 - droptime, M_OR_FT(60, 200), 0, 0, 1, OC);
|
||||
plan_add_segment(dp, 30 * 60 - droptime, M_OR_FT(60, 200), 0, 0, 1, OC);
|
||||
}
|
||||
|
||||
void setupPlanVpmbMultiLevelAir(struct diveplan *dp)
|
||||
|
@ -195,7 +195,7 @@ void setupPlanVpmbMultiLevelAir(struct diveplan *dp)
|
|||
dp->bottomsac = prefs.bottomsac;
|
||||
dp->decosac = prefs.decosac;
|
||||
|
||||
struct gasmix bottomgas = { {210}, {0} };
|
||||
struct gasmix bottomgas = {{210}, {0}};
|
||||
displayed_dive.cylinder[0].gasmix = bottomgas;
|
||||
displayed_dive.cylinder[0].type.size.mliter = 200000;
|
||||
displayed_dive.cylinder[0].type.workingpressure.mbar = 232000;
|
||||
|
@ -205,9 +205,9 @@ void setupPlanVpmbMultiLevelAir(struct diveplan *dp)
|
|||
|
||||
int droptime = M_OR_FT(20, 66) * 60 / M_OR_FT(99, 330);
|
||||
plan_add_segment(dp, droptime, M_OR_FT(20, 66), 0, 0, 1, OC);
|
||||
plan_add_segment(dp, 10*60 - droptime, M_OR_FT(20, 66), 0, 0, 1, OC);
|
||||
plan_add_segment(dp, 1*60, M_OR_FT(60, 200), 0, 0, 1, OC);
|
||||
plan_add_segment(dp, 29*60, M_OR_FT(60, 200), 0, 0, 1, OC);
|
||||
plan_add_segment(dp, 10 * 60 - droptime, M_OR_FT(20, 66), 0, 0, 1, OC);
|
||||
plan_add_segment(dp, 1 * 60, M_OR_FT(60, 200), 0, 0, 1, OC);
|
||||
plan_add_segment(dp, 29 * 60, M_OR_FT(60, 200), 0, 0, 1, OC);
|
||||
}
|
||||
|
||||
void setupPlanVpmb100m60min(struct diveplan *dp)
|
||||
|
@ -217,10 +217,10 @@ void setupPlanVpmb100m60min(struct diveplan *dp)
|
|||
dp->bottomsac = prefs.bottomsac;
|
||||
dp->decosac = prefs.decosac;
|
||||
|
||||
struct gasmix bottomgas = { {180}, {450} };
|
||||
struct gasmix ean50 = { {500}, {0} };
|
||||
struct gasmix oxygen = { {1000}, {0} };
|
||||
pressure_t po2 = { 1600 };
|
||||
struct gasmix bottomgas = {{180}, {450}};
|
||||
struct gasmix ean50 = {{500}, {0}};
|
||||
struct gasmix oxygen = {{1000}, {0}};
|
||||
pressure_t po2 = {1600};
|
||||
displayed_dive.cylinder[0].gasmix = bottomgas;
|
||||
displayed_dive.cylinder[0].type.size.mliter = 200000;
|
||||
displayed_dive.cylinder[0].type.workingpressure.mbar = 232000;
|
||||
|
@ -231,10 +231,10 @@ void setupPlanVpmb100m60min(struct diveplan *dp)
|
|||
free_dps(dp);
|
||||
|
||||
int droptime = M_OR_FT(100, 330) * 60 / M_OR_FT(99, 330);
|
||||
plan_add_segment(dp, 0, gas_mod(&ean50, po2, &displayed_dive, M_OR_FT(3,10)).mm, 1, 0, 1, OC);
|
||||
plan_add_segment(dp, 0, gas_mod(&oxygen, po2, &displayed_dive, M_OR_FT(3,10)).mm, 2, 0, 1, OC);
|
||||
plan_add_segment(dp, 0, gas_mod(&ean50, po2, &displayed_dive, M_OR_FT(3, 10)).mm, 1, 0, 1, OC);
|
||||
plan_add_segment(dp, 0, gas_mod(&oxygen, po2, &displayed_dive, M_OR_FT(3, 10)).mm, 2, 0, 1, OC);
|
||||
plan_add_segment(dp, droptime, M_OR_FT(100, 330), 0, 0, 1, OC);
|
||||
plan_add_segment(dp, 60*60 - droptime, M_OR_FT(100, 330), 0, 0, 1, OC);
|
||||
plan_add_segment(dp, 60 * 60 - droptime, M_OR_FT(100, 330), 0, 0, 1, OC);
|
||||
}
|
||||
|
||||
void setupPlanVpmb100m10min(struct diveplan *dp)
|
||||
|
@ -244,10 +244,10 @@ void setupPlanVpmb100m10min(struct diveplan *dp)
|
|||
dp->bottomsac = prefs.bottomsac;
|
||||
dp->decosac = prefs.decosac;
|
||||
|
||||
struct gasmix bottomgas = { {180}, {450} };
|
||||
struct gasmix ean50 = { {500}, {0} };
|
||||
struct gasmix oxygen = { {1000}, {0} };
|
||||
pressure_t po2 = { 1600 };
|
||||
struct gasmix bottomgas = {{180}, {450}};
|
||||
struct gasmix ean50 = {{500}, {0}};
|
||||
struct gasmix oxygen = {{1000}, {0}};
|
||||
pressure_t po2 = {1600};
|
||||
displayed_dive.cylinder[0].gasmix = bottomgas;
|
||||
displayed_dive.cylinder[0].type.size.mliter = 60000;
|
||||
displayed_dive.cylinder[0].type.workingpressure.mbar = 232000;
|
||||
|
@ -258,10 +258,10 @@ void setupPlanVpmb100m10min(struct diveplan *dp)
|
|||
free_dps(dp);
|
||||
|
||||
int droptime = M_OR_FT(100, 330) * 60 / M_OR_FT(99, 330);
|
||||
plan_add_segment(dp, 0, gas_mod(&ean50, po2, &displayed_dive, M_OR_FT(3,10)).mm, 1, 0, 1, OC);
|
||||
plan_add_segment(dp, 0, gas_mod(&oxygen, po2, &displayed_dive, M_OR_FT(3,10)).mm, 2, 0, 1, OC);
|
||||
plan_add_segment(dp, 0, gas_mod(&ean50, po2, &displayed_dive, M_OR_FT(3, 10)).mm, 1, 0, 1, OC);
|
||||
plan_add_segment(dp, 0, gas_mod(&oxygen, po2, &displayed_dive, M_OR_FT(3, 10)).mm, 2, 0, 1, OC);
|
||||
plan_add_segment(dp, droptime, M_OR_FT(100, 330), 0, 0, 1, OC);
|
||||
plan_add_segment(dp, 10*60 - droptime, M_OR_FT(100, 330), 0, 0, 1, OC);
|
||||
plan_add_segment(dp, 10 * 60 - droptime, M_OR_FT(100, 330), 0, 0, 1, OC);
|
||||
}
|
||||
|
||||
void setupPlanVpmb30m20min(struct diveplan *dp)
|
||||
|
@ -271,7 +271,7 @@ void setupPlanVpmb30m20min(struct diveplan *dp)
|
|||
dp->bottomsac = prefs.bottomsac;
|
||||
dp->decosac = prefs.decosac;
|
||||
|
||||
struct gasmix bottomgas = { {210}, {0} };
|
||||
struct gasmix bottomgas = {{210}, {0}};
|
||||
displayed_dive.cylinder[0].gasmix = bottomgas;
|
||||
displayed_dive.cylinder[0].type.size.mliter = 36000;
|
||||
displayed_dive.cylinder[0].type.workingpressure.mbar = 232000;
|
||||
|
@ -281,7 +281,7 @@ void setupPlanVpmb30m20min(struct diveplan *dp)
|
|||
|
||||
int droptime = M_OR_FT(30, 100) * 60 / M_OR_FT(18, 60);
|
||||
plan_add_segment(dp, droptime, M_OR_FT(30, 100), 0, 0, 1, OC);
|
||||
plan_add_segment(dp, 20*60 - droptime, M_OR_FT(30, 100), 0, 0, 1, OC);
|
||||
plan_add_segment(dp, 20 * 60 - droptime, M_OR_FT(30, 100), 0, 0, 1, OC);
|
||||
}
|
||||
|
||||
void setupPlanVpmb100mTo70m30min(struct diveplan *dp)
|
||||
|
@ -291,11 +291,11 @@ void setupPlanVpmb100mTo70m30min(struct diveplan *dp)
|
|||
dp->bottomsac = prefs.bottomsac;
|
||||
dp->decosac = prefs.decosac;
|
||||
|
||||
struct gasmix bottomgas = { {120}, {650} };
|
||||
struct gasmix tx21_35 = { {210}, {350} };
|
||||
struct gasmix ean50 = { {500}, {0} };
|
||||
struct gasmix oxygen = { {1000}, {0} };
|
||||
pressure_t po2 = { 1600 };
|
||||
struct gasmix bottomgas = {{120}, {650}};
|
||||
struct gasmix tx21_35 = {{210}, {350}};
|
||||
struct gasmix ean50 = {{500}, {0}};
|
||||
struct gasmix oxygen = {{1000}, {0}};
|
||||
pressure_t po2 = {1600};
|
||||
displayed_dive.cylinder[0].gasmix = bottomgas;
|
||||
displayed_dive.cylinder[0].type.size.mliter = 36000;
|
||||
displayed_dive.cylinder[0].type.workingpressure.mbar = 232000;
|
||||
|
@ -307,12 +307,12 @@ void setupPlanVpmb100mTo70m30min(struct diveplan *dp)
|
|||
free_dps(dp);
|
||||
|
||||
int droptime = M_OR_FT(100, 330) * 60 / M_OR_FT(18, 60);
|
||||
plan_add_segment(dp, 0, gas_mod(&tx21_35, po2, &displayed_dive, M_OR_FT(3,10)).mm, 1, 0, 1, OC);
|
||||
plan_add_segment(dp, 0, gas_mod(&ean50, po2, &displayed_dive, M_OR_FT(3,10)).mm, 2, 0, 1, OC);
|
||||
plan_add_segment(dp, 0, gas_mod(&oxygen, po2, &displayed_dive, M_OR_FT(3,10)).mm, 3, 0, 1, OC);
|
||||
plan_add_segment(dp, 0, gas_mod(&tx21_35, po2, &displayed_dive, M_OR_FT(3, 10)).mm, 1, 0, 1, OC);
|
||||
plan_add_segment(dp, 0, gas_mod(&ean50, po2, &displayed_dive, M_OR_FT(3, 10)).mm, 2, 0, 1, OC);
|
||||
plan_add_segment(dp, 0, gas_mod(&oxygen, po2, &displayed_dive, M_OR_FT(3, 10)).mm, 3, 0, 1, OC);
|
||||
plan_add_segment(dp, droptime, M_OR_FT(100, 330), 0, 0, 1, OC);
|
||||
plan_add_segment(dp, 20*60 - droptime, M_OR_FT(100, 330), 0, 0, 1, OC);
|
||||
plan_add_segment(dp, 3*60, M_OR_FT(70, 230), 0, 0, 1, OC);
|
||||
plan_add_segment(dp, 20 * 60 - droptime, M_OR_FT(100, 330), 0, 0, 1, OC);
|
||||
plan_add_segment(dp, 3 * 60, M_OR_FT(70, 230), 0, 0, 1, OC);
|
||||
plan_add_segment(dp, (30 - 20 - 3) * 60, M_OR_FT(70, 230), 0, 0, 1, OC);
|
||||
}
|
||||
|
||||
|
@ -373,7 +373,8 @@ void TestPlan::testMetric()
|
|||
|
||||
// check minimum gas result
|
||||
struct divedatapoint *dp = testPlan.dp;
|
||||
while(!dp->minimum_gas.mbar && dp->next) dp = dp->next;
|
||||
while (!dp->minimum_gas.mbar && dp->next)
|
||||
dp = dp->next;
|
||||
QCOMPARE(lrint(dp->minimum_gas.mbar / 1000.0), 148l);
|
||||
// check first gas change to EAN36 at 33m
|
||||
struct event *ev = displayed_dive.dc.events;
|
||||
|
@ -413,7 +414,8 @@ void TestPlan::testImperial()
|
|||
|
||||
// check minimum gas result
|
||||
struct divedatapoint *dp = testPlan.dp;
|
||||
while(!dp->minimum_gas.mbar && dp->next) dp = dp->next;
|
||||
while (!dp->minimum_gas.mbar && dp->next)
|
||||
dp = dp->next;
|
||||
QCOMPARE(lrint(dp->minimum_gas.mbar / 1000.0), 154l);
|
||||
// check first gas change to EAN36 at 33m
|
||||
struct event *ev = displayed_dive.dc.events;
|
||||
|
@ -453,7 +455,8 @@ void TestPlan::testVpmbMetric45m30minTx()
|
|||
|
||||
// check minimum gas result
|
||||
struct divedatapoint *dp = testPlan.dp;
|
||||
while(!dp->minimum_gas.mbar && dp->next) dp = dp->next;
|
||||
while (!dp->minimum_gas.mbar && dp->next)
|
||||
dp = dp->next;
|
||||
QCOMPARE(lrint(dp->minimum_gas.mbar / 1000.0), 108l);
|
||||
// print first ceiling
|
||||
printf("First ceiling %.1f m\n", (mbar_to_depth(test_deco_state.first_ceiling_pressure.mbar, &displayed_dive) * 0.001));
|
||||
|
@ -483,7 +486,8 @@ void TestPlan::testVpmbMetric60m10minTx()
|
|||
|
||||
// check minimum gas result
|
||||
struct divedatapoint *dp = testPlan.dp;
|
||||
while(!dp->minimum_gas.mbar && dp->next) dp = dp->next;
|
||||
while (!dp->minimum_gas.mbar && dp->next)
|
||||
dp = dp->next;
|
||||
QCOMPARE(lrint(dp->minimum_gas.mbar / 1000.0), 162l);
|
||||
// print first ceiling
|
||||
printf("First ceiling %.1f m\n", (mbar_to_depth(test_deco_state.first_ceiling_pressure.mbar, &displayed_dive) * 0.001));
|
||||
|
@ -513,7 +517,8 @@ void TestPlan::testVpmbMetric60m30minAir()
|
|||
|
||||
// check minimum gas result
|
||||
struct divedatapoint *dp = testPlan.dp;
|
||||
while(!dp->minimum_gas.mbar && dp->next) dp = dp->next;
|
||||
while (!dp->minimum_gas.mbar && dp->next)
|
||||
dp = dp->next;
|
||||
QCOMPARE(lrint(dp->minimum_gas.mbar / 1000.0), 180l);
|
||||
// print first ceiling
|
||||
printf("First ceiling %.1f m\n", (mbar_to_depth(test_deco_state.first_ceiling_pressure.mbar, &displayed_dive) * 0.001));
|
||||
|
@ -543,7 +548,8 @@ void TestPlan::testVpmbMetric60m30minEan50()
|
|||
|
||||
// check minimum gas result
|
||||
struct divedatapoint *dp = testPlan.dp;
|
||||
while(!dp->minimum_gas.mbar && dp->next) dp = dp->next;
|
||||
while (!dp->minimum_gas.mbar && dp->next)
|
||||
dp = dp->next;
|
||||
QCOMPARE(lrint(dp->minimum_gas.mbar / 1000.0), 155l);
|
||||
// print first ceiling
|
||||
printf("First ceiling %.1f m\n", (mbar_to_depth(test_deco_state.first_ceiling_pressure.mbar, &displayed_dive) * 0.001));
|
||||
|
@ -579,7 +585,8 @@ void TestPlan::testVpmbMetric60m30minTx()
|
|||
|
||||
// check minimum gas result
|
||||
struct divedatapoint *dp = testPlan.dp;
|
||||
while(!dp->minimum_gas.mbar && dp->next) dp = dp->next;
|
||||
while (!dp->minimum_gas.mbar && dp->next)
|
||||
dp = dp->next;
|
||||
QCOMPARE(lrint(dp->minimum_gas.mbar / 1000.0), 159l);
|
||||
// print first ceiling
|
||||
printf("First ceiling %.1f m\n", (mbar_to_depth(test_deco_state.first_ceiling_pressure.mbar, &displayed_dive) * 0.001));
|
||||
|
@ -615,7 +622,8 @@ void TestPlan::testVpmbMetric100m60min()
|
|||
|
||||
// check minimum gas result
|
||||
struct divedatapoint *dp = testPlan.dp;
|
||||
while(!dp->minimum_gas.mbar && dp->next) dp = dp->next;
|
||||
while (!dp->minimum_gas.mbar && dp->next)
|
||||
dp = dp->next;
|
||||
QCOMPARE(lrint(dp->minimum_gas.mbar / 1000.0), 157l);
|
||||
// print first ceiling
|
||||
printf("First ceiling %.1f m\n", (mbar_to_depth(test_deco_state.first_ceiling_pressure.mbar, &displayed_dive) * 0.001));
|
||||
|
@ -657,7 +665,8 @@ void TestPlan::testVpmbMetricMultiLevelAir()
|
|||
|
||||
// check minimum gas result
|
||||
struct divedatapoint *dp = testPlan.dp;
|
||||
while(!dp->minimum_gas.mbar && dp->next) dp = dp->next;
|
||||
while (!dp->minimum_gas.mbar && dp->next)
|
||||
dp = dp->next;
|
||||
QCOMPARE(lrint(dp->minimum_gas.mbar / 1000.0), 101l);
|
||||
// print first ceiling
|
||||
printf("First ceiling %.1f m\n", (mbar_to_depth(test_deco_state.first_ceiling_pressure.mbar, &displayed_dive) * 0.001));
|
||||
|
@ -687,7 +696,8 @@ void TestPlan::testVpmbMetric100m10min()
|
|||
|
||||
// check minimum gas result
|
||||
struct divedatapoint *dp = testPlan.dp;
|
||||
while(!dp->minimum_gas.mbar && dp->next) dp = dp->next;
|
||||
while (!dp->minimum_gas.mbar && dp->next)
|
||||
dp = dp->next;
|
||||
QCOMPARE(lrint(dp->minimum_gas.mbar / 1000.0), 175l);
|
||||
// print first ceiling
|
||||
printf("First ceiling %.1f m\n", (mbar_to_depth(test_deco_state.first_ceiling_pressure.mbar, &displayed_dive) * 0.001));
|
||||
|
@ -733,7 +743,8 @@ void TestPlan::testVpmbMetricRepeat()
|
|||
|
||||
// check minimum gas result
|
||||
struct divedatapoint *dp = testPlan.dp;
|
||||
while(!dp->minimum_gas.mbar && dp->next) dp = dp->next;
|
||||
while (!dp->minimum_gas.mbar && dp->next)
|
||||
dp = dp->next;
|
||||
QCOMPARE(lrint(dp->minimum_gas.mbar / 1000.0), 61l);
|
||||
// print first ceiling
|
||||
printf("First ceiling %.1f m\n", (mbar_to_depth(test_deco_state.first_ceiling_pressure.mbar, &displayed_dive) * 0.001));
|
||||
|
@ -753,7 +764,8 @@ void TestPlan::testVpmbMetricRepeat()
|
|||
|
||||
// check minimum gas result
|
||||
dp = testPlan.dp;
|
||||
while(!dp->minimum_gas.mbar && dp->next) dp = dp->next;
|
||||
while (!dp->minimum_gas.mbar && dp->next)
|
||||
dp = dp->next;
|
||||
QCOMPARE(lrint(dp->minimum_gas.mbar / 1000.0), 80l);
|
||||
// print first ceiling
|
||||
printf("First ceiling %.1f m\n", (mbar_to_depth(test_deco_state.first_ceiling_pressure.mbar, &displayed_dive) * 0.001));
|
||||
|
@ -789,7 +801,8 @@ void TestPlan::testVpmbMetricRepeat()
|
|||
|
||||
// check minimum gas result
|
||||
dp = testPlan.dp;
|
||||
while(!dp->minimum_gas.mbar && dp->next) dp = dp->next;
|
||||
while (!dp->minimum_gas.mbar && dp->next)
|
||||
dp = dp->next;
|
||||
QCOMPARE(lrint(dp->minimum_gas.mbar / 1000.0), 61l);
|
||||
// print first ceiling
|
||||
printf("First ceiling %.1f m\n", (mbar_to_depth(test_deco_state.first_ceiling_pressure.mbar, &displayed_dive) * 0.001));
|
||||
|
|
|
@ -3,14 +3,14 @@
|
|||
|
||||
#include "core/subsurface-qt/SettingsObjectWrapper.h"
|
||||
|
||||
#include <QtTest>
|
||||
#include <QDate>
|
||||
#include <QtTest>
|
||||
|
||||
#define TEST(METHOD, VALUE) \
|
||||
QCOMPARE(METHOD, VALUE); \
|
||||
pref->sync(); \
|
||||
pref->load(); \
|
||||
QCOMPARE(METHOD, VALUE);
|
||||
#define TEST(METHOD, VALUE) \
|
||||
QCOMPARE(METHOD, VALUE); \
|
||||
pref->sync(); \
|
||||
pref->load(); \
|
||||
QCOMPARE(METHOD, VALUE);
|
||||
|
||||
void TestPreferences::initTestCase()
|
||||
{
|
||||
|
@ -165,17 +165,17 @@ void TestPreferences::testPreferences()
|
|||
fb->setUserId("tomaz-user-id");
|
||||
fb->setAlbumId("album-id");
|
||||
|
||||
TEST(fb->accessToken(),QStringLiteral("rand-access-token"));
|
||||
TEST(fb->userId(), QStringLiteral("tomaz-user-id"));
|
||||
TEST(fb->albumId(), QStringLiteral("album-id"));
|
||||
TEST(fb->accessToken(), QStringLiteral("rand-access-token"));
|
||||
TEST(fb->userId(), QStringLiteral("tomaz-user-id"));
|
||||
TEST(fb->albumId(), QStringLiteral("album-id"));
|
||||
|
||||
fb->setAccessToken("rand-access-token-2");
|
||||
fb->setUserId("tomaz-user-id-2");
|
||||
fb->setAlbumId("album-id-2");
|
||||
|
||||
TEST(fb->accessToken(),QStringLiteral("rand-access-token-2"));
|
||||
TEST(fb->userId(), QStringLiteral("tomaz-user-id-2"));
|
||||
TEST(fb->albumId(), QStringLiteral("album-id-2"));
|
||||
TEST(fb->accessToken(), QStringLiteral("rand-access-token-2"));
|
||||
TEST(fb->userId(), QStringLiteral("tomaz-user-id-2"));
|
||||
TEST(fb->albumId(), QStringLiteral("album-id-2"));
|
||||
|
||||
auto geo = pref->geocoding;
|
||||
geo->setFirstTaxonomyCategory(TC_NONE);
|
||||
|
@ -202,12 +202,12 @@ void TestPreferences::testPreferences()
|
|||
proxy->setUser("unknown");
|
||||
proxy->setPass("secret");
|
||||
|
||||
TEST(proxy->type(),2);
|
||||
TEST(proxy->port(),80);
|
||||
TEST(proxy->auth(),true);
|
||||
TEST(proxy->host(),QStringLiteral("localhost"));
|
||||
TEST(proxy->user(),QStringLiteral("unknown"));
|
||||
TEST(proxy->pass(),QStringLiteral("secret"));
|
||||
TEST(proxy->type(), 2);
|
||||
TEST(proxy->port(), 80);
|
||||
TEST(proxy->auth(), true);
|
||||
TEST(proxy->host(), QStringLiteral("localhost"));
|
||||
TEST(proxy->user(), QStringLiteral("unknown"));
|
||||
TEST(proxy->pass(), QStringLiteral("secret"));
|
||||
|
||||
proxy->setType(3);
|
||||
proxy->setPort(8080);
|
||||
|
@ -216,12 +216,12 @@ void TestPreferences::testPreferences()
|
|||
proxy->setUser("unknown_1");
|
||||
proxy->setPass("secret_1");
|
||||
|
||||
TEST(proxy->type(),3);
|
||||
TEST(proxy->port(),8080);
|
||||
TEST(proxy->auth(),false);
|
||||
TEST(proxy->host(),QStringLiteral("127.0.0.1"));
|
||||
TEST(proxy->user(),QStringLiteral("unknown_1"));
|
||||
TEST(proxy->pass(),QStringLiteral("secret_1"));
|
||||
TEST(proxy->type(), 3);
|
||||
TEST(proxy->port(), 8080);
|
||||
TEST(proxy->auth(), false);
|
||||
TEST(proxy->host(), QStringLiteral("127.0.0.1"));
|
||||
TEST(proxy->user(), QStringLiteral("unknown_1"));
|
||||
TEST(proxy->pass(), QStringLiteral("secret_1"));
|
||||
|
||||
auto planner = pref->planner_settings;
|
||||
planner->setLastStop(true);
|
||||
|
@ -249,30 +249,30 @@ void TestPreferences::testPreferences()
|
|||
|
||||
planner->setDecoMode(BUEHLMANN);
|
||||
|
||||
TEST(planner->lastStop(),true);
|
||||
TEST(planner->verbatimPlan(),true);
|
||||
TEST(planner->displayRuntime(),true);
|
||||
TEST(planner->displayDuration(),true);
|
||||
TEST(planner->displayTransitions(),true);
|
||||
TEST(planner->doo2breaks(),true);
|
||||
TEST(planner->dropStoneMode(),true);
|
||||
TEST(planner->safetyStop(),true);
|
||||
TEST(planner->switchAtRequiredStop(),true);
|
||||
TEST(planner->lastStop(), true);
|
||||
TEST(planner->verbatimPlan(), true);
|
||||
TEST(planner->displayRuntime(), true);
|
||||
TEST(planner->displayDuration(), true);
|
||||
TEST(planner->displayTransitions(), true);
|
||||
TEST(planner->doo2breaks(), true);
|
||||
TEST(planner->dropStoneMode(), true);
|
||||
TEST(planner->safetyStop(), true);
|
||||
TEST(planner->switchAtRequiredStop(), true);
|
||||
|
||||
TEST(planner->ascrate75(),1);
|
||||
TEST(planner->ascrate50(),2);
|
||||
TEST(planner->ascratestops(),3);
|
||||
TEST(planner->ascratelast6m(),4);
|
||||
TEST(planner->descrate(),5);
|
||||
TEST(planner->bottompo2(),6);
|
||||
TEST(planner->decopo2(),7);
|
||||
TEST(planner->bestmixend(),8);
|
||||
TEST(planner->reserveGas(),9);
|
||||
TEST(planner->minSwitchDuration(),10);
|
||||
TEST(planner->bottomSac(),11);
|
||||
TEST(planner->decoSac(),12);
|
||||
TEST(planner->ascrate75(), 1);
|
||||
TEST(planner->ascrate50(), 2);
|
||||
TEST(planner->ascratestops(), 3);
|
||||
TEST(planner->ascratelast6m(), 4);
|
||||
TEST(planner->descrate(), 5);
|
||||
TEST(planner->bottompo2(), 6);
|
||||
TEST(planner->decopo2(), 7);
|
||||
TEST(planner->bestmixend(), 8);
|
||||
TEST(planner->reserveGas(), 9);
|
||||
TEST(planner->minSwitchDuration(), 10);
|
||||
TEST(planner->bottomSac(), 11);
|
||||
TEST(planner->decoSac(), 12);
|
||||
|
||||
TEST(planner->decoMode(),BUEHLMANN);
|
||||
TEST(planner->decoMode(), BUEHLMANN);
|
||||
|
||||
planner->setLastStop(false);
|
||||
planner->setVerbatimPlan(false);
|
||||
|
@ -299,30 +299,30 @@ void TestPreferences::testPreferences()
|
|||
|
||||
planner->setDecoMode(RECREATIONAL);
|
||||
|
||||
TEST(planner->lastStop(),false);
|
||||
TEST(planner->verbatimPlan(),false);
|
||||
TEST(planner->displayRuntime(),false);
|
||||
TEST(planner->displayDuration(),false);
|
||||
TEST(planner->displayTransitions(),false);
|
||||
TEST(planner->doo2breaks(),false);
|
||||
TEST(planner->dropStoneMode(),false);
|
||||
TEST(planner->safetyStop(),false);
|
||||
TEST(planner->switchAtRequiredStop(),false);
|
||||
TEST(planner->lastStop(), false);
|
||||
TEST(planner->verbatimPlan(), false);
|
||||
TEST(planner->displayRuntime(), false);
|
||||
TEST(planner->displayDuration(), false);
|
||||
TEST(planner->displayTransitions(), false);
|
||||
TEST(planner->doo2breaks(), false);
|
||||
TEST(planner->dropStoneMode(), false);
|
||||
TEST(planner->safetyStop(), false);
|
||||
TEST(planner->switchAtRequiredStop(), false);
|
||||
|
||||
TEST(planner->ascrate75(),11);
|
||||
TEST(planner->ascrate50(),12);
|
||||
TEST(planner->ascratestops(),13);
|
||||
TEST(planner->ascratelast6m(),14);
|
||||
TEST(planner->descrate(),15);
|
||||
TEST(planner->bottompo2(),16);
|
||||
TEST(planner->decopo2(),17);
|
||||
TEST(planner->bestmixend(),18);
|
||||
TEST(planner->reserveGas(),19);
|
||||
TEST(planner->minSwitchDuration(),110);
|
||||
TEST(planner->bottomSac(),111);
|
||||
TEST(planner->decoSac(),112);
|
||||
TEST(planner->ascrate75(), 11);
|
||||
TEST(planner->ascrate50(), 12);
|
||||
TEST(planner->ascratestops(), 13);
|
||||
TEST(planner->ascratelast6m(), 14);
|
||||
TEST(planner->descrate(), 15);
|
||||
TEST(planner->bottompo2(), 16);
|
||||
TEST(planner->decopo2(), 17);
|
||||
TEST(planner->bestmixend(), 18);
|
||||
TEST(planner->reserveGas(), 19);
|
||||
TEST(planner->minSwitchDuration(), 110);
|
||||
TEST(planner->bottomSac(), 111);
|
||||
TEST(planner->decoSac(), 112);
|
||||
|
||||
TEST(planner->decoMode(),RECREATIONAL);
|
||||
TEST(planner->decoMode(), RECREATIONAL);
|
||||
|
||||
auto units = pref->unit_settings;
|
||||
units->setLength(0);
|
||||
|
@ -334,14 +334,14 @@ void TestPreferences::testPreferences()
|
|||
units->setUnitSystem(QStringLiteral("metric"));
|
||||
units->setCoordinatesTraditional(false);
|
||||
|
||||
TEST(units->length(),0);
|
||||
TEST(units->pressure(),0);
|
||||
TEST(units->volume(),0);
|
||||
TEST(units->temperature(),0);
|
||||
TEST(units->weight(),0);
|
||||
TEST(units->verticalSpeedTime(),0);
|
||||
TEST(units->unitSystem(),QStringLiteral("metric"));
|
||||
TEST(units->coordinatesTraditional(),false);
|
||||
TEST(units->length(), 0);
|
||||
TEST(units->pressure(), 0);
|
||||
TEST(units->volume(), 0);
|
||||
TEST(units->temperature(), 0);
|
||||
TEST(units->weight(), 0);
|
||||
TEST(units->verticalSpeedTime(), 0);
|
||||
TEST(units->unitSystem(), QStringLiteral("metric"));
|
||||
TEST(units->coordinatesTraditional(), false);
|
||||
|
||||
units->setLength(1);
|
||||
units->setPressure(1);
|
||||
|
@ -352,60 +352,60 @@ void TestPreferences::testPreferences()
|
|||
units->setUnitSystem(QStringLiteral("fake-metric-system"));
|
||||
units->setCoordinatesTraditional(true);
|
||||
|
||||
TEST(units->length(),1);
|
||||
TEST(units->pressure(),1);
|
||||
TEST(units->volume(),1);
|
||||
TEST(units->temperature(),1);
|
||||
TEST(units->weight(),1);
|
||||
TEST(units->verticalSpeedTime(),1);
|
||||
TEST(units->unitSystem(),QStringLiteral("personalized"));
|
||||
TEST(units->coordinatesTraditional(),true);
|
||||
TEST(units->length(), 1);
|
||||
TEST(units->pressure(), 1);
|
||||
TEST(units->volume(), 1);
|
||||
TEST(units->temperature(), 1);
|
||||
TEST(units->weight(), 1);
|
||||
TEST(units->verticalSpeedTime(), 1);
|
||||
TEST(units->unitSystem(), QStringLiteral("personalized"));
|
||||
TEST(units->coordinatesTraditional(), true);
|
||||
|
||||
auto general = pref->general_settings;
|
||||
general->setDefaultFilename ("filename");
|
||||
general->setDefaultCylinder ("cylinder_2");
|
||||
general->setDefaultFilename("filename");
|
||||
general->setDefaultCylinder("cylinder_2");
|
||||
//TODOl: Change this to a enum. // This is 'undefined', it will need to figure out later between no_file or use_deault file.
|
||||
general->setDefaultFileBehavior (0);
|
||||
general->setDefaultSetPoint (0);
|
||||
general->setO2Consumption (0);
|
||||
general->setPscrRatio (0);
|
||||
general->setUseDefaultFile (true);
|
||||
general->setDefaultFileBehavior(0);
|
||||
general->setDefaultSetPoint(0);
|
||||
general->setO2Consumption(0);
|
||||
general->setPscrRatio(0);
|
||||
general->setUseDefaultFile(true);
|
||||
|
||||
TEST(general->defaultFilename(), QStringLiteral("filename"));
|
||||
TEST(general->defaultCylinder(), QStringLiteral("cylinder_2"));
|
||||
TEST(general->defaultFileBehavior(), (short) LOCAL_DEFAULT_FILE); // since we have a default file, here it returns
|
||||
TEST(general->defaultFileBehavior(), (short)LOCAL_DEFAULT_FILE); // since we have a default file, here it returns
|
||||
TEST(general->defaultSetPoint(), 0);
|
||||
TEST(general->o2Consumption(), 0);
|
||||
TEST(general->pscrRatio(), 0);
|
||||
TEST(general->useDefaultFile(), true);
|
||||
|
||||
general->setDefaultFilename ("no_file_name");
|
||||
general->setDefaultCylinder ("cylinder_1");
|
||||
general->setDefaultFilename("no_file_name");
|
||||
general->setDefaultCylinder("cylinder_1");
|
||||
//TODOl: Change this to a enum.
|
||||
general->setDefaultFileBehavior (CLOUD_DEFAULT_FILE);
|
||||
general->setDefaultFileBehavior(CLOUD_DEFAULT_FILE);
|
||||
|
||||
general->setDefaultSetPoint (1);
|
||||
general->setO2Consumption (1);
|
||||
general->setPscrRatio (1);
|
||||
general->setUseDefaultFile (false);
|
||||
general->setDefaultSetPoint(1);
|
||||
general->setO2Consumption(1);
|
||||
general->setPscrRatio(1);
|
||||
general->setUseDefaultFile(false);
|
||||
|
||||
TEST(general->defaultFilename(), QStringLiteral("no_file_name"));
|
||||
TEST(general->defaultCylinder(), QStringLiteral("cylinder_1"));
|
||||
TEST(general->defaultFileBehavior(), (short) CLOUD_DEFAULT_FILE);
|
||||
TEST(general->defaultFileBehavior(), (short)CLOUD_DEFAULT_FILE);
|
||||
TEST(general->defaultSetPoint(), 1);
|
||||
TEST(general->o2Consumption(), 1);
|
||||
TEST(general->pscrRatio(), 1);
|
||||
TEST(general->useDefaultFile(), false);
|
||||
|
||||
auto language = pref->language_settings;
|
||||
language->setLangLocale ("en_US");
|
||||
language->setLanguage ("en");
|
||||
language->setTimeFormat ("hh:mm");
|
||||
language->setDateFormat ("dd/mm/yy");
|
||||
language->setDateFormatShort ("dd/mm");
|
||||
language->setTimeFormatOverride (false);
|
||||
language->setDateFormatOverride (false);
|
||||
language->setUseSystemLanguage (false);
|
||||
language->setLangLocale("en_US");
|
||||
language->setLanguage("en");
|
||||
language->setTimeFormat("hh:mm");
|
||||
language->setDateFormat("dd/mm/yy");
|
||||
language->setDateFormatShort("dd/mm");
|
||||
language->setTimeFormatOverride(false);
|
||||
language->setDateFormatOverride(false);
|
||||
language->setUseSystemLanguage(false);
|
||||
|
||||
TEST(language->langLocale(), QStringLiteral("en_US"));
|
||||
TEST(language->language(), QStringLiteral("en"));
|
||||
|
@ -416,22 +416,22 @@ void TestPreferences::testPreferences()
|
|||
TEST(language->dateFormatOverride(), false);
|
||||
TEST(language->useSystemLanguage(), false);
|
||||
|
||||
language->setLangLocale ("en_EN");
|
||||
language->setLanguage ("br");
|
||||
language->setTimeFormat ("mm:hh");
|
||||
language->setDateFormat ("yy/mm/dd");
|
||||
language->setDateFormatShort ("dd/yy");
|
||||
language->setTimeFormatOverride (true);
|
||||
language->setDateFormatOverride (true);
|
||||
language->setUseSystemLanguage (true);
|
||||
language->setLangLocale("en_EN");
|
||||
language->setLanguage("br");
|
||||
language->setTimeFormat("mm:hh");
|
||||
language->setDateFormat("yy/mm/dd");
|
||||
language->setDateFormatShort("dd/yy");
|
||||
language->setTimeFormatOverride(true);
|
||||
language->setDateFormatOverride(true);
|
||||
language->setUseSystemLanguage(true);
|
||||
|
||||
TEST(language->langLocale(), QStringLiteral("en_EN"));
|
||||
TEST(language->language(), QStringLiteral("br"));
|
||||
TEST(language->timeFormat(), QStringLiteral("mm:hh"));
|
||||
TEST(language->dateFormat(), QStringLiteral("yy/mm/dd"));
|
||||
TEST(language->dateFormatShort(), QStringLiteral("dd/yy"));
|
||||
TEST(language->timeFormatOverride(),true);
|
||||
TEST(language->dateFormatOverride(),true);
|
||||
TEST(language->timeFormatOverride(), true);
|
||||
TEST(language->dateFormatOverride(), true);
|
||||
TEST(language->useSystemLanguage(), true);
|
||||
|
||||
auto location = pref->location_settings;
|
||||
|
|
|
@ -5,8 +5,7 @@
|
|||
#include <QTest>
|
||||
#include <functional>
|
||||
|
||||
class TestPreferences : public QObject
|
||||
{
|
||||
class TestPreferences : public QObject {
|
||||
Q_OBJECT
|
||||
private slots:
|
||||
void initTestCase();
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
#include <QtTest>
|
||||
|
||||
class TestProfile : public QObject{
|
||||
class TestProfile : public QObject {
|
||||
Q_OBJECT
|
||||
private slots:
|
||||
void testRedCeiling();
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
// SPDX-License-Identifier: GPL-2.0
|
||||
#include "testqPrefAnimations.h"
|
||||
|
||||
#include "core/settings/qPref.h"
|
||||
#include "core/pref.h"
|
||||
#include "core/qthelper.h"
|
||||
#include "core/settings/qPref.h"
|
||||
|
||||
#include <QDate>
|
||||
#include <QTest>
|
||||
|
@ -39,7 +39,7 @@ void TestQPrefAnimations::test_set_struct()
|
|||
|
||||
void TestQPrefAnimations::test_set_load_struct()
|
||||
{
|
||||
// test set func -> load -> struct pref
|
||||
// test set func -> load -> struct pref
|
||||
|
||||
auto tst = qPrefAnimations::instance();
|
||||
|
||||
|
|
|
@ -4,8 +4,7 @@
|
|||
|
||||
#include <QObject>
|
||||
|
||||
class TestQPrefAnimations : public QObject
|
||||
{
|
||||
class TestQPrefAnimations : public QObject {
|
||||
Q_OBJECT
|
||||
private slots:
|
||||
void initTestCase();
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
// SPDX-License-Identifier: GPL-2.0
|
||||
#include "testqPrefCloudStorage.h"
|
||||
|
||||
#include "core/settings/qPref.h"
|
||||
#include "core/pref.h"
|
||||
#include "core/qthelper.h"
|
||||
#include "core/settings/qPref.h"
|
||||
|
||||
#include <QTest>
|
||||
|
||||
|
@ -48,7 +48,6 @@ void TestQPrefCloudStorage::test_struct_get()
|
|||
QCOMPARE(tst->save_password_local(), prefs.save_password_local);
|
||||
QCOMPARE(tst->save_userid_local(), prefs.save_userid_local);
|
||||
QCOMPARE(tst->userid(), QString(prefs.userid));
|
||||
|
||||
}
|
||||
|
||||
void TestQPrefCloudStorage::test_set_struct()
|
||||
|
@ -88,7 +87,7 @@ void TestQPrefCloudStorage::test_set_struct()
|
|||
|
||||
void TestQPrefCloudStorage::test_set_load_struct()
|
||||
{
|
||||
// test set func -> load -> struct pref
|
||||
// test set func -> load -> struct pref
|
||||
|
||||
auto tst = qPrefCloudStorage::instance();
|
||||
|
||||
|
@ -206,11 +205,11 @@ void TestQPrefCloudStorage::test_multiple()
|
|||
QCOMPARE(tst->cloud_timeout(), tst_direct->cloud_timeout());
|
||||
}
|
||||
|
||||
#define TEST(METHOD, VALUE) \
|
||||
QCOMPARE(METHOD, VALUE); \
|
||||
cloud->sync(); \
|
||||
cloud->load(); \
|
||||
QCOMPARE(METHOD, VALUE);
|
||||
#define TEST(METHOD, VALUE) \
|
||||
QCOMPARE(METHOD, VALUE); \
|
||||
cloud->sync(); \
|
||||
cloud->load(); \
|
||||
QCOMPARE(METHOD, VALUE);
|
||||
|
||||
void TestQPrefCloudStorage::test_oldPreferences()
|
||||
{
|
||||
|
|
|
@ -4,8 +4,7 @@
|
|||
|
||||
#include <QObject>
|
||||
|
||||
class TestQPrefCloudStorage : public QObject
|
||||
{
|
||||
class TestQPrefCloudStorage : public QObject {
|
||||
Q_OBJECT
|
||||
|
||||
private slots:
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
// SPDX-License-Identifier: GPL-2.0
|
||||
#include "testqPrefDisplay.h"
|
||||
|
||||
#include "core/settings/qPref.h"
|
||||
#include "core/pref.h"
|
||||
#include "core/qthelper.h"
|
||||
#include "core/settings/qPref.h"
|
||||
|
||||
#include <QDate>
|
||||
#include <QTest>
|
||||
|
@ -25,7 +25,7 @@ void TestQPrefDisplay::test_struct_get()
|
|||
prefs.divelist_font = copy_qstring("comic");
|
||||
prefs.font_size = 12.0;
|
||||
prefs.show_developer = false;
|
||||
prefs.theme = copy_qstring("myTheme");
|
||||
prefs.theme = copy_qstring("myTheme");
|
||||
|
||||
QCOMPARE(display->display_invalid_dives(), prefs.display_invalid_dives);
|
||||
QCOMPARE(display->divelist_font(), QString(prefs.divelist_font));
|
||||
|
@ -44,7 +44,7 @@ void TestQPrefDisplay::test_set_struct()
|
|||
display->set_divelist_font("doNotCareAtAll");
|
||||
display->set_font_size(12.0);
|
||||
display->set_show_developer(false);
|
||||
display->set_theme("myTheme");
|
||||
display->set_theme("myTheme");
|
||||
|
||||
QCOMPARE(prefs.display_invalid_dives, true);
|
||||
QCOMPARE(prefs.divelist_font, "doNotCareAtAll");
|
||||
|
@ -55,7 +55,7 @@ void TestQPrefDisplay::test_set_struct()
|
|||
|
||||
void TestQPrefDisplay::test_set_load_struct()
|
||||
{
|
||||
// test set func -> load -> struct pref
|
||||
// test set func -> load -> struct pref
|
||||
|
||||
auto display = qPrefDisplay::instance();
|
||||
|
||||
|
@ -63,13 +63,13 @@ void TestQPrefDisplay::test_set_load_struct()
|
|||
display->set_divelist_font("doNotCareString");
|
||||
display->set_font_size(15.0);
|
||||
display->set_show_developer(true);
|
||||
display->set_theme("myTheme2");
|
||||
display->set_theme("myTheme2");
|
||||
|
||||
prefs.display_invalid_dives = true;
|
||||
prefs.divelist_font = copy_qstring("doNotCareAtAll");
|
||||
prefs.font_size = 12.0;
|
||||
prefs.show_developer = false;
|
||||
prefs.theme = copy_qstring("myTheme");
|
||||
prefs.theme = copy_qstring("myTheme");
|
||||
|
||||
display->load();
|
||||
QCOMPARE(prefs.display_invalid_dives, false);
|
||||
|
@ -89,14 +89,14 @@ void TestQPrefDisplay::test_struct_disk()
|
|||
prefs.divelist_font = copy_qstring("doNotCareAtAll");
|
||||
prefs.font_size = 17.0;
|
||||
prefs.show_developer = false;
|
||||
prefs.theme = copy_qstring("myTheme3");
|
||||
prefs.theme = copy_qstring("myTheme3");
|
||||
|
||||
display->sync();
|
||||
prefs.display_invalid_dives = false;
|
||||
prefs.divelist_font = copy_qstring("noString");
|
||||
prefs.font_size = 11.0;
|
||||
prefs.show_developer = true;
|
||||
prefs.theme = copy_qstring("myTheme");
|
||||
prefs.theme = copy_qstring("myTheme");
|
||||
|
||||
display->load();
|
||||
QCOMPARE(prefs.display_invalid_dives, true);
|
||||
|
@ -114,14 +114,14 @@ void TestQPrefDisplay::test_multiple()
|
|||
prefs.divelist_font = copy_qstring("comic");
|
||||
prefs.font_size = 11.0;
|
||||
prefs.show_developer = true;
|
||||
prefs.theme = copy_qstring("myTheme");
|
||||
prefs.theme = copy_qstring("myTheme");
|
||||
auto display_direct = new qPrefDisplay;
|
||||
|
||||
prefs.display_invalid_dives = true;
|
||||
prefs.divelist_font = copy_qstring("multipleCharsInString");
|
||||
prefs.font_size = 15.0;
|
||||
prefs.show_developer = false;
|
||||
prefs.theme = copy_qstring("myTheme8");
|
||||
prefs.theme = copy_qstring("myTheme8");
|
||||
auto display = qPrefDisplay::instance();
|
||||
|
||||
QCOMPARE(display->display_invalid_dives(), display_direct->display_invalid_dives());
|
||||
|
|
|
@ -4,8 +4,7 @@
|
|||
|
||||
#include <QObject>
|
||||
|
||||
class TestQPrefDisplay : public QObject
|
||||
{
|
||||
class TestQPrefDisplay : public QObject {
|
||||
Q_OBJECT
|
||||
private slots:
|
||||
void initTestCase();
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
// SPDX-License-Identifier: GPL-2.0
|
||||
#include "testqPrefDiveComputer.h"
|
||||
|
||||
#include "core/settings/qPref.h"
|
||||
#include "core/pref.h"
|
||||
#include "core/qthelper.h"
|
||||
#include "core/settings/qPref.h"
|
||||
|
||||
#include <QTest>
|
||||
|
||||
|
@ -54,7 +54,7 @@ void TestQPrefDiveComputer::test_set_struct()
|
|||
|
||||
void TestQPrefDiveComputer::test_set_load_struct()
|
||||
{
|
||||
// test set func -> load -> struct pref
|
||||
// test set func -> load -> struct pref
|
||||
|
||||
auto tst = qPrefDiveComputer::instance();
|
||||
|
||||
|
@ -120,11 +120,11 @@ void TestQPrefDiveComputer::test_multiple()
|
|||
QCOMPARE(tst->download_mode(), tst_direct->download_mode());
|
||||
}
|
||||
|
||||
#define TEST(METHOD, VALUE) \
|
||||
QCOMPARE(METHOD, VALUE); \
|
||||
dc->sync(); \
|
||||
dc->load(); \
|
||||
QCOMPARE(METHOD, VALUE);
|
||||
#define TEST(METHOD, VALUE) \
|
||||
QCOMPARE(METHOD, VALUE); \
|
||||
dc->sync(); \
|
||||
dc->load(); \
|
||||
QCOMPARE(METHOD, VALUE);
|
||||
|
||||
void TestQPrefDiveComputer::test_oldPreferences()
|
||||
{
|
||||
|
@ -152,4 +152,3 @@ void TestQPrefDiveComputer::test_oldPreferences()
|
|||
}
|
||||
|
||||
QTEST_MAIN(TestQPrefDiveComputer)
|
||||
|
||||
|
|
|
@ -4,8 +4,7 @@
|
|||
|
||||
#include <QObject>
|
||||
|
||||
class TestQPrefDiveComputer : public QObject
|
||||
{
|
||||
class TestQPrefDiveComputer : public QObject {
|
||||
Q_OBJECT
|
||||
|
||||
private slots:
|
||||
|
|
|
@ -1,13 +1,12 @@
|
|||
// SPDX-License-Identifier: GPL-2.0
|
||||
#include <QApplication>
|
||||
#include <QQmlContext>
|
||||
#include <QQmlEngine>
|
||||
#include <QtQuickTest>
|
||||
#include <QtTest>
|
||||
#include <QQmlEngine>
|
||||
#include <QQmlContext>
|
||||
#include <QApplication>
|
||||
|
||||
#include "core/settings/qPref.h"
|
||||
#include "core/qt-gui.h"
|
||||
#include "core/settings/qPref.h"
|
||||
|
||||
// this is the content of QUICK_TEST_MAIN amended with
|
||||
// registration of ssrf classes
|
||||
|
@ -34,7 +33,7 @@ int main(int argc, char **argv)
|
|||
// save tst_dir and pass rest to Qt
|
||||
const char *tst_dir = argv[1];
|
||||
for (int i = 1; i < argc; i++)
|
||||
argv[i] = argv[i+1];
|
||||
argv[i] = argv[i + 1];
|
||||
argc--;
|
||||
|
||||
// Register types
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
// SPDX-License-Identifier: GPL-2.0
|
||||
#include "testrenumber.h"
|
||||
#include "core/dive.h"
|
||||
#include "core/file.h"
|
||||
#include "core/divelist.h"
|
||||
#include "core/file.h"
|
||||
#include <QTextStream>
|
||||
|
||||
void TestRenumber::setup()
|
||||
|
|
|
@ -4,8 +4,7 @@
|
|||
|
||||
#include <QtTest>
|
||||
|
||||
class TestRenumber : public QObject
|
||||
{
|
||||
class TestRenumber : public QObject {
|
||||
Q_OBJECT
|
||||
private slots:
|
||||
void setup();
|
||||
|
|
|
@ -10,15 +10,15 @@ void TestUnitConversion::testUnitConversions()
|
|||
QCOMPARE(IS_FP_SAME(ml_to_cuft(1000), 0.0353147), true);
|
||||
QCOMPARE(IS_FP_SAME(cuft_to_l(1), 28.316847), true);
|
||||
QCOMPARE(IS_FP_SAME(mm_to_feet(1000), 3.280840), true);
|
||||
QCOMPARE(feet_to_mm(1), (long unsigned int) 305);
|
||||
QCOMPARE(to_feet((depth_t){ 1000 }), 3);
|
||||
QCOMPARE(feet_to_mm(1), (long unsigned int)305);
|
||||
QCOMPARE(to_feet((depth_t){1000}), 3);
|
||||
QCOMPARE(IS_FP_SAME(mkelvin_to_C(647000), 373.85), true);
|
||||
QCOMPARE(IS_FP_SAME(mkelvin_to_F(647000), 704.93), true);
|
||||
QCOMPARE(F_to_mkelvin(704.93), (unsigned long)647000);
|
||||
QCOMPARE(C_to_mkelvin(373.85), (unsigned long)647000);
|
||||
QCOMPARE(IS_FP_SAME(psi_to_bar(14.6959488), 1.01325), true);
|
||||
QCOMPARE(psi_to_mbar(14.6959488), (long)1013);
|
||||
QCOMPARE(to_PSI((pressure_t){ 1013 }), (int)15);
|
||||
QCOMPARE(to_PSI((pressure_t){1013}), (int)15);
|
||||
QCOMPARE(IS_FP_SAME(bar_to_atm(1.013), 1.0), true);
|
||||
QCOMPARE(IS_FP_SAME(mbar_to_atm(1013), 1.0), true);
|
||||
QCOMPARE(mbar_to_PSI(1013), (int)15);
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
#include <QtTest>
|
||||
|
||||
class TestUnitConversion : public QObject{
|
||||
class TestUnitConversion : public QObject {
|
||||
Q_OBJECT
|
||||
private slots:
|
||||
void testUnitConversions();
|
||||
|
|
Loading…
Add table
Reference in a new issue