A Discrete-Event Network Simulator
API
QueueDiscTracesTestCase Class Reference

Queue Disc Traces Test Case. More...

+ Inheritance diagram for QueueDiscTracesTestCase:
+ Collaboration diagram for QueueDiscTracesTestCase:

Public Member Functions

 QueueDiscTracesTestCase ()
 
void CheckDroppedAfterDequeue (Ptr< QueueDisc > qd, uint32_t nDadPackets, uint32_t nDadBytes)
 Check that packets/bytes dropped after dequeue are consistent with what is expected. More...
 
void CheckDroppedBeforeEnqueue (Ptr< QueueDisc > qd, uint32_t nDbePackets, uint32_t nDbeBytes)
 Check that packets/bytes dropped before enqueue are consistent with what is expected. More...
 
void CheckQueued (Ptr< QueueDisc > qd, uint32_t nPackets, uint32_t nBytes)
 Check that queued packets/bytes are consistent with what is expected. More...
 
virtual void DoRun (void)
 Implementation to actually run this TestCase. More...
 
- Public Member Functions inherited from ns3::TestCase
 TestCase (const TestCase &)=delete
 
virtual ~TestCase ()
 Destructor. More...
 
std::string GetName (void) const
 
TestCaseoperator= (const TestCase &)=delete
 

Private Attributes

std::map< Ptr< QueueDisc >, TestCounterm_counter
 counters for the queue discs More...
 

Additional Inherited Members

- Public Types inherited from ns3::TestCase
enum  TestDuration { QUICK = 1 , EXTENSIVE = 2 , TAKES_FOREVER = 3 }
 How long the test takes to execute. More...
 
- Protected Member Functions inherited from ns3::TestCase
 TestCase (std::string name)
 Constructor. More...
 
void AddTestCase (TestCase *testCase, TestDuration duration=QUICK)
 Add an individual child TestCase to this test suite. More...
 
TestCaseGetParent () const
 Get the parent of this TestCsse. More...
 
bool IsStatusFailure (void) const
 Check if any tests failed. More...
 
bool IsStatusSuccess (void) const
 Check if all tests passed. More...
 
void SetDataDir (std::string directory)
 Set the data directory where reference trace files can be found. More...
 
void ReportTestFailure (std::string cond, std::string actual, std::string limit, std::string message, std::string file, int32_t line)
 Log the failure of this TestCase. More...
 
bool MustAssertOnFailure (void) const
 Check if this run should assert on failure. More...
 
bool MustContinueOnFailure (void) const
 Check if this run should continue on failure. More...
 
std::string CreateDataDirFilename (std::string filename)
 Construct the full path to a file in the data directory. More...
 
std::string CreateTempDirFilename (std::string filename)
 Construct the full path to a file in a temporary directory. More...
 

Detailed Description

Queue Disc Traces Test Case.

This test case makes use of a test queue disc acting as root queue disc and having a single child queue disc, which has a single DropTail queue. The Enqueue, Dequeue, DropBeforeEnqueue and DropAfterDequeue traces of both queue discs are connected to the methods of TestCounter objects that keep track of the amount of packets/bytes queued inside each queue disc and the cumulative amount of packets/bytes dropped before enqueue and after dequeue. A series of enqueue, dequeue and peek operations are performed on the root queue disc and both the statistics kept by the QueueDisc class and the values computed by the TestCounter objects are compared with the expected values.

Definition at line 325 of file queue-disc-traces-test-suite.cc.

Constructor & Destructor Documentation

◆ QueueDiscTracesTestCase()

QueueDiscTracesTestCase::QueueDiscTracesTestCase ( )

Definition at line 357 of file queue-disc-traces-test-suite.cc.

Member Function Documentation

◆ CheckDroppedAfterDequeue()

void QueueDiscTracesTestCase::CheckDroppedAfterDequeue ( Ptr< QueueDisc qd,
uint32_t  nDadPackets,
uint32_t  nDadBytes 
)

Check that packets/bytes dropped after dequeue are consistent with what is expected.

Parameters
qdthe queue disc
nDadPacketsthe expected number of packets
nDadBytesthe expected number of bytes

Definition at line 393 of file queue-disc-traces-test-suite.cc.

References ns3::QueueDisc::GetStats(), m_counter, NS_TEST_ASSERT_MSG_EQ, ns3::QueueDisc::Stats::nTotalDroppedBytesAfterDequeue, and ns3::QueueDisc::Stats::nTotalDroppedPacketsAfterDequeue.

Referenced by DoRun().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ CheckDroppedBeforeEnqueue()

void QueueDiscTracesTestCase::CheckDroppedBeforeEnqueue ( Ptr< QueueDisc qd,
uint32_t  nDbePackets,
uint32_t  nDbeBytes 
)

Check that packets/bytes dropped before enqueue are consistent with what is expected.

Parameters
qdthe queue disc
nDbePacketsthe expected number of packets
nDbeBytesthe expected number of bytes

Definition at line 377 of file queue-disc-traces-test-suite.cc.

References ns3::QueueDisc::GetStats(), m_counter, NS_TEST_ASSERT_MSG_EQ, ns3::QueueDisc::Stats::nTotalDroppedBytesBeforeEnqueue, and ns3::QueueDisc::Stats::nTotalDroppedPacketsBeforeEnqueue.

Referenced by DoRun().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ CheckQueued()

void QueueDiscTracesTestCase::CheckQueued ( Ptr< QueueDisc qd,
uint32_t  nPackets,
uint32_t  nBytes 
)

Check that queued packets/bytes are consistent with what is expected.

Parameters
qdthe queue disc
nPacketsthe expected number of packets
nBytesthe expected number of bytes

Definition at line 363 of file queue-disc-traces-test-suite.cc.

References ns3::QueueDisc::GetNBytes(), ns3::QueueDisc::GetNPackets(), m_counter, and NS_TEST_ASSERT_MSG_EQ.

Referenced by DoRun().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ DoRun()

void QueueDiscTracesTestCase::DoRun ( void  )
virtual

Implementation to actually run this TestCase.

Subclasses should override this method to conduct their tests.

Implements ns3::TestCase.

Definition at line 409 of file queue-disc-traces-test-suite.cc.

References CheckDroppedAfterDequeue(), CheckDroppedBeforeEnqueue(), CheckQueued(), ns3::QueueDisc::Dequeue(), ns3::QueueDisc::Enqueue(), ns3::QueueDisc::GetQueueDiscClass(), ns3::Object::Initialize(), m_counter, NS_TEST_ASSERT_MSG_EQ, NS_TEST_ASSERT_MSG_NE, and ns3::QueueDisc::Peek().

+ Here is the call graph for this function:

Member Data Documentation

◆ m_counter

std::map<Ptr<QueueDisc>,TestCounter> QueueDiscTracesTestCase::m_counter
private

counters for the queue discs

Definition at line 354 of file queue-disc-traces-test-suite.cc.

Referenced by CheckDroppedAfterDequeue(), CheckDroppedBeforeEnqueue(), CheckQueued(), and DoRun().


The documentation for this class was generated from the following file: