From 445c853b7ac2e649109f33e54fcfdcdbfcefa94a Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Mon, 11 Mar 2013 16:41:34 +0100 Subject: [PATCH] test/TestGRecord: unit test for XCSoar 6.4 / 6.5 G records Fails due to TRAC #2657. --- build/test.mk | 11 ++++++++++- test/data/grecord64a.igc | 10 ++++++++++ test/data/grecord64b.igc | 10 ++++++++++ test/data/grecord65a.igc | 10 ++++++++++ test/data/grecord65b.igc | 10 ++++++++++ test/src/TestGRecord.cpp | 44 ++++++++++++++++++++++++++++++++++++++++++++ 6 files changed, 94 insertions(+), 1 deletion(-) create mode 100644 test/data/grecord64a.igc create mode 100644 test/data/grecord64b.igc create mode 100644 test/data/grecord65a.igc create mode 100644 test/data/grecord65b.igc create mode 100644 test/src/TestGRecord.cpp diff --git a/build/test.mk b/build/test.mk index a0234568e..8dddfaac6 100644 --- a/build/test.mk +++ b/build/test.mk @@ -84,7 +84,7 @@ TEST_NAMES = \ TestAngle TestUnits TestEarth TestSunEphemeris \ TestValidity TestUTM TestProfile \ TestRadixTree TestGeoBounds TestGeoClip \ - TestLogger TestDriver TestClimbAvCalc \ + TestLogger TestGRecord TestDriver TestClimbAvCalc \ TestWaypointReader TestThermalBase \ TestFlarmNet \ TestColorRamp TestGeoPoint TestDiffFilter \ @@ -560,6 +560,15 @@ TEST_LOGGER_SOURCES = \ TEST_LOGGER_DEPENDS = IO OS GEO MATH UTIL $(eval $(call link-program,TestLogger,TEST_LOGGER)) +TEST_GRECORD_SOURCES = \ + $(SRC)/Logger/GRecord.cpp \ + $(SRC)/Logger/MD5.cpp \ + $(SRC)/Version.cpp \ + $(TEST_SRC_DIR)/tap.c \ + $(TEST_SRC_DIR)/TestGRecord.cpp +TEST_GRECORD_DEPENDS = IO OS UTIL +$(eval $(call link-program,TestGRecord,TEST_GRECORD)) + TEST_DRIVER_SOURCES = \ $(SRC)/Device/Port/NullPort.cpp \ $(SRC)/Device/Parser.cpp \ diff --git a/test/data/grecord64a.igc b/test/data/grecord64a.igc new file mode 100644 index 000000000..978b201ac --- /dev/null +++ b/test/data/grecord64a.igc @@ -0,0 +1,10 @@ +AXCSAAA +HFFTYFRTYPE:XCSOAR,XCSOAR Linux 6.4.6 Jan 23 2013 +G0e84a84cab101a9f +G65598e0478043380 +G4df6de454dcbcf08 +Gd727b9cf71f32ea0 +Gb16a9d57f016942d +G2f6b868eaca5d173 +Gc8c2a9484dba41f4 +G3e5bb4f1e839ec95 diff --git a/test/data/grecord64b.igc b/test/data/grecord64b.igc new file mode 100644 index 000000000..b72e98aeb --- /dev/null +++ b/test/data/grecord64b.igc @@ -0,0 +1,10 @@ +AXCSAAA +HFFTYFRTYPE:XCSOAR XCSOAR Linux 6.4.6 Jan 23 2013 +Gd3aa0cfda5e30cd0 +G337ac95cc4f228ed +Ga840bb6f125814ca +G8f31112e82272b13 +G8db66b0968c2224d +G7ef748203b03ccea +G962a36f360dff706 +G24a1dd0ca7fca316 diff --git a/test/data/grecord65a.igc b/test/data/grecord65a.igc new file mode 100644 index 000000000..9cf73ac5a --- /dev/null +++ b/test/data/grecord65a.igc @@ -0,0 +1,10 @@ +AXCSAAA +HFFTYFRTYPE:XCSOAR,XCSOAR Android 6.5 Mar 8 2013 +Gc0a3f8ffad5ed663 +G680242ec7b5da911 +Gc78a96b36bd1c70c +G91e28911d970d8d7 +Gb9b1cbb1ef95114b +G42fcefa5896c0797 +G9883313f5de2338e +G98b94a12a08e8c66 diff --git a/test/data/grecord65b.igc b/test/data/grecord65b.igc new file mode 100644 index 000000000..cd8d2f141 --- /dev/null +++ b/test/data/grecord65b.igc @@ -0,0 +1,10 @@ +AXCSAAA +HFFTYFRTYPE:XCSOAR XCSOAR Android 6.5 Mar 8 2013 +G4344ba0741b42afa +G07675a8294b1b1be +G119050de14479fb1 +G244ac2478ff39a88 +Gfe1acfdf51d5a897 +Gde736824f2d4cfad +G5b0a3a1f372f9a13 +G3d96c0e61d181030 diff --git a/test/src/TestGRecord.cpp b/test/src/TestGRecord.cpp new file mode 100644 index 000000000..2ce83077f --- /dev/null +++ b/test/src/TestGRecord.cpp @@ -0,0 +1,44 @@ +/* Copyright_License { + + XCSoar Glide Computer - http://www.xcsoar.org/ + Copyright (C) 2000-2013 The XCSoar Project + A detailed list of copyright holders can be found in the file "AUTHORS". + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + as published by the Free Software Foundation; either version 2 + of the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +} +*/ + +#include "Logger/GRecord.hpp" +#include "TestUtil.hpp" + +static void +CheckGRecord(const TCHAR *path) +{ + GRecord grecord; + grecord.Initialize(); + ok1(grecord.VerifyGRecordInFile(path)); +} + +int main(int argc, char **argv) +{ + plan_tests(4); + + CheckGRecord(_T("test/data/grecord64a.igc")); + CheckGRecord(_T("test/data/grecord64b.igc")); + CheckGRecord(_T("test/data/grecord65a.igc")); + CheckGRecord(_T("test/data/grecord65b.igc")); + + return exit_status(); +} -- 2.11.4.GIT