mirror of
https://gitlab.ibr.cs.tu-bs.de/tschuber/ns-3-leo.git
synced 2025-06-08 10:03:58 +02:00
Add test for postion
This commit is contained in:
parent
0a9aa411ef
commit
4324bb5984
2 changed files with 19 additions and 2 deletions
|
@ -25,6 +25,7 @@ LeoCircularOrbitMobilityModel::GetTypeId ()
|
|||
MakeDoubleAccessor (&LeoCircularOrbitMobilityModel::SetAltitude,
|
||||
&LeoCircularOrbitMobilityModel::GetAltitude),
|
||||
MakeDoubleChecker<double> ())
|
||||
// TODO check value limits
|
||||
.AddAttribute ("Inclination",
|
||||
"The inclination of the orbital plane in degrees",
|
||||
DoubleValue (10.0),
|
||||
|
@ -33,7 +34,7 @@ LeoCircularOrbitMobilityModel::GetTypeId ()
|
|||
MakeDoubleChecker<double> ())
|
||||
.AddAttribute ("Latitude",
|
||||
"The latitude at which the orital plane intersects the equatorial plane in degrees",
|
||||
DoubleValue (10.0),
|
||||
DoubleValue (0.0),
|
||||
MakeDoubleAccessor (&LeoCircularOrbitMobilityModel::SetLatitude,
|
||||
&LeoCircularOrbitMobilityModel::GetLatitude),
|
||||
MakeDoubleChecker<double> ())
|
||||
|
|
|
@ -13,7 +13,6 @@ class LeoOrbitSpeedTestCase : public TestCase
|
|||
public:
|
||||
LeoOrbitSpeedTestCase () : TestCase ("Test speed for 0 altitude") {}
|
||||
virtual ~LeoOrbitSpeedTestCase () {}
|
||||
|
||||
private:
|
||||
virtual void DoRun (void)
|
||||
{
|
||||
|
@ -24,11 +23,28 @@ private:
|
|||
}
|
||||
};
|
||||
|
||||
class LeoOrbitPositionTestCase : public TestCase
|
||||
{
|
||||
public:
|
||||
LeoOrbitPositionTestCase () : TestCase ("Test position for 0 altitude and 0 inclination") {}
|
||||
virtual ~LeoOrbitPositionTestCase () {}
|
||||
private:
|
||||
virtual void DoRun (void)
|
||||
{
|
||||
Ptr<LeoCircularOrbitMobilityModel> mob = CreateObject<LeoCircularOrbitMobilityModel> ();
|
||||
mob->SetAttribute ("Altitude", DoubleValue (0.0));
|
||||
mob->SetAttribute ("Inclination", DoubleValue (1.0));
|
||||
|
||||
NS_TEST_ASSERT_MSG_EQ (mob->GetPosition ().GetLength(), LEO_EARTH_RAD_M, "Unexpected position on earths surface for 1 deg inclination");
|
||||
}
|
||||
};
|
||||
|
||||
class LeoOrbitTestSuite : TestSuite
|
||||
{
|
||||
public:
|
||||
LeoOrbitTestSuite() : TestSuite ("leo-orbit", UNIT) {
|
||||
AddTestCase (new LeoOrbitSpeedTestCase, TestCase::QUICK);
|
||||
AddTestCase (new LeoOrbitPositionTestCase, TestCase::QUICK);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue