From 4b93d0e2d8251b2a72904ae6796eb2c1229485b8 Mon Sep 17 00:00:00 2001 From: Roland Winklmeier Date: Sat, 17 Dec 2016 21:29:20 +0100 Subject: [PATCH] CCoordinateGeodetic::calculateEuclideanDistance unit tests --- tests/blackmisc/testgeo.cpp | 10 ++++++++++ tests/blackmisc/testgeo.h | 3 +++ 2 files changed, 13 insertions(+) diff --git a/tests/blackmisc/testgeo.cpp b/tests/blackmisc/testgeo.cpp index 3ba0f57a5..7ee4e64e7 100644 --- a/tests/blackmisc/testgeo.cpp +++ b/tests/blackmisc/testgeo.cpp @@ -15,6 +15,7 @@ */ #include "testgeo.h" +#include "blackmisc/geo/coordinategeodetic.h" #include "blackmisc/geo/earthangle.h" #include "blackmisc/geo/latitude.h" #include "blackmisc/pq/physicalquantity.h" @@ -39,6 +40,15 @@ namespace BlackMiscTest QVERIFY2(lati.valueRounded() == 30.0, "Latitude should be 30 degrees"); } + void CTestGeo::coordinateGeodetic() + { + CCoordinateGeodetic northPole = { 90.0, 0.0 }; + CCoordinateGeodetic southPole = { -90.0, 0.0 }; + QCOMPARE(calculateEuclideanDistance(northPole, southPole), 2.0); + CCoordinateGeodetic equator = { 0.0, 70.354683 }; + QCOMPARE(calculateEuclideanDistance(northPole, equator), std::sqrt(2.0f)); + } + } // namespace //! \endcond diff --git a/tests/blackmisc/testgeo.h b/tests/blackmisc/testgeo.h index a821dde45..8b945bd0f 100644 --- a/tests/blackmisc/testgeo.h +++ b/tests/blackmisc/testgeo.h @@ -34,6 +34,9 @@ namespace BlackMiscTest private slots: //! Basic unit tests for geo classes void geoBasics(); + + //! CCoordinateGeodetic unit tests + void coordinateGeodetic(); }; } // namespace