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 "Plane/Plane.hpp"
24 #include "Plane/PlaneFileGlue.hpp"
25 #include "IO/FileLineReader.hpp"
26 #include "IO/KeyValueFileReader.hpp"
27 #include "IO/KeyValueFileWriter.hpp"
28 #include "Units/System.hpp"
29 #include "TestUtil.hpp"
35 PlaneGlue::ReadFile(plane
, _T("test/data/D-4449.xcp"));
37 ok1(plane
.registration
== _T("D-4449"));
38 ok1(plane
.competition_id
== _T("TH"));
39 ok1(plane
.type
== _T("Hornet"));
40 ok1(plane
.handicap
== 100);
41 ok1(plane
.polar_name
== _T("Hornet"));
42 ok1(equals(plane
.polar_shape
[0].v
,
43 Units::ToSysUnit(fixed(80), Unit::KILOMETER_PER_HOUR
)));
44 ok1(equals(plane
.polar_shape
[1].v
,
45 Units::ToSysUnit(fixed(120), Unit::KILOMETER_PER_HOUR
)));
46 ok1(equals(plane
.polar_shape
[2].v
,
47 Units::ToSysUnit(fixed(160), Unit::KILOMETER_PER_HOUR
)));
48 ok1(equals(plane
.polar_shape
[0].w
, -0.606));
49 ok1(equals(plane
.polar_shape
[1].w
, -0.99));
50 ok1(equals(plane
.polar_shape
[2].w
, -1.918));
51 ok1(equals(plane
.reference_mass
, 318));
52 ok1(equals(plane
.dry_mass
, 302));
53 ok1(equals(plane
.max_ballast
, 100));
54 ok1(plane
.dump_time
== 90);
55 ok1(equals(plane
.max_speed
, 41.666));
56 ok1(equals(plane
.wing_area
, 9.8));
63 plane
.registration
= _T("D-4449");
64 plane
.competition_id
= _T("TH");
65 plane
.type
= _T("Hornet");
67 plane
.polar_name
= _T("Hornet");
68 plane
.polar_shape
[0].v
= Units::ToSysUnit(fixed(80), Unit::KILOMETER_PER_HOUR
);
69 plane
.polar_shape
[1].v
= Units::ToSysUnit(fixed(120), Unit::KILOMETER_PER_HOUR
);
70 plane
.polar_shape
[2].v
= Units::ToSysUnit(fixed(160), Unit::KILOMETER_PER_HOUR
);
71 plane
.polar_shape
[0].w
= fixed(-0.606);
72 plane
.polar_shape
[1].w
= fixed(-0.99);
73 plane
.polar_shape
[2].w
= fixed(-1.918);
74 plane
.reference_mass
= fixed(318);
75 plane
.dry_mass
= fixed(302);
76 plane
.max_ballast
= fixed(100);
78 plane
.max_speed
= fixed(41.666);
79 plane
.wing_area
= fixed(9.8);
81 PlaneGlue::WriteFile(plane
, _T("output/D-4449.xcp"));
83 FileLineReader
reader(_T("output/D-4449.xcp"));
88 bool found1
= false, found2
= false, found3
= false, found4
= false;
89 bool found5
= false, found6
= false, found7
= false, found8
= false;
90 bool found9
= false, found10
= false, found11
= false, found12
= false;
93 while ((line
= reader
.ReadLine()) != NULL
) {
94 if (_tcscmp(line
, _T("Registration=\"D-4449\"")) == 0)
96 if (_tcscmp(line
, _T("CompetitionID=\"TH\"")) == 0)
98 if (_tcscmp(line
, _T("Type=\"Hornet\"")) == 0)
100 if (_tcscmp(line
, _T("Handicap=\"100\"")) == 0)
102 if (_tcscmp(line
, _T("PolarName=\"Hornet\"")) == 0)
104 if (_tcscmp(line
, _T("PolarInformation=\"80.000,-0.606,120.000,-0.990,160.000,-1.918\"")) == 0)
106 if (_tcscmp(line
, _T("PolarReferenceMass=\"318.000000\"")) == 0)
108 if (_tcscmp(line
, _T("PolarDryMass=\"302.000000\"")) == 0)
110 if (_tcscmp(line
, _T("MaxBallast=\"100.000000\"")) == 0)
112 if (_tcscmp(line
, _T("DumpTime=\"90.000000\"")) == 0)
114 if (_tcscmp(line
, _T("MaxSpeed=\"41.666000\"")) == 0)
116 if (_tcscmp(line
, _T("WingArea=\"9.800000\"")) == 0)
137 int main(int argc
, char **argv
)
144 return exit_status();