Debian Codegraph @

test_suite/unit_tests/Airports/test_runway.cxx

raw symbols SCIP
1 /*
2 * Copyright (C) 2021 Keith Paterson
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 #include "config.h"
21
22 #include "test_runway.hxx"
23
24 #include <iostream>
25 #include <cstring>
26 #include <memory>
27
28 #include <simgear/math/sg_geodesy.hxx>
29 #include <simgear/math/SGGeod.hxx>
30 #include <AIModel/AIAircraft.hxx>
31 #include <AIModel/AIFlightPlan.hxx>
32 #include <AIModel/AIManager.hxx>
33 #include <AIModel/performancedb.hxx>
34 #include <Airports/airport.hxx>
35 #include <Airports/airportdynamicsmanager.hxx>
36 #include <Airports/runways.hxx>
37 #include <Traffic/TrafficMgr.hxx>
38 #include <Time/TimeManager.hxx>
39
40 #include <ATC/atc_mgr.hxx>
41
42 #include <Main/fg_props.hxx>
43 #include <Main/globals.hxx>
44
45 /////////////////////////////////////////////////////////////////////////////
46
47 // Set up function for each test.
48 void RunwayTests::setUp()
49 {
50 }
51
52 // Clean up after each test.
53 void RunwayTests::tearDown()
54 {
55 }
56
57 void RunwayTests::testRunway()
58 {
59 PositionedID aAirport = 0;
60 SGGeod aGeod = SGGeod::fromDeg(-33.92935800, 151.17160300);
61 double heading = 155;
62 int length = 3962;
63 double width = 45.0;
64 double displ_thresh = 79;
65 double stopway = 0;
66 FGRunway runway = FGRunway( FGPositioned::RUNWAY,
67 aAirport,
68 "16R",
69 aGeod,
70 heading,
71 length,
72 width,
73 displ_thresh,
74 stopway,
75 1);
76 int calculated = SGGeodesy::distanceM(runway.begin(), runway.end());
77 CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE("Distance between the runway endpoints should be runway length", length, calculated, 1);
78 calculated = SGGeodesy::distanceM(runway.begin(), runway.pointOnCenterline(-length));
79 CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE("Distance between the runway start and point on centerline should be runway length", length, calculated, 1);
80 }