1
0
Fork 0

Extend unit-test for route-manager waypoint selection

SF-Ticket: https://sourceforge.net/p/flightgear/codetickets/2372/
This commit is contained in:
James Turner 2021-08-20 12:08:17 +01:00
parent 049b3dcba6
commit 4bf88a0b67
2 changed files with 32 additions and 0 deletions

View file

@ -867,6 +867,36 @@ void RouteManagerTests::testsSelectNavaid()
CPPUNIT_ASSERT_EQUAL(wp2->source()->name(), string{"BRYANSK NDB"});
}
void RouteManagerTests::testsSelectWaypoint()
{
// another part of the issue at
// https://sourceforge.net/p/flightgear/codetickets/2372/
auto rm = globals->get_subsystem<FGRouteMgr>();
FlightPlanRef f = new FlightPlan;
rm->setFlightPlan(f);
auto rmNode = globals->get_props()->getNode("autopilot/route-manager", true);
rmNode->setStringValue("input", "70N,015E");
rmNode->setStringValue("input", "55N,015E");
rmNode->setStringValue("input", "@INSERT1:OSS");
rmNode->setStringValue("input", "@INSERT2:BOR");
auto leg = f->legAtIndex(1);
auto wp1 = leg->waypoint();
CPPUNIT_ASSERT_EQUAL(wp1->ident(), string{"OSS"});
CPPUNIT_ASSERT_EQUAL(wp1->source()->name(), string{"OSTERSUND VOR-DME"});
// CPPUNIT_ASSERT_DOUBLES_EQUAL(227, leg->courseDeg(), 0.5);
// CPPUNIT_ASSERT_DOUBLES_EQUAL(59, leg->distanceNm(), 0.5);
leg = f->legAtIndex(2);
auto wp2 = leg->waypoint();
CPPUNIT_ASSERT_EQUAL(wp2->ident(), string{"BOR"});
CPPUNIT_ASSERT_EQUAL(wp2->source()->name(), string{"BORLANGE VOR-DME"});
}
void RouteManagerTests::testCommandAPI()
{
auto rm = globals->get_subsystem<FGRouteMgr>();

View file

@ -46,6 +46,7 @@ class RouteManagerTests : public CppUnit::TestFixture
CPPUNIT_TEST(testRouteWithApproachProcedures);
CPPUNIT_TEST(testsSelectNavaid);
CPPUNIT_TEST(testCommandAPI);
CPPUNIT_TEST(testsSelectWaypoint);
CPPUNIT_TEST_SUITE_END();
@ -74,6 +75,7 @@ public:
void testRouteWithApproachProcedures();
void testsSelectNavaid();
void testCommandAPI();
void testsSelectWaypoint();
private:
GPS* m_gps = nullptr;