1
0
Fork 0

Unit-tests for Nasal range()

This commit is contained in:
James Turner 2022-01-07 16:16:01 +00:00
parent d5bc2d4629
commit 179b751bf5
2 changed files with 16 additions and 0 deletions

View file

@ -227,3 +227,17 @@ void NasalSysTests::testRoundFloor()
)");
CPPUNIT_ASSERT(ok);
}
void NasalSysTests::testRange()
{
auto nasalSys = globals->get_subsystem<FGNasalSys>();
nasalSys->getAndClearErrorList();
bool ok = FGTestApi::executeNasal(R"(
unitTest.assert_equal(range(5), [0, 1, 2, 3, 4]);
unitTest.assert_equal(range(2, 8), [2, 3, 4, 5, 6, 7]);
unitTest.assert_equal(range(2, 10, 3), [2, 5, 8]);
)");
CPPUNIT_ASSERT(ok);
}

View file

@ -36,6 +36,7 @@ class NasalSysTests : public CppUnit::TestFixture
CPPUNIT_TEST(testAirportGhost);
CPPUNIT_TEST(testCompileLarge);
CPPUNIT_TEST(testRoundFloor);
CPPUNIT_TEST(testRange);
CPPUNIT_TEST_SUITE_END();
public:
@ -51,6 +52,7 @@ public:
void testAirportGhost();
void testCompileLarge();
void testRoundFloor();
void testRange();
};
#endif // _FG_NASALSYS_UNIT_TESTS_HXX