20#include <ns3/antenna-model.h>
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(),
208 std::numeric_limits<double>::max()};
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)
302 TestCase::Duration::QUICK);
304 TestCase::Duration::QUICK);
306 TestCase::Duration::QUICK);
308 TestCase::Duration::QUICK);
310 TestCase::Duration::QUICK);
312 TestCase::Duration::QUICK);
315 TestCase::Duration::QUICK);
317 TestCase::Duration::QUICK);
319 TestCase::Duration::QUICK);
321 TestCase::Duration::QUICK);
323 TestCase::Duration::QUICK);
325 TestCase::Duration::QUICK);
328 TestCase::Duration::QUICK);
330 TestCase::Duration::QUICK);
332 TestCase::Duration::QUICK);
334 TestCase::Duration::QUICK);
336 TestCase::Duration::QUICK);
338 TestCase::Duration::QUICK);
340 TestCase::Duration::QUICK);
342 TestCase::Duration::QUICK);
344 TestCase::Duration::QUICK);
346 TestCase::Duration::QUICK);
348 TestCase::Duration::QUICK);
350 TestCase::Duration::QUICK);
354 TestCase::Duration::QUICK);
357 TestCase::Duration::QUICK);
360 TestCase::Duration::QUICK);
363 TestCase::Duration::QUICK);
367 TestCase::Duration::QUICK);
370 TestCase::Duration::QUICK);
373 TestCase::Duration::QUICK);
377 TestCase::Duration::QUICK);
379 TestCase::Duration::QUICK);
382 TestCase::Duration::QUICK);
386 TestCase::Duration::QUICK);
389 TestCase::Duration::QUICK);
392 TestCase::Duration::QUICK);
396 TestCase::Duration::QUICK);
398 TestCase::Duration::QUICK);
401 TestCase::Duration::QUICK);
405 TestCase::Duration::QUICK);
408 TestCase::Duration::QUICK);
411 TestCase::Duration::QUICK);
415 TestCase::Duration::QUICK);
418 TestCase::Duration::QUICK);
421 Angles(M_PI, 3 * M_PI_4)),
422 TestCase::Duration::QUICK);
425 Angles(3 * M_PI_4, M_PI_2)),
426 TestCase::Duration::QUICK);
429 Angles(-3 * M_PI_4, M_PI_2)),
430 TestCase::Duration::QUICK);
433 TestCase::Duration::QUICK);
436 Angles(M_PI_2, 3 * M_PI_4)),
437 TestCase::Duration::QUICK);
441 TestCase::Duration::QUICK);
444 Angles(-M_PI_2, 3 * M_PI_4)),
445 TestCase::Duration::QUICK);
450 TestCase::Duration::QUICK);
453 Angles(M_PI_4, 3 * M_PI_4)),
454 TestCase::Duration::QUICK);
458 TestCase::Duration::QUICK);
461 Angles(3 * M_PI_4, M_PI_4)),
462 TestCase::Duration::QUICK);
466 TestCase::Duration::QUICK);
469 TestCase::Duration::QUICK);
472 TestCase::Duration::QUICK);
476 TestCase::Duration::QUICK);
478 TestCase::Duration::QUICK);
481 TestCase::Duration::QUICK);
485 TestCase::Duration::QUICK);
488 TestCase::Duration::QUICK);
492 TestCase::Duration::QUICK);
496 TestCase::Duration::QUICK);
499 Angles(3 * M_PI_4, M_PI_2)),
500 TestCase::Duration::QUICK);
504 Angles(M_PI_4, 3 * M_PI_4)),
505 TestCase::Duration::QUICK);
507 Vector(-0.5, 12.45, -1),
509 TestCase::Duration::QUICK);
515 TestCase::Duration::QUICK);
517 TestCase::Duration::QUICK);
520 TestCase::Duration::QUICK);
522 TestCase::Duration::QUICK);
526 TestCase::Duration::QUICK);
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... methods (WrapTo180, WrapTo360, WrapToPi, and WrapTo2Pi) by using a ...
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, Duration duration=Duration::QUICK)
Add an individual child TestCase to this test suite.
#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