3 # include <simgear_config.h>
6 #include <simgear/compiler.h>
16 #include <simgear/misc/sg_dir.hxx>
17 #include <simgear/structure/exception.hxx>
26 #define COMPARE(a, b) \
28 cerr << "failed:" << #a << " != " << #b << endl; \
29 cerr << "\tgot:" << a << endl; \
35 cerr << "failed:" << #a << endl; \
42 SGMetar m1("2011/10/20 11:25 EHAM 201125Z 27012KT 240V300 9999 VCSH FEW025CB SCT048 10/05 Q1025 TEMPO VRB03KT");
43 COMPARE(m1.getYear(), 2011);
44 COMPARE(m1.getMonth(), 10);
45 COMPARE(m1.getDay(), 20);
46 COMPARE(m1.getHour(), 11);
47 COMPARE(m1.getMinute(), 25);
48 COMPARE(m1.getReportType(), -1); // should default to NIL?
50 COMPARE(m1.getWindDir(), 270);
51 COMPARE(m1.getWindSpeed_kt(), 12);
53 COMPARE(m1.getTemperature_C(), 10);
54 COMPARE(m1.getDewpoint_C(), 5);
55 COMPARE(m1.getPressure_hPa(), 1025);
58 int main(int argc, char* argv[])
62 } catch (sg_exception& e) {
63 cerr << "got exception:" << e.getMessage() << endl;