X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=test%2Foran-interface-test-suite.cc;fp=test%2Foran-interface-test-suite.cc;h=fa33f64cded6f49fe34cf300b382cc86f720fe90;hb=8585bec317470bd91aa09d3274748af569ec5b75;hp=0000000000000000000000000000000000000000;hpb=240b99b7058fa8e961b36911746848a1b6b618b3;p=sim%2Fns3-o-ran-e2.git diff --git a/test/oran-interface-test-suite.cc b/test/oran-interface-test-suite.cc new file mode 100644 index 0000000..fa33f64 --- /dev/null +++ b/test/oran-interface-test-suite.cc @@ -0,0 +1,90 @@ +/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ +/* + * Copyright (c) 2022 Northeastern University + * Copyright (c) 2022 Sapienza, University of Rome + * Copyright (c) 2022 University of Padova + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation; + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Author: Andrea Lacava + * Tommaso Zugno + * Michele Polese + */ + +// Include a header file from your module to test. +#include "ns3/oran-interface.h" + +// An essential include is test.h +#include "ns3/test.h" + +// Do not put your test classes in namespace ns3. You may find it useful +// to use the using directive to access the ns3 namespace directly +using namespace ns3; + +// This is an example TestCase. +class OranInterfaceTestCase1 : public TestCase +{ +public: + OranInterfaceTestCase1 (); + virtual ~OranInterfaceTestCase1 (); + +private: + virtual void DoRun (void); +}; + +// Add some help text to this case to describe what it is intended to test +OranInterfaceTestCase1::OranInterfaceTestCase1 () + : TestCase ("OranInterface test case (does nothing)") +{ +} + +// This destructor does nothing but we include it as a reminder that +// the test case should clean up after itself +OranInterfaceTestCase1::~OranInterfaceTestCase1 () +{ +} + +// +// This method is the pure virtual method from class TestCase that every +// TestCase must implement +// +void +OranInterfaceTestCase1::DoRun (void) +{ + // A wide variety of test macros are available in src/core/test.h + NS_TEST_ASSERT_MSG_EQ (true, true, "true doesn't equal true for some reason"); + // Use this one for floating point comparisons + NS_TEST_ASSERT_MSG_EQ_TOL (0.01, 0.01, 0.001, "Numbers are not equal within tolerance"); +} + +// The TestSuite class names the TestSuite, identifies what type of TestSuite, +// and enables the TestCases to be run. Typically, only the constructor for +// this class must be defined +// +class OranInterfaceTestSuite : public TestSuite +{ +public: + OranInterfaceTestSuite (); +}; + +OranInterfaceTestSuite::OranInterfaceTestSuite () + : TestSuite ("oran-interface", UNIT) +{ + // TestDuration for TestCase can be QUICK, EXTENSIVE or TAKES_FOREVER + AddTestCase (new OranInterfaceTestCase1, TestCase::QUICK); +} + +// Do not forget to allocate an instance of this TestSuite +static OranInterfaceTestSuite soranInterfaceTestSuite; +