21 #include "ns3/sequence-number.h" 23 #include "ns3/object.h" 24 #include "ns3/traced-value.h" 25 #include "ns3/trace-source-accessor.h" 58 static TypeId tid =
TypeId (
"ns3::SequenceNumberTestObj")
60 .AddTraceSource (
"TestTracedSequenceNumber",
61 "A traceable sequence number",
63 "ns3::SequenceNumber32TracedValueCallback")
64 .AddConstructor<SequenceNumberTestObj> ()
77 m_testTracedSequenceNumber += 1;
105 virtual void DoRun (
void);
109 :
TestCase (
"Sequence number test case")
128 #define SEQ_TEST_ASSERT_EQUAL(a,b) NS_TEST_ASSERT_MSG_EQ (a,b, "foo") 129 #define SEQ_TEST_ASSERT(a) NS_TEST_ASSERT_MSG_EQ (bool(a), true, "foo") 135 value = (num1 + num2).GetValue ();
203 obj->IncSequenceNumber ();
Sequence Number TestSuite.
Smart pointer class similar to boost::intrusive_ptr.
#define SEQ_TEST_ASSERT(a)
virtual ~SequenceNumberTestCase()
#define SEQ_TEST_ASSERT_EQUAL(a, b)
TracedValue< SequenceNumber32 > m_testTracedSequenceNumber
Test traced sequence number.
Test object using sequence numbers.
SequenceNumber32 m_oldval
Old value.
SequenceNumberTestSuite()
Ptr< const TraceSourceAccessor > MakeTraceSourceAccessor(T a)
Create a TraceSourceAccessor which will control access to the underlying trace source.
TypeId GetInstanceTypeId(void) const
Get the most derived TypeId for this Object.
void AddTestCase(TestCase *testCase, TestDuration duration=QUICK)
Add an individual child TestCase to this test suite.
Callback< R > MakeCallback(R(T::*memPtr)(void), OBJ objPtr)
virtual void DoRun(void)
Implementation to actually run this TestCase.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
void SequenceNumberTracer(SequenceNumber32 oldval, SequenceNumber32 newval)
Sequence number tracker.
static SequenceNumberTestSuite g_seqNumTests
Static variable for test initialization.
static TypeId GetTypeId(void)
Get the type ID.
A base class which provides memory management and object aggregation.
This test suite implements a Unit Test.
void IncSequenceNumber()
Increment the sequence number.
NUMERIC_TYPE GetValue() const
Extracts the numeric value of the sequence number.
a unique identifier for an interface.
TypeId SetParent(TypeId tid)
Set the parent TypeId.
SequenceNumber< uint32_t, int32_t > SequenceNumber32
32 bit Sequence number.
SequenceNumber32 m_newval
New value.
Sequence Number Unit Test.