| 1 | /* |
| 2 | * Copyright (C) 2019 James Turner |
| 3 | * |
| 4 | * This file is part of the program FlightGear. |
| 5 | * |
| 6 | * This program is free software: you can redistribute it and/or modify |
| 7 | * it under the terms of the GNU General Public License as published by |
| 8 | * the Free Software Foundation, either version 2 of the License, or |
| 9 | * (at your option) any later version. |
| 10 | * |
| 11 | * This program is distributed in the hope that it will be useful, |
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 14 | * GNU General Public License for more details. |
| 15 | * |
| 16 | * You should have received a copy of the GNU General Public License |
| 17 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 18 | */ |
| 19 | |
| 20 | |
| 21 | #ifndef _FG_RNAV_PROCEDURE_UNIT_TESTS_HXX |
| 22 | #define _FG_RNAV_PROCEDURE_UNIT_TESTS_HXX |
| 23 | |
| 24 | |
| 25 | #include <cppunit/extensions/HelperMacros.h> |
| 26 | #include <cppunit/TestFixture.h> |
| 27 | |
| 28 | #include <memory> |
| 29 | |
| 30 | #include <simgear/props/props.hxx> |
| 31 | |
| 32 | class SGGeod; |
| 33 | class GPS; |
| 34 | |
| 35 | // The flight plan unit tests. |
| 36 | class RNAVProcedureTests : public CppUnit::TestFixture |
| 37 | { |
| 38 | // Set up the test suite. |
| 39 | CPPUNIT_TEST_SUITE(RNAVProcedureTests); |
| 40 | |
| 41 | CPPUNIT_TEST(testEGPH_TLA6C); |
| 42 | CPPUNIT_TEST(testHeadingToAlt); |
| 43 | CPPUNIT_TEST(testUglyHeadingToAlt); |
| 44 | CPPUNIT_TEST(testLFKC_AJO1R); |
| 45 | CPPUNIT_TEST(testTransitionsSID); |
| 46 | CPPUNIT_TEST(testTransitionsSTAR); |
| 47 | CPPUNIT_TEST(testLEBL_LARP2F); |
| 48 | CPPUNIT_TEST(testIndexOf); |
| 49 | |
| 50 | CPPUNIT_TEST_SUITE_END(); |
| 51 | |
| 52 | void setPositionAndStabilise(const SGGeod& g); |
| 53 | |
| 54 | GPS* setupStandardGPS(SGPropertyNode_ptr config = {}, |
| 55 | const std::string name = "gps", const int index = 0); |
| 56 | void setupRouteManager(); |
| 57 | |
| 58 | public: |
| 59 | // Set up function for each test. |
| 60 | void setUp(); |
| 61 | |
| 62 | // Clean up after each test. |
| 63 | void tearDown(); |
| 64 | |
| 65 | // The tests. |
| 66 | //void testBasic(); |
| 67 | |
| 68 | void testEGPH_TLA6C(); |
| 69 | void testHeadingToAlt(); |
| 70 | void testUglyHeadingToAlt(); |
| 71 | void testLFKC_AJO1R(); |
| 72 | void testTransitionsSID(); |
| 73 | void testTransitionsSTAR(); |
| 74 | void testLEBL_LARP2F(); |
| 75 | void testIndexOf(); |
| 76 | private: |
| 77 | GPS* m_gps = nullptr; |
| 78 | SGPropertyNode_ptr m_gpsNode; |
| 79 | |
| 80 | }; |
| 81 | |
| 82 | #endif // _FG_RNAV_PROCEDURE_UNIT_TESTS_HXX |