mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-22 23:05:36 +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 "samplesfsx.h"
|
||||
#include <QCoreApplication>
|
||||
#include <QTextStream>
|
||||
#include <QDebug>
|
||||
|
||||
/*!
|
||||
* Samples
|
||||
*/
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
QTextStream streamIn(stdin);
|
||||
BlackSim::registerMetadata();
|
||||
// BlackSimTest::CSamplesFsCommon::samples();
|
||||
BlackSimTest::CSamplesFsx::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();
|
||||
}
|
||||
QCoreApplication a(argc, argv);
|
||||
return a.exec();
|
||||
}
|
||||
|
||||
@@ -88,16 +88,26 @@ namespace BlackMiscTest
|
||||
CIndexVariantMap vmWildcard(true);
|
||||
CIndexVariantMap vmNoWildcard(false);
|
||||
CIndexVariantMap vm;
|
||||
CIndexVariantMap vmCopy(vmWildcard);
|
||||
|
||||
// remark: Shortcoming here, as the callsign will automatically set for user in station
|
||||
// I have to set this as well, otherwise, not match.
|
||||
vm.addValue(CAtcStation::IndexController, CUser("123456", "Joe Doe", CCallsign("EDDMTWR")));
|
||||
|
||||
// compare
|
||||
|
||||
QVERIFY2(vmWildcard == station1, "Station should be equal to wildcard");
|
||||
QVERIFY2(station1 != vmNoWildcard, "Station should not be equal to empty list");
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user