17 using namespace swift::misc::aviation;
18 using namespace swift::misc::geo;
19 using namespace swift::misc::math;
20 using namespace swift::misc::network;
21 using namespace swift::misc::physical_quantities;
22 using namespace swift::misc::simulation;
27 int randomIndex(
int size) {
return CMathUtils::randomInteger(0, size - 1); }
29 const CServer &CTestData::getTrafficServer()
31 static const CServer trafficServer(
"fooserver",
"a foo server",
"localhost", 1234,
32 CUser(
"112233",
"Some real name",
"email@xyz.com",
"secret"),
CFsdSetup(),
33 CEcosystem(CEcosystem::VATSIM), CServer::FSDServerVatsim);
37 const CVariantList &CTestData::getCVariantList()
45 CPropertyIndexVariantMap getCPropertyIndexVariantMapImpl()
47 CPropertyIndexVariantMap valueMap;
48 valueMap.addValue(1000, 111.222);
49 valueMap.addValue(2000, CTestData::getRandomControllerCallsign());
50 valueMap.addValue(3000, CTestData::getCoordinateFrankfurtTower());
51 valueMap.addValue(4000, QDateTime::currentDateTime().addDays(1));
52 valueMap.addValue(5000, QString(
"foobar"));
56 const CPropertyIndexVariantMap &CTestData::getCPropertyIndexVariantMap()
58 static const CPropertyIndexVariantMap valueMap(getCPropertyIndexVariantMapImpl());
65 CCoordinateGeodetic::fromWgs84(
"48° 21′ 13″ N",
"11° 47′ 09″ E", { 1487, CLengthUnit::ft() });
72 CCoordinateGeodetic::fromWgs84(
"50° 1' 18.38″ N",
"8° 33' 23.24″ E", { 355, CLengthUnit::ft() });
80 CCallsign(
"DAMBZ", CCallsign::Aircraft), info,
"EDDF",
"EDDM",
"EDDN", QDateTime::currentDateTimeUtc(),
81 QDateTime::currentDateTime().addSecs(600),
CTime(1.0, CTimeUnit::h()),
CTime(2.0, CTimeUnit::h()),
90 CFrequency(119.9, CFrequencyUnit::MHz()), CTestData::getCoordinateFrankfurtTower(),
91 CLength(50, CLengthUnit::km()),
false);
98 CFrequency(118.7, CFrequencyUnit::MHz()), CTestData::getCoordinateMunichTower(),
99 CLength(50, CLengthUnit::km()),
true, QDateTime::currentDateTimeUtc().addSecs(2400));
106 CFrequency(120.7, CFrequencyUnit::MHz()), CTestData::getCoordinateMunichTower(),
107 CLength(100, CLengthUnit::km()),
false);
114 { CTestData::getFrankfurtTower(), CTestData::getMunichTower(), CTestData::getMunichApproach() });
118 const CAtcStation &CTestData::getRandomAtcStation()
120 static const int s = CTestData::getAtcStations().size();
121 return getAtcStations()[randomIndex(s)];
131 const CCallsign &CTestData::getRandomPilotCallsign()
133 static const QList<CCallsign> callsigns(CTestData::getPilotCallsigns().toQList());
134 return callsigns[randomIndex(callsigns.size())];
144 const CCallsign &CTestData::getRandomControllerCallsign()
146 static const QList<CCallsign> callsigns(CTestData::getControllerCallsigns().toQList());
147 return callsigns[randomIndex(callsigns.size())];
152 static const QList<CCallsign> callsigns(CTestData::getPilotCallsigns().toQList());
154 CUser(
"100100",
"Joe Doe", callsigns[0]),
155 CUser(
"100101",
"Jane Foo", callsigns[1]),
156 CUser(
"100200",
"Frank Sky", callsigns[2]),
157 CUser(
"100300",
"Richard F. Frings", callsigns[3]),
158 CUser(
"100301",
"Torben Frey", callsigns[4]),
159 CUser(
"100400",
"Kay Dòresn", callsigns[5]),
164 const CUser &CTestData::getRandomPilot()
166 static const int s = CTestData::getPilots().size();
167 return CTestData::getPilots()[randomIndex(s)];
170 const CUserList &CTestData::getControllers()
172 static const QList<CCallsign> callsigns(CTestData::getControllerCallsigns().toQList());
174 CUser(
"300100",
"Jeff Doe", callsigns[0]),
175 CUser(
"300101",
"Foo Mister", callsigns[1]),
176 CUser(
"300200",
"Sky Du", callsigns[2]),
177 CUser(
"300300",
"F. Frings", callsigns[3]),
178 CUser(
"300301",
"Ralf Smith", callsigns[4]),
179 CUser(
"300400",
"Doreen Jump", callsigns[5]),
184 const CUser &CTestData::getRandomController()
186 static const int s = CTestData::getControllers().size();
187 return CTestData::getControllers()[randomIndex(s)];
194 CAngle(5, CAngleUnit::deg()),
CSpeed(111, CSpeedUnit::km_h()));
195 situation.setAltitude({ 2500, CLengthUnit::ft() });
196 situation.setCallsign(CTestData::getRandomPilotCallsign());
202 static const CAircraftSituation situation(getAircraftSituationAboveMunichTowerImpl());
210 CAngle(10, CAngleUnit::deg()),
CSpeed(200, CSpeedUnit::km_h()));
211 situation.setAltitude({ 4000, CLengthUnit::ft() });
212 situation.setCallsign(CTestData::getRandomPilotCallsign());
218 static const CAircraftSituation situation(getAircraftSituationAboveFrankfurtTowerImpl());
224 static const QString json =
227 Q_ASSERT(icao.hasValidDbKey());
233 static const QString json =
236 Q_ASSERT(icao.hasValidDbKey());
242 static const QString json =
245 Q_ASSERT(icao.hasValidDbKey());
251 static const QString json =
254 Q_ASSERT(icao.hasValidDbKey());
258 const CLivery &CTestData::getDbLiveryDLHStarAlliance()
260 static const QString json =
263 Q_ASSERT(livery.hasValidDbKey());
267 const CAircraftModel &CTestData::getDbAircraftModelFsxA2AC172Skyhawk()
269 static const QString json =
272 Q_ASSERT(model.hasValidDbKey());
273 Q_ASSERT(!model.getModelString().isEmpty());
277 const CAircraftModel &CTestData::getDbAircraftModelFsxAerosoftA320()
279 static const QString json =
282 Q_ASSERT(model.hasValidDbKey());
283 Q_ASSERT(!model.getModelString().isEmpty());
289 CUser pilot = CTestData::getRandomPilot();
291 CTestData::getAircraftSituationAboveMunichTower());
293 aircraft.setTransponder(t);
294 aircraft.setCom1ActiveFrequency(CTestData::getRandomAtcStation().getFrequency());
295 aircraft.setCom2ActiveFrequency(CTestData::getRandomAtcStation().getFrequency());
307 CUser pilot = CTestData::getRandomPilot();
309 CTestData::getAircraftSituationAboveFrankfurtTower());
311 aircraft.setTransponder(t);
312 aircraft.setCom1ActiveFrequency(CTestData::getRandomAtcStation().getFrequency());
313 aircraft.setCom2ActiveFrequency(CTestData::getRandomAtcStation().getFrequency());
static QString readFileToString(const QString &fileNameAndPath)
Read file into string.
static const QString & testFilesDirectory()
Where test files are located.
static CVariant from(T &&value)
Synonym for fromValue().
Value object for ICAO classification.
Value object encapsulating information of an aircraft's situation.
Value object for ICAO classification.
Altitude as used in aviation, can be AGL or MSL altitude.
Value object encapsulating information about an ATC station.
Value object for a list of ATC stations.
Value object encapsulating information of a callsign.
Value object for a set of callsigns.
Flightplan-related information about an aircraft (aircraft ICAO, equipment and WTC)
Value object for a flight plan.
@ IFR
Instrument flight rules.
Heading as used in aviation, can be true or magnetic heading.
Value object encapsulating information about an airpot.
Ecosystem of server belonging together.
Value object for a FSD setup.
Value object encapsulating information of a server.
Value object encapsulating information of a user.
const aviation::CCallsign & getCallsign() const
Get associated callsign.
Value object encapsulating a list of voice rooms.
Physical unit angle (radians, degrees)
Physical unit length (length)
Aircraft model (used by another pilot, my models on disk)
Comprehensive information of an aircraft.
QJsonObject jsonObjectFromString(const QString &json, bool acceptCacheFormat)
JSON Object from string.
Generate data for testing purposes.