diff --git a/test/isl-propagation-test-suite.cc b/test/isl-propagation-test-suite.cc index c7a1c74..d7bb072 100644 --- a/test/isl-propagation-test-suite.cc +++ b/test/isl-propagation-test-suite.cc @@ -7,68 +7,42 @@ using namespace ns3; +#define EARTH_RAD 6.3781e6 + class IslPropagationAngleTestCase1 : public TestCase { public: - IslPropagationAngleTestCase1 (); - virtual ~IslPropagationAngleTestCase1 (); - + IslPropagationAngleTestCase1 () : TestCase ("neighboring sats have line-of-sight") {} + virtual ~IslPropagationAngleTestCase1 () {} private: - virtual void DoRun (void); + void DoRun (void) + { + Ptr a = CreateObject (); + a->SetPosition (Vector3D (EARTH_RAD + 1.0e6, 10, 0)); + Ptr b = CreateObject (); + b->SetPosition (Vector3D (EARTH_RAD + 1.0e6, 0, 0)); + + NS_TEST_ASSERT_MSG_EQ (IslPropagationLossModel::GetLos (a, b), true, "no line-of-sight"); + } }; -IslPropagationAngleTestCase1::IslPropagationAngleTestCase1 () - : TestCase ("Test LOS computation neighboring sats") -{ -} - -IslPropagationAngleTestCase1::~IslPropagationAngleTestCase1 () -{ -} - -#define EARTH_RAD 6.3781e6 - -void -IslPropagationAngleTestCase1::DoRun (void) -{ - Ptr a = CreateObject (); - a->SetPosition (Vector3D (EARTH_RAD + 1.0e6, 10, 0)); - Ptr b = CreateObject (); - b->SetPosition (Vector3D (EARTH_RAD + 1.0e6, 0, 0)); - - NS_TEST_ASSERT_MSG_EQ (IslPropagationLossModel::GetLos (a, b), true, "LOS of neighboring satellites"); -} - class IslPropagationAngleTestCase2 : public TestCase { public: - IslPropagationAngleTestCase2 (); - virtual ~IslPropagationAngleTestCase2 (); - + IslPropagationAngleTestCase2 () : TestCase ("satellites on opposing sites of earth have no line-of-sight") {} + virtual ~IslPropagationAngleTestCase2 () {} private: - virtual void DoRun (void); + virtual void DoRun (void) + { + Ptr a = CreateObject (); + a->SetPosition (Vector3D (EARTH_RAD + 1.0e6, 0, 0)); + Ptr b = CreateObject (); + b->SetPosition (Vector3D (- (EARTH_RAD + 1.0e6), 0, 0)); + + NS_TEST_ASSERT_MSG_EQ (IslPropagationLossModel::GetLos (a, b), false, "line-of-sight"); + } }; -IslPropagationAngleTestCase2::IslPropagationAngleTestCase2 () - : TestCase ("Test LOS of sats without LOS") -{ -} - -IslPropagationAngleTestCase2::~IslPropagationAngleTestCase2 () -{ -} - -void -IslPropagationAngleTestCase2::DoRun (void) -{ - Ptr a = CreateObject (); - a->SetPosition (Vector3D (EARTH_RAD + 1.0e6, 0, 0)); - Ptr b = CreateObject (); - b->SetPosition (Vector3D (- (EARTH_RAD + 1.0e6), 0, 0)); - - NS_TEST_ASSERT_MSG_EQ (IslPropagationLossModel::GetLos (a, b), false, "LOS of opposing"); -} - class IslPropagationTestSuite : public TestSuite { public: