44 * Define the class-tests group:
45 * \verbatim /// \ingroup module-tests
48 * Make sure test.h is included:
49 * \verbatim #include "ns3/test.h" \endverbatim
51 * Put the test code in namespace ns3::tests.
52 * \verbatim namespace ns3 {
53 namespace tests { \endverbatim
55 * Write your test cases and final test suite, and put them in
57 * \verbatim /// \ingroup class-tests
58class ClassTestSuite : public TestSuite {...}; \endverbatim
60 * Create a static variable to hold the instance of your test suite:
61 * \verbatim /// \ingroup class-tests
63static ClassTestSuite g_classTestSuite; \endverbatim
65 * Finally, close the ingroup and namespace blocks:
66 * \verbatim } // namespace tests
67} // namespace ns3 \endverbatim
94 void DoRun()
override;
99 :
TestCase(
"Sample test case (does nothing)")
void AddTestCase(TestCase *testCase, Duration duration=Duration::QUICK)
Add an individual child TestCase to this test suite.
This is an example TestCase.
SampleTestCase1()
Constructor.
~SampleTestCase1() override
Destructor.
void DoRun() override
This method is the pure virtual method from class TestCase that every TestCase must implement.
The TestSuite class names the TestSuite, identifies what type of TestSuite, and enables the TestCases...
SampleTestSuite()
Constructor.
static SampleTestSuite g_sampleTestSuite
SampleTestSuite instance variable.
#define NS_TEST_ASSERT_MSG_EQ(actual, limit, msg)
Test that an actual and expected (limit) value are equal and report and abort if not.
#define NS_TEST_ASSERT_MSG_EQ_TOL(actual, limit, tol, msg)
Test that actual and expected (limit) values are equal to plus or minus some tolerance and report and...
Every class exported by the ns3 library is enclosed in the ns3 namespace.