A Discrete-Event Network Simulator
API
Testing Implementation

Internal implementation of the Testing system. More...

+ Collaboration diagram for Testing Implementation:

Classes

struct  ns3::TestCase::Result
 Container for results from a TestCase. More...
 
struct  ns3::TestCaseFailure
 Container for details of a test failure. More...
 
class  ns3::TestRunner
 A runner to execute tests. More...
 
class  ns3::TestRunnerImpl
 Container for all tests. More...
 

Macros

#define NS_TEST_ASSERT_MSG_EQ_INTERNAL(actual, limit, msg, file, line)
 Test that an actual and expected (limit) value are equal and report and abort if not. More...
 
#define NS_TEST_ASSERT_MSG_EQ_RETURNS_BOOL_INTERNAL(actual, limit, msg, file, line)
 Test that an actual and expected (limit) value are equal and report and abort if not. More...
 
#define NS_TEST_ASSERT_MSG_EQ_TOL_INTERNAL(actual, limit, tol, msg, file, line)
 Test that actual and expected (limit) values are equal to plus or minus some tolerance and report and abort if not. More...
 
#define NS_TEST_ASSERT_MSG_EQ_TOL_RETURNS_BOOL_INTERNAL(actual, limit, tol, msg, file, line)
 Test that actual and expected (limit) values are equal to plus or minus some tolerance and report and abort if not. More...
 
#define NS_TEST_ASSERT_MSG_GT_INTERNAL(actual, limit, msg, file, line)
 Test that an actual value is greater than a limit and report and abort if not. More...
 
#define NS_TEST_ASSERT_MSG_GT_OR_EQ_INTERNAL(actual, limit, msg, file, line)
 Test that an actual value is greater than or equal to a limit and report and abort if not. More...
 
#define NS_TEST_ASSERT_MSG_LT_INTERNAL(actual, limit, msg, file, line)
 Test that an actual value is less than a limit and report and abort if not. More...
 
#define NS_TEST_ASSERT_MSG_LT_OR_EQ_INTERNAL(actual, limit, msg, file, line)
 Test that an actual value is less than or equal to a limit and report and abort if not. More...
 
#define NS_TEST_ASSERT_MSG_NE_INTERNAL(actual, limit, msg, file, line)
 Test that an actual and expected (limit) value are not equal and report and abort if not. More...
 
#define NS_TEST_ASSERT_MSG_NE_RETURNS_BOOL_INTERNAL(actual, limit, msg, file, line)
 Test that an actual and expected (limit) value are not equal and report and abort if not. More...
 
#define NS_TEST_EXPECT_MSG_EQ_INTERNAL(actual, limit, msg, file, line)
 Test that an actual and expected (limit) value are equal and report if not. More...
 
#define NS_TEST_EXPECT_MSG_EQ_TOL_INTERNAL(actual, limit, tol, msg, file, line)
 Test that actual and expected (limit) values are equal to plus or minus some tolerance and report if not. More...
 
#define NS_TEST_EXPECT_MSG_GT_INTERNAL(actual, limit, msg, file, line)
 Test that an actual value is greater than a limit and report if not. More...
 
#define NS_TEST_EXPECT_MSG_GT_OR_EQ_INTERNAL(actual, limit, msg, file, line)
 Test that an actual value is greater than or equal to limit and report if not. More...
 
#define NS_TEST_EXPECT_MSG_LT_INTERNAL(actual, limit, msg, file, line)
 Test that an actual value is less than a limit and report if not. More...
 
#define NS_TEST_EXPECT_MSG_LT_OR_EQ_INTERNAL(actual, limit, msg, file, line)
 Test that an actual value is less than or equal to a limit and report if not. More...
 
#define NS_TEST_EXPECT_MSG_NE_INTERNAL(actual, limit, msg, file, line)
 Test that an actual and expected (limit) value are not equal and report if not. More...
 

Detailed Description

Internal implementation of the Testing system.

Macro Definition Documentation

#define NS_TEST_ASSERT_MSG_EQ_INTERNAL (   actual,
  limit,
  msg,
  file,
  line 
)
Value:
do { \
if (!((actual) == (limit))) \
{ \
std::ostringstream msgStream; \
msgStream << msg; \
std::ostringstream actualStream; \
actualStream << actual; \
std::ostringstream limitStream; \
limitStream << limit; \
ReportTestFailure (std::string (#actual) + " (actual) == " + \
std::string (#limit) + " (limit)", \
actualStream.str (), limitStream.str (), \
msgStream.str (), file, line); \
} \
} while (false)
#define ASSERT_ON_FAILURE
Check if we should assert on errors, and do so.
Definition: test.h:77
#define CONTINUE_ON_FAILURE
If we shouldn't continue on errors, return.
Definition: test.h:89
if(desigRtr==addrLocal)

Test that an actual and expected (limit) value are equal and report and abort if not.

Definition at line 120 of file test.h.

Referenced by PacketMetadataTest::CheckHistory(), and BufferTest::EnsureWrittenBytes().

#define NS_TEST_ASSERT_MSG_EQ_RETURNS_BOOL_INTERNAL (   actual,
  limit,
  msg,
  file,
  line 
)
Value:
do { \
if (!((actual) == (limit))) \
{ \
std::ostringstream msgStream; \
msgStream << msg; \
std::ostringstream actualStream; \
actualStream << actual; \
std::ostringstream limitStream; \
limitStream << limit; \
ReportTestFailure (std::string (#actual) + " (actual) == " + \
std::string (#limit) + " (limit)", \
actualStream.str (), limitStream.str (), \
msgStream.str (), file, line); \
} \
} while (false)
#define ASSERT_ON_FAILURE
Check if we should assert on errors, and do so.
Definition: test.h:77
#define CONTINUE_ON_FAILURE_RETURNS_BOOL
If we shouldn't continue on errors, return test status.
Definition: test.h:101
if(desigRtr==addrLocal)

Test that an actual and expected (limit) value are equal and report and abort if not.

Definition at line 176 of file test.h.

#define NS_TEST_ASSERT_MSG_EQ_TOL_INTERNAL (   actual,
  limit,
  tol,
  msg,
  file,
  line 
)
Value:
do { \
if ((actual) > (limit) + (tol) || (actual) < (limit) - (tol)) \
{ \
std::ostringstream msgStream; \
msgStream << msg; \
std::ostringstream actualStream; \
actualStream << actual; \
std::ostringstream limitStream; \
limitStream << limit << " +- " << tol; \
std::ostringstream condStream; \
condStream << #actual << " (actual) < " << #limit \
<< " (limit) + " << #tol << " (tol) && " \
<< #actual << " (actual) > " << #limit \
<< " (limit) - " << #tol << " (tol)"; \
ReportTestFailure (condStream.str (), actualStream.str (), \
limitStream.str (), msgStream.str (), \
file, line); \
} \
} while (false)
#define ASSERT_ON_FAILURE
Check if we should assert on errors, and do so.
Definition: test.h:77
#define CONTINUE_ON_FAILURE
If we shouldn't continue on errors, return.
Definition: test.h:89
if(desigRtr==addrLocal)

Test that actual and expected (limit) values are equal to plus or minus some tolerance and report and abort if not.

Definition at line 298 of file test.h.

#define NS_TEST_ASSERT_MSG_EQ_TOL_RETURNS_BOOL_INTERNAL (   actual,
  limit,
  tol,
  msg,
  file,
  line 
)
Value:
do { \
if ((actual) > (limit) + (tol) || (actual) < (limit) - (tol)) \
{ \
std::ostringstream msgStream; \
msgStream << msg; \
std::ostringstream actualStream; \
actualStream << actual; \
std::ostringstream limitStream; \
limitStream << limit << " +- " << tol; \
std::ostringstream condStream; \
condStream << #actual << " (actual) < " << #limit \
<< " (limit) + " << #tol << " (tol) && " \
<< #actual << " (actual) > " << #limit \
<< " (limit) - " << #tol << " (tol)"; \
ReportTestFailure (condStream.str (), actualStream.str (), \
limitStream.str (), msgStream.str (), \
file, line); \
} \
} while (false)
#define ASSERT_ON_FAILURE
Check if we should assert on errors, and do so.
Definition: test.h:77
#define CONTINUE_ON_FAILURE_RETURNS_BOOL
If we shouldn't continue on errors, return test status.
Definition: test.h:101
if(desigRtr==addrLocal)

Test that actual and expected (limit) values are equal to plus or minus some tolerance and report and abort if not.

Definition at line 388 of file test.h.

#define NS_TEST_ASSERT_MSG_GT_INTERNAL (   actual,
  limit,
  msg,
  file,
  line 
)
Value:
do { \
if (!((actual) > (limit))) \
{ \
std::ostringstream msgStream; \
msgStream << msg; \
std::ostringstream actualStream; \
actualStream << actual; \
std::ostringstream limitStream; \
limitStream << limit; \
ReportTestFailure (std::string (#actual) + " (actual) > " + \
std::string (#limit) + " (limit)", \
actualStream.str (), limitStream.str (), \
msgStream.str (), file, line); \
} \
} while (false)
#define ASSERT_ON_FAILURE
Check if we should assert on errors, and do so.
Definition: test.h:77
#define CONTINUE_ON_FAILURE
If we shouldn't continue on errors, return.
Definition: test.h:89
if(desigRtr==addrLocal)

Test that an actual value is greater than a limit and report and abort if not.

Definition at line 936 of file test.h.

#define NS_TEST_ASSERT_MSG_GT_OR_EQ_INTERNAL (   actual,
  limit,
  msg,
  file,
  line 
)
Value:
do { \
if (!((actual) >= (limit))) \
{ \
std::ostringstream msgStream; \
msgStream << msg; \
std::ostringstream actualStream; \
actualStream << actual; \
std::ostringstream limitStream; \
limitStream << limit; \
ReportTestFailure (std::string (#actual) + " (actual) > " + \
std::string (#limit) + " (limit)", \
actualStream.str (), limitStream.str (), \
msgStream.str (), file, line); \
} \
} while (false)
#define ASSERT_ON_FAILURE
Check if we should assert on errors, and do so.
Definition: test.h:77
#define CONTINUE_ON_FAILURE
If we shouldn't continue on errors, return.
Definition: test.h:89
if(desigRtr==addrLocal)

Test that an actual value is greater than or equal to a limit and report and abort if not.

Definition at line 960 of file test.h.

#define NS_TEST_ASSERT_MSG_LT_INTERNAL (   actual,
  limit,
  msg,
  file,
  line 
)
Value:
do { \
if (!((actual) < (limit))) \
{ \
std::ostringstream msgStream; \
msgStream << msg; \
std::ostringstream actualStream; \
actualStream << actual; \
std::ostringstream limitStream; \
limitStream << limit; \
ReportTestFailure (std::string (#actual) + " (actual) < " + \
std::string (#limit) + " (limit)", \
actualStream.str (), limitStream.str (), \
msgStream.str (), file, line); \
} \
} while (false)
#define ASSERT_ON_FAILURE
Check if we should assert on errors, and do so.
Definition: test.h:77
#define CONTINUE_ON_FAILURE
If we shouldn't continue on errors, return.
Definition: test.h:89
if(desigRtr==addrLocal)

Test that an actual value is less than a limit and report and abort if not.

Definition at line 751 of file test.h.

#define NS_TEST_ASSERT_MSG_LT_OR_EQ_INTERNAL (   actual,
  limit,
  msg,
  file,
  line 
)
Value:
do { \
if (!((actual) <= (limit))) \
{ \
std::ostringstream msgStream; \
msgStream << msg; \
std::ostringstream actualStream; \
actualStream << actual; \
std::ostringstream limitStream; \
limitStream << limit; \
ReportTestFailure (std::string (#actual) + " (actual) < " + \
std::string (#limit) + " (limit)", \
actualStream.str (), limitStream.str (), \
msgStream.str (), file, line); \
} \
} while (false)
#define ASSERT_ON_FAILURE
Check if we should assert on errors, and do so.
Definition: test.h:77
#define CONTINUE_ON_FAILURE
If we shouldn't continue on errors, return.
Definition: test.h:89
if(desigRtr==addrLocal)

Test that an actual value is less than or equal to a limit and report and abort if not.

Definition at line 775 of file test.h.

#define NS_TEST_ASSERT_MSG_NE_INTERNAL (   actual,
  limit,
  msg,
  file,
  line 
)
Value:
do { \
if (!((actual) != (limit))) \
{ \
std::ostringstream msgStream; \
msgStream << msg; \
std::ostringstream actualStream; \
actualStream << actual; \
std::ostringstream limitStream; \
limitStream << limit; \
ReportTestFailure (std::string (#actual) + " (actual) != " + \
std::string (#limit) + " (limit)", \
actualStream.str (), limitStream.str (), \
msgStream.str (), file, line); \
} \
} while (false)
#define ASSERT_ON_FAILURE
Check if we should assert on errors, and do so.
Definition: test.h:77
#define CONTINUE_ON_FAILURE
If we shouldn't continue on errors, return.
Definition: test.h:89
if(desigRtr==addrLocal)

Test that an actual and expected (limit) value are not equal and report and abort if not.

Definition at line 577 of file test.h.

#define NS_TEST_ASSERT_MSG_NE_RETURNS_BOOL_INTERNAL (   actual,
  limit,
  msg,
  file,
  line 
)
Value:
do { \
if (!((actual) != (limit))) \
{ \
std::ostringstream msgStream; \
msgStream << msg; \
std::ostringstream actualStream; \
actualStream << actual; \
std::ostringstream limitStream; \
limitStream << limit; \
ReportTestFailure (std::string (#actual) + " (actual) != " + \
std::string (#limit) + " (limit)", \
actualStream.str (), limitStream.str (), \
msgStream.str (), file, line); \
} \
} while (false)
#define ASSERT_ON_FAILURE
Check if we should assert on errors, and do so.
Definition: test.h:77
#define CONTINUE_ON_FAILURE_RETURNS_BOOL
If we shouldn't continue on errors, return test status.
Definition: test.h:101
if(desigRtr==addrLocal)

Test that an actual and expected (limit) value are not equal and report and abort if not.

Definition at line 632 of file test.h.

#define NS_TEST_EXPECT_MSG_EQ_INTERNAL (   actual,
  limit,
  msg,
  file,
  line 
)
Value:
do { \
if (!((actual) == (limit))) \
{ \
std::ostringstream msgStream; \
msgStream << msg; \
std::ostringstream actualStream; \
actualStream << actual; \
std::ostringstream limitStream; \
limitStream << limit; \
ReportTestFailure (std::string (#actual) + " (actual) == " + \
std::string (#limit) + " (limit)", \
actualStream.str (), limitStream.str (), \
msgStream.str (), file, line); \
} \
} while (false)
#define ASSERT_ON_FAILURE
Check if we should assert on errors, and do so.
Definition: test.h:77
if(desigRtr==addrLocal)

Test that an actual and expected (limit) value are equal and report if not.

Required to avoid use of return statement which allows use in methods (esp. callbacks) returning void.

Definition at line 238 of file test.h.

Referenced by PacketTest::DoCheck().

#define NS_TEST_EXPECT_MSG_EQ_TOL_INTERNAL (   actual,
  limit,
  tol,
  msg,
  file,
  line 
)
Value:
do { \
if ((actual) > (limit) + (tol) || (actual) < (limit) - (tol)) \
{ \
std::ostringstream msgStream; \
msgStream << msg; \
std::ostringstream actualStream; \
actualStream << actual; \
std::ostringstream limitStream; \
limitStream << limit << " +- " << tol; \
std::ostringstream condStream; \
condStream << #actual << " (actual) < " << #limit \
<< " (limit) + " << #tol << " (tol) && " \
<< #actual << " (actual) > " << #limit \
<< " (limit) - " << #tol << " (tol)"; \
ReportTestFailure (condStream.str (), actualStream.str (), \
limitStream.str (), msgStream.str (), \
file, line); \
} \
} while (false)
#define ASSERT_ON_FAILURE
Check if we should assert on errors, and do so.
Definition: test.h:77
if(desigRtr==addrLocal)

Test that actual and expected (limit) values are equal to plus or minus some tolerance and report if not.

Required to avoid use of return statement which allows use in methods (esp. callbacks) returning void.

Definition at line 484 of file test.h.

Referenced by WaypointLazyNotifyFalse::CourseChangeCallback(), WaypointLazyNotifyTrue::CourseChangeCallback(), WaypointLazyNotifyFalse::TestXPosition(), WaypointLazyNotifyTrue::TestXPosition(), WaypointInitialPositionIsWaypoint::TestXPosition(), and WaypointMobilityModelViaHelper::TestXPosition().

#define NS_TEST_EXPECT_MSG_GT_INTERNAL (   actual,
  limit,
  msg,
  file,
  line 
)
Value:
do { \
if (!((actual) > (limit))) \
{ \
std::ostringstream msgStream; \
msgStream << msg; \
std::ostringstream actualStream; \
actualStream << actual; \
std::ostringstream limitStream; \
limitStream << limit; \
ReportTestFailure (std::string (#actual) + " (actual) > " + \
std::string (#limit) + " (limit)", \
actualStream.str (), limitStream.str (), \
msgStream.str (), file, line); \
} \
} while (false)
#define ASSERT_ON_FAILURE
Check if we should assert on errors, and do so.
Definition: test.h:77
if(desigRtr==addrLocal)

Test that an actual value is greater than a limit and report if not.

Required to avoid use of return statement which allows use in methods (callbacks) returning void.

Definition at line 1028 of file test.h.

#define NS_TEST_EXPECT_MSG_GT_OR_EQ_INTERNAL (   actual,
  limit,
  msg,
  file,
  line 
)
Value:
do { \
if (!((actual) >= (limit))) \
{ \
std::ostringstream msgStream; \
msgStream << msg; \
std::ostringstream actualStream; \
actualStream << actual; \
std::ostringstream limitStream; \
limitStream << limit; \
ReportTestFailure (std::string (#actual) + " (actual) > " + \
std::string (#limit) + " (limit)", \
actualStream.str (), limitStream.str (), \
msgStream.str (), file, line); \
} \
} while (false)
#define ASSERT_ON_FAILURE
Check if we should assert on errors, and do so.
Definition: test.h:77
if(desigRtr==addrLocal)

Test that an actual value is greater than or equal to limit and report if not.

Required to avoid use of return statement which allows use in methods (callbacks) returning void.

Definition at line 1054 of file test.h.

#define NS_TEST_EXPECT_MSG_LT_INTERNAL (   actual,
  limit,
  msg,
  file,
  line 
)
Value:
do { \
if (!((actual) < (limit))) \
{ \
std::ostringstream msgStream; \
msgStream << msg; \
std::ostringstream actualStream; \
actualStream << actual; \
std::ostringstream limitStream; \
limitStream << limit; \
ReportTestFailure (std::string (#actual) + " (actual) < " + \
std::string (#limit) + " (limit)", \
actualStream.str (), limitStream.str (), \
msgStream.str (), file, line); \
} \
} while (false)
#define ASSERT_ON_FAILURE
Check if we should assert on errors, and do so.
Definition: test.h:77
if(desigRtr==addrLocal)

Test that an actual value is less than a limit and report if not.

Required to avoid use of return statement which allows use in methods (callbacks) returning void.

Definition at line 842 of file test.h.

#define NS_TEST_EXPECT_MSG_LT_OR_EQ_INTERNAL (   actual,
  limit,
  msg,
  file,
  line 
)
Value:
do { \
if (!((actual) <= (limit))) \
{ \
std::ostringstream msgStream; \
msgStream << msg; \
std::ostringstream actualStream; \
actualStream << actual; \
std::ostringstream limitStream; \
limitStream << limit; \
ReportTestFailure (std::string (#actual) + " (actual) < " + \
std::string (#limit) + " (limit)", \
actualStream.str (), limitStream.str (), \
msgStream.str (), file, line); \
} \
} while (false)
#define ASSERT_ON_FAILURE
Check if we should assert on errors, and do so.
Definition: test.h:77
if(desigRtr==addrLocal)

Test that an actual value is less than or equal to a limit and report if not.

Required to avoid use of return statement which allows use in methods (callbacks) returning void.

Definition at line 868 of file test.h.

#define NS_TEST_EXPECT_MSG_NE_INTERNAL (   actual,
  limit,
  msg,
  file,
  line 
)
Value:
do { \
if (!((actual) != (limit))) \
{ \
std::ostringstream msgStream; \
msgStream << msg; \
std::ostringstream actualStream; \
actualStream << actual; \
std::ostringstream limitStream; \
limitStream << limit; \
ReportTestFailure (std::string (#actual) + " (actual) != " + \
std::string (#limit) + " (limit)", \
actualStream.str (), limitStream.str (), \
msgStream.str (), file, line); \
} \
} while (false)
#define ASSERT_ON_FAILURE
Check if we should assert on errors, and do so.
Definition: test.h:77
if(desigRtr==addrLocal)

Test that an actual and expected (limit) value are not equal and report if not.

Required to avoid use of return statement which allows use in methods (callbacks) returning void.

Definition at line 693 of file test.h.