Add test for STAR transitions (failing)
This commit is contained in:
parent
5747b51df3
commit
bdf969e802
2 changed files with 57 additions and 3 deletions
test_suite/unit_tests/Instrumentation
|
@ -93,6 +93,30 @@ public:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void arrivalChanged() override
|
||||||
|
{
|
||||||
|
// mimic the default delegate, inserting the STAR waypoints
|
||||||
|
|
||||||
|
// clear anything existing
|
||||||
|
thePlan->clearWayptsWithFlag(WPT_ARRIVAL);
|
||||||
|
|
||||||
|
// insert waypt for the destination runway
|
||||||
|
auto dr = new RunwayWaypt(thePlan->destinationRunway(), thePlan);
|
||||||
|
dr->setFlag(WPT_ARRIVAL);
|
||||||
|
thePlan->insertWayptAtIndex(dr, 0);
|
||||||
|
|
||||||
|
if (thePlan->star()) {
|
||||||
|
WayptVec starRoute;
|
||||||
|
bool ok = thePlan->star()->route(thePlan->destinationRunway(), nullptr, starRoute);
|
||||||
|
if (!ok)
|
||||||
|
throw sg_exception("failed to route via STAR");
|
||||||
|
int insertIndex = 1;
|
||||||
|
for (auto w : starRoute) {
|
||||||
|
thePlan->insertWayptAtIndex(w, insertIndex++);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
} // of anonymous namespace
|
} // of anonymous namespace
|
||||||
|
@ -520,14 +544,17 @@ void RNAVProcedureTests::testLFKC_AJO1R()
|
||||||
CPPUNIT_ASSERT(ok);
|
CPPUNIT_ASSERT(ok);
|
||||||
}
|
}
|
||||||
|
|
||||||
void RNAVProcedureTests::testTransitions()
|
void RNAVProcedureTests::testTransitionsSID()
|
||||||
{
|
{
|
||||||
auto kjfk = FGAirport::findByIdent("kjfk");
|
auto kjfk = FGAirport::findByIdent("kjfk");
|
||||||
//auto sid = kjfk->findSIDWithIdent("DEEZZ5.13L");
|
//auto sid = kjfk->findSIDWithIdent("DEEZZ5.13L");
|
||||||
|
// the method used by nasal to search for a transition only accepts transition ID as argument
|
||||||
|
// - not the associated SID. I believe this is an issue. This code will try to load DEEZZ5.04L!
|
||||||
auto sid = kjfk->selectSIDByTransition("CANDR");
|
auto sid = kjfk->selectSIDByTransition("CANDR");
|
||||||
// procedures not loaded, abandon test
|
// procedures not loaded, abandon test
|
||||||
if (!sid)
|
if (!sid)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
auto rm = globals->get_subsystem<FGRouteMgr>();
|
auto rm = globals->get_subsystem<FGRouteMgr>();
|
||||||
auto fp = new FlightPlan;
|
auto fp = new FlightPlan;
|
||||||
|
|
||||||
|
@ -543,3 +570,28 @@ void RNAVProcedureTests::testTransitions()
|
||||||
auto wp = fp->legAtIndex(6);
|
auto wp = fp->legAtIndex(6);
|
||||||
CPPUNIT_ASSERT_EQUAL(std::string{"CANDR"}, wp->waypoint()->ident());
|
CPPUNIT_ASSERT_EQUAL(std::string{"CANDR"}, wp->waypoint()->ident());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void RNAVProcedureTests::testTransitionsSTAR()
|
||||||
|
{
|
||||||
|
auto kjfk = FGAirport::findByIdent("kjfk");
|
||||||
|
//auto star = kjfk->findSIDWithIdent("DEEZZ5.13L");
|
||||||
|
auto star = kjfk->selectSTARByTransition("SEY");
|
||||||
|
// procedures not loaded, abandon test
|
||||||
|
if (!star)
|
||||||
|
return;
|
||||||
|
|
||||||
|
auto rm = globals->get_subsystem<FGRouteMgr>();
|
||||||
|
auto fp = new FlightPlan;
|
||||||
|
|
||||||
|
auto testDelegate = new TestFPDelegate;
|
||||||
|
testDelegate->thePlan = fp;
|
||||||
|
fp->addDelegate(testDelegate);
|
||||||
|
|
||||||
|
rm->setFlightPlan(fp);
|
||||||
|
FGTestApi::setUp::populateFPWithNasal(fp, "KBOS", "22R", "KJFK", "22L", "");
|
||||||
|
|
||||||
|
fp->setSTAR(star);
|
||||||
|
CPPUNIT_ASSERT_EQUAL(8, fp->numLegs());
|
||||||
|
auto wp = fp->legAtIndex(1);
|
||||||
|
CPPUNIT_ASSERT_EQUAL(std::string{"SEY"}, wp->waypoint()->ident());
|
||||||
|
}
|
||||||
|
|
|
@ -42,7 +42,8 @@ class RNAVProcedureTests : public CppUnit::TestFixture
|
||||||
CPPUNIT_TEST(testHeadingToAlt);
|
CPPUNIT_TEST(testHeadingToAlt);
|
||||||
CPPUNIT_TEST(testUglyHeadingToAlt);
|
CPPUNIT_TEST(testUglyHeadingToAlt);
|
||||||
CPPUNIT_TEST(testLFKC_AJO1R);
|
CPPUNIT_TEST(testLFKC_AJO1R);
|
||||||
CPPUNIT_TEST(testTransitions);
|
CPPUNIT_TEST(testTransitionsSID);
|
||||||
|
CPPUNIT_TEST(testTransitionsSTAR);
|
||||||
CPPUNIT_TEST_SUITE_END();
|
CPPUNIT_TEST_SUITE_END();
|
||||||
|
|
||||||
void setPositionAndStabilise(const SGGeod& g);
|
void setPositionAndStabilise(const SGGeod& g);
|
||||||
|
@ -65,7 +66,8 @@ public:
|
||||||
void testHeadingToAlt();
|
void testHeadingToAlt();
|
||||||
void testUglyHeadingToAlt();
|
void testUglyHeadingToAlt();
|
||||||
void testLFKC_AJO1R();
|
void testLFKC_AJO1R();
|
||||||
void testTransitions();
|
void testTransitionsSID();
|
||||||
|
void testTransitionsSTAR();
|
||||||
private:
|
private:
|
||||||
GPS* m_gps = nullptr;
|
GPS* m_gps = nullptr;
|
||||||
SGPropertyNode_ptr m_gpsNode;
|
SGPropertyNode_ptr m_gpsNode;
|
||||||
|
|
Loading…
Add table
Reference in a new issue