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