mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-17 19:05:31 +08:00
refs #214, added test for variant map hash. Improved samples for BlackSim.
This commit is contained in:
@@ -7,15 +7,28 @@
|
|||||||
#include "samplesfscommon.h"
|
#include "samplesfscommon.h"
|
||||||
#include "samplesfsx.h"
|
#include "samplesfsx.h"
|
||||||
#include <QCoreApplication>
|
#include <QCoreApplication>
|
||||||
|
#include <QTextStream>
|
||||||
|
#include <QDebug>
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* Samples
|
* Samples
|
||||||
*/
|
*/
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
|
QTextStream streamIn(stdin);
|
||||||
BlackSim::registerMetadata();
|
BlackSim::registerMetadata();
|
||||||
// BlackSimTest::CSamplesFsCommon::samples();
|
qDebug() << "Run samples:";
|
||||||
|
qDebug() << "1 .. FS common";
|
||||||
|
qDebug() << "2 .. FSX";
|
||||||
|
QString i = streamIn.readLine().toLower().trimmed();
|
||||||
|
if (i.startsWith("1"))
|
||||||
|
{
|
||||||
|
BlackSimTest::CSamplesFsCommon::samples();
|
||||||
|
}
|
||||||
|
else if (i.startsWith("2"))
|
||||||
|
{
|
||||||
BlackSimTest::CSamplesFsx::samples();
|
BlackSimTest::CSamplesFsx::samples();
|
||||||
|
}
|
||||||
QCoreApplication a(argc, argv);
|
QCoreApplication a(argc, argv);
|
||||||
return a.exec();
|
return a.exec();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -88,16 +88,26 @@ namespace BlackMiscTest
|
|||||||
CIndexVariantMap vmWildcard(true);
|
CIndexVariantMap vmWildcard(true);
|
||||||
CIndexVariantMap vmNoWildcard(false);
|
CIndexVariantMap vmNoWildcard(false);
|
||||||
CIndexVariantMap vm;
|
CIndexVariantMap vm;
|
||||||
|
CIndexVariantMap vmCopy(vmWildcard);
|
||||||
|
|
||||||
// remark: Shortcoming here, as the callsign will automatically set for user in station
|
// remark: Shortcoming here, as the callsign will automatically set for user in station
|
||||||
// I have to set this as well, otherwise, not match.
|
// I have to set this as well, otherwise, not match.
|
||||||
vm.addValue(CAtcStation::IndexController, CUser("123456", "Joe Doe", CCallsign("EDDMTWR")));
|
vm.addValue(CAtcStation::IndexController, CUser("123456", "Joe Doe", CCallsign("EDDMTWR")));
|
||||||
|
|
||||||
// compare
|
// compare
|
||||||
|
|
||||||
QVERIFY2(vmWildcard == station1, "Station should be equal to wildcard");
|
QVERIFY2(vmWildcard == station1, "Station should be equal to wildcard");
|
||||||
QVERIFY2(station1 != vmNoWildcard, "Station should not be equal to empty list");
|
QVERIFY2(station1 != vmNoWildcard, "Station should not be equal to empty list");
|
||||||
QVERIFY2(station1 == vm, "Controller should match");
|
QVERIFY2(station1 == vm, "Controller should match");
|
||||||
QVERIFY2(vmWildcard == vmWildcard, "Maps should be equal");
|
QVERIFY2(vmWildcard == vmCopy, "Maps should be equal");
|
||||||
|
QVERIFY2(vmWildcard.getValueHash() == vmCopy.getValueHash(), "Hashs should be equal (simple)");
|
||||||
|
|
||||||
|
vm.addValue(CAtcStation::IndexFrequency, CFrequency(118.7, CFrequencyUnit::MHz()));
|
||||||
|
vm.addValue(CAtcStation::IndexPosition, geoPos);
|
||||||
|
vmCopy = vm;
|
||||||
|
QVERIFY2(vm.getValueHash() == vmCopy.getValueHash(), "Hashs should be equal (detailed)");
|
||||||
|
vmCopy.setWildcard(!vm.isWildcard());
|
||||||
|
QVERIFY2(vm.getValueHash() != vmCopy.getValueHash(), "Hashs should not be equal (detailed)");
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|||||||
Reference in New Issue
Block a user