src/core/test.h File Reference

#include <list>
#include <string>
#include <utility>
#include <ostream>
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::Test
 base class for new regressions tests More...
class  ns3::TestManager
 gather and run all regression tests More...

Namespaces

namespace  ns3
 

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


Defines

#define NS_TEST_ASSERT_EQUAL_FILELINE(got, expected, file, line)
#define NS_TEST_ASSERT_UNEQUAL_FILELINE(got, expected, file, line)
#define NS_TEST_ASSERT_FILELINE(assertion, file, line)
#define NS_TEST_ASSERT_EQUAL(got, expected)   NS_TEST_ASSERT_EQUAL_FILELINE(got,expected,__FILE__,__LINE__)
#define NS_TEST_ASSERT_UNEQUAL(got, expected)   NS_TEST_ASSERT_UNEQUAL_FILELINE(got,expected,__FILE__,__LINE__)
#define NS_TEST_ASSERT(assertion)   NS_TEST_ASSERT_FILELINE (assertion, __FILE__,__LINE__)

Define Documentation

#define NS_TEST_ASSERT ( assertion   )     NS_TEST_ASSERT_FILELINE (assertion, __FILE__,__LINE__)

Convenience macro to check an assertion is held during an unit test. Note: this macro assumes a 'bool result = true' declaration exists in the test function body, and that the function returns that value.

Parameters:
assertion expression that must be true if the test did not fail

Definition at line 179 of file test.h.

Referenced by ns3::PacketTest::DoCheck(), ns3::DcfManagerTest::EndTest(), ns3::DcfManagerTest::NotifyAccessGranted(), ns3::DcfManagerTest::NotifyCollision(), ns3::DcfManagerTest::NotifyInternalCollision(), ns3::SimulatorTests::RunOneTest(), ns3::WatchdogTests::RunTests(), ns3::TimerTests::RunTests(), ns3::TimeTests::RunTests(), ns3::SimulatorTests::RunTests(), ns3::olsr::OlsrRoutingTableTest::RunTests(), ns3::OlsrHeaderTest::RunTests(), ns3::DropTailQueueTest::RunTests(), ns3::TracedCallbackTest::RunTests(), ns3::AttributeTest::RunTests(), and ns3::BufferTest::RunTests().

#define NS_TEST_ASSERT_EQUAL ( got,
expected   )     NS_TEST_ASSERT_EQUAL_FILELINE(got,expected,__FILE__,__LINE__)
#define NS_TEST_ASSERT_EQUAL_FILELINE ( got,
expected,
file,
line   ) 
Value:
do {                                                              \
    if ((got) != (expected))                                        \
      {                                                             \
        Failure () << file << ":" <<line                            \
                   << ": expected " << (expected)                   \
                   << ", got " << (got) << std::endl;               \
        result = false;                                             \
      }                                                             \
  } while (false)

Definition at line 111 of file test.h.

Referenced by ns3::PacketTest::DoCheck().

#define NS_TEST_ASSERT_FILELINE ( assertion,
file,
line   ) 
Value:
do {                                                  \
    if (!(assertion))                                   \
      {                                                 \
        Failure () << file << ":" <<line                \
                   << ": assertion `" << #assertion     \
                   << "' failed." << std::endl;         \
        result = false;                                 \
      }                                                 \
  } while (false)

Definition at line 134 of file test.h.

#define NS_TEST_ASSERT_UNEQUAL ( got,
expected   )     NS_TEST_ASSERT_UNEQUAL_FILELINE(got,expected,__FILE__,__LINE__)

Convenience macro to check that a value returned by a test is what is expected. Note: this macro assumes a 'bool result = true' declaration exists in the test function body, and that the function returns that value.

Parameters:
got value obtained from the test
expected value that the test is expected to return

Definition at line 168 of file test.h.

Referenced by ns3::ObjectTest::RunTests(), and ns3::AttributeTest::RunTests().

#define NS_TEST_ASSERT_UNEQUAL_FILELINE ( got,
expected,
file,
line   ) 
Value:
do {                                                              \
    if ((got) == (expected))                                        \
      {                                                             \
        Failure () << file << ":" <<line                            \
                   << ": did not want " << (expected)               \
                   << ", got " << (got) << std::endl;               \
        result = false;                                             \
      }                                                             \
  } while (false)

Definition at line 122 of file test.h.

Generated on Thu Dec 3 14:06:47 2009 for NS-3 by  doxygen 1.6.3