24 #include <ns3/geographic-positions.h>
60 double originLongitude,
63 double maxDistFromOrigin,
68 virtual void DoRun (
void);
69 static std::string
Name (
double originLatitude,
70 double originLongitude,
71 double maxDistFromOrigin);
82 double originLongitude,
83 double maxDistFromOrigin)
85 std::ostringstream oss;
86 oss <<
"origin latitude = " << originLatitude <<
" degrees, "
87 <<
"origin longitude = " << originLongitude <<
" degrees, "
88 <<
"max distance from origin = " << maxDistFromOrigin;
93 double originLongitude,
96 double maxDistFromOrigin,
98 :
TestCase (
Name (originLatitude, originLongitude, maxDistFromOrigin)),
99 m_originLatitude (originLatitude),
100 m_originLongitude (originLongitude),
101 m_maxAltitude (maxAltitude),
102 m_numPoints (numPoints),
103 m_maxDistFromOrigin (maxDistFromOrigin),
115 std::list<Vector> points = GeographicPositions::RandCartesianPointsAroundGeographicPoint (
m_originLatitude,
121 Vector origin = GeographicPositions::GeographicToCartesianCoordinates (
m_originLatitude,
124 GeographicPositions::SPHERE);
126 while (!points.empty ())
128 randPoint = points.front ();
132 double straightDistFromOrigin = sqrt (pow (randPoint.x - origin.x, 2) +
133 pow (randPoint.y - origin.y, 2) +
134 pow (randPoint.z - origin.z, 2));
141 "random point (" << randPoint.x <<
", " << randPoint.y
142 <<
", " << randPoint.z <<
") is outside of max radius from origin");
154 :
TestSuite (
"rand-cart-around-geo", UNIT)
156 NS_LOG_INFO (
"creating RandCartAroundGeoTestSuite");
159 for (
double originLatitude = -89.9; originLatitude <= 89.9; originLatitude += 35.96)
161 for (
double originLongitude = 0; originLongitude <= 360; originLongitude += 72)
163 for (
double maxDistFromOrigin = 1000; maxDistFromOrigin <= 1000000; maxDistFromOrigin *= 10)
virtual void DoRun(void)
Implementation to actually run this TestCase.
void SetStream(int64_t stream)
Specifies the stream number for this RNG stream.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
#define NS_LOG_INFO(msg)
Use NS_LOG to output a message of level LOG_INFO.
RandCartAroundGeoTestCase(double originLatitude, double originLongitude, double maxAltitude, int numPoints, double maxDistFromOrigin, Ptr< UniformRandomVariable > uniRand)
virtual ~RandCartAroundGeoTestCase()
static std::string Name(std::string str, uint32_t totalStreamSize, uint32_t sourceWriteSize, uint32_t serverReadSize, uint32_t serverWriteSize, uint32_t sourceReadSize, bool useIpv6)
void AddTestCase(TestCase *testCase, enum TestDuration duration)
Add an individual child TestCase to this test suite.
static std::string Name(double originLatitude, double originLongitude, double maxDistFromOrigin)
Every class exported by the ns3 library is enclosed in the ns3 namespace.
static RandCartAroundGeoTestSuite g_RandCartAroundGeoTestSuite
static const double EARTH_RADIUS
Ptr< UniformRandomVariable > m_uniRand
static const double EARTH_RADIUS
RandCartAroundGeoTestSuite()
static const double TOLERANCE
double m_maxDistFromOrigin
#define NS_TEST_ASSERT_MSG_LT(actual, limit, msg)
Test that an actual value is less than a limit and report and abort if not.