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 Unit Test.
virtual ~SequenceNumberTestCase()
virtual void DoRun(void)
Implementation to actually run this TestCase.
SequenceNumber32 m_oldval
Old value.
void SequenceNumberTracer(SequenceNumber32 oldval, SequenceNumber32 newval)
Sequence number tracker.
SequenceNumber32 m_newval
New value.
Sequence Number TestSuite.
SequenceNumberTestSuite()
Test object using sequence numbers.
TracedValue< SequenceNumber32 > m_testTracedSequenceNumber
Test traced sequence number.
static TypeId GetTypeId(void)
Get the type ID.
void IncSequenceNumber()
Increment the sequence number.
TypeId GetInstanceTypeId(void) const
Get the most derived TypeId for this Object.
A base class which provides memory management and object aggregation.
Smart pointer class similar to boost::intrusive_ptr.
NUMERIC_TYPE GetValue() const
Extracts the numeric value of the sequence number.
void AddTestCase(TestCase *testCase, TestDuration duration=QUICK)
Add an individual child TestCase to this test suite.
@ UNIT
This test suite implements a Unit Test.
a unique identifier for an interface.
TypeId SetParent(TypeId tid)
Set the parent TypeId.
SequenceNumber< uint32_t, int32_t > SequenceNumber32
32 bit Sequence number.
Ptr< const TraceSourceAccessor > MakeTraceSourceAccessor(T a)
Create a TraceSourceAccessor which will control access to the underlying trace source.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Callback< R, Ts... > MakeCallback(R(T::*memPtr)(Ts...), OBJ objPtr)
Build Callbacks for class method members which take varying numbers of arguments and potentially retu...
#define SEQ_TEST_ASSERT_EQUAL(a, b)
static SequenceNumberTestSuite g_seqNumTests
Static variable for test initialization.
#define SEQ_TEST_ASSERT(a)