20 #include "ns3/drop-tail-queue.h"
21 #include "ns3/uinteger.h"
29 virtual void DoRun (
void);
32 DropTailQueueTestCase::DropTailQueueTestCase ()
33 :
TestCase (
"Sanity check on the drop tail queue implementation")
41 "Verify that we can actually set the attribute");
44 p1 = Create<Packet> ();
45 p2 = Create<Packet> ();
46 p3 = Create<Packet> ();
47 p4 = Create<Packet> ();
49 NS_TEST_EXPECT_MSG_EQ (queue->
GetNPackets (), 0,
"There should be no packets in there");
51 NS_TEST_EXPECT_MSG_EQ (queue->
GetNPackets (), 1,
"There should be one packet in there");
53 NS_TEST_EXPECT_MSG_EQ (queue->
GetNPackets (), 2,
"There should be two packets in there");
55 NS_TEST_EXPECT_MSG_EQ (queue->
GetNPackets (), 3,
"There should be three packets in there");
57 NS_TEST_EXPECT_MSG_EQ (queue->
GetNPackets (), 3,
"There should be still three packets in there");
62 NS_TEST_EXPECT_MSG_EQ ((p != 0),
true,
"I want to remove the first packet");
63 NS_TEST_EXPECT_MSG_EQ (queue->
GetNPackets (), 2,
"There should be two packets in there");
64 NS_TEST_EXPECT_MSG_EQ (p->GetUid (), p1->GetUid (),
"was this the first packet ?");
67 NS_TEST_EXPECT_MSG_EQ ((p != 0),
true,
"I want to remove the second packet");
68 NS_TEST_EXPECT_MSG_EQ (queue->
GetNPackets (), 1,
"There should be one packet in there");
69 NS_TEST_EXPECT_MSG_EQ (p->GetUid (), p2->GetUid (),
"Was this the second packet ?");
72 NS_TEST_EXPECT_MSG_EQ ((p != 0),
true,
"I want to remove the third packet");
73 NS_TEST_EXPECT_MSG_EQ (queue->
GetNPackets (), 0,
"There should be no packets in there");
74 NS_TEST_EXPECT_MSG_EQ (p->GetUid (), p3->GetUid (),
"Was this the third packet ?");
77 NS_TEST_EXPECT_MSG_EQ ((p == 0),
true,
"There are really no packets in there");
88 } g_dropTailQueueTestSuite;
smart pointer class similar to boost::intrusive_ptr
bool Enqueue(Ptr< Packet > p)
bool SetAttributeFailSafe(std::string name, const AttributeValue &value)
TestSuite(std::string name, Type type=UNIT)
Constuct a new test suite.
virtual void DoRun(void)
Implementation to actually run this test case.
Hold an unsigned integer type.
Ptr< Packet > Dequeue(void)
uint32_t GetNPackets(void) const
void AddTestCase(TestCase *testCase) NS_DEPRECATED
Add an individual test case to this test suite.