mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-31 12:55:33 +08:00
(will be consolidated with existing utility classes)
This commit is contained in:
committed by
Mathew Sutcliffe
parent
ae5b0310b6
commit
ed820da20d
75
src/blackmisc/test/testdata.cpp
Normal file
75
src/blackmisc/test/testdata.cpp
Normal file
@@ -0,0 +1,75 @@
|
||||
/* Copyright (C) 2017
|
||||
* swift project Community / Contributors
|
||||
*
|
||||
* This file is part of swift project. It is subject to the license terms in the LICENSE file found in the top-level
|
||||
* directory of this distribution and at http://www.swift-project.org/license.html. No part of swift project,
|
||||
* including this file, may be copied, modified, propagated, or distributed except according to the terms
|
||||
* contained in the LICENSE file.
|
||||
*/
|
||||
|
||||
#include "testdata.h"
|
||||
#include "blackmisc/aviation/atcstationlist.h"
|
||||
|
||||
using namespace BlackMisc::Aviation;
|
||||
using namespace BlackMisc::Geo;
|
||||
using namespace BlackMisc::Network;
|
||||
using namespace BlackMisc::PhysicalQuantities;
|
||||
|
||||
namespace BlackMisc
|
||||
{
|
||||
namespace Test
|
||||
{
|
||||
const CCoordinateGeodetic &CTestData::coordinateMunichTower()
|
||||
{
|
||||
static const CCoordinateGeodetic c = CCoordinateGeodetic::fromWgs84("48° 21′ 13″ N", "11° 47′ 09″ E", { 1487, CLengthUnit::ft() });
|
||||
return c;
|
||||
}
|
||||
|
||||
const CCoordinateGeodetic &CTestData::coordinateFrankfurtTower()
|
||||
{
|
||||
static const CCoordinateGeodetic c = CCoordinateGeodetic::fromWgs84("50° 1' 18.38″ N", "8° 33' 23.24″ E", { 355, CLengthUnit::ft() });
|
||||
return c;
|
||||
}
|
||||
|
||||
const CAtcStationList &CTestData::getTowerStations()
|
||||
{
|
||||
static const CAtcStationList stations(
|
||||
{
|
||||
CAtcStation(CCallsign("EDDF_TWR"), CUser("654321", "Joe Bar"),
|
||||
CFrequency(118.7, CFrequencyUnit::MHz()), CTestData::coordinateMunichTower(), CLength(50, CLengthUnit::km())),
|
||||
CAtcStation(CCallsign("EDDM_TWR"), CUser("654321", "John Doe"),
|
||||
CFrequency(119.9, CFrequencyUnit::MHz()), CTestData::coordinateFrankfurtTower(), CLength(50, CLengthUnit::km()))
|
||||
});
|
||||
return stations;
|
||||
}
|
||||
|
||||
const CAtcStation &CTestData::getAtcStation()
|
||||
{
|
||||
return getTowerStations()[0];
|
||||
}
|
||||
|
||||
const CCallsign &CTestData::getRandomAtcCallsign()
|
||||
{
|
||||
static const QList<CCallsign> callsigns(
|
||||
{
|
||||
CCallsign("EDDM_TWR"), CCallsign("EDDM_APP"), CCallsign("EDDM_GND"),
|
||||
CCallsign("EDDF_TWR"), CCallsign("EDDF_APP"),
|
||||
CCallsign("EDDF_GND")
|
||||
});
|
||||
int i = (rand() % (callsigns.size()));
|
||||
return callsigns[i];
|
||||
}
|
||||
|
||||
const CCallsign &CTestData::getRandomAircraftCallsign()
|
||||
{
|
||||
static const QList<CCallsign> callsigns(
|
||||
{
|
||||
CCallsign("DEMBZ"), CCallsign("DLH123"), CCallsign("RYR635L"),
|
||||
CCallsign("LGL974"), CCallsign("AUI129"),
|
||||
CCallsign("CLX756")
|
||||
});
|
||||
int i = (rand() % (callsigns.size()));
|
||||
return callsigns[i];
|
||||
}
|
||||
} // ns
|
||||
} // ns
|
||||
59
src/blackmisc/test/testdata.h
Normal file
59
src/blackmisc/test/testdata.h
Normal file
@@ -0,0 +1,59 @@
|
||||
/* Copyright (C) 2017
|
||||
* Swift Project Community / Contributors
|
||||
*
|
||||
* This file is part of Swift Project. It is subject to the license terms in the LICENSE file found in the top-level
|
||||
* directory of this distribution and at http://www.swift-project.org/license.html. No part of swift project,
|
||||
* including this file, may be copied, modified, propagated, or distributed except according to the terms
|
||||
* contained in the LICENSE file.
|
||||
*/
|
||||
|
||||
//! \file
|
||||
|
||||
#ifndef BLACKMISC_TEST_TESTDATA_H
|
||||
#define BLACKMISC_TEST_TESTDATA_H
|
||||
|
||||
#include "blackmisc/blackmiscexport.h"
|
||||
|
||||
namespace BlackMisc
|
||||
{
|
||||
namespace Aviation
|
||||
{
|
||||
class CAtcStation;
|
||||
class CAtcStationList;
|
||||
class CCallsign;
|
||||
}
|
||||
namespace Geo
|
||||
{
|
||||
class CCoordinateGeodetic;
|
||||
}
|
||||
|
||||
namespace Test
|
||||
{
|
||||
/*!
|
||||
* Testdata for unit tests/data
|
||||
*/
|
||||
class BLACKMISC_EXPORT CTestData
|
||||
{
|
||||
public:
|
||||
//! Munich tower coordinate
|
||||
static const BlackMisc::Geo::CCoordinateGeodetic &coordinateMunichTower();
|
||||
|
||||
//! Frankfurt tower coordinate
|
||||
static const BlackMisc::Geo::CCoordinateGeodetic &coordinateFrankfurtTower();
|
||||
|
||||
//! Tower stations
|
||||
static const BlackMisc::Aviation::CAtcStationList &getTowerStations();
|
||||
|
||||
//! Get ATC station
|
||||
static const BlackMisc::Aviation::CAtcStation &getAtcStation();
|
||||
|
||||
//! Get a random callsign (ATC)
|
||||
static const BlackMisc::Aviation::CCallsign &getRandomAtcCallsign();
|
||||
|
||||
//! Get a random callsign (aircraft)
|
||||
static const BlackMisc::Aviation::CCallsign &getRandomAircraftCallsign();
|
||||
};
|
||||
} // ns
|
||||
} // ns
|
||||
|
||||
#endif // guard
|
||||
Reference in New Issue
Block a user