27 #include "../utils/satellite-env-variables.h"
29 #include "ns3/geo-coordinate.h"
31 #include "ns3/simulator.h"
32 #include "ns3/singleton.h"
39 #ifdef PRINT_POSITION_INFO
46 std::cout.setf(std::ios::fixed, std::ios::floatfield);
47 std::cout.precision(15);
51 << pos2.x <<
", y=" << pos2.y <<
", z=" << pos2.z
67 virtual void DoRun(
void);
72 : TestCase(
"Test Geo Coordinate correctness")
87 Singleton<SatEnvVariables>::Get()->DoInitialize();
88 Singleton<SatEnvVariables>::Get()->SetOutputVariables(
"test-geo-coordinate",
"",
true);
90 for (
int i = -180; i <= 180; i += 30)
97 position1 =
GeoCoordinate(i / 2, i, i * 30, GeoCoordinate::SPHERE);
102 position1 =
GeoCoordinate(i / 2, i, i * 30, GeoCoordinate::WGS84);
107 position1 =
GeoCoordinate(i / 2, i, i * 30, GeoCoordinate::GRS80);
113 Singleton<SatEnvVariables>::Get()->DoDispose();
119 double altDiff, lonDiff, latDiff = 0;
120 bool altSignSame, lonSignSame, latSignSame =
false;
122 #ifdef PRINT_POSITION_INFO
123 PrintPositionInfo(position1);
124 PrintPositionInfo(position2);
136 NS_TEST_ASSERT_MSG_LT(altDiff, 0.0001,
"Altitude difference too big!");
137 NS_TEST_ASSERT_MSG_LT(lonDiff, 0.0001,
"Longitude difference too big!");
138 NS_TEST_ASSERT_MSG_LT(latDiff, 0.0001,
"Latitude difference too big!");
140 NS_TEST_ASSERT_MSG_EQ(altSignSame,
true,
"Altitude signs are different.");
141 NS_TEST_ASSERT_MSG_EQ(lonSignSame,
true,
"Longitude signs are different.");
142 NS_TEST_ASSERT_MSG_EQ(latSignSame,
true,
"Latitude signs are different.");
155 : TestSuite(
"geo-coordinate-test", UNIT)
Test case to unit test that GeoCoordinate can be created with valid values.
void Validate(GeoCoordinate &coord1, GeoCoordinate &coord2)
virtual ~GeoCoordinateTestCase()
Test suite for GeoCoordinate unit test cases.
GeoCoordinate class is used to store and operate with geodetic coordinates.
double GetAltitude() const
Gets altitude value of coordinate.
double GetLatitude() const
Gets latitude value of coordinate.
ReferenceEllipsoid_t GetRefEllipsoid()
Gets reference ellipsoid used by GeoCoordinate object.
double GetLongitude() const
Gets longitude value of coordinate.
Vector ToVector() const
Converts Geodetic coordinates to Cartesian coordinates.
SatArqSequenceNumber is handling the sequence numbers for the ARQ process.
static GeoCoordinateTestSuite geoCoordinateTestSuite