1
0
Fork 0

Add test for airway() nasal function

This commit is contained in:
legoboyvdlp R 2020-06-15 14:48:58 +01:00 committed by James Turner
parent 4e855c3182
commit f05c10e13a
2 changed files with 25 additions and 0 deletions
test_suite/unit_tests/Navaids

View file

@ -292,3 +292,26 @@ void FPNasalTests::testApproachTransitionAPIWithCloning()
CPPUNIT_ASSERT_EQUAL(string{"ILS06"}, fp2->approach()->ident()); CPPUNIT_ASSERT_EQUAL(string{"ILS06"}, fp2->approach()->ident());
CPPUNIT_ASSERT_EQUAL(string{"SUG2A"}, fp2->approachTransition()->ident()); CPPUNIT_ASSERT_EQUAL(string{"SUG2A"}, fp2->approachTransition()->ident());
} }
void FPNasalTests::testAirwaysAPI()
{
bool ok = FGTestApi::executeNasal(R"(
var airwayIdent = "L620";
var airwayStore = airway(airwayIdent);
unitTest.assert(airwayStore != nil, "Airway " ~ airwayIdent ~ " not found");
unitTest.assert(airwayStore.id == airwayIdent, "Incorrect airway found");
airwayIdent = "UL620";
var cln = findNavaidsByID("CLN")[0];
airwayStore = airway(airwayIdent, cln);
unitTest.assert(airwayStore != nil, "Airway " ~ airwayIdent ~ " not found");
unitTest.assert(airwayStore.id == airwayIdent, "Incorrect airway found");
airwayIdent = "J547";
airwayStore = airway(airwayIdent);
unitTest.assert(airwayStore != nil, "Airway " ~ airwayIdent ~ " not found");
unitTest.assert(airwayStore.id == airwayIdent, "Incorrect airway found");
)");
CPPUNIT_ASSERT(ok);
}

View file

@ -35,6 +35,7 @@ class FPNasalTests : public CppUnit::TestFixture
CPPUNIT_TEST(testSTARTransitionAPI); CPPUNIT_TEST(testSTARTransitionAPI);
CPPUNIT_TEST(testApproachTransitionAPI); CPPUNIT_TEST(testApproachTransitionAPI);
CPPUNIT_TEST(testApproachTransitionAPIWithCloning); CPPUNIT_TEST(testApproachTransitionAPIWithCloning);
CPPUNIT_TEST(testAirwaysAPI);
CPPUNIT_TEST_SUITE_END(); CPPUNIT_TEST_SUITE_END();
@ -52,4 +53,5 @@ public:
void testSTARTransitionAPI(); void testSTARTransitionAPI();
void testApproachTransitionAPI(); void testApproachTransitionAPI();
void testApproachTransitionAPIWithCloning(); void testApproachTransitionAPIWithCloning();
void testAirwaysAPI();
}; };