20 #include <ns3/antenna-model.h>
44 static std::string BuildNameString(Vector v);
53 void DoRun()
override;
62 std::ostringstream oss;
106 void DoRun()
override;
116 std::ostringstream oss;
117 oss <<
" v = " << v <<
", o = " << o;
154 static std::string
BuildNameString(
double lowerBound,
double upperBound);
171 void DoRun()
override;
181 std::ostringstream oss;
182 oss <<
"WrapTo [" << lowerBound <<
", " << upperBound <<
")";
189 :
TestCase(BuildNameString(lowerBound, upperBound)),
191 m_lowerBound(lowerBound),
192 m_upperBound(upperBound)
206 constexpr
int STEP_NUM = 100;
207 double directions[] = {std::numeric_limits<double>::lowest(),
209 for (
double dir : directions)
212 for (
double x = wrapPoint; i < STEP_NUM;
x = std::nextafter(
x,
dir), ++i)
218 "Invalid wrap (too low) " <<
x <<
" maps to " << result <<
" and "
222 "Invalid wrap (too high) " <<
x <<
" maps to " << result
252 void DoRun()
override;
262 std::ostringstream oss;
263 oss <<
"Wrap " << angle <<
" to " << wrappedAngle;
270 :
TestCase(BuildNameString(angle, wrappedAngle)),
273 m_wrappedAngle(wrappedAngle)
419 Angles(M_PI, 3 * M_PI_4)),
423 Angles(3 * M_PI_4, M_PI_2)),
427 Angles(-3 * M_PI_4, M_PI_2)),
434 Angles(M_PI_2, 3 * M_PI_4)),
442 Angles(-M_PI_2, 3 * M_PI_4)),
451 Angles(M_PI_4, 3 * M_PI_4)),
459 Angles(3 * M_PI_4, M_PI_4)),
497 Angles(3 * M_PI_4, M_PI_2)),
502 Angles(M_PI_4, 3 * M_PI_4)),
505 Vector(-0.5, 12.45, -1),
Angles Test using one vector for initialization.
void DoRun() override
Implementation to actually run this TestCase.
OneVectorConstructorTestCase(Vector v, Angles a)
Constructor.
static std::string BuildNameString(Vector v)
Build the test name.
Angles Test using two vectors for initialization.
TwoVectorsConstructorTestCase(Vector v, Vector o, Angles a)
Constructor.
void DoRun() override
Implementation to actually run this TestCase.
static std::string BuildNameString(Vector v, Vector o)
Build the test name.
Test the output for WrapToRangeFunction.
WrapToRangeFunctionalTestCase(WrapToRangeFunction wrapper, double angle, double wrappedAngle)
Constructor.
double m_angle
the input angle
double m_wrappedAngle
the expected wrapper angle
static std::string BuildNameString(double angle, double wrappedAngle)
Build the test name.
void DoRun() override
Implementation to actually run this TestCase.
WrapToRangeFunction m_wrapper
the wrapper function
Test bounds for various WrapTo...
void CheckWrappingPoint(double wrapPoint)
The given wrapper shall wrap an angle into the expected range.
double m_lowerBound
the corresponding lower bound
WrapToRangeFunction m_wrapper
the wrapper function
WrapToRangeTestCase(WrapToRangeFunction wrapper, double lowerBound, double upperBound)
Constructor.
void DoRun() override
Implementation to actually run this TestCase.
static std::string BuildNameString(double lowerBound, double upperBound)
Build the test name.
double m_upperBound
the corresponding upper bound
Class holding the azimuth and inclination angles of spherical coordinates.
double GetInclination() const
Getter for inclination angle.
double GetAzimuth() const
Getter for azimuth angle.
void AddTestCase(TestCase *testCase, TestDuration duration=QUICK)
Add an individual child TestCase to this test suite.
Vector3D Vector
Vector alias typedef for compatibility with mobility models.
#define NS_TEST_EXPECT_MSG_EQ(actual, limit, msg)
Test that an actual and expected (limit) value are equal and report if not.
#define NS_TEST_EXPECT_MSG_EQ_TOL(actual, limit, tol, msg)
Test that actual and expected (limit) values are equal to plus or minus some tolerance and report if ...
Every class exported by the ns3 library is enclosed in the ns3 namespace.
double WrapToPi(double a)
Wrap angle in [-M_PI, M_PI)
double WrapTo180(double a)
Wrap angle in [-180, 180)
double WrapTo360(double a)
Wrap angle in [0, 360)
double WrapTo2Pi(double a)
Wrap angle in [0, 2*M_PI)
static AnglesTestSuite g_staticAnglesTestSuiteInstance
Static variable for test initialization.
std::function< double(double)> WrapToRangeFunction