base class for new regressions tests More...
#include <test.h>
Public Member Functions | |
Test (char const *name) | |
virtual | ~Test () |
virtual bool | RunTests (void)=0 |
Protected Member Functions | |
std::ostream & | Failure (void) |
base class for new regressions tests
To add a new regression test, you need to:
The following sample code shows you how to do this:
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ #include "ns3/test.h" using namespace ns3; #ifdef RUN_SELF_TESTS // declare subclass of base class Test class MyTest : public Test { public: MyTest (bool ok); virtual ~MyTest (); virtual bool RunTests (void); private: bool m_ok; }; // implement MyTest MyTest::MyTest (bool ok) : Test ("My"), m_ok (ok) {} MyTest::~MyTest () {} bool MyTest::RunTests (void) { return m_ok; } // instantiate MyTest once static MyTest g_my_test = MyTest (true); #endif /* RUN_SELF_TESTS */ int main (int argc, char *argv[]) { // run tests TestManager::EnableVerbose (); TestManager::RunTests (); return 0; }
Definition at line 52 of file test.h.
ns3::Test::Test | ( | char const * | name | ) |
name | the name of the test |
Definition at line 98 of file test.cc.
References ns3::TestManager::Add().
std::ostream & ns3::Test::Failure | ( | void | ) | [protected] |
Definition at line 107 of file test.cc.
Referenced by ns3::PacketMetadataTest::CheckHistory(), ns3::BufferTest::EnsureWrittenBytes(), ns3::OlsrHeaderTest::RunTests(), and ns3::RandomVariableTest::RunTests().
virtual bool ns3::Test::RunTests | ( | void | ) | [pure virtual] |
Implemented in ns3::BufferTest, ns3::PacketMetadataTest, ns3::PacketTest, ns3::EventGarbageCollectorTests, ns3::AttributeTest, ns3::CallbackTest, CommandLineTest, ns3::ConfigTest, ns3::GlobalValueTests, ns3::ObjectTest, ns3::PtrTest, ns3::RandomVariableTest, ns3::TracedCallbackTest, ns3::TypeTraitsTest, ns3::PointToPointTest, ns3::DcfManagerTest, ns3::WifiTest, ns3::AddressHelperTest, ns3::TcpSocketImplTest, ns3::UdpSocketImplTest, ns3::DropTailQueueTest, ns3::Ipv4AddressGeneratorTest, ns3::GlobalRouteManagerImplTest, ns3::OlsrHeaderTest, ns3::olsr::OlsrRoutingTableTest, ns3::HighPrecision128Tests, ns3::SimulatorTests, ns3::TimeTests, ns3::TimerTests, and ns3::WatchdogTests.