1
0
Fork 0

Test infrastrucutre tweaks

This commit is contained in:
James Turner 2021-07-21 10:59:08 +01:00
parent 12f18b325b
commit 870dbc04f5
5 changed files with 17 additions and 24 deletions

View file

@ -70,6 +70,7 @@ void initTestGlobals(const std::string& testName)
fgSetDefaults();
auto t = globals->add_new_subsystem<TimeManager>(SGSubsystemMgr::INIT);
t->bind();
t->init(); // establish mag-var data
/**

View file

@ -293,15 +293,15 @@ void AIFlightPlanTests::testAIFlightPlanLoadXML()
<flightplan>
<wp>
<name>onGroundWP</name>
<lat></lat>
<lon></lon>
<lat>57</lat>
<lon>3</lon>
<ktas>10</ktas>
<on-ground>1</on-ground>
</wp>
<wp>
<name>someWP</name>
<lat></lat>
<lon></lon>
<lat>57</lat>
<lon>4</lon>
<ktas>200</ktas>
<alt>8000</alt>
</wp>

View file

@ -94,7 +94,7 @@ void GroundnetTests::testShortestRoute()
FGTaxiNodeRef end = network->findNearestNodeOnRunway(runway->threshold());
FGTaxiRoute route = network->findShortestRoute(startParking, end);
CPPUNIT_ASSERT_EQUAL(true, network->exists());
CPPUNIT_ASSERT_EQUAL(25, route.size());
CPPUNIT_ASSERT_EQUAL(29, route.size());
}
/**

View file

@ -51,15 +51,16 @@
/////////////////////////////////////////////////////////////////////////////
// Set up function for each test.
void AirportTests::setUp() {
FGTestApi::setUp::initTestGlobals("timeManager");
FGTestApi::setUp::initTestGlobals("Traffic");
void AirportTests::setUp()
{
FGTestApi::setUp::initTestGlobals("Airports");
FGTestApi::setUp::initNavDataCache();
}
// Clean up after each test.
void AirportTests::tearDown()
{
FGTestApi::tearDown::shutdownTestGlobals();
}
/**

View file

@ -54,7 +54,7 @@ void TimeManagerTests::tearDown()
void TimeManagerTests::testBasic()
{
auto timeManager = new TimeManager;
auto timeManager = globals->get_subsystem<TimeManager>();
// set standard values
fgSetBool("/sim/freeze", false);
@ -82,15 +82,13 @@ void TimeManagerTests::testBasic()
void TimeManagerTests::testFreezeUnfreeze()
{
auto timeManager = new TimeManager;
auto timeManager = globals->get_subsystem<TimeManager>();
// set standard values
fgSetBool("/sim/freeze/clock", false);
fgSetBool("/sim/sceneryloaded", true);
fgSetDouble("/sim/model-hz", 120.0);
timeManager->bind();
timeManager->init();
timeManager->postinit();
double simDt, realDt;
@ -122,19 +120,17 @@ void TimeManagerTests::testFreezeUnfreeze()
void TimeManagerTests::testTimeZones()
{
auto timeManager = globals->get_subsystem<TimeManager>();
auto vabb = fgFindAirportID("VABB");
FGTestApi::setPositionAndStabilise(vabb->geod());
auto timeManager = new TimeManager;
// set standard values
fgSetBool("/sim/freeze", false);
fgSetBool("/sim/sceneryloaded", true);
fgSetDouble("/sim/model-hz", 120.0);
timeManager->bind();
timeManager->init();
timeManager->postinit();
// fake Unix time by setting this; it will then
@ -172,12 +168,11 @@ void TimeManagerTests::testTimeZones()
void TimeManagerTests::testETCTimeZones()
{
auto timeManager = globals->get_subsystem<TimeManager>();
auto phto = fgFindAirportID("PHTO");
FGTestApi::setPositionAndStabilise(phto->geod());
auto timeManager = new TimeManager;
timeManager->bind();
timeManager->init();
timeManager->postinit();
// fake Unix time by setting this; it will then
@ -185,8 +180,6 @@ void TimeManagerTests::testETCTimeZones()
const auto testDate = 314611200L;
fgSetInt("/sim/time/cur-time-override", testDate);
globals->add_subsystem("time", timeManager, SGSubsystemMgr::INIT);
FGTestApi::setPositionAndStabilise(phto->geod());
timeManager->reposition();
timeManager->update(0.0);
@ -219,15 +212,13 @@ void TimeManagerTests::testSpecifyTimeOffset()
// to define sun position
return;
auto timeManager = new TimeManager;
auto timeManager = globals->get_subsystem<TimeManager>();
// set standard values
fgSetBool("/sim/freeze", false);
fgSetBool("/sim/sceneryloaded", true);
fgSetDouble("/sim/model-hz", 120.0);
timeManager->bind();
timeManager->init();
timeManager->postinit();
const auto testDate = 314611200L;