A Discrete-Event Network Simulator
API
test.h File Reference

Definition of the testing macros and declaration of the testing classes. More...

#include <iostream>
#include <fstream>
#include <sstream>
#include <string>
#include <vector>
#include <list>
#include <limits>
#include <stdint.h>
#include "non-copyable.h"
#include "system-wall-clock-ms.h"
+ Include dependency graph for test.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  ns3::TestCase
 encapsulates test code More...
 
class  ns3::TestRunner
 A runner to execute tests. More...
 
class  ns3::TestSuite
 A suite of tests to run. More...
 
class  ns3::TestVectors< T >
 A simple way to store test vectors (for stimulus or from responses) More...
 

Namespaces

 ns3
 Every class exported by the ns3 library is enclosed in the ns3 namespace.
 

Macros

#define ASSERT_ON_FAILURE
 Check if we should assert on errors, and do so. More...
 
#define CONTINUE_ON_FAILURE
 If we shouldn't continue on errors, return. More...
 
#define CONTINUE_ON_FAILURE_RETURNS_BOOL
 If we shouldn't continue on errors, return test status. More...
 
#define NS_TEST_ASSERT_MSG_EQ(actual, limit, msg)   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_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(actual, limit, msg)   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_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(actual, limit, tol, msg)   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_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(actual, limit, tol, msg)   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_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(actual, limit, msg)   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_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(actual, limit, msg)   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_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(actual, limit, msg)   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_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(actual, limit, msg)   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_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(actual, limit, msg)   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_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(actual, limit, msg)   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_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(actual, limit, msg)   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_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(actual, limit, tol, msg)   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_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(actual, limit, msg)   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_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(actual, limit, msg)   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_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(actual, limit, msg)   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_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(actual, limit, msg)   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_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(actual, limit, msg)   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...
 
#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...
 

Functions

bool ns3::TestDoubleIsEqual (const double a, const double b, const double epsilon=std::numeric_limits< double >::epsilon())
 Compare two double precision floating point numbers and declare them equal if they are within some epsilon of each other. More...
 

Detailed Description

Definition of the testing macros and declaration of the testing classes.

Definition in file test.h.