From 335d0003cc39b34ab15563abd8a00fef5abe2dc5 Mon Sep 17 00:00:00 2001 From: James Turner Date: Wed, 24 Feb 2021 11:19:44 +0000 Subject: [PATCH] Test Nasal airport.taxiways API --- test_suite/unit_tests/Scripting/testNasalSys.cxx | 16 ++++++++++++++++ test_suite/unit_tests/Scripting/testNasalSys.hxx | 2 ++ 2 files changed, 18 insertions(+) diff --git a/test_suite/unit_tests/Scripting/testNasalSys.cxx b/test_suite/unit_tests/Scripting/testNasalSys.cxx index 354d496e9..1a71c05fe 100644 --- a/test_suite/unit_tests/Scripting/testNasalSys.cxx +++ b/test_suite/unit_tests/Scripting/testNasalSys.cxx @@ -21,6 +21,7 @@ #include "testNasalSys.hxx" #include "test_suite/FGTestApi/testGlobals.hxx" +#include "test_suite/FGTestApi/NavDataCache.hxx" #include @@ -36,6 +37,7 @@ void NasalSysTests::setUp() { FGTestApi::setUp::initTestGlobals("NasalSys"); + FGTestApi::setUp::initNavDataCache(); fgInitAllowedPaths(); globals->get_props()->getNode("nasal", true); @@ -150,3 +152,17 @@ void NasalSysTests::testCommands() CPPUNIT_ASSERT(!ok); CPPUNIT_ASSERT_EQUAL(19, fgGetInt("/foo/test")); } + +void NasalSysTests::testAirportGhost() +{ + auto nasalSys = globals->get_subsystem(); + nasalSys->getAndClearErrorList(); + + bool ok = FGTestApi::executeNasal(R"( + var apt = airportinfo('LFBD'); + var taxiways = apt.taxiways; + unitTest.assert_equal(size(taxiways), 0); + )"); + CPPUNIT_ASSERT(ok); + +} diff --git a/test_suite/unit_tests/Scripting/testNasalSys.hxx b/test_suite/unit_tests/Scripting/testNasalSys.hxx index e815f4fc6..5a5544136 100644 --- a/test_suite/unit_tests/Scripting/testNasalSys.hxx +++ b/test_suite/unit_tests/Scripting/testNasalSys.hxx @@ -33,6 +33,7 @@ class NasalSysTests : public CppUnit::TestFixture CPPUNIT_TEST_SUITE(NasalSysTests); CPPUNIT_TEST(testStructEquality); CPPUNIT_TEST(testCommands); + CPPUNIT_TEST(testAirportGhost); CPPUNIT_TEST_SUITE_END(); public: @@ -45,6 +46,7 @@ public: // The tests. void testStructEquality(); void testCommands(); + void testAirportGhost(); }; #endif // _FG_NASALSYS_UNIT_TESTS_HXX