20 #include "ns3/object.h"
21 #include "ns3/sequence-number.h"
23 #include "ns3/trace-source-accessor.h"
24 #include "ns3/traced-value.h"
57 TypeId(
"ns3::SequenceNumberTestObj")
60 "TestTracedSequenceNumber",
61 "A traceable sequence number",
63 "ns3::SequenceNumber32TracedValueCallback")
64 .AddConstructor<SequenceNumberTestObj>();
76 m_testTracedSequenceNumber += 1;
103 void DoRun()
override;
107 :
TestCase(
"Sequence number test case")
127 #define SEQ_TEST_ASSERT_EQUAL(a, b) NS_TEST_ASSERT_MSG_EQ(a, b, "foo")
128 #define SEQ_TEST_ASSERT(a) NS_TEST_ASSERT_MSG_EQ(bool(a), true, "foo")
135 value = (num1 + num2).GetValue();
209 obj->TraceConnectWithoutContext(
210 "TestTracedSequenceNumber",
212 obj->IncSequenceNumber();
Sequence Number Unit Test.
~SequenceNumberTestCase() override
void DoRun() override
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.
void IncSequenceNumber()
Increment the sequence number.
static TypeId GetTypeId()
Get the type ID.
TypeId GetInstanceTypeId() const override
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.
SequenceNumber< uint16_t, int16_t > SequenceNumber16
16 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, Args... > MakeCallback(R(T::*memPtr)(Args...), 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)