NS-3
ns3::TestCase Class Reference

encapsulates test code More...

#include <test.h>

Inheritance diagram for ns3::TestCase:
Collaboration diagram for ns3::TestCase:

List of all members.

Protected Member Functions

 TestCase (std::string name)
void AddTestCase (TestCase *testCase)
 Add an individual test case to this test suite.
void SetDataDir (std::string directory)
bool GetErrorStatus (void) const NS_DEPRECATED
bool IsStatusFailure (void) const
bool IsStatusSuccess (void) const
void ReportTestFailure (std::string cond, std::string actual, std::string limit, std::string message, std::string file, int32_t line)
bool MustAssertOnFailure (void) const
bool MustContinueOnFailure (void) const
std::string CreateDataDirFilename (std::string filename)
std::string CreateTempDirFilename (std::string filename)

Friends

class TestRunnerImpl

Detailed Description

encapsulates test code

To allow a new test to be run within the ns-3 test framework, users need to create subclasses of this base class, override the DoRun method, and use the NS_TEST_* macros within DoRun.


Constructor & Destructor Documentation

ns3::TestCase::TestCase ( std::string  name) [protected]
Parameters:
namethe name of the new test created

Member Function Documentation

void ns3::TestCase::AddTestCase ( TestCase testCase) [protected]

Add an individual test case to this test suite.

Parameters:
testCasePointer to the test case object to be added.
bool ns3::TestCase::GetErrorStatus ( void  ) const [protected]

This method is deprecated. IsStatusFailure replaces it.

bool ns3::TestCase::IsStatusFailure ( void  ) const [protected]
Returns:
true if the tests have failed, false otherwise.
bool ns3::TestCase::IsStatusSuccess ( void  ) const [protected]
Returns:
true if the tests have succeeded, false otherwise.
void ns3::TestCase::SetDataDir ( std::string  directory) [protected]
Parameters:
directorythe directory where the test data is located

In general, this method is invoked as SetDataDir (NS_TEST_SOURCEDIR); However, if a module contains a test directory with subdirectories (e.g. src/mesh/test), and the test data (e.g. pcap traces) is located in one of these subdirectories, then the variable NS_TEST_SOURCEDIR may not work and the user may want to explicitly pass in a directory string.

Note that NS_TEST_SOURCEDIR is set in src/wscript for each module


The documentation for this class was generated from the following file: