27 #include "../utils/satellite-env-variables.h"
29 #include "ns3/geo-coordinate.h"
31 #include "ns3/simulator.h"
32 #include "ns3/singleton.h"
41 #ifdef PRINT_POSITION_INFO
48 std::cout.setf(std::ios::fixed, std::ios::floatfield);
49 std::cout.precision(15);
53 << pos2.x <<
", y=" << pos2.y <<
", z=" << pos2.z
69 virtual void DoRun(
void);
74 : TestCase(
"Test Geo Coordinate correctness")
89 Singleton<SatEnvVariables>::Get()->DoInitialize();
90 Singleton<SatEnvVariables>::Get()->SetOutputVariables(
"test-geo-coordinate",
"",
true);
92 for (
int i = -180; i <= 180; i += 30)
99 position1 =
GeoCoordinate(i / 2, i, i * 30, GeoCoordinate::SPHERE);
104 position1 =
GeoCoordinate(i / 2, i, i * 30, GeoCoordinate::WGS84);
109 position1 =
GeoCoordinate(i / 2, i, i * 30, GeoCoordinate::GRS80);
115 Singleton<SatEnvVariables>::Get()->DoDispose();
121 double altDiff, lonDiff, latDiff = 0;
122 bool altSignSame, lonSignSame, latSignSame =
false;
124 #ifdef PRINT_POSITION_INFO
125 PrintPositionInfo(position1);
126 PrintPositionInfo(position2);
138 NS_TEST_ASSERT_MSG_LT(altDiff, 0.0001,
"Altitude difference too big!");
139 NS_TEST_ASSERT_MSG_LT(lonDiff, 0.0001,
"Longitude difference too big!");
140 NS_TEST_ASSERT_MSG_LT(latDiff, 0.0001,
"Latitude difference too big!");
142 NS_TEST_ASSERT_MSG_EQ(altSignSame,
true,
"Altitude signs are different.");
143 NS_TEST_ASSERT_MSG_EQ(lonSignSame,
true,
"Longitude signs are different.");
144 NS_TEST_ASSERT_MSG_EQ(latSignSame,
true,
"Latitude signs are different.");
157 : TestSuite(
"geo-coordinate-test", Type::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