1
0
Fork 0

Add (failing) test for indexOfWP function with procedures

This commit is contained in:
legoboyvdlp R 2020-05-15 21:22:08 +01:00 committed by James Turner
parent 85d2a15e32
commit d8b778a59e
2 changed files with 30 additions and 0 deletions

View file

@ -655,3 +655,31 @@ void RNAVProcedureTests::testLEBL_LARP2F()
FGTestApi::runForTime(180.0);
CPPUNIT_ASSERT_DOUBLES_EQUAL(199, m_gpsNode->getDoubleValue("wp/leg-true-course-deg"), 0.5);
}
// This could probably be in a better place but this allows it to access TestDelegate.
// Also it does relate to procedures as its a bug that only occurs with procedures
void RNAVProcedureTests::testIndexOf()
{
auto egkk = FGAirport::findByIdent("EGKK");
auto sid = egkk->findSIDWithIdent("SAM3P");
// procedures not loaded, abandon test
if (!sid)
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, "EGKK", "08R", "EGJJ", "27", "LELNA");
fp->setSID(sid);
FGPositioned::TypeFilter f{FGPositioned::VOR};
auto southamptonVOR = fgpositioned_cast<FGNavRecord>(FGPositioned::findClosestWithIdent("SAM", SGGeod::fromDeg(-1.25, 51.0), &f));
auto SAM = fp->legAtIndex(6)->waypoint();
CPPUNIT_ASSERT_EQUAL(southamptonVOR->ident(), SAM->ident());
CPPUNIT_ASSERT_EQUAL(6, fp->findWayptIndex(southamptonVOR));
}

View file

@ -45,6 +45,7 @@ class RNAVProcedureTests : public CppUnit::TestFixture
CPPUNIT_TEST(testTransitionsSID);
CPPUNIT_TEST(testTransitionsSTAR);
CPPUNIT_TEST(testLEBL_LARP2F);
CPPUNIT_TEST(testIndexOf);
CPPUNIT_TEST_SUITE_END();
@ -71,6 +72,7 @@ public:
void testTransitionsSID();
void testTransitionsSTAR();
void testLEBL_LARP2F();
void testIndexOf();
private:
GPS* m_gps = nullptr;
SGPropertyNode_ptr m_gpsNode;