Add test for position after some time

This commit is contained in:
Tim Schubert 2020-08-14 22:34:49 +02:00
parent 4324bb5984
commit 9dddf5ad20

View file

@ -39,12 +39,38 @@ private:
} }
}; };
class LeoOrbitProgressTestCase : public TestCase
{
public:
LeoOrbitProgressTestCase () : TestCase ("Test position for 0 altitude and 0 inclination after 60 seconds") {}
virtual ~LeoOrbitProgressTestCase () {}
private:
void TestLengthPosition (double expected, Ptr<LeoCircularOrbitMobilityModel> mob)
{
Vector pos = mob->GetPosition ();
NS_TEST_EXPECT_MSG_EQ_TOL_INTERNAL (pos.GetLength (), expected, 0.001, "Position not equal", __FILE__, __LINE__);
}
virtual void DoRun (void)
{
Ptr<LeoCircularOrbitMobilityModel> mob = CreateObject<LeoCircularOrbitMobilityModel> ();
mob->SetAttribute ("Altitude", DoubleValue (0.0));
mob->SetAttribute ("Inclination", DoubleValue (1.0));
Simulator::Schedule (Seconds (360.0), &LeoOrbitProgressTestCase::TestLengthPosition, this, LEO_EARTH_RAD_M, mob);
Simulator::Run ();
Simulator::Destroy ();
}
};
// TODO offset
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); AddTestCase (new LeoOrbitPositionTestCase, TestCase::QUICK);
AddTestCase (new LeoOrbitProgressTestCase, TestCase::QUICK);
} }
}; };