22 #include "ns3/wifi-mac-queue.h"
23 #include "ns3/simulator.h"
45 void DoRun ()
override;
49 :
TestCase (
"Test DROP_OLDEST setting")
56 auto wifiMacQueue = CreateObject<WifiMacQueue> (
AC_BE);
57 wifiMacQueue->SetMaxSize (
QueueSize (
"5p"));
58 wifiMacQueue->SetAttribute (
"DropPolicy",
EnumValue (WifiMacQueue::DROP_OLDEST));
61 std::vector<uint64_t> packetUids;
62 for (uint32_t i = 0; i < 5; i++)
67 auto packet = Create<Packet> ();
68 auto item = Create<WifiMacQueueItem> (packet, header);
69 wifiMacQueue->PushFront (item);
71 packetUids.push_back (packet->GetUid ());
75 auto it = wifiMacQueue->begin ();
77 for (uint32_t i = 5; i > 0; i--)
80 packetUids.at (i - 1),
81 "Stored packet is not the expected one");
89 auto packet = Create<Packet> ();
90 auto item = Create<WifiMacQueueItem> (packet, header);
91 wifiMacQueue->PushFront (item);
94 packetUids.at (4) = packet->GetUid ();
97 it = wifiMacQueue->begin ();
99 for (uint32_t i = 5; i > 0; i--)
102 packetUids.at (i - 1),
103 "Stored packet is not the expected one");
107 Simulator::Destroy ();
Test DROP_OLDEST setting.
WifiMacQueueDropOldestTest()
Constructor.
void DoRun() override
Implementation to actually run this TestCase.
Wifi MAC Queue Test Suite.
Hold variables of type enum.
Class for representing queue sizes.
void AddTestCase(TestCase *testCase, TestDuration duration=QUICK)
Add an individual child TestCase to this test suite.
#define NS_TEST_EXPECT_MSG_EQ(actual, limit, msg)
Test that an actual and expected (limit) value are equal and report if not.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
static WifiMacQueueTestSuite g_wifiMacQueueTestSuite
the test suite