mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-08-11 12:15:36 +08:00
refs #879, use test data in samples/unit tests
This commit is contained in:
committed by
Mathew Sutcliffe
parent
4b506f20ab
commit
e73c8c4f36
@@ -11,6 +11,7 @@
|
||||
//! \ingroup sampleblackmisc
|
||||
|
||||
#include "samplescontainer.h"
|
||||
#include "blackmisc/test/testdata.h"
|
||||
#include "blackmisc/aviation/atcstation.h"
|
||||
#include "blackmisc/aviation/atcstationlist.h"
|
||||
#include "blackmisc/aviation/callsign.h"
|
||||
@@ -35,27 +36,16 @@ using namespace BlackMisc::Aviation;
|
||||
using namespace BlackMisc::PhysicalQuantities;
|
||||
using namespace BlackMisc::Geo;
|
||||
using namespace BlackMisc::Network;
|
||||
using namespace BlackMisc::Test;
|
||||
|
||||
namespace BlackSample
|
||||
{
|
||||
int CSamplesContainer::samples()
|
||||
{
|
||||
// ATC stations
|
||||
QDateTime dtFrom = QDateTime::currentDateTimeUtc();
|
||||
QDateTime dtUntil = dtFrom.addSecs(60 * 60); // 1 hour
|
||||
QDateTime dtFrom2 = dtUntil;
|
||||
QDateTime dtUntil2 = dtUntil.addSecs(60 * 60);
|
||||
CFrequency freqEddmTwr(118.7, CFrequencyUnit::MHz());
|
||||
CCallsign callsignEddmTwr("eddm_twr");
|
||||
CCoordinateGeodetic geoPos =
|
||||
CCoordinateGeodetic::fromWgs84("48° 21′ 13″ N", "11° 47′ 09″ E", { 1487, CLengthUnit::ft() });
|
||||
CAtcStation station1(callsignEddmTwr, CUser("123456", "Joe Doe"),
|
||||
freqEddmTwr,
|
||||
geoPos, CLength(50, CLengthUnit::km()), false, dtFrom, dtUntil);
|
||||
const CAtcStation station1(CTestData::getMunichTower());
|
||||
CAtcStation station2(station1);
|
||||
CAtcStation station3(CCallsign("eddm_app"), CUser("654321", "Jen Doe"),
|
||||
CFrequency(120.7, CFrequencyUnit::MHz()),
|
||||
geoPos, CLength(100, CLengthUnit::km()), false, dtFrom2, dtUntil2);
|
||||
CAtcStation station3(CTestData::getMunichApproach());
|
||||
|
||||
// ATC List
|
||||
CAtcStationList atcList;
|
||||
@@ -85,7 +75,6 @@ namespace BlackSample
|
||||
CFrequency changedFrequency(118.25, CFrequencyUnit::MHz());
|
||||
CPropertyIndexVariantMap vm(CAtcStation::IndexFrequency, CVariant::from(changedFrequency));
|
||||
|
||||
|
||||
// demonstration apply
|
||||
CPropertyIndexList changedProperties;
|
||||
changedProperties = station1Cpy.apply(vm, true);
|
||||
@@ -95,11 +84,11 @@ namespace BlackSample
|
||||
|
||||
// applyIf
|
||||
int changed;
|
||||
changed = atcList.applyIf(&CAtcStation::getCallsign, callsignEddmTwr, vm);
|
||||
changed = atcList.applyIf(&CAtcStation::getCallsign, CTestData::getMunichTower().getCallsign(), vm);
|
||||
qDebug() << "applyIf, changed" << changed << vm << "expected 1";
|
||||
changed = atcList.applyIf(&CAtcStation::getCallsign, callsignEddmTwr, vm);
|
||||
changed = atcList.applyIf(&CAtcStation::getCallsign, CTestData::getMunichTower().getCallsign(), vm);
|
||||
qDebug() << "applyIf, changed" << changed << vm << "expected 1";
|
||||
changed = atcList.applyIf(&CAtcStation::getCallsign, callsignEddmTwr, vm, true);
|
||||
changed = atcList.applyIf(&CAtcStation::getCallsign, CTestData::getMunichTower().getCallsign(), vm, true);
|
||||
qDebug() << "applyIf, changed" << changed << vm << "expected 0";
|
||||
|
||||
return 0;
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
#include "blackmisc/pq/speed.h"
|
||||
#include "blackmisc/pq/units.h"
|
||||
#include "blackmisc/simulation/simulatedaircraft.h"
|
||||
#include "blackmisc/test/testdata.h"
|
||||
#include "blackmisc/stringutils.h"
|
||||
|
||||
#include <stdio.h>
|
||||
@@ -45,13 +46,10 @@ using namespace BlackMisc::Simulation;
|
||||
using namespace BlackMisc::PhysicalQuantities;
|
||||
using namespace BlackMisc::Geo;
|
||||
using namespace BlackMisc::Network;
|
||||
using namespace BlackMisc::Test;
|
||||
|
||||
namespace BlackSample
|
||||
{
|
||||
|
||||
/*
|
||||
* Samples
|
||||
*/
|
||||
int CSamplesJson::samples()
|
||||
{
|
||||
QTextStream cin(stdin);
|
||||
@@ -61,14 +59,10 @@ namespace BlackSample
|
||||
l.convertFromJson(json);
|
||||
qDebug() << json << l;
|
||||
qDebug() << "-------";
|
||||
QDateTime dtFrom = QDateTime::currentDateTimeUtc();
|
||||
QDateTime dtUntil = dtFrom.addSecs(60 * 60); // 1 hour
|
||||
CCoordinateGeodetic geoPos = CCoordinateGeodetic::fromWgs84("48° 21′ 13″ N", "11° 47′ 09″ E", { 1487, CLengthUnit::ft() });
|
||||
CAtcStation station(CCallsign("eddm_twr"), CUser("123456", "Joe Doe"),
|
||||
CFrequency(118.7, CFrequencyUnit::MHz()), geoPos, CLength(50, CLengthUnit::km()), false, dtFrom, dtUntil);
|
||||
CAtcStation station = CTestData::getMunichTower();
|
||||
json = station.toJson();
|
||||
QJsonDocument doc(json);
|
||||
qDebug() << doc.toJson(QJsonDocument::Indented);
|
||||
qDebug().noquote() << doc.toJson(QJsonDocument::Indented);
|
||||
qDebug() << "-------";
|
||||
|
||||
station = CAtcStation();
|
||||
@@ -77,14 +71,11 @@ namespace BlackSample
|
||||
qDebug() << "------- Enter -----";
|
||||
cin.readLine();
|
||||
|
||||
CAircraftSituation situation(geoPos, CHeading(10, CHeading::True, CAngleUnit::deg()),
|
||||
CAngle(12, CAngleUnit::deg()), CAngle(5, CAngleUnit::deg()),
|
||||
CSpeed(111, CSpeedUnit::km_h()));
|
||||
CSimulatedAircraft aircraft(CCallsign("DAMBZ"), CUser("123456", "Joe Pilot"), situation);
|
||||
CSimulatedAircraft aircraft(CCallsign("DAMBZ"), CUser("123456", "Joe Pilot"), CTestData::getAircraftSituationAboveMunichTower());
|
||||
aircraft.setCom1System(CComSystem::getCom1System(122.8, 118.75));
|
||||
aircraft.setCom2System(CComSystem::getCom2System(123.8, 124.00));
|
||||
aircraft.setTransponder(CTransponder::getStandardTransponder(7000, CTransponder::ModeC));
|
||||
aircraft.setIcaoCodes(CAircraftIcaoCode("B737", "L2J"), CAirlineIcaoCode("DLH"));
|
||||
aircraft.setIcaoCodes(CTestData::getDBAircraftIcaoB737(), CAirlineIcaoCode("DLH"));
|
||||
|
||||
json = aircraft.toJson();
|
||||
doc = QJsonDocument(json);
|
||||
@@ -97,10 +88,7 @@ namespace BlackSample
|
||||
qDebug() << "------- Enter -----";
|
||||
cin.readLine();
|
||||
|
||||
CAtcStationList stations;
|
||||
stations.push_back(station);
|
||||
station.setCallsign(CCallsign("eddn_gnd"));
|
||||
stations.push_back(station);
|
||||
CAtcStationList stations = CTestData::getAtcStations();
|
||||
json = stations.toJson();
|
||||
doc.setObject(json);
|
||||
qDebug() << doc.toJson(QJsonDocument::Indented);
|
||||
@@ -124,5 +112,4 @@ namespace BlackSample
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
#include "blackmisc/test/testserviceinterface.h"
|
||||
#include "blackmisc/dbusserver.h"
|
||||
#include "blackmisc/network/server.h"
|
||||
#include "blackmisc/test/testdata.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
@@ -96,7 +97,6 @@ namespace BlackSample
|
||||
ITestServiceInterface testServiceInterface(CTestService::InterfaceName(), CTestService::ObjectPath(), connection);
|
||||
QTextStream qtin(stdin);
|
||||
QTextStream qtout(stdout);
|
||||
QString line;
|
||||
|
||||
while (true)
|
||||
{
|
||||
@@ -138,17 +138,15 @@ namespace BlackSample
|
||||
speed.switchUnit(CSpeedUnit::kts());
|
||||
testServiceInterface.receiveSpeed(speed);
|
||||
qtout << "Send speed via interface " << speed << endl;
|
||||
QThread::msleep(2500);
|
||||
speed.switchUnit(CSpeedUnit::km_h());
|
||||
speed.addValueSameUnit(1.0);
|
||||
|
||||
// Network
|
||||
const CServer trafficServer("fooserver", "a foo server", "localhost", 1234,
|
||||
CUser("112233", "Some real name", "email@xyz.com", "secret"));
|
||||
const CServer trafficServer = CTestData::getTrafficServer();
|
||||
QVariant tsqv = QVariant::fromValue(trafficServer);
|
||||
QDBusVariant tsv(tsqv);
|
||||
testServiceInterface.receiveVariant(tsv, tsqv.userType());
|
||||
qtout << "Send server via interface and variant " << trafficServer << tsqv.userType() << endl;
|
||||
qtout << "Send server via interface and variant '" << trafficServer << QLatin1Literal("' ") << tsqv.userType() << endl;
|
||||
|
||||
// Aviation
|
||||
const CComSystem comSystem = CComSystem("DBUS COM1", CPhysicalQuantitiesConstants::FrequencyInternationalAirDistress(), CPhysicalQuantitiesConstants::FrequencyUnicom());
|
||||
@@ -179,59 +177,34 @@ namespace BlackSample
|
||||
testServiceInterface.receiveLength(alt);
|
||||
qtout << "Send altitude via interface " << alt << endl;
|
||||
|
||||
const CCallsign callsign("d-ambz");
|
||||
const CCallsign callsign = CTestData::getRandomPilotCallsign();
|
||||
testServiceInterface.receiveCallsign(callsign);
|
||||
qtout << "Send callsign via interface " << callsign << endl;
|
||||
|
||||
CCoordinateGeodetic geoPos = CCoordinateGeodetic::fromWgs84("48° 21′ 13″ N", "11° 47′ 09″ E", { 1487, CLengthUnit::ft() }); // Munich
|
||||
CAtcStation station(CCallsign("eddm_twr"), CUser("123456", "Joe Controller"),
|
||||
CFrequency(118.7, CFrequencyUnit::MHz()),
|
||||
geoPos, CLength(50, CLengthUnit::km()));
|
||||
|
||||
const CAtcStation station = CTestData::getMunichTower();
|
||||
testServiceInterface.receiveAtcStation(station);
|
||||
qtout << "Send ATC " << station << endl;
|
||||
|
||||
// Geo
|
||||
// EDDF: 50° 2′ 0″ N, 8° 34′ 14″ E, 100m MSL
|
||||
geoPos = CCoordinateGeodetic::fromWgs84("50° 2′ 1″ 23 N", "8° 34′ 14″ E", { 111, CLengthUnit::m() });
|
||||
const CCoordinateGeodetic geoPos = CTestData::getCoordinateFrankfurtTower();
|
||||
testServiceInterface.receiveGeoPosition(geoPos);
|
||||
qtout << "Send geo position " << geoPos << endl;
|
||||
CApplication::processEventsFor(1000);
|
||||
|
||||
qtout << "----------------- variant tests ----------------" << endl;
|
||||
CVariantList cvList;
|
||||
cvList.push_back(CVariant::fromValue(len));
|
||||
cvList.push_back(CVariant::fromValue(alt));
|
||||
CVariantList lengthsV;
|
||||
lengthsV.push_back(CVariant::fromValue(len));
|
||||
lengthsV.push_back(CVariant::fromValue(alt));
|
||||
testServiceInterface.receiveLengthsQvl(cvList);
|
||||
qtout << "Send lengths via interface as CVariantList" << endl;
|
||||
testServiceInterface.receiveLengthsQl(lengthsV);
|
||||
qtout << "Send lengths via interface as QList<CVariant>" << endl;
|
||||
for (const CVariant &lv : cvList)
|
||||
{
|
||||
qtout << " " << "Send length in list: " << lv << endl;
|
||||
}
|
||||
CApplication::processEventsFor(2000);
|
||||
const CVariantList cvList = CTestData::getCVariantList();
|
||||
testServiceInterface.receiveVariantList(cvList);
|
||||
qtout << "Send " << cvList.size() << " variants via interface as CVariantList" << endl;
|
||||
|
||||
// Value map
|
||||
qtout << "----------------- index variant map ----------------" << endl;
|
||||
|
||||
CPropertyIndexVariantMap valueMap;
|
||||
valueMap.addValue(1000, 111.222);
|
||||
valueMap.addValue(2000, callsign);
|
||||
valueMap.addValue(3000, alt);
|
||||
valueMap.addValue(4000, track);
|
||||
valueMap.addValue(5000, QDateTime::currentDateTime().addDays(1));
|
||||
valueMap.addValue(6000, QString("foobar"));
|
||||
const CPropertyIndexVariantMap valueMap = CTestData::getCPropertyIndexVariantMap();
|
||||
testServiceInterface.receiveValueMap(valueMap);
|
||||
qtout << "Send index variant map " << valueMap << endl;
|
||||
CApplication::processEventsFor(2000);
|
||||
qtout << "Send " << valueMap.size() << " index variant map entries" << endl;
|
||||
CApplication::processEventsFor(1000);
|
||||
|
||||
qtout << "----------------- pings ----------------" << endl;
|
||||
int errors = ITestServiceInterface::pingTests(testServiceInterface, false);
|
||||
const int errors = ITestServiceInterface::pingTests(testServiceInterface, false);
|
||||
qtout << "Ping errors " << errors << endl;
|
||||
CApplication::processEventsFor(2000);
|
||||
CApplication::processEventsFor(1000);
|
||||
|
||||
// Performance tools
|
||||
qtout << "----------------- performance ----------------" << endl;
|
||||
@@ -240,24 +213,24 @@ namespace BlackSample
|
||||
timer.start();
|
||||
for (int i = 0; i < 10; i++)
|
||||
{
|
||||
CSpeed speedDummy(i, CSpeedUnit::km_h());
|
||||
speedDummy = testServiceInterface.getSpeed();
|
||||
CSpeed speedDummy = testServiceInterface.getSpeed();
|
||||
Q_UNUSED(speedDummy);
|
||||
}
|
||||
qint64 t10 = timer.elapsed(); // ms
|
||||
|
||||
timer.restart();
|
||||
for (int i = 0; i < 100; i++)
|
||||
{
|
||||
CSpeed speedDummy(i, CSpeedUnit::km_h());
|
||||
speedDummy = testServiceInterface.getSpeed();
|
||||
CSpeed speedDummy = testServiceInterface.getSpeed();
|
||||
Q_UNUSED(speedDummy);
|
||||
}
|
||||
qint64 t100 = timer.elapsed(); // ms
|
||||
|
||||
timer.restart();
|
||||
for (int i = 0; i < 1000; i++)
|
||||
{
|
||||
CSpeed speedDummy(i, CSpeedUnit::km_h());
|
||||
speedDummy = testServiceInterface.getSpeed();
|
||||
CSpeed speedDummy = testServiceInterface.getSpeed();
|
||||
Q_UNUSED(speedDummy);
|
||||
}
|
||||
qint64 t1000 = timer.elapsed(); // ms
|
||||
timer.invalidate();
|
||||
@@ -266,22 +239,22 @@ namespace BlackSample
|
||||
timer.start();
|
||||
for (int i = 0; i < 10; i++)
|
||||
{
|
||||
CAtcStation stationDummy(QString::number(i));
|
||||
stationDummy = testServiceInterface.getAtcStation();
|
||||
CAtcStation stationDummy = testServiceInterface.getAtcStation();
|
||||
Q_UNUSED(stationDummy);
|
||||
}
|
||||
t10 = timer.elapsed(); // ms
|
||||
timer.restart();
|
||||
for (int i = 0; i < 100; i++)
|
||||
{
|
||||
CAtcStation stationDummy(QString::number(i));
|
||||
stationDummy = testServiceInterface.getAtcStation();
|
||||
CAtcStation stationDummy = testServiceInterface.getAtcStation();
|
||||
Q_UNUSED(stationDummy);
|
||||
}
|
||||
t100 = timer.elapsed(); // ms
|
||||
timer.restart();
|
||||
for (int i = 0; i < 1000; i++)
|
||||
{
|
||||
CAtcStation stationDummy(QString::number(i));
|
||||
stationDummy = testServiceInterface.getAtcStation();
|
||||
CAtcStation stationDummy = testServiceInterface.getAtcStation();
|
||||
Q_UNUSED(stationDummy);
|
||||
}
|
||||
t1000 = timer.elapsed(); // ms
|
||||
qtout << "Reading station objects 10/100/1000 in ms: " << t10 << " " << t100 << " " << t1000 << endl;
|
||||
@@ -326,7 +299,7 @@ namespace BlackSample
|
||||
// next round?
|
||||
qtout << "---------------------------------------" << endl;
|
||||
qtout << "Key ....... x to exit" << endl;
|
||||
line = qtin.readLine().toLower().trimmed();
|
||||
QString line = qtin.readLine().toLower().trimmed();
|
||||
if (line.startsWith('x'))
|
||||
{
|
||||
qtout << "Ending!" << endl;
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
#include "blackmisc/pq/frequency.h"
|
||||
#include "blackmisc/pq/length.h"
|
||||
#include "blackmisc/pq/units.h"
|
||||
#include "blackmisc/test/testdata.h"
|
||||
#include "blackmisc/range.h"
|
||||
#include "blackmisc/stringutils.h"
|
||||
|
||||
@@ -38,6 +39,7 @@ using namespace BlackMisc::Aviation;
|
||||
using namespace BlackMisc::PhysicalQuantities;
|
||||
using namespace BlackMisc::Geo;
|
||||
using namespace BlackMisc::Network;
|
||||
using namespace BlackMisc::Test;
|
||||
|
||||
namespace BlackSample
|
||||
{
|
||||
@@ -69,19 +71,11 @@ namespace BlackSample
|
||||
CCallsign callsign2("DAmbz");
|
||||
out << callsign1 << " " << callsign2 << " " << (callsign1 == callsign2) << endl;
|
||||
|
||||
QDateTime dtFrom = QDateTime::currentDateTimeUtc();
|
||||
QDateTime dtUntil = dtFrom.addSecs(60 * 60); // 1 hour
|
||||
QDateTime dtFrom2 = dtUntil;
|
||||
QDateTime dtUntil2 = dtUntil.addSecs(60 * 60);
|
||||
CCoordinateGeodetic geoPos =
|
||||
CCoordinateGeodetic::fromWgs84("48° 21′ 13″ N", "11° 47′ 09″ E", { 1487, CLengthUnit::ft() });
|
||||
CAtcStation station1(CCallsign("eddm_twr"), CUser("123456", "Joe Doe"),
|
||||
CFrequency(118.7, CFrequencyUnit::MHz()),
|
||||
geoPos, CLength(50, CLengthUnit::km()), false, dtFrom, dtUntil);
|
||||
CAtcStation station1 = CTestData::getFrankfurtTower();
|
||||
CAtcStation station2(station1);
|
||||
CAtcStation station3(CCallsign("eddm_twr"), CUser("654321", "Jen Doe"),
|
||||
CFrequency(118.7, CFrequencyUnit::MHz()),
|
||||
geoPos, CLength(100, CLengthUnit::km()), false, dtFrom2, dtUntil2);
|
||||
CAtcStation station3(station1);
|
||||
station3.setController(CTestData::getRandomController());
|
||||
|
||||
out << station1 << " " << station2 << " " << (station1.getCallsign() == station2.getCallsign()) << endl;
|
||||
|
||||
// User parsing
|
||||
@@ -89,13 +83,8 @@ namespace BlackSample
|
||||
out << user.getRealName() << user.getHomeBase() << endl;
|
||||
|
||||
// ATC List
|
||||
CAtcStationList atcList;
|
||||
atcList.push_back(station1);
|
||||
atcList.push_back(station2);
|
||||
atcList.push_back(station3);
|
||||
atcList.push_back(station1);
|
||||
atcList.push_back(station2);
|
||||
atcList.push_back(station3);
|
||||
CAtcStationList atcList = CTestData::getAtcStations();
|
||||
atcList.push_back(CTestData::getAtcStations());
|
||||
atcList = atcList.findBy(&CAtcStation::getCallsign, "eddm_twr", &CAtcStation::getFrequency, CFrequency(118.7, CFrequencyUnit::MHz()));
|
||||
atcList = atcList.sortedBy(&CAtcStation::getBookedFromUtc, &CAtcStation::getCallsign, &CAtcStation::getControllerRealName);
|
||||
out << atcList << endl;
|
||||
|
||||
@@ -167,25 +167,12 @@ namespace BlackMisc
|
||||
if (m_verbose) out() << "Pid: " << CTestService::getPid() << " Received length: " << length << endl;
|
||||
}
|
||||
|
||||
void CTestService::receiveLengthsQvl(const QVariantList &lengthsVariantList) const
|
||||
void CTestService::receiveVariantList(const CVariantList &variantList) const
|
||||
{
|
||||
if (m_verbose) out() << "Pid: " << CTestService::getPid() << " " << lengthsVariantList.size() << endl;
|
||||
foreach (QVariant lv, lengthsVariantList)
|
||||
if (m_verbose) out() << "Pid: " << CTestService::getPid() << " " << variantList.size() << endl;
|
||||
for (CVariant lv : variantList)
|
||||
{
|
||||
BlackMisc::PhysicalQuantities::CLength l;
|
||||
lv.value<QDBusArgument>() >> l;
|
||||
if (m_verbose) out() << " Received length in list: " << l << endl;
|
||||
}
|
||||
}
|
||||
|
||||
void CTestService::receiveLengthsQl(const QList<QVariant> &lengthsList) const
|
||||
{
|
||||
if (m_verbose) out() << "Pid: " << CTestService::getPid() << " Received " << lengthsList.size() << endl;
|
||||
foreach (QVariant lv, lengthsList)
|
||||
{
|
||||
BlackMisc::PhysicalQuantities::CLength l;
|
||||
lv.value<QDBusArgument>() >> l;
|
||||
if (m_verbose) out() << " Received length in list: " << l << endl;
|
||||
if (m_verbose) out() << " Received variant: " << lv.toQString() << endl;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -31,6 +31,7 @@
|
||||
#include "blackmisc/pq/speed.h"
|
||||
#include "blackmisc/propertyindex.h"
|
||||
#include "blackmisc/propertyindexvariantmap.h"
|
||||
#include "blackmisc/variantlist.h"
|
||||
#include "blackmisc/simulation/fscommon/aircraftcfgentrieslist.h"
|
||||
#include "blackmisc/simulation/simulatedaircraft.h"
|
||||
#include "blackmisc/simulation/simulatedaircraftlist.h"
|
||||
@@ -136,11 +137,8 @@ namespace BlackMisc
|
||||
//! Receive a length
|
||||
void receiveLength(const BlackMisc::PhysicalQuantities::CLength &length) const;
|
||||
|
||||
//! Receive lengths
|
||||
void receiveLengthsQl(const QList<QVariant> &lengthsList) const;
|
||||
|
||||
//! Receive lengths
|
||||
void receiveLengthsQvl(const QVariantList &lengthsVariantList) const;
|
||||
//! Receive variant list
|
||||
void receiveVariantList(const BlackMisc::CVariantList &variantList) const;
|
||||
|
||||
//! Receive ATC station
|
||||
void receiveAtcStation(const BlackMisc::Aviation::CAtcStation &station) const;
|
||||
|
||||
@@ -45,10 +45,7 @@ namespace BlackMisc
|
||||
ok = pingCompare(pi, piPing, out, verbose, errors);
|
||||
if (verbose) { out << "Pinged property index via interface" << errorInfo(ok) << endl; }
|
||||
|
||||
CPropertyIndexVariantMap ivm;
|
||||
ivm.addValue(1000, "one");
|
||||
ivm.addValue(2000, "two");
|
||||
ivm.addValue(3000, "three");
|
||||
const CPropertyIndexVariantMap ivm = CTestData::getCPropertyIndexVariantMap();
|
||||
const CPropertyIndexVariantMap ivmPing = testServiceInterface.pingIndexVariantMap(ivm);
|
||||
ok = pingCompare(ivm, ivmPing, out, verbose, errors);
|
||||
if (verbose) { out << "Pinged variant map via interface" << errorInfo(ok) << endl; }
|
||||
@@ -69,24 +66,22 @@ namespace BlackMisc
|
||||
ok = pingCompare(speedNull, speedNullPing, out, verbose, errors);
|
||||
if (verbose) { out << "Pinged null speed via interface" << errorInfo(ok) << endl; }
|
||||
|
||||
const CAtcStation station = CTestData::getAtcStation();
|
||||
const CAtcStation station = CTestData::getRandomAtcStation();
|
||||
const CAtcStation stationPing = testServiceInterface.pingAtcStation(station);
|
||||
ok = pingCompare(station, stationPing, out, verbose, errors);
|
||||
if (verbose) { out << "Pinged ATC station via interface" << errorInfo(ok) << endl; }
|
||||
|
||||
const CAircraftIcaoCode icaoData("B737", "L2J");
|
||||
const CAircraftIcaoCode icaoData = CTestData::getDBAircraftIcaoB737();
|
||||
const CAircraftIcaoCode icaoDataPing = testServiceInterface.pingAircraftIcaoData(icaoData);
|
||||
ok = pingCompare(icaoData, icaoDataPing, out, verbose, errors);
|
||||
if (verbose) { out << "Pinged ICAO data via interface" << errorInfo(ok) << endl; }
|
||||
|
||||
const CUser user("223344", "Ping Me User");
|
||||
const CUser user = CTestData::getRandomPilot();
|
||||
const CUser userPing = testServiceInterface.pingUser(user);
|
||||
ok = pingCompare(user, userPing, out, verbose, errors);
|
||||
if (verbose) { out << "Pinged user via interface" << errorInfo(ok) << endl; }
|
||||
|
||||
// EDDF: 50° 2′ 0″ N, 8° 34′ 14″ E, 2000m MSL
|
||||
const CCoordinateGeodetic coordinate = CCoordinateGeodetic::fromWgs84("50° 2′ 1″ 23 N", "8° 34′ 14″ E", { 2000, CLengthUnit::m() });
|
||||
const CAircraftSituation situation = CAircraftSituation("DAMBZ", coordinate);
|
||||
const CAircraftSituation situation = CTestData::getAircraftSituationAboveMunichTower();
|
||||
const CAircraftSituation situationPing = testServiceInterface.pingSituation(situation);
|
||||
ok = pingCompare(situation, situationPing, out, verbose, errors);
|
||||
if (verbose) { out << "Pinged situation via interface" << errorInfo(ok) << endl; }
|
||||
@@ -112,33 +107,23 @@ namespace BlackMisc
|
||||
ok = pingCompare(parts, partsPing, out, verbose, errors);
|
||||
if (verbose) { out << "Pinged engine via interface" << errorInfo(ok) << endl; }
|
||||
|
||||
const CAircraftModel model("foobar", CAircraftModel::TypeManuallySet);
|
||||
const CAircraftModel model = CTestData::getDbAircraftModelFsxAerosoftA320();
|
||||
const CAircraftModel modelPing = testServiceInterface.pingAircraftModel(model);
|
||||
ok = pingCompare(model, modelPing, out, verbose, errors);
|
||||
if (verbose) { out << "Pinged model via interface" << errorInfo(ok) << endl; }
|
||||
|
||||
const CAircraftModel model2("mymodel", CAircraftModel::TypeFSInnData);
|
||||
const CAircraftModelList models({ model, model2});
|
||||
const CAircraftModelList models({ model, CTestData::getDbAircraftModelFsxA2AC172Skyhawk() });
|
||||
const CAircraftModelList modelsPing = testServiceInterface.pingAircraftModelList(models);
|
||||
ok = pingCompare(models, modelsPing, out, verbose, errors);
|
||||
if (verbose) { out << "Pinged model list via interface" << errorInfo(ok) << endl; }
|
||||
|
||||
const CCallsign callsign("DEMBZ");
|
||||
CSimulatedAircraft aircraft(callsign, CUser("123456", "Joe Pilot"), situation);
|
||||
aircraft.setTransponder(transponder);
|
||||
aircraft.setModel(model);
|
||||
aircraft.setNetworkModel(model2);
|
||||
const CSimulatedAircraft aircraft = CTestData::getA320Aircraft();
|
||||
const CSimulatedAircraft aircraftPing = testServiceInterface.pingSimulatedAircraft(aircraft);
|
||||
ok = pingCompare(aircraft, aircraftPing, out, verbose, errors);
|
||||
pingCompare(aircraft.getModel(), aircraftPing.getModel(), out, verbose, errors);
|
||||
pingCompare(aircraft.getNetworkModel(), aircraftPing.getNetworkModel(), out, verbose, errors);
|
||||
if (verbose) { out << "Pinged simulated aircraft via interface" << errorInfo(ok) << endl; }
|
||||
|
||||
CAtcStationList atcStationList;
|
||||
atcStationList.push_back(station);
|
||||
atcStationList.push_back(station);
|
||||
atcStationList.push_back(station);
|
||||
CAtcStationList atcStationListPing = testServiceInterface.pingAtcStationList(atcStationList);
|
||||
const CAtcStationList atcStationList = CTestData::getAtcStations();
|
||||
const CAtcStationList atcStationListPing = testServiceInterface.pingAtcStationList(atcStationList);
|
||||
ok = pingCompare(atcStationList, atcStationListPing, out, verbose, errors);
|
||||
if (verbose) { out << "Pinged ATC station list via interface" << errorInfo(ok) << endl; }
|
||||
|
||||
@@ -163,8 +148,8 @@ namespace BlackMisc
|
||||
if (verbose) { out << "Pinged CVariant(clients) list via interface" << errorInfo(ok) << endl; }
|
||||
|
||||
const CVariant cv2 = CVariant::fromValue(aircraft);
|
||||
const CVariant cvPing2 = testServiceInterface.pingCVariant(cv2);
|
||||
ok = pingCompare(cv2.value<CSimulatedAircraft>(), cvPing2.value<CSimulatedAircraft>(), out, verbose, errors);
|
||||
const CVariant cv2Ping = testServiceInterface.pingCVariant(cv2);
|
||||
ok = pingCompare(cv2.value<CSimulatedAircraft>(), cv2Ping.value<CSimulatedAircraft>(), out, verbose, errors);
|
||||
if (verbose) { out << "Pinged CVariant(aircraft) list via interface" << errorInfo(ok) << endl; }
|
||||
|
||||
// end
|
||||
|
||||
@@ -314,18 +314,11 @@ namespace BlackMisc
|
||||
return asyncCallWithArgumentList(QLatin1Literal("receiveLength"), argumentList);
|
||||
}
|
||||
|
||||
QDBusPendingReply<> receiveLengthsQl(const BlackMisc::CVariantList &lengthsList)
|
||||
QDBusPendingReply<> receiveVariantList(const BlackMisc::CVariantList &list)
|
||||
{
|
||||
QList<QVariant> argumentList;
|
||||
argumentList << QVariant::fromValue(lengthsList);
|
||||
return asyncCallWithArgumentList(QLatin1Literal("receiveLengthsQl"), argumentList);
|
||||
}
|
||||
|
||||
QDBusPendingReply<> receiveLengthsQvl(const BlackMisc::CVariantList &lengthsVariantList)
|
||||
{
|
||||
QList<QVariant> argumentList;
|
||||
argumentList << QVariant::fromValue(lengthsVariantList);
|
||||
return asyncCallWithArgumentList(QLatin1Literal("receiveLengthsQvl"), argumentList);
|
||||
argumentList << QVariant::fromValue(list);
|
||||
return asyncCallWithArgumentList(QLatin1Literal("receiveVariantList"), argumentList);
|
||||
}
|
||||
|
||||
QDBusPendingReply<> receiveList(const QList<double> &list)
|
||||
|
||||
Reference in New Issue
Block a user