From f05c10e13a123c402956b684d76a8a051c4074dd Mon Sep 17 00:00:00 2001 From: legoboyvdlp R Date: Mon, 15 Jun 2020 14:48:58 +0100 Subject: [PATCH] Add test for airway() nasal function --- .../unit_tests/Navaids/test_fpNasal.cxx | 23 +++++++++++++++++++ .../unit_tests/Navaids/test_fpNasal.hxx | 2 ++ 2 files changed, 25 insertions(+) diff --git a/test_suite/unit_tests/Navaids/test_fpNasal.cxx b/test_suite/unit_tests/Navaids/test_fpNasal.cxx index 8794c5dc6..94d2ec975 100644 --- a/test_suite/unit_tests/Navaids/test_fpNasal.cxx +++ b/test_suite/unit_tests/Navaids/test_fpNasal.cxx @@ -291,4 +291,27 @@ void FPNasalTests::testApproachTransitionAPIWithCloning() auto fp2 = fp->clone("testplan2"); CPPUNIT_ASSERT_EQUAL(string{"ILS06"}, fp2->approach()->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); } \ No newline at end of file diff --git a/test_suite/unit_tests/Navaids/test_fpNasal.hxx b/test_suite/unit_tests/Navaids/test_fpNasal.hxx index 35e7610bb..bc49c1063 100644 --- a/test_suite/unit_tests/Navaids/test_fpNasal.hxx +++ b/test_suite/unit_tests/Navaids/test_fpNasal.hxx @@ -35,6 +35,7 @@ class FPNasalTests : public CppUnit::TestFixture CPPUNIT_TEST(testSTARTransitionAPI); CPPUNIT_TEST(testApproachTransitionAPI); CPPUNIT_TEST(testApproachTransitionAPIWithCloning); + CPPUNIT_TEST(testAirwaysAPI); CPPUNIT_TEST_SUITE_END(); @@ -52,4 +53,5 @@ public: void testSTARTransitionAPI(); void testApproachTransitionAPI(); void testApproachTransitionAPIWithCloning(); + void testAirwaysAPI(); };