Queue Disc Traces Test Case. More...
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. | |
void | CheckDroppedBeforeEnqueue (Ptr< QueueDisc > qd, uint32_t nDbePackets, uint32_t nDbeBytes) |
Check that packets/bytes dropped before enqueue are consistent with what is expected. | |
void | CheckQueued (Ptr< QueueDisc > qd, uint32_t nPackets, uint32_t nBytes) |
Check that queued packets/bytes are consistent with what is expected. | |
void | DoRun () override |
Implementation to actually run this TestCase. | |
Public Member Functions inherited from ns3::TestCase | |
TestCase (const TestCase &)=delete | |
virtual | ~TestCase () |
Destructor. | |
std::string | GetName () const |
TestCase & | operator= (const TestCase &)=delete |
Private Attributes | |
std::map< Ptr< QueueDisc >, TestCounter > | m_counter |
counters for the queue discs | |
Additional Inherited Members | |
Public Types inherited from ns3::TestCase | |
enum class | Duration { QUICK = 1 , EXTENSIVE = 2 , TAKES_FOREVER = 3 } |
How long the test takes to execute. More... | |
Static Public Attributes inherited from ns3::TestCase | |
static constexpr auto | QUICK = Duration::QUICK |
Deprecated test duration simple enums. | |
static constexpr auto | EXTENSIVE = Duration::EXTENSIVE |
static constexpr auto | TAKES_FOREVER = Duration::TAKES_FOREVER |
Protected Member Functions inherited from ns3::TestCase | |
TestCase (std::string name) | |
Constructor. | |
void | AddTestCase (TestCase *testCase, Duration duration=Duration::QUICK) |
Add an individual child TestCase to this test suite. | |
TestCase * | GetParent () const |
Get the parent of this TestCase. | |
bool | IsStatusFailure () const |
Check if any tests failed. | |
bool | IsStatusSuccess () const |
Check if all tests passed. | |
void | SetDataDir (std::string directory) |
Set the data directory where reference trace files can be found. | |
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. | |
bool | MustAssertOnFailure () const |
Check if this run should assert on failure. | |
bool | MustContinueOnFailure () const |
Check if this run should continue on failure. | |
std::string | CreateDataDirFilename (std::string filename) |
Construct the full path to a file in the data directory. | |
std::string | CreateTempDirFilename (std::string filename) |
Construct the full path to a file in a temporary directory. | |
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 305 of file queue-disc-traces-test-suite.cc.
QueueDiscTracesTestCase::QueueDiscTracesTestCase | ( | ) |
Definition at line 337 of file queue-disc-traces-test-suite.cc.
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.
qd | the queue disc |
nDadPackets | the expected number of packets |
nDadBytes | the expected number of bytes |
Definition at line 387 of file queue-disc-traces-test-suite.cc.
References m_counter, NS_TEST_ASSERT_MSG_EQ, ns3::QueueDisc::Stats::nTotalDroppedBytesAfterDequeue, and ns3::QueueDisc::Stats::nTotalDroppedPacketsAfterDequeue.
Referenced by DoRun().
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.
qd | the queue disc |
nDbePackets | the expected number of packets |
nDbeBytes | the expected number of bytes |
Definition at line 361 of file queue-disc-traces-test-suite.cc.
References m_counter, NS_TEST_ASSERT_MSG_EQ, ns3::QueueDisc::Stats::nTotalDroppedBytesBeforeEnqueue, and ns3::QueueDisc::Stats::nTotalDroppedPacketsBeforeEnqueue.
Referenced by DoRun().
void QueueDiscTracesTestCase::CheckQueued | ( | Ptr< QueueDisc > | qd, |
uint32_t | nPackets, | ||
uint32_t | nBytes ) |
Check that queued packets/bytes are consistent with what is expected.
qd | the queue disc |
nPackets | the expected number of packets |
nBytes | the expected number of bytes |
Definition at line 343 of file queue-disc-traces-test-suite.cc.
References m_counter, and NS_TEST_ASSERT_MSG_EQ.
Referenced by DoRun().
|
overridevirtual |
Implementation to actually run this TestCase.
Subclasses should override this method to conduct their tests.
Implements ns3::TestCase.
Definition at line 413 of file queue-disc-traces-test-suite.cc.
References CheckDroppedAfterDequeue(), CheckDroppedBeforeEnqueue(), CheckQueued(), ns3::Create(), ns3::CreateObject(), ns3::Simulator::Destroy(), m_counter, NS_TEST_ASSERT_MSG_EQ, and NS_TEST_ASSERT_MSG_NE.
|
private |
counters for the queue discs
Definition at line 334 of file queue-disc-traces-test-suite.cc.
Referenced by CheckDroppedAfterDequeue(), CheckDroppedBeforeEnqueue(), CheckQueued(), and DoRun().