refs #214, added test for variant map hash. Improved samples for BlackSim.

This commit is contained in:
Klaus Basan
2014-04-21 11:35:46 +02:00
parent 1cad64fef8
commit 319bf6d7e4
2 changed files with 26 additions and 3 deletions

View File

@@ -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();
}

View File

@@ -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