Add test for postion

This commit is contained in:
Tim Schubert 2020-08-14 22:08:25 +02:00
parent 0a9aa411ef
commit 4324bb5984
2 changed files with 19 additions and 2 deletions

View file

@ -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);
}
};