mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-22 14:55: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
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user