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 "Math/SunEphemeris.hpp"
24 #include "Geo/GeoPoint.hpp"
25 #include "Time/BrokenDateTime.hpp"
26 #include "Time/RoughTime.hpp"
27 #include "TestUtil.hpp"
32 const GeoPoint
location(Angle::Degrees(7.7061111111111114),
33 Angle::Degrees(51.051944444444445));
42 SunEphemeris::Result sun
=
43 SunEphemeris::CalcSunTimes(location
, dt
, RoughTimeDelta::FromHours(2));
45 ok1(between(sun
.morning_twilight
, 6.88, 6.9));
46 ok1(between(sun
.time_of_noon
, 13.3, 13.4));
47 ok1(between(sun
.time_of_sunset
, 19.36, 19.40));
48 ok1(between(sun
.time_of_sunrise
, 7.32, 7.41));
49 ok1(between(sun
.evening_twilight
, 19.81, 19.82));
57 const GeoPoint
location(Angle::Degrees(146.00666666666666),
58 Angle::Degrees(-36.551944444444445));
67 SunEphemeris::Result sun
=
68 SunEphemeris::CalcSunTimes(location
, dt
, RoughTimeDelta::FromHours(11));
70 ok1(between(sun
.time_of_sunrise
, 6.91, 6.95));
71 ok1(between(sun
.time_of_sunset
, 20.03, 20.04));
77 double test_data1
[24] = {
104 double test_data2
[24] = {
131 GeoPoint
location(Angle::Degrees(7), Angle::Degrees(51));
140 for (unsigned hour
= 0; hour
< 24; hour
++) {
143 SunEphemeris::Result sun
=
144 SunEphemeris::CalcSunTimes(location
, dt
, RoughTimeDelta::FromHours(0));
146 ok1(equals(sun
.azimuth
, test_data1
[hour
]));
149 location
.latitude
.Flip();
151 for (unsigned hour
= 0; hour
< 24; hour
++) {
154 SunEphemeris::Result sun
=
155 SunEphemeris::CalcSunTimes(location
, dt
, RoughTimeDelta::FromHours(2));
157 ok1(equals(sun
.azimuth
, test_data2
[hour
]));
161 int main(int argc
, char **argv
)
166 test_times_southern();
169 return exit_status();