mirror of
https://gitlab.ibr.cs.tu-bs.de/tschuber/ns-3-leo.git
synced 2025-06-08 18:13:57 +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,
|
MakeDoubleAccessor (&LeoCircularOrbitMobilityModel::SetAltitude,
|
||||||
&LeoCircularOrbitMobilityModel::GetAltitude),
|
&LeoCircularOrbitMobilityModel::GetAltitude),
|
||||||
MakeDoubleChecker<double> ())
|
MakeDoubleChecker<double> ())
|
||||||
|
// TODO check value limits
|
||||||
.AddAttribute ("Inclination",
|
.AddAttribute ("Inclination",
|
||||||
"The inclination of the orbital plane in degrees",
|
"The inclination of the orbital plane in degrees",
|
||||||
DoubleValue (10.0),
|
DoubleValue (10.0),
|
||||||
|
@ -33,7 +34,7 @@ LeoCircularOrbitMobilityModel::GetTypeId ()
|
||||||
MakeDoubleChecker<double> ())
|
MakeDoubleChecker<double> ())
|
||||||
.AddAttribute ("Latitude",
|
.AddAttribute ("Latitude",
|
||||||
"The latitude at which the orital plane intersects the equatorial plane in degrees",
|
"The latitude at which the orital plane intersects the equatorial plane in degrees",
|
||||||
DoubleValue (10.0),
|
DoubleValue (0.0),
|
||||||
MakeDoubleAccessor (&LeoCircularOrbitMobilityModel::SetLatitude,
|
MakeDoubleAccessor (&LeoCircularOrbitMobilityModel::SetLatitude,
|
||||||
&LeoCircularOrbitMobilityModel::GetLatitude),
|
&LeoCircularOrbitMobilityModel::GetLatitude),
|
||||||
MakeDoubleChecker<double> ())
|
MakeDoubleChecker<double> ())
|
||||||
|
|
|
@ -13,7 +13,6 @@ class LeoOrbitSpeedTestCase : public TestCase
|
||||||
public:
|
public:
|
||||||
LeoOrbitSpeedTestCase () : TestCase ("Test speed for 0 altitude") {}
|
LeoOrbitSpeedTestCase () : TestCase ("Test speed for 0 altitude") {}
|
||||||
virtual ~LeoOrbitSpeedTestCase () {}
|
virtual ~LeoOrbitSpeedTestCase () {}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
virtual void DoRun (void)
|
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
|
class LeoOrbitTestSuite : TestSuite
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
LeoOrbitTestSuite() : TestSuite ("leo-orbit", UNIT) {
|
LeoOrbitTestSuite() : TestSuite ("leo-orbit", UNIT) {
|
||||||
AddTestCase (new LeoOrbitSpeedTestCase, TestCase::QUICK);
|
AddTestCase (new LeoOrbitSpeedTestCase, TestCase::QUICK);
|
||||||
|
AddTestCase (new LeoOrbitPositionTestCase, TestCase::QUICK);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue