3 XCSoar Glide Computer - http://www.xcsoar.org/
4 Copyright (C) 2000-2013 The XCSoar Project
5 A detailed list of copyright holders can be found in the file "AUTHORS".
7 This program is free software; you can redistribute it and/or
8 modify it under the terms of the GNU General Public License
9 as published by the Free Software Foundation; either version 2
10 of the License, or (at your option) any later version.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
23 #include "TaskEventsPrint.hpp"
24 #include "harness_flight.hpp"
25 #include "Engine/Waypoint/Waypoints.hpp"
28 test_abort(int n_wind
)
30 GlidePolar
glide_polar(fixed(2));
32 SetupWaypoints(waypoints
);
35 PrintDistanceCounts();
37 TaskBehaviour task_behaviour
;
38 task_behaviour
.SetDefaults();
39 task_behaviour
.DisableAll();
40 task_behaviour
.enable_trace
= false;
42 TaskManager
task_manager(task_behaviour
, waypoints
);
44 TaskEventsPrint
default_events(verbose
);
45 task_manager
.SetTaskEvents(default_events
);
47 task_manager
.SetGlidePolar(glide_polar
);
49 test_task(task_manager
, waypoints
, 1);
52 task_report(task_manager
, "abort");
54 autopilot_parms
.goto_target
= true;
55 return run_flight(task_manager
, autopilot_parms
, n_wind
);
59 test_goto(int n_wind
, unsigned id
, bool auto_mc
)
61 GlidePolar
glide_polar(fixed(2));
63 SetupWaypoints(waypoints
);
66 PrintDistanceCounts();
68 TaskBehaviour task_behaviour
;
69 task_behaviour
.SetDefaults();
70 task_behaviour
.DisableAll();
71 task_behaviour
.auto_mc
= auto_mc
;
72 task_behaviour
.enable_trace
= false;
74 TaskManager
task_manager(task_behaviour
, waypoints
);
76 TaskEventsPrint
default_events(verbose
);
77 task_manager
.SetTaskEvents(default_events
);
79 task_manager
.SetGlidePolar(glide_polar
);
81 test_task(task_manager
, waypoints
, 1);
83 task_manager
.DoGoto(*waypoints
.LookupId(id
));
84 task_report(task_manager
, "goto");
86 waypoints
.Clear(); // clear waypoints so abort wont do anything
88 autopilot_parms
.goto_target
= true;
89 return run_flight(task_manager
, autopilot_parms
, n_wind
);
95 GlidePolar
glide_polar(fixed(2));
97 SetupWaypoints(waypoints
);
100 PrintDistanceCounts();
102 TaskBehaviour task_behaviour
;
103 task_behaviour
.SetDefaults();
104 task_behaviour
.DisableAll();
105 task_behaviour
.enable_trace
= false;
107 TaskManager
task_manager(task_behaviour
, waypoints
);
109 TaskEventsPrint
default_events(verbose
);
110 task_manager
.SetTaskEvents(default_events
);
112 task_manager
.SetGlidePolar(glide_polar
);
114 task_report(task_manager
, "null");
116 waypoints
.Clear(); // clear waypoints so abort wont do anything
118 autopilot_parms
.goto_target
= true;
119 return run_flight(task_manager
, autopilot_parms
, 0);
123 main(int argc
, char** argv
)
126 autopilot_parms
.SetIdeal();
128 if (!ParseArgs(argc
, argv
))
133 ok(test_abort(0), "abort", 0);
134 ok(test_goto(0, 5, false), "goto", 0);
135 ok(test_goto(0, 5, true), "goto with auto mc", 0);
136 ok(test_null(), "null", 0);
138 return exit_status();