diff --git a/src/mobility/test/geo-to-cartesian-test.cc b/src/mobility/test/geo-to-cartesian-test.cc index 126c6bd4a..06022c93d 100644 --- a/src/mobility/test/geo-to-cartesian-test.cc +++ b/src/mobility/test/geo-to-cartesian-test.cc @@ -486,9 +486,30 @@ const double ZWGS84_MATLAB[216] = {0, 0, 0, 0, 0, 0, 6043686.27224277, -1.55198002803211e-09, -1.55198002803211e-09}; +/** + * \ingroup mobility-test + * \defgroup mobility-test mobility module tests + */ + + +/** + * \ingroup mobility-test + * \ingroup tests + * + * \brief Geo To Cartesian Test Case + */ class GeoToCartesianTestCase : public TestCase { public: + /** + * Constructor + * + * \param latitude latitude + * \param longitude longitude + * \param altitude altitude + * \param sphType sphere type + * \param i index + */ GeoToCartesianTestCase (double latitude, double longitude, double altitude, @@ -498,15 +519,23 @@ public: private: virtual void DoRun (void); + /** + * Name function + * \param latitude the latitude + * \param longitude the longitude + * \param altitude the altitude + * \param sphType the sphere type + * \returns the name string + */ static std::string Name (double latitude, double longitude, double altitude, GeographicPositions::EarthSpheroidType sphType); - double m_latitude; - double m_longitude; - double m_altitude; - GeographicPositions::EarthSpheroidType m_sphType; - int m_i; + double m_latitude; ///< latitude + double m_longitude; ///< longitude + double m_altitude; ///< altitude + GeographicPositions::EarthSpheroidType m_sphType; ///< spheroid type + int m_i; ///< index }; std::string @@ -604,7 +633,12 @@ GeoToCartesianTestCase::DoRun (void) } } - +/** + * \ingroup mobility-test + * \ingroup tests + * + * \brief Geo To Cartesian Test Suite + */ class GeoToCartesianTestSuite : public TestSuite { public: diff --git a/src/mobility/test/mobility-test-suite.cc b/src/mobility/test/mobility-test-suite.cc index c843d28b9..2ed026316 100644 --- a/src/mobility/test/mobility-test-suite.cc +++ b/src/mobility/test/mobility-test-suite.cc @@ -34,8 +34,13 @@ using namespace ns3; -// Test whether course change notifications occur regardless of calls -// to Update() position (which are triggered by calls to GetPosition()) +/** + * \ingroup mobility-test + * \ingroup tests + * + * \brief Test whether course change notifications occur regardless of calls + * to Update() position (which are triggered by calls to GetPosition()) + */ class WaypointLazyNotifyFalse : public TestCase { public: @@ -43,12 +48,21 @@ public: virtual ~WaypointLazyNotifyFalse (); private: + /** + * Test X position function + * \param expectedXPos the expected X position + */ void TestXPosition (double expectedXPos); + /** + * Course change callback + * \param path the path + * \param model the mobility model + */ void CourseChangeCallback (std::string path, Ptr model); virtual void DoRun (void); - Ptr m_node; - Ptr m_mob; - int m_courseChanges; + Ptr m_node; ///< mode + Ptr m_mob; ///< modility model + int m_courseChanges; ///< course changes }; WaypointLazyNotifyFalse::WaypointLazyNotifyFalse () @@ -95,6 +109,12 @@ WaypointLazyNotifyFalse::DoRun (void) Simulator::Destroy (); } +/** + * \ingroup mobility-test + * \ingroup tests + * + * \brief Waypoint Lazy Notify True + */ class WaypointLazyNotifyTrue : public TestCase { public: @@ -102,11 +122,20 @@ public: virtual ~WaypointLazyNotifyTrue (); private: + /** + * Text X position function + * \param expectedXPos the expected X position + */ void TestXPosition (double expectedXPos); + /** + * Course change callback + * \param path the path + * \param model the mobility model + */ void CourseChangeCallback (std::string path, Ptr model); virtual void DoRun (void); - Ptr m_node; - Ptr m_mob; + Ptr m_node; ///< node + Ptr m_mob; ///< modility model }; WaypointLazyNotifyTrue::WaypointLazyNotifyTrue () @@ -152,6 +181,12 @@ WaypointLazyNotifyTrue::DoRun (void) Simulator::Destroy (); } +/** + * \ingroup mobility-test + * \ingroup tests + * + * \brief Waypoint Initial Position Is Waypoint Test + */ class WaypointInitialPositionIsWaypoint : public TestCase { public: @@ -159,14 +194,24 @@ public: virtual ~WaypointInitialPositionIsWaypoint (); private: + /** + * Text X position function + * \param model the mobility model + * \param expectedXPos the expected X position + */ void TestXPosition (Ptr model, double expectedXPos); + /** + * Test number of way points + * \param model the mobility model + * \param num the number of way points + */ void TestNumWaypoints (Ptr model, uint32_t num); virtual void DoRun (void); - Ptr m_mob1; - Ptr m_mob2; - Ptr m_mob3; - Ptr m_mob4; - Ptr m_mob5; + Ptr m_mob1; ///< mobility model 1 + Ptr m_mob2; ///< mobility model 2 + Ptr m_mob3; ///< mobility model 3 + Ptr m_mob4; ///< mobility model 4 + Ptr m_mob5; ///< mobility model 5 }; WaypointInitialPositionIsWaypoint::WaypointInitialPositionIsWaypoint () @@ -276,6 +321,12 @@ WaypointInitialPositionIsWaypoint::DoRun (void) Simulator::Destroy (); } +/** + * \ingroup mobility-test + * \ingroup tests + * + * \brief Waypoint Mobility Model Via Helper Test + */ class WaypointMobilityModelViaHelper : public TestCase { public: @@ -283,6 +334,11 @@ public: virtual ~WaypointMobilityModelViaHelper (); private: + /** + * Text X position function + * \param mob the mobility model + * \param expectedXPos the expected X position + */ void TestXPosition (Ptr mob, double expectedXPos); virtual void DoRun (void); }; @@ -354,6 +410,12 @@ WaypointMobilityModelViaHelper::DoRun (void) Simulator::Destroy (); } +/** + * \ingroup mobility-test + * \ingroup tests + * + * \brief Mobility Test Suite + */ class MobilityTestSuite : public TestSuite { public: @@ -369,4 +431,4 @@ MobilityTestSuite::MobilityTestSuite () AddTestCase (new WaypointMobilityModelViaHelper, TestCase::QUICK); } -static MobilityTestSuite mobilityTestSuite; +static MobilityTestSuite mobilityTestSuite; ///< the test suite diff --git a/src/mobility/test/mobility-trace-test-suite.cc b/src/mobility/test/mobility-trace-test-suite.cc index 13addc92c..612fee9fe 100644 --- a/src/mobility/test/mobility-trace-test-suite.cc +++ b/src/mobility/test/mobility-trace-test-suite.cc @@ -35,12 +35,12 @@ using namespace ns3; -//=========================================================================== -// Class: MobilityTraceTestCase -// -// -// Test case. -//=========================================================================== +/** + * \ingroup mobility-test + * \ingroup tests + * + * \brief Mobility Trace Test Case + */ class MobilityTraceTestCase : public TestCase { @@ -107,12 +107,12 @@ MobilityTraceTestCase::DoRun (void) } -//=========================================================================== -// Class: MobilityTraceTestSuite -// -// -// Test suite. -//=========================================================================== +/** + * \ingroup mobility-test + * \ingroup tests + * + * \brief Mobility Trace Test Suite + */ class MobilityTraceTestSuite : public TestSuite { @@ -126,4 +126,4 @@ MobilityTraceTestSuite::MobilityTraceTestSuite () AddTestCase (new MobilityTraceTestCase, TestCase::QUICK); } -static MobilityTraceTestSuite mobilityTraceTestSuite; +static MobilityTraceTestSuite mobilityTraceTestSuite; ///< the test suite diff --git a/src/mobility/test/ns2-mobility-helper-test-suite.cc b/src/mobility/test/ns2-mobility-helper-test-suite.cc index e990ace44..3e34aeffa 100644 --- a/src/mobility/test/ns2-mobility-helper-test-suite.cc +++ b/src/mobility/test/ns2-mobility-helper-test-suite.cc @@ -74,7 +74,10 @@ bool AreVectorsEqual (Vector const & actual, Vector const & limit, double tol) } /** - * Every test case is supposed to: + * \ingroup mobility-test + * \ingroup tests + * + * \brief Every test case is supposed to: * 1. Generate short mobility trace file * 2. Read it back using Ns2MobilityHelper * 3. Check initial node positions and speeds. @@ -91,6 +94,14 @@ public: Vector pos; ///< reference position Vector vel; ///< reference velocity + /** + * Constructor + * + * \param id reference ID + * \param t time + * \param p position + * \param v velocity + */ ReferencePoint (std::string const & id, Time t, Vector const & p, Vector const & v) : node (id), time (t), @@ -255,7 +266,12 @@ private: } }; -/// The test suite +/** + * \ingroup mobility-test + * \ingroup tests + * + * \brief The test suite + */ class Ns2MobilityHelperTestSuite : public TestSuite { public: @@ -517,4 +533,4 @@ public: AddTestCase (t, TestCase::QUICK); } -} g_ns2TransmobilityHelperTestSuite; +} g_ns2TransmobilityHelperTestSuite; ///< the test suite diff --git a/src/mobility/test/rand-cart-around-geo-test.cc b/src/mobility/test/rand-cart-around-geo-test.cc index 5babe54f9..a7d5df7de 100644 --- a/src/mobility/test/rand-cart-around-geo-test.cc +++ b/src/mobility/test/rand-cart-around-geo-test.cc @@ -46,16 +46,34 @@ NS_LOG_COMPONENT_DEFINE ("RandCartAroundGeoTest"); using namespace ns3; -// 0.1 meter tolerance for testing, which is very small compared to the maximum -// distances from origin being tested +/** + * 0.1 meter tolerance for testing, which is very small compared to the maximum + * distances from origin being tested + */ const double TOLERANCE = 0.1; -// earth's radius in meters if modeled as a perfect sphere +/// earth's radius in meters if modeled as a perfect sphere static const double EARTH_RADIUS = 6371e3; +/** + * \ingroup mobility-test + * \ingroup tests + * + * \brief Rand Cart Around Geo Test Case + */ class RandCartAroundGeoTestCase : public TestCase { public: + /** + * Constructor + * + * \param originLatitude origin latitude + * \param originLongitude origin longitude + * \param maxAltitude maximum altitude + * \param numPoints number of points + * \param maxDistFromOrigin maximum distance from origin + * \param uniRand random variable + */ RandCartAroundGeoTestCase (double originLatitude, double originLongitude, double maxAltitude, @@ -66,15 +84,22 @@ public: private: virtual void DoRun (void); + /** + * name function + * \param originLatitude the origin latitude + * \param originLongitude the origin longitude + * \param maxDistFromOrigin the maximum distance from the origin + * \returns the name string + */ static std::string Name (double originLatitude, double originLongitude, double maxDistFromOrigin); - double m_originLatitude; - double m_originLongitude; - double m_maxAltitude; - int m_numPoints; - double m_maxDistFromOrigin; - Ptr m_uniRand; + double m_originLatitude; ///< origin latitude + double m_originLongitude; ///< origin longitude + double m_maxAltitude; ///< maximum altitude + int m_numPoints; ///< number of points + double m_maxDistFromOrigin; ///< maximum distance from origin + Ptr m_uniRand; ///< random number }; std::string @@ -143,7 +168,12 @@ RandCartAroundGeoTestCase::DoRun (void) } } - +/** + * \ingroup mobility-test + * \ingroup tests + * + * \brief Rand Cart Around Geo Test Suite + */ class RandCartAroundGeoTestSuite : public TestSuite { public: @@ -174,4 +204,4 @@ RandCartAroundGeoTestSuite::RandCartAroundGeoTestSuite () } } -static RandCartAroundGeoTestSuite g_RandCartAroundGeoTestSuite; +static RandCartAroundGeoTestSuite g_RandCartAroundGeoTestSuite; ///< the test suite diff --git a/src/mobility/test/steady-state-random-waypoint-mobility-model-test.cc b/src/mobility/test/steady-state-random-waypoint-mobility-model-test.cc index 6e5b2cd12..073b5c31a 100644 --- a/src/mobility/test/steady-state-random-waypoint-mobility-model-test.cc +++ b/src/mobility/test/steady-state-random-waypoint-mobility-model-test.cc @@ -28,6 +28,12 @@ using namespace ns3; +/** + * \ingroup mobility-test + * \ingroup tests + * + * \brief Steady State Random Waypoint Test + */ class SteadyStateRandomWaypointTest : public TestCase { public: @@ -36,11 +42,12 @@ public: virtual ~SteadyStateRandomWaypointTest () {} private: - std::vector > mobilityStack; - double count; + std::vector > mobilityStack; ///< modility model + double count; ///< count private: virtual void DoRun (void); virtual void DoTeardown (void); + /// Distribution compare function void DistribCompare (); }; @@ -137,10 +144,16 @@ SteadyStateRandomWaypointTest::DistribCompare () NS_TEST_EXPECT_MSG_EQ_TOL (dev_v, 4.4, 0.22, "Got unexpected velocity standard deviation"); } +/** + * \ingroup mobility-test + * \ingroup tests + * + * \brief Steady State Random Waypoint Test Suite + */ struct SteadyStateRandomWaypointTestSuite : public TestSuite { SteadyStateRandomWaypointTestSuite () : TestSuite ("steady-state-rwp-mobility-model", UNIT) { AddTestCase (new SteadyStateRandomWaypointTest, TestCase::QUICK); } -} g_steadyStateRandomWaypointTestSuite; +} g_steadyStateRandomWaypointTestSuite; ///< the test suite diff --git a/src/mobility/test/waypoint-mobility-model-test.cc b/src/mobility/test/waypoint-mobility-model-test.cc index e2c0b4500..1fcbbd8c5 100644 --- a/src/mobility/test/waypoint-mobility-model-test.cc +++ b/src/mobility/test/waypoint-mobility-model-test.cc @@ -26,9 +26,20 @@ using namespace ns3; +/** + * \ingroup mobility-test + * \ingroup tests + * + * \brief Waypoint Mobility Model Notify Test + */ class WaypointMobilityModelNotifyTest : public TestCase { public: + /** + * Constructor + * + * \param lazy lazy? + */ WaypointMobilityModelNotifyTest (bool lazy) : TestCase (lazy ? "Check Waypoint Mobility Model LAZY notification accuracy" : "Check Waypoint Mobility Model NON-LAZY notification accuracy"), @@ -40,15 +51,20 @@ public: } private: - std::vector > mobilityStack; - uint32_t mobilityCount; - uint32_t waypointCount; - std::deque waypoints; - bool lazyNotify; + std::vector > mobilityStack; ///< mobilty model + uint32_t mobilityCount; ///< mobility count + uint32_t waypointCount; ///< waypoint count + std::deque waypoints; ///< waypoints + bool lazyNotify; ///< lazy notify? private: virtual void DoRun (void); virtual void DoTeardown (void); + /// Force updates void ForceUpdates (void); + /** + * Course cange callback + * \param model the mobility model + */ void CourseChangeCallback (Ptr model); }; @@ -145,6 +161,12 @@ WaypointMobilityModelNotifyTest::CourseChangeCallback (Ptr } } +/** + * \ingroup mobility-test + * \ingroup tests + * + * \brief Waypoint Mobility Model Add Waypoint Test + */ class WaypointMobilityModelAddWaypointTest : public TestCase { public: @@ -157,13 +179,17 @@ public: } private: - Ptr m_mobilityModel; - uint32_t m_waypointCount; - uint32_t m_waypointCounter; - Waypoint m_nextWaypoint; + Ptr m_mobilityModel; ///< mobility model + uint32_t m_waypointCount; ///< waypoint count + uint32_t m_waypointCounter; ///< waypoint counter + Waypoint m_nextWaypoint; ///< next waypoint private: virtual void DoRun (void); virtual void DoTeardown (void); + /** + * Course change calback + * \param model the mobility model + */ void CourseChangeCallback (Ptr model); }; @@ -219,6 +245,12 @@ WaypointMobilityModelAddWaypointTest::CourseChangeCallback (Ptr