A Discrete-Event Network Simulator
API
Testing Implementation

Internal implementation of the Testing system. More...

+ Collaboration diagram for Testing Implementation:

Classes

class  ns3::TestRunner
 A runner to execute 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:68
#define CONTINUE_ON_FAILURE
If we shouldn't continue on errors, return.
Definition: test.h:80

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

Definition at line 111 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:68
#define CONTINUE_ON_FAILURE_RETURNS_BOOL
If we shouldn't continue on errors, return test status.
Definition: test.h:92

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

Definition at line 166 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:68
#define CONTINUE_ON_FAILURE
If we shouldn't continue on errors, return.
Definition: test.h:80

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

Definition at line 286 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:68
#define CONTINUE_ON_FAILURE_RETURNS_BOOL
If we shouldn't continue on errors, return test status.
Definition: test.h:92

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

Definition at line 370 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:68
#define CONTINUE_ON_FAILURE
If we shouldn't continue on errors, return.
Definition: test.h:80

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

Definition at line 900 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:68
#define CONTINUE_ON_FAILURE
If we shouldn't continue on errors, return.
Definition: test.h:80

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

Definition at line 924 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:68
#define CONTINUE_ON_FAILURE
If we shouldn't continue on errors, return.
Definition: test.h:80

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

Definition at line 718 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:68
#define CONTINUE_ON_FAILURE
If we shouldn't continue on errors, return.
Definition: test.h:80

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

Definition at line 742 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:68
#define CONTINUE_ON_FAILURE
If we shouldn't continue on errors, return.
Definition: test.h:80

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

Definition at line 547 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:68
#define CONTINUE_ON_FAILURE_RETURNS_BOOL
If we shouldn't continue on errors, return test status.
Definition: test.h:92

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

Definition at line 601 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:68

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 227 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:68

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 460 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:68

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 990 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:68

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 1016 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:68

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 808 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:68

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 834 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:68

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 661 of file test.h.