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 "harness_flight.hpp"
24 #include "harness_wind.hpp"
27 test_speed_factor(int test_num
, int n_wind
)
29 // flying at opt speed should be minimum time flight!
33 TestFlightResult result
= test_flight(test_num
, n_wind
, 1.0);
34 te0
= result
.time_elapsed
;
36 result
= test_flight(test_num
, n_wind
, 0.7);
37 te1
= result
.time_elapsed
;
38 // time of this should be higher than nominal
39 ok(te0
< te1
, GetTestName("vopt slow or", test_num
, n_wind
), 0);
41 result
= test_flight(test_num
, n_wind
, 1.5);
42 te2
= result
.time_elapsed
;
43 // time of this should be higher than nominal
44 ok(te0
< te2
, GetTestName("vopt fast or", test_num
, n_wind
), 0);
46 bool retval
= (te0
< te1
) && (te0
< te2
);
47 if (verbose
|| !retval
) {
48 printf("# sf 0.8 time_elapsed_rat %g\n", te1
/ te0
);
49 printf("# sf 1.2 time_elapsed_rat %g\n", te2
/ te0
);
55 main(int argc
, char** argv
)
58 autopilot_parms
.SetIdeal();
60 if (!ParseArgs(argc
, argv
))
63 unsigned i
= rand() % NUM_WIND
;
66 // tests whether flying at VOpt for OR task is optimal
67 test_speed_factor(3, i
);