18 using namespace swift::misc::geo;
19 using namespace swift::misc::physical_quantities;
20 using namespace swift::misc::math;
34 void coordinateGeodetic();
37 void CTestGeo::geoBasics()
40 QVERIFY2(lat * 2 == lat + lat,
"Latitude addition should be equal");
42 QVERIFY2(lat.valueRounded() == 30.0,
"Latitude should be 30 degrees");
46 double v = lat.valueRounded(CAngleUnit::deg());
47 QVERIFY2(v == 20.0,
"Values shall be the same");
51 v = lat.valueRounded(CAngleUnit::deg());
52 QVERIFY2(v == 28.0,
"Values shall be the same");
56 v = lat.valueRounded(CAngleUnit::deg());
57 QVERIFY2(v == 30.0,
"Values shall be the same");
60 void CTestGeo::coordinateGeodetic()
64 QCOMPARE(calculateEuclideanDistance(northPole, southPole), 2.0);
66 QCOMPARE(calculateEuclideanDistance(northPole, equator), std::sqrt(2.0f));
69 double latValue = testCoordinate.
latitude().
value(CAngleUnit::deg());
70 double lngValue = testCoordinate.
longitude().
value(CAngleUnit::deg());
71 QVERIFY2(latValue == 90.0,
"Latitude value supposed to be 90");
72 QVERIFY2(lngValue == 0.0,
"Longitude value supposed to be 0");
73 CLatitude newLat(90.0, CAngleUnit::deg());
75 latValue = testCoordinate.
latitude().
value(CAngleUnit::deg());
76 QCOMPARE(latValue, newLat.value(CAngleUnit::deg()));
83 #include "testgeo.moc"
void setLatitude(const CLatitude &latitude)
Set latitude.
virtual CLatitude latitude() const
Latitude.
virtual CLongitude longitude() const
Longitude.
Physical unit angle (radians, degrees)
double value(MU unit) const
Value in given unit.
SWIFTTEST_APPLESS_MAIN(MiscTest::CTestGeo)
main