traffic-control: (fixes #628) Use ASSERT test macros outside of callbacks

This commit is contained in:
Tom Henderson
2022-04-18 12:30:56 -07:00
parent 55c36d8045
commit fbb84923f2
9 changed files with 495 additions and 495 deletions

View File

@@ -144,141 +144,141 @@ AredQueueDiscTestCase::RunAredDiscTest (QueueSizeUnit mode)
qSize = qSize * modeSize;
}
NS_TEST_EXPECT_MSG_EQ (queue->SetAttributeFailSafe ("MinTh", DoubleValue (minTh)), true,
NS_TEST_ASSERT_MSG_EQ (queue->SetAttributeFailSafe ("MinTh", DoubleValue (minTh)), true,
"Verify that we can actually set the attribute MinTh");
NS_TEST_EXPECT_MSG_EQ (queue->SetAttributeFailSafe ("MaxTh", DoubleValue (maxTh)), true,
NS_TEST_ASSERT_MSG_EQ (queue->SetAttributeFailSafe ("MaxTh", DoubleValue (maxTh)), true,
"Verify that we can actually set the attribute MaxTh");
NS_TEST_EXPECT_MSG_EQ (queue->SetAttributeFailSafe ("MaxSize", QueueSizeValue (QueueSize (mode, qSize))),
NS_TEST_ASSERT_MSG_EQ (queue->SetAttributeFailSafe ("MaxSize", QueueSizeValue (QueueSize (mode, qSize))),
true, "Verify that we can actually set the attribute MaxSize");
NS_TEST_EXPECT_MSG_EQ (queue->SetAttributeFailSafe ("QW", DoubleValue (0.0)), true,
NS_TEST_ASSERT_MSG_EQ (queue->SetAttributeFailSafe ("QW", DoubleValue (0.0)), true,
"Verify that we can actually set the attribute QW");
queue->Initialize ();
Enqueue (queue, pktSize, 300);
QueueDisc::Stats st = queue->GetStats ();
NS_TEST_EXPECT_MSG_EQ (st.GetNDroppedPackets (RedQueueDisc::UNFORCED_DROP), 0,
NS_TEST_ASSERT_MSG_EQ (st.GetNDroppedPackets (RedQueueDisc::UNFORCED_DROP), 0,
"There should be zero unforced drops");
// test 2: Verify automatic setting of QW. [QW = 0.0 with lesser LinkBandwidth]
queue = CreateObject<RedQueueDisc> ();
NS_TEST_EXPECT_MSG_EQ (queue->SetAttributeFailSafe ("MinTh", DoubleValue (minTh)), true,
NS_TEST_ASSERT_MSG_EQ (queue->SetAttributeFailSafe ("MinTh", DoubleValue (minTh)), true,
"Verify that we can actually set the attribute MinTh");
NS_TEST_EXPECT_MSG_EQ (queue->SetAttributeFailSafe ("MaxTh", DoubleValue (maxTh)), true,
NS_TEST_ASSERT_MSG_EQ (queue->SetAttributeFailSafe ("MaxTh", DoubleValue (maxTh)), true,
"Verify that we can actually set the attribute MaxTh");
NS_TEST_EXPECT_MSG_EQ (queue->SetAttributeFailSafe ("MaxSize", QueueSizeValue (QueueSize (mode, qSize))),
NS_TEST_ASSERT_MSG_EQ (queue->SetAttributeFailSafe ("MaxSize", QueueSizeValue (QueueSize (mode, qSize))),
true, "Verify that we can actually set the attribute MaxSize");
NS_TEST_EXPECT_MSG_EQ (queue->SetAttributeFailSafe ("QW", DoubleValue (0.0)), true,
NS_TEST_ASSERT_MSG_EQ (queue->SetAttributeFailSafe ("QW", DoubleValue (0.0)), true,
"Verify that we can actually set the attribute QW");
NS_TEST_EXPECT_MSG_EQ (queue->SetAttributeFailSafe ("LinkBandwidth", DataRateValue (DataRate ("0.015Mbps"))), true,
NS_TEST_ASSERT_MSG_EQ (queue->SetAttributeFailSafe ("LinkBandwidth", DataRateValue (DataRate ("0.015Mbps"))), true,
"Verify that we can actually set the attribute LinkBandwidth");
queue->Initialize ();
Enqueue (queue, pktSize, 300);
st = queue->GetStats ();
NS_TEST_EXPECT_MSG_NE (st.GetNDroppedPackets (RedQueueDisc::UNFORCED_DROP), 0,
NS_TEST_ASSERT_MSG_NE (st.GetNDroppedPackets (RedQueueDisc::UNFORCED_DROP), 0,
"There should be some unforced drops");
// test 3: Verify automatic setting of QW. [QW = -1.0 with default LinkBandwidth]
queue = CreateObject<RedQueueDisc> ();
NS_TEST_EXPECT_MSG_EQ (queue->SetAttributeFailSafe ("MinTh", DoubleValue (minTh)), true,
NS_TEST_ASSERT_MSG_EQ (queue->SetAttributeFailSafe ("MinTh", DoubleValue (minTh)), true,
"Verify that we can actually set the attribute MinTh");
NS_TEST_EXPECT_MSG_EQ (queue->SetAttributeFailSafe ("MaxTh", DoubleValue (maxTh)), true,
NS_TEST_ASSERT_MSG_EQ (queue->SetAttributeFailSafe ("MaxTh", DoubleValue (maxTh)), true,
"Verify that we can actually set the attribute MaxTh");
NS_TEST_EXPECT_MSG_EQ (queue->SetAttributeFailSafe ("MaxSize", QueueSizeValue (QueueSize (mode, qSize))),
NS_TEST_ASSERT_MSG_EQ (queue->SetAttributeFailSafe ("MaxSize", QueueSizeValue (QueueSize (mode, qSize))),
true, "Verify that we can actually set the attribute MaxSize");
NS_TEST_EXPECT_MSG_EQ (queue->SetAttributeFailSafe ("QW", DoubleValue (-1.0)), true,
NS_TEST_ASSERT_MSG_EQ (queue->SetAttributeFailSafe ("QW", DoubleValue (-1.0)), true,
"Verify that we can actually set the attribute QW");
queue->Initialize ();
Enqueue (queue, pktSize, 300);
st = queue->GetStats ();
NS_TEST_EXPECT_MSG_EQ (st.GetNDroppedPackets (RedQueueDisc::UNFORCED_DROP), 0,
NS_TEST_ASSERT_MSG_EQ (st.GetNDroppedPackets (RedQueueDisc::UNFORCED_DROP), 0,
"There should be zero unforced drops");
// test 4: Verify automatic setting of QW. [QW = -1.0 with lesser LinkBandwidth]
queue = CreateObject<RedQueueDisc> ();
NS_TEST_EXPECT_MSG_EQ (queue->SetAttributeFailSafe ("MinTh", DoubleValue (minTh)), true,
NS_TEST_ASSERT_MSG_EQ (queue->SetAttributeFailSafe ("MinTh", DoubleValue (minTh)), true,
"Verify that we can actually set the attribute MinTh");
NS_TEST_EXPECT_MSG_EQ (queue->SetAttributeFailSafe ("MaxTh", DoubleValue (maxTh)), true,
NS_TEST_ASSERT_MSG_EQ (queue->SetAttributeFailSafe ("MaxTh", DoubleValue (maxTh)), true,
"Verify that we can actually set the attribute MaxTh");
NS_TEST_EXPECT_MSG_EQ (queue->SetAttributeFailSafe ("MaxSize", QueueSizeValue (QueueSize (mode, qSize))),
NS_TEST_ASSERT_MSG_EQ (queue->SetAttributeFailSafe ("MaxSize", QueueSizeValue (QueueSize (mode, qSize))),
true, "Verify that we can actually set the attribute MaxSize");
NS_TEST_EXPECT_MSG_EQ (queue->SetAttributeFailSafe ("QW", DoubleValue (-1.0)), true,
NS_TEST_ASSERT_MSG_EQ (queue->SetAttributeFailSafe ("QW", DoubleValue (-1.0)), true,
"Verify that we can actually set the attribute QW");
NS_TEST_EXPECT_MSG_EQ (queue->SetAttributeFailSafe ("LinkBandwidth", DataRateValue (DataRate ("0.015Mbps"))), true,
NS_TEST_ASSERT_MSG_EQ (queue->SetAttributeFailSafe ("LinkBandwidth", DataRateValue (DataRate ("0.015Mbps"))), true,
"Verify that we can actually set the attribute LinkBandwidth");
queue->Initialize ();
Enqueue (queue, pktSize, 300);
st = queue->GetStats ();
NS_TEST_EXPECT_MSG_NE (st.GetNDroppedPackets (RedQueueDisc::UNFORCED_DROP), 0,
NS_TEST_ASSERT_MSG_NE (st.GetNDroppedPackets (RedQueueDisc::UNFORCED_DROP), 0,
"There should be some unforced drops");
// test 5: Verify automatic setting of QW. [QW = -2.0 with default LinkBandwidth]
queue = CreateObject<RedQueueDisc> ();
NS_TEST_EXPECT_MSG_EQ (queue->SetAttributeFailSafe ("MinTh", DoubleValue (minTh)), true,
NS_TEST_ASSERT_MSG_EQ (queue->SetAttributeFailSafe ("MinTh", DoubleValue (minTh)), true,
"Verify that we can actually set the attribute MinTh");
NS_TEST_EXPECT_MSG_EQ (queue->SetAttributeFailSafe ("MaxTh", DoubleValue (maxTh)), true,
NS_TEST_ASSERT_MSG_EQ (queue->SetAttributeFailSafe ("MaxTh", DoubleValue (maxTh)), true,
"Verify that we can actually set the attribute MaxTh");
NS_TEST_EXPECT_MSG_EQ (queue->SetAttributeFailSafe ("MaxSize", QueueSizeValue (QueueSize (mode, qSize))),
NS_TEST_ASSERT_MSG_EQ (queue->SetAttributeFailSafe ("MaxSize", QueueSizeValue (QueueSize (mode, qSize))),
true, "Verify that we can actually set the attribute MaxSize");
NS_TEST_EXPECT_MSG_EQ (queue->SetAttributeFailSafe ("QW", DoubleValue (-2.0)), true,
NS_TEST_ASSERT_MSG_EQ (queue->SetAttributeFailSafe ("QW", DoubleValue (-2.0)), true,
"Verify that we can actually set the attribute QW");
queue->Initialize ();
Enqueue (queue, pktSize, 300);
st = queue->GetStats ();
uint32_t test5 = st.GetNDroppedPackets (RedQueueDisc::UNFORCED_DROP);
NS_TEST_EXPECT_MSG_NE (test5, 0, "There should be some unforced drops");
NS_TEST_ASSERT_MSG_NE (test5, 0, "There should be some unforced drops");
// test 6: Verify automatic setting of QW. [QW = -2.0 with lesser LinkBandwidth]
queue = CreateObject<RedQueueDisc> ();
NS_TEST_EXPECT_MSG_EQ (queue->SetAttributeFailSafe ("MinTh", DoubleValue (minTh)), true,
NS_TEST_ASSERT_MSG_EQ (queue->SetAttributeFailSafe ("MinTh", DoubleValue (minTh)), true,
"Verify that we can actually set the attribute MinTh");
NS_TEST_EXPECT_MSG_EQ (queue->SetAttributeFailSafe ("MaxTh", DoubleValue (maxTh)), true,
NS_TEST_ASSERT_MSG_EQ (queue->SetAttributeFailSafe ("MaxTh", DoubleValue (maxTh)), true,
"Verify that we can actually set the attribute MaxTh");
NS_TEST_EXPECT_MSG_EQ (queue->SetAttributeFailSafe ("MaxSize", QueueSizeValue (QueueSize (mode, qSize))),
NS_TEST_ASSERT_MSG_EQ (queue->SetAttributeFailSafe ("MaxSize", QueueSizeValue (QueueSize (mode, qSize))),
true, "Verify that we can actually set the attribute MaxSize");
NS_TEST_EXPECT_MSG_EQ (queue->SetAttributeFailSafe ("QW", DoubleValue (-2.0)), true,
NS_TEST_ASSERT_MSG_EQ (queue->SetAttributeFailSafe ("QW", DoubleValue (-2.0)), true,
"Verify that we can actually set the attribute QW");
NS_TEST_EXPECT_MSG_EQ (queue->SetAttributeFailSafe ("LinkBandwidth", DataRateValue (DataRate ("0.015Mbps"))), true,
NS_TEST_ASSERT_MSG_EQ (queue->SetAttributeFailSafe ("LinkBandwidth", DataRateValue (DataRate ("0.015Mbps"))), true,
"Verify that we can actually set the attribute LinkBandwidth");
queue->Initialize ();
Enqueue (queue, pktSize, 300);
st = queue->GetStats ();
uint32_t test6 = st.GetNDroppedPackets (RedQueueDisc::UNFORCED_DROP);
NS_TEST_EXPECT_MSG_NE (test6, test5, "Test 6 should have more unforced drops than Test 5");
NS_TEST_ASSERT_MSG_NE (test6, test5, "Test 6 should have more unforced drops than Test 5");
// test 7: Verify automatic setting of minTh and maxTh. [minTh = maxTh = 0.0, with default LinkBandwidth]
queue = CreateObject<RedQueueDisc> ();
NS_TEST_EXPECT_MSG_EQ (queue->SetAttributeFailSafe ("MinTh", DoubleValue (0.0)), true,
NS_TEST_ASSERT_MSG_EQ (queue->SetAttributeFailSafe ("MinTh", DoubleValue (0.0)), true,
"Verify that we can actually set the attribute MinTh");
NS_TEST_EXPECT_MSG_EQ (queue->SetAttributeFailSafe ("MaxTh", DoubleValue (0.0)), true,
NS_TEST_ASSERT_MSG_EQ (queue->SetAttributeFailSafe ("MaxTh", DoubleValue (0.0)), true,
"Verify that we can actually set the attribute MaxTh");
NS_TEST_EXPECT_MSG_EQ (queue->SetAttributeFailSafe ("MaxSize", QueueSizeValue (QueueSize (mode, qSize))),
NS_TEST_ASSERT_MSG_EQ (queue->SetAttributeFailSafe ("MaxSize", QueueSizeValue (QueueSize (mode, qSize))),
true, "Verify that we can actually set the attribute MaxSize");
queue->Initialize ();
Enqueue (queue, pktSize, 300);
st = queue->GetStats ();
NS_TEST_EXPECT_MSG_NE (st.GetNDroppedPackets (RedQueueDisc::UNFORCED_DROP), 0,
NS_TEST_ASSERT_MSG_NE (st.GetNDroppedPackets (RedQueueDisc::UNFORCED_DROP), 0,
"There should be some unforced drops");
// test 8: Verify automatic setting of minTh and maxTh. [minTh = maxTh = 0.0, with higher LinkBandwidth]
queue = CreateObject<RedQueueDisc> ();
NS_TEST_EXPECT_MSG_EQ (queue->SetAttributeFailSafe ("MinTh", DoubleValue (0.0)), true,
NS_TEST_ASSERT_MSG_EQ (queue->SetAttributeFailSafe ("MinTh", DoubleValue (0.0)), true,
"Verify that we can actually set the attribute MinTh");
NS_TEST_EXPECT_MSG_EQ (queue->SetAttributeFailSafe ("MaxTh", DoubleValue (0.0)), true,
NS_TEST_ASSERT_MSG_EQ (queue->SetAttributeFailSafe ("MaxTh", DoubleValue (0.0)), true,
"Verify that we can actually set the attribute MaxTh");
NS_TEST_EXPECT_MSG_EQ (queue->SetAttributeFailSafe ("MaxSize", QueueSizeValue (QueueSize (mode, qSize))),
NS_TEST_ASSERT_MSG_EQ (queue->SetAttributeFailSafe ("MaxSize", QueueSizeValue (QueueSize (mode, qSize))),
true, "Verify that we can actually set the attribute MaxSize");
NS_TEST_EXPECT_MSG_EQ (queue->SetAttributeFailSafe ("LinkBandwidth", DataRateValue (DataRate ("150Mbps"))), true,
NS_TEST_ASSERT_MSG_EQ (queue->SetAttributeFailSafe ("LinkBandwidth", DataRateValue (DataRate ("150Mbps"))), true,
"Verify that we can actually set the attribute LinkBandwidth");
queue->Initialize ();
Enqueue (queue, pktSize, 300);
st = queue->GetStats ();
NS_TEST_EXPECT_MSG_EQ (st.GetNDroppedPackets (RedQueueDisc::UNFORCED_DROP), 0,
NS_TEST_ASSERT_MSG_EQ (st.GetNDroppedPackets (RedQueueDisc::UNFORCED_DROP), 0,
"There should be zero unforced drops");
@@ -286,15 +286,15 @@ AredQueueDiscTestCase::RunAredDiscTest (QueueSizeUnit mode)
queue = CreateObject<RedQueueDisc> ();
minTh = 5 * modeSize;
maxTh = 15 * modeSize;
NS_TEST_EXPECT_MSG_EQ (queue->SetAttributeFailSafe ("MinTh", DoubleValue (minTh)), true,
NS_TEST_ASSERT_MSG_EQ (queue->SetAttributeFailSafe ("MinTh", DoubleValue (minTh)), true,
"Verify that we can actually set the attribute MinTh");
NS_TEST_EXPECT_MSG_EQ (queue->SetAttributeFailSafe ("MaxTh", DoubleValue (maxTh)), true,
NS_TEST_ASSERT_MSG_EQ (queue->SetAttributeFailSafe ("MaxTh", DoubleValue (maxTh)), true,
"Verify that we can actually set the attribute MaxTh");
NS_TEST_EXPECT_MSG_EQ (queue->SetAttributeFailSafe ("MaxSize", QueueSizeValue (QueueSize (mode, qSize))),
NS_TEST_ASSERT_MSG_EQ (queue->SetAttributeFailSafe ("MaxSize", QueueSizeValue (QueueSize (mode, qSize))),
true, "Verify that we can actually set the attribute MaxSize");
NS_TEST_EXPECT_MSG_EQ (queue->SetAttributeFailSafe ("QW", DoubleValue (0.002)), true,
NS_TEST_ASSERT_MSG_EQ (queue->SetAttributeFailSafe ("QW", DoubleValue (0.002)), true,
"Verify that we can actually set the attribute QW");
NS_TEST_EXPECT_MSG_EQ (queue->SetAttributeFailSafe ("LInterm", DoubleValue (2)), true,
NS_TEST_ASSERT_MSG_EQ (queue->SetAttributeFailSafe ("LInterm", DoubleValue (2)), true,
"Verify that we can actually set the attribute LInterm");
queue->Initialize ();
EnqueueWithDelay (queue, pktSize, 300);
@@ -302,17 +302,17 @@ AredQueueDiscTestCase::RunAredDiscTest (QueueSizeUnit mode)
Simulator::Run ();
st = queue->GetStats ();
uint32_t test9 = st.GetNDroppedPackets (RedQueueDisc::UNFORCED_DROP);
NS_TEST_EXPECT_MSG_NE (st.GetNDroppedPackets (RedQueueDisc::UNFORCED_DROP), 0,
NS_TEST_ASSERT_MSG_NE (st.GetNDroppedPackets (RedQueueDisc::UNFORCED_DROP), 0,
"There should be some unforced drops");
// test 10: Adaptive RED (automatic and adaptive settings enabled)
queue = CreateObject<RedQueueDisc> ();
NS_TEST_EXPECT_MSG_EQ (queue->SetAttributeFailSafe ("MaxSize", QueueSizeValue (QueueSize (mode, qSize))),
NS_TEST_ASSERT_MSG_EQ (queue->SetAttributeFailSafe ("MaxSize", QueueSizeValue (QueueSize (mode, qSize))),
true, "Verify that we can actually set the attribute MaxSize");
NS_TEST_EXPECT_MSG_EQ (queue->SetAttributeFailSafe ("LInterm", DoubleValue (2)), true,
NS_TEST_ASSERT_MSG_EQ (queue->SetAttributeFailSafe ("LInterm", DoubleValue (2)), true,
"Verify that we can actually set the attribute LInterm");
NS_TEST_EXPECT_MSG_EQ (queue->SetAttributeFailSafe ("ARED", BooleanValue (true)), true,
NS_TEST_ASSERT_MSG_EQ (queue->SetAttributeFailSafe ("ARED", BooleanValue (true)), true,
"Verify that we can actually set the attribute ARED");
queue->Initialize ();
EnqueueWithDelay (queue, pktSize, 300);
@@ -320,7 +320,7 @@ AredQueueDiscTestCase::RunAredDiscTest (QueueSizeUnit mode)
Simulator::Run ();
st = queue->GetStats ();
uint32_t test10 = st.GetNDroppedPackets (RedQueueDisc::UNFORCED_DROP);
NS_TEST_EXPECT_MSG_LT (test10, test9, "Test 10 should have less unforced drops than test 9");
NS_TEST_ASSERT_MSG_LT (test10, test9, "Test 10 should have less unforced drops than test 9");
}
void

View File

@@ -135,11 +135,11 @@ CobaltQueueDiscBasicEnqueueDequeue::DoRun (void)
Address dest;
NS_TEST_EXPECT_MSG_EQ (queue->SetAttributeFailSafe ("Interval", StringValue ("50ms")), true,
NS_TEST_ASSERT_MSG_EQ (queue->SetAttributeFailSafe ("Interval", StringValue ("50ms")), true,
"Verify that we can actually set the attribute Interval");
NS_TEST_EXPECT_MSG_EQ (queue->SetAttributeFailSafe ("Target", StringValue ("4ms")), true,
NS_TEST_ASSERT_MSG_EQ (queue->SetAttributeFailSafe ("Target", StringValue ("4ms")), true,
"Verify that we can actually set the attribute Target");
NS_TEST_EXPECT_MSG_EQ (queue->SetAttributeFailSafe ("BlueThreshold", TimeValue (Time::Max ())), true,
NS_TEST_ASSERT_MSG_EQ (queue->SetAttributeFailSafe ("BlueThreshold", TimeValue (Time::Max ())), true,
"Disable Blue enhancement");
if (m_mode == QueueSizeUnit::BYTES)
@@ -150,7 +150,7 @@ CobaltQueueDiscBasicEnqueueDequeue::DoRun (void)
{
modeSize = 1;
}
NS_TEST_EXPECT_MSG_EQ (queue->SetAttributeFailSafe ("MaxSize", QueueSizeValue (QueueSize (m_mode, modeSize * 1500))),
NS_TEST_ASSERT_MSG_EQ (queue->SetAttributeFailSafe ("MaxSize", QueueSizeValue (QueueSize (m_mode, modeSize * 1500))),
true, "Verify that we can actually set the attribute MaxSize");
queue->Initialize ();
@@ -162,58 +162,58 @@ CobaltQueueDiscBasicEnqueueDequeue::DoRun (void)
p5 = Create<Packet> (pktSize);
p6 = Create<Packet> (pktSize);
NS_TEST_EXPECT_MSG_EQ (queue->GetCurrentSize ().GetValue (), 0 * modeSize, "There should be no packets in queue");
NS_TEST_ASSERT_MSG_EQ (queue->GetCurrentSize ().GetValue (), 0 * modeSize, "There should be no packets in queue");
queue->Enqueue (Create<CobaltQueueDiscTestItem> (p1, dest,0, false));
NS_TEST_EXPECT_MSG_EQ (queue->GetCurrentSize ().GetValue (), 1 * modeSize, "There should be one packet in queue");
NS_TEST_ASSERT_MSG_EQ (queue->GetCurrentSize ().GetValue (), 1 * modeSize, "There should be one packet in queue");
queue->Enqueue (Create<CobaltQueueDiscTestItem> (p2, dest,0, false));
NS_TEST_EXPECT_MSG_EQ (queue->GetCurrentSize ().GetValue (), 2 * modeSize, "There should be two packets in queue");
NS_TEST_ASSERT_MSG_EQ (queue->GetCurrentSize ().GetValue (), 2 * modeSize, "There should be two packets in queue");
queue->Enqueue (Create<CobaltQueueDiscTestItem> (p3, dest,0, false));
NS_TEST_EXPECT_MSG_EQ (queue->GetCurrentSize ().GetValue (), 3 * modeSize, "There should be three packets in queue");
NS_TEST_ASSERT_MSG_EQ (queue->GetCurrentSize ().GetValue (), 3 * modeSize, "There should be three packets in queue");
queue->Enqueue (Create<CobaltQueueDiscTestItem> (p4, dest,0, false));
NS_TEST_EXPECT_MSG_EQ (queue->GetCurrentSize ().GetValue (), 4 * modeSize, "There should be four packets in queue");
NS_TEST_ASSERT_MSG_EQ (queue->GetCurrentSize ().GetValue (), 4 * modeSize, "There should be four packets in queue");
queue->Enqueue (Create<CobaltQueueDiscTestItem> (p5, dest,0, false));
NS_TEST_EXPECT_MSG_EQ (queue->GetCurrentSize ().GetValue (), 5 * modeSize, "There should be five packets in queue");
NS_TEST_ASSERT_MSG_EQ (queue->GetCurrentSize ().GetValue (), 5 * modeSize, "There should be five packets in queue");
queue->Enqueue (Create<CobaltQueueDiscTestItem> (p6, dest,0, false));
NS_TEST_EXPECT_MSG_EQ (queue->GetCurrentSize ().GetValue (), 6 * modeSize, "There should be six packets in queue");
NS_TEST_ASSERT_MSG_EQ (queue->GetCurrentSize ().GetValue (), 6 * modeSize, "There should be six packets in queue");
NS_TEST_EXPECT_MSG_EQ (queue->GetStats ().GetNDroppedPackets (CobaltQueueDisc::OVERLIMIT_DROP), 0, "There should be no packets being dropped due to full queue");
NS_TEST_ASSERT_MSG_EQ (queue->GetStats ().GetNDroppedPackets (CobaltQueueDisc::OVERLIMIT_DROP), 0, "There should be no packets being dropped due to full queue");
Ptr<QueueDiscItem> item;
item = queue->Dequeue ();
NS_TEST_EXPECT_MSG_EQ ((item != 0), true, "I want to remove the first packet");
NS_TEST_EXPECT_MSG_EQ (queue->GetCurrentSize ().GetValue (), 5 * modeSize, "There should be five packets in queue");
NS_TEST_EXPECT_MSG_EQ (item->GetPacket ()->GetUid (), p1->GetUid (), "was this the first packet ?");
NS_TEST_ASSERT_MSG_EQ ((item != 0), true, "I want to remove the first packet");
NS_TEST_ASSERT_MSG_EQ (queue->GetCurrentSize ().GetValue (), 5 * modeSize, "There should be five packets in queue");
NS_TEST_ASSERT_MSG_EQ (item->GetPacket ()->GetUid (), p1->GetUid (), "was this the first packet ?");
item = queue->Dequeue ();
NS_TEST_EXPECT_MSG_EQ ((item != 0), true, "I want to remove the second packet");
NS_TEST_EXPECT_MSG_EQ (queue->GetCurrentSize ().GetValue (), 4 * modeSize, "There should be four packets in queue");
NS_TEST_EXPECT_MSG_EQ (item->GetPacket ()->GetUid (), p2->GetUid (), "Was this the second packet ?");
NS_TEST_ASSERT_MSG_EQ ((item != 0), true, "I want to remove the second packet");
NS_TEST_ASSERT_MSG_EQ (queue->GetCurrentSize ().GetValue (), 4 * modeSize, "There should be four packets in queue");
NS_TEST_ASSERT_MSG_EQ (item->GetPacket ()->GetUid (), p2->GetUid (), "Was this the second packet ?");
item = queue->Dequeue ();
NS_TEST_EXPECT_MSG_EQ ((item != 0), true, "I want to remove the third packet");
NS_TEST_EXPECT_MSG_EQ (queue->GetCurrentSize ().GetValue (), 3 * modeSize, "There should be three packets in queue");
NS_TEST_EXPECT_MSG_EQ (item->GetPacket ()->GetUid (), p3->GetUid (), "Was this the third packet ?");
NS_TEST_ASSERT_MSG_EQ ((item != 0), true, "I want to remove the third packet");
NS_TEST_ASSERT_MSG_EQ (queue->GetCurrentSize ().GetValue (), 3 * modeSize, "There should be three packets in queue");
NS_TEST_ASSERT_MSG_EQ (item->GetPacket ()->GetUid (), p3->GetUid (), "Was this the third packet ?");
item = queue->Dequeue ();
NS_TEST_EXPECT_MSG_EQ ((item != 0), true, "I want to remove the forth packet");
NS_TEST_EXPECT_MSG_EQ (queue->GetCurrentSize ().GetValue (), 2 * modeSize, "There should be two packets in queue");
NS_TEST_EXPECT_MSG_EQ (item->GetPacket ()->GetUid (), p4->GetUid (), "Was this the fourth packet ?");
NS_TEST_ASSERT_MSG_EQ ((item != 0), true, "I want to remove the forth packet");
NS_TEST_ASSERT_MSG_EQ (queue->GetCurrentSize ().GetValue (), 2 * modeSize, "There should be two packets in queue");
NS_TEST_ASSERT_MSG_EQ (item->GetPacket ()->GetUid (), p4->GetUid (), "Was this the fourth packet ?");
item = queue->Dequeue ();
NS_TEST_EXPECT_MSG_EQ ((item != 0), true, "I want to remove the fifth packet");
NS_TEST_EXPECT_MSG_EQ (queue->GetCurrentSize ().GetValue (), 1 * modeSize, "There should be one packet in queue");
NS_TEST_EXPECT_MSG_EQ (item->GetPacket ()->GetUid (), p5->GetUid (), "Was this the fifth packet ?");
NS_TEST_ASSERT_MSG_EQ ((item != 0), true, "I want to remove the fifth packet");
NS_TEST_ASSERT_MSG_EQ (queue->GetCurrentSize ().GetValue (), 1 * modeSize, "There should be one packet in queue");
NS_TEST_ASSERT_MSG_EQ (item->GetPacket ()->GetUid (), p5->GetUid (), "Was this the fifth packet ?");
item = queue->Dequeue ();
NS_TEST_EXPECT_MSG_EQ ((item != 0), true, "I want to remove the last packet");
NS_TEST_EXPECT_MSG_EQ (queue->GetCurrentSize ().GetValue (), 0 * modeSize, "There should be zero packet in queue");
NS_TEST_EXPECT_MSG_EQ (item->GetPacket ()->GetUid (), p6->GetUid (), "Was this the sixth packet ?");
NS_TEST_ASSERT_MSG_EQ ((item != 0), true, "I want to remove the last packet");
NS_TEST_ASSERT_MSG_EQ (queue->GetCurrentSize ().GetValue (), 0 * modeSize, "There should be zero packet in queue");
NS_TEST_ASSERT_MSG_EQ (item->GetPacket ()->GetUid (), p6->GetUid (), "Was this the sixth packet ?");
item = queue->Dequeue ();
NS_TEST_EXPECT_MSG_EQ ((item == 0), true, "There are really no packets in queue");
NS_TEST_ASSERT_MSG_EQ ((item == 0), true, "There are really no packets in queue");
NS_TEST_EXPECT_MSG_EQ (queue->GetStats ().GetNDroppedPackets (CobaltQueueDisc::TARGET_EXCEEDED_DROP), 0, "There should be no packet drops according to Cobalt algorithm");
NS_TEST_ASSERT_MSG_EQ (queue->GetStats ().GetNDroppedPackets (CobaltQueueDisc::TARGET_EXCEEDED_DROP), 0, "There should be no packet drops according to Cobalt algorithm");
}
/**
@@ -274,9 +274,9 @@ CobaltQueueDiscDropTest::RunDropTest (QueueSizeUnit mode)
}
queue = CreateObject<CobaltQueueDisc> ();
NS_TEST_EXPECT_MSG_EQ (queue->SetAttributeFailSafe ("MaxSize", QueueSizeValue (QueueSize (mode, modeSize * 100))),
NS_TEST_ASSERT_MSG_EQ (queue->SetAttributeFailSafe ("MaxSize", QueueSizeValue (QueueSize (mode, modeSize * 100))),
true, "Verify that we can actually set the attribute MaxSize");
NS_TEST_EXPECT_MSG_EQ (queue->SetAttributeFailSafe ("BlueThreshold", TimeValue (Time::Max ())), true,
NS_TEST_ASSERT_MSG_EQ (queue->SetAttributeFailSafe ("BlueThreshold", TimeValue (Time::Max ())), true,
"Disable Blue enhancement");
queue->Initialize ();
@@ -295,8 +295,8 @@ CobaltQueueDiscDropTest::RunDropTest (QueueSizeUnit mode)
QueueDisc::Stats st = queue->GetStats ();
// The Pdrop value should increase, from it's default value of zero
NS_TEST_EXPECT_MSG_NE (queue->GetPdrop (), 0, "Pdrop should be non-zero");
NS_TEST_EXPECT_MSG_NE (st.GetNDroppedPackets (CobaltQueueDisc::OVERLIMIT_DROP), 0, "Drops due to queue overflow should be non-zero");
NS_TEST_ASSERT_MSG_NE (queue->GetPdrop (), 0, "Pdrop should be non-zero");
NS_TEST_ASSERT_MSG_NE (st.GetNDroppedPackets (CobaltQueueDisc::OVERLIMIT_DROP), 0, "Drops due to queue overflow should be non-zero");
}
void
@@ -410,17 +410,17 @@ CobaltQueueDiscMarkTest::DoRun (void)
modeSize = 1;
}
NS_TEST_EXPECT_MSG_EQ (queue->SetAttributeFailSafe ("MaxSize", QueueSizeValue (QueueSize (m_mode, modeSize * 500))),
NS_TEST_ASSERT_MSG_EQ (queue->SetAttributeFailSafe ("MaxSize", QueueSizeValue (QueueSize (m_mode, modeSize * 500))),
true, "Verify that we can actually set the attribute MaxSize");
NS_TEST_EXPECT_MSG_EQ (queue->SetAttributeFailSafe ("UseEcn", BooleanValue (false)),
NS_TEST_ASSERT_MSG_EQ (queue->SetAttributeFailSafe ("UseEcn", BooleanValue (false)),
true, "Verify that we can actually set the attribute UseEcn");
NS_TEST_EXPECT_MSG_EQ (queue->SetAttributeFailSafe ("BlueThreshold", TimeValue (Time::Max ())), true,
NS_TEST_ASSERT_MSG_EQ (queue->SetAttributeFailSafe ("BlueThreshold", TimeValue (Time::Max ())), true,
"Disable Blue enhancement");
queue->Initialize ();
// Not-ECT traffic to induce packet drop
Enqueue (queue, pktSize, 20, false);
NS_TEST_EXPECT_MSG_EQ (queue->GetCurrentSize ().GetValue (), 20 * modeSize, "There should be 20 packets in queue.");
NS_TEST_ASSERT_MSG_EQ (queue->GetCurrentSize ().GetValue (), 20 * modeSize, "There should be 20 packets in queue.");
// Although the first dequeue occurs with a sojourn time above target
// there should not be any dropped packets in this interval
@@ -436,17 +436,17 @@ CobaltQueueDiscMarkTest::DoRun (void)
// Test case 2, queue with ECN capable traffic for marking of packets instead of dropping
queue = CreateObject<CobaltQueueDisc> ();
NS_TEST_EXPECT_MSG_EQ (queue->SetAttributeFailSafe ("MaxSize", QueueSizeValue (QueueSize (m_mode, modeSize * 500))),
NS_TEST_ASSERT_MSG_EQ (queue->SetAttributeFailSafe ("MaxSize", QueueSizeValue (QueueSize (m_mode, modeSize * 500))),
true, "Verify that we can actually set the attribute MaxSize");
NS_TEST_EXPECT_MSG_EQ (queue->SetAttributeFailSafe ("UseEcn", BooleanValue (true)),
NS_TEST_ASSERT_MSG_EQ (queue->SetAttributeFailSafe ("UseEcn", BooleanValue (true)),
true, "Verify that we can actually set the attribute UseEcn");
NS_TEST_EXPECT_MSG_EQ (queue->SetAttributeFailSafe ("BlueThreshold", TimeValue (Time::Max ())), true,
NS_TEST_ASSERT_MSG_EQ (queue->SetAttributeFailSafe ("BlueThreshold", TimeValue (Time::Max ())), true,
"Disable Blue enhancement");
queue->Initialize ();
// ECN capable traffic
Enqueue (queue, pktSize, 20, true);
NS_TEST_EXPECT_MSG_EQ (queue->GetCurrentSize ().GetValue (), 20 * modeSize, "There should be 20 packets in queue.");
NS_TEST_ASSERT_MSG_EQ (queue->GetCurrentSize ().GetValue (), 20 * modeSize, "There should be 20 packets in queue.");
// Although the first dequeue occurs with a sojourn time above target
// there should not be any marked packets in this interval
@@ -467,11 +467,11 @@ CobaltQueueDiscMarkTest::DoRun (void)
// Test case 3, some packets are ECN capable
queue = CreateObject<CobaltQueueDisc> ();
NS_TEST_EXPECT_MSG_EQ (queue->SetAttributeFailSafe ("MaxSize", QueueSizeValue (QueueSize (m_mode, modeSize * 500))),
NS_TEST_ASSERT_MSG_EQ (queue->SetAttributeFailSafe ("MaxSize", QueueSizeValue (QueueSize (m_mode, modeSize * 500))),
true, "Verify that we can actually set the attribute MaxSize");
NS_TEST_EXPECT_MSG_EQ (queue->SetAttributeFailSafe ("UseEcn", BooleanValue (true)),
NS_TEST_ASSERT_MSG_EQ (queue->SetAttributeFailSafe ("UseEcn", BooleanValue (true)),
true, "Verify that we can actually set the attribute UseEcn");
NS_TEST_EXPECT_MSG_EQ (queue->SetAttributeFailSafe ("BlueThreshold", TimeValue (Time::Max ())), true,
NS_TEST_ASSERT_MSG_EQ (queue->SetAttributeFailSafe ("BlueThreshold", TimeValue (Time::Max ())), true,
"Disable Blue enhancement");
queue->Initialize ();
@@ -479,7 +479,7 @@ CobaltQueueDiscMarkTest::DoRun (void)
Enqueue (queue, pktSize, 3, true);
// Rest of the packet are not ecnCapable
Enqueue (queue, pktSize, 17, false);
NS_TEST_EXPECT_MSG_EQ (queue->GetCurrentSize ().GetValue (), 20 * modeSize, "There should be 20 packets in queue.");
NS_TEST_ASSERT_MSG_EQ (queue->GetCurrentSize ().GetValue (), 20 * modeSize, "There should be 20 packets in queue.");
// Although the first dequeue occurs with a sojourn time above target
// there should not be any marked packets in this interval
@@ -545,7 +545,7 @@ CobaltQueueDiscMarkTest::Dequeue (Ptr<CobaltQueueDisc> queue, uint32_t modeSize,
currentMarkCount = queue->GetStats ().GetNMarkedPackets (CobaltQueueDisc::FORCED_MARK);
NS_TEST_EXPECT_MSG_EQ (queue->GetCurrentSize ().GetValue (), initialQSize - modeSize, "There should be 1 packet dequeued.");
NS_TEST_EXPECT_MSG_EQ (currentDropCount, 0, "There should not be any packet drops");
NS_TEST_ASSERT_MSG_EQ (currentMarkCount, 0, "We are not in dropping state."
NS_TEST_EXPECT_MSG_EQ (currentMarkCount, 0, "We are not in dropping state."
"Sojourn time has just gone above target from below."
"Hence, there should be no marked packets");
}
@@ -599,7 +599,7 @@ CobaltQueueDiscMarkTest::Dequeue (Ptr<CobaltQueueDisc> queue, uint32_t modeSize,
currentMarkCount = queue->GetStats ().GetNMarkedPackets (CobaltQueueDisc::FORCED_MARK);
NS_TEST_EXPECT_MSG_EQ (queue->GetCurrentSize ().GetValue (), initialQSize - modeSize, "There should be 1 packet dequeued.");
NS_TEST_EXPECT_MSG_EQ (currentDropCount, 0, "There should not be any packet drops");
NS_TEST_ASSERT_MSG_EQ (currentMarkCount, 0, "We are not in dropping state."
NS_TEST_EXPECT_MSG_EQ (currentMarkCount, 0, "We are not in dropping state."
"Sojourn time has just gone above target from below."
"Hence, there should be no marked packets");
}
@@ -770,11 +770,11 @@ CobaltQueueDiscCeThresholdTest::DoRun (void)
modeSize = 1;
}
NS_TEST_EXPECT_MSG_EQ (queue->SetAttributeFailSafe ("UseEcn", BooleanValue (true)),
NS_TEST_ASSERT_MSG_EQ (queue->SetAttributeFailSafe ("UseEcn", BooleanValue (true)),
true, "Verify that we can actually set the attribute UseEcn");
NS_TEST_EXPECT_MSG_EQ (queue->SetAttributeFailSafe ("CeThreshold", TimeValue (MilliSeconds (1))),
NS_TEST_ASSERT_MSG_EQ (queue->SetAttributeFailSafe ("CeThreshold", TimeValue (MilliSeconds (1))),
true, "Verify that we can actually set the attribute UseEcn");
NS_TEST_EXPECT_MSG_EQ (queue->SetAttributeFailSafe ("BlueThreshold", TimeValue (Time::Max ())), true,
NS_TEST_ASSERT_MSG_EQ (queue->SetAttributeFailSafe ("BlueThreshold", TimeValue (Time::Max ())), true,
"Disable Blue enhancement");
queue->Initialize ();
@@ -891,17 +891,17 @@ CobaltQueueDiscEnhancedBlueTest::DoRun (void)
QueueDisc::Stats st = queue->GetStats ();
// The Pdrop value should increase, from it's default value of zero
NS_TEST_EXPECT_MSG_EQ (queue->GetPdrop (), 0.234375, "Pdrop should be increased by 1/256 for every packet whose sojourn time is above 400ms."
NS_TEST_ASSERT_MSG_EQ (queue->GetPdrop (), 0.234375, "Pdrop should be increased by 1/256 for every packet whose sojourn time is above 400ms."
" From the 41st dequeue until the last one, sojourn time is above 400ms, so 60 packets have sojourn time above 400ms"
"hence Pdrop should be increased 60*(1/256) which is 0.234375");
NS_TEST_EXPECT_MSG_EQ (st.GetNDroppedPackets (CobaltQueueDisc::TARGET_EXCEEDED_DROP), 49, "There should a fixed number of drops (49 here)");
NS_TEST_ASSERT_MSG_EQ (st.GetNDroppedPackets (CobaltQueueDisc::TARGET_EXCEEDED_DROP), 49, "There should a fixed number of drops (49 here)");
Simulator::Destroy ();
queue = CreateObject<CobaltQueueDisc> ();
NS_TEST_EXPECT_MSG_EQ (queue->SetAttributeFailSafe ("UseEcn", BooleanValue (true)),
NS_TEST_ASSERT_MSG_EQ (queue->SetAttributeFailSafe ("UseEcn", BooleanValue (true)),
true, "Verify that we can actually set the attribute UseEcn");
NS_TEST_EXPECT_MSG_EQ (queue->SetAttributeFailSafe ("BlueThreshold", TimeValue (Time::Max ())), true,
NS_TEST_ASSERT_MSG_EQ (queue->SetAttributeFailSafe ("BlueThreshold", TimeValue (Time::Max ())), true,
"Disable Blue enhancement");
queue->Initialize ();
Enqueue (queue, modeSize, 200);
@@ -912,8 +912,8 @@ CobaltQueueDiscEnhancedBlueTest::DoRun (void)
st = queue->GetStats ();
NS_TEST_EXPECT_MSG_EQ (queue->GetPdrop (), 0, "Pdrop should be zero");
NS_TEST_EXPECT_MSG_EQ (st.GetNDroppedPackets (CobaltQueueDisc::TARGET_EXCEEDED_DROP), 0, "There should not any dropped packets");
NS_TEST_ASSERT_MSG_EQ (queue->GetPdrop (), 0, "Pdrop should be zero");
NS_TEST_ASSERT_MSG_EQ (st.GetNDroppedPackets (CobaltQueueDisc::TARGET_EXCEEDED_DROP), 0, "There should not any dropped packets");
Simulator::Destroy ();
}

View File

@@ -147,11 +147,11 @@ CoDelQueueDiscBasicEnqueueDequeue::DoRun (void)
Address dest;
NS_TEST_EXPECT_MSG_EQ (queue->SetAttributeFailSafe ("MinBytes", UintegerValue (pktSize)), true,
NS_TEST_ASSERT_MSG_EQ (queue->SetAttributeFailSafe ("MinBytes", UintegerValue (pktSize)), true,
"Verify that we can actually set the attribute MinBytes");
NS_TEST_EXPECT_MSG_EQ (queue->SetAttributeFailSafe ("Interval", StringValue ("50ms")), true,
NS_TEST_ASSERT_MSG_EQ (queue->SetAttributeFailSafe ("Interval", StringValue ("50ms")), true,
"Verify that we can actually set the attribute Interval");
NS_TEST_EXPECT_MSG_EQ (queue->SetAttributeFailSafe ("Target", StringValue ("4ms")), true,
NS_TEST_ASSERT_MSG_EQ (queue->SetAttributeFailSafe ("Target", StringValue ("4ms")), true,
"Verify that we can actually set the attribute Target");
if (m_mode == QueueSizeUnit::BYTES)
@@ -162,7 +162,7 @@ CoDelQueueDiscBasicEnqueueDequeue::DoRun (void)
{
modeSize = 1;
}
NS_TEST_EXPECT_MSG_EQ (queue->SetAttributeFailSafe ("MaxSize", QueueSizeValue (QueueSize (m_mode, modeSize * 1500))),
NS_TEST_ASSERT_MSG_EQ (queue->SetAttributeFailSafe ("MaxSize", QueueSizeValue (QueueSize (m_mode, modeSize * 1500))),
true, "Verify that we can actually set the attribute MaxSize");
queue->Initialize ();
@@ -174,59 +174,59 @@ CoDelQueueDiscBasicEnqueueDequeue::DoRun (void)
p5 = Create<Packet> (pktSize);
p6 = Create<Packet> (pktSize);
NS_TEST_EXPECT_MSG_EQ (queue->GetCurrentSize().GetValue (), 0 * modeSize, "There should be no packets in queue");
NS_TEST_ASSERT_MSG_EQ (queue->GetCurrentSize().GetValue (), 0 * modeSize, "There should be no packets in queue");
queue->Enqueue (Create<CodelQueueDiscTestItem> (p1, dest, false));
NS_TEST_EXPECT_MSG_EQ (queue->GetCurrentSize().GetValue (), 1 * modeSize, "There should be one packet in queue");
NS_TEST_ASSERT_MSG_EQ (queue->GetCurrentSize().GetValue (), 1 * modeSize, "There should be one packet in queue");
queue->Enqueue (Create<CodelQueueDiscTestItem> (p2, dest, false));
NS_TEST_EXPECT_MSG_EQ (queue->GetCurrentSize().GetValue (), 2 * modeSize, "There should be two packets in queue");
NS_TEST_ASSERT_MSG_EQ (queue->GetCurrentSize().GetValue (), 2 * modeSize, "There should be two packets in queue");
queue->Enqueue (Create<CodelQueueDiscTestItem> (p3, dest, false));
NS_TEST_EXPECT_MSG_EQ (queue->GetCurrentSize().GetValue (), 3 * modeSize, "There should be three packets in queue");
NS_TEST_ASSERT_MSG_EQ (queue->GetCurrentSize().GetValue (), 3 * modeSize, "There should be three packets in queue");
queue->Enqueue (Create<CodelQueueDiscTestItem> (p4, dest, false));
NS_TEST_EXPECT_MSG_EQ (queue->GetCurrentSize().GetValue (), 4 * modeSize, "There should be four packets in queue");
NS_TEST_ASSERT_MSG_EQ (queue->GetCurrentSize().GetValue (), 4 * modeSize, "There should be four packets in queue");
queue->Enqueue (Create<CodelQueueDiscTestItem> (p5, dest, false));
NS_TEST_EXPECT_MSG_EQ (queue->GetCurrentSize().GetValue (), 5 * modeSize, "There should be five packets in queue");
NS_TEST_ASSERT_MSG_EQ (queue->GetCurrentSize().GetValue (), 5 * modeSize, "There should be five packets in queue");
queue->Enqueue (Create<CodelQueueDiscTestItem> (p6, dest, false));
NS_TEST_EXPECT_MSG_EQ (queue->GetCurrentSize().GetValue (), 6 * modeSize, "There should be six packets in queue");
NS_TEST_ASSERT_MSG_EQ (queue->GetCurrentSize().GetValue (), 6 * modeSize, "There should be six packets in queue");
NS_TEST_EXPECT_MSG_EQ (queue->GetStats ().GetNDroppedPackets (CoDelQueueDisc::OVERLIMIT_DROP),
NS_TEST_ASSERT_MSG_EQ (queue->GetStats ().GetNDroppedPackets (CoDelQueueDisc::OVERLIMIT_DROP),
0, "There should be no packets being dropped due to full queue");
Ptr<QueueDiscItem> item;
item = queue->Dequeue ();
NS_TEST_EXPECT_MSG_EQ ((item != 0), true, "I want to remove the first packet");
NS_TEST_EXPECT_MSG_EQ (queue->GetCurrentSize().GetValue (), 5 * modeSize, "There should be five packets in queue");
NS_TEST_EXPECT_MSG_EQ (item->GetPacket ()->GetUid (), p1->GetUid (), "was this the first packet ?");
NS_TEST_ASSERT_MSG_EQ ((item != 0), true, "I want to remove the first packet");
NS_TEST_ASSERT_MSG_EQ (queue->GetCurrentSize().GetValue (), 5 * modeSize, "There should be five packets in queue");
NS_TEST_ASSERT_MSG_EQ (item->GetPacket ()->GetUid (), p1->GetUid (), "was this the first packet ?");
item = queue->Dequeue ();
NS_TEST_EXPECT_MSG_EQ ((item != 0), true, "I want to remove the second packet");
NS_TEST_EXPECT_MSG_EQ (queue->GetCurrentSize().GetValue (), 4 * modeSize, "There should be four packets in queue");
NS_TEST_EXPECT_MSG_EQ (item->GetPacket ()->GetUid (), p2->GetUid (), "Was this the second packet ?");
NS_TEST_ASSERT_MSG_EQ ((item != 0), true, "I want to remove the second packet");
NS_TEST_ASSERT_MSG_EQ (queue->GetCurrentSize().GetValue (), 4 * modeSize, "There should be four packets in queue");
NS_TEST_ASSERT_MSG_EQ (item->GetPacket ()->GetUid (), p2->GetUid (), "Was this the second packet ?");
item = queue->Dequeue ();
NS_TEST_EXPECT_MSG_EQ ((item != 0), true, "I want to remove the third packet");
NS_TEST_EXPECT_MSG_EQ (queue->GetCurrentSize().GetValue (), 3 * modeSize, "There should be three packets in queue");
NS_TEST_EXPECT_MSG_EQ (item->GetPacket ()->GetUid (), p3->GetUid (), "Was this the third packet ?");
NS_TEST_ASSERT_MSG_EQ ((item != 0), true, "I want to remove the third packet");
NS_TEST_ASSERT_MSG_EQ (queue->GetCurrentSize().GetValue (), 3 * modeSize, "There should be three packets in queue");
NS_TEST_ASSERT_MSG_EQ (item->GetPacket ()->GetUid (), p3->GetUid (), "Was this the third packet ?");
item = queue->Dequeue ();
NS_TEST_EXPECT_MSG_EQ ((item != 0), true, "I want to remove the forth packet");
NS_TEST_EXPECT_MSG_EQ (queue->GetCurrentSize().GetValue (), 2 * modeSize, "There should be two packets in queue");
NS_TEST_EXPECT_MSG_EQ (item->GetPacket ()->GetUid (), p4->GetUid (), "Was this the fourth packet ?");
NS_TEST_ASSERT_MSG_EQ ((item != 0), true, "I want to remove the forth packet");
NS_TEST_ASSERT_MSG_EQ (queue->GetCurrentSize().GetValue (), 2 * modeSize, "There should be two packets in queue");
NS_TEST_ASSERT_MSG_EQ (item->GetPacket ()->GetUid (), p4->GetUid (), "Was this the fourth packet ?");
item = queue->Dequeue ();
NS_TEST_EXPECT_MSG_EQ ((item != 0), true, "I want to remove the fifth packet");
NS_TEST_EXPECT_MSG_EQ (queue->GetCurrentSize().GetValue (), 1 * modeSize, "There should be one packet in queue");
NS_TEST_EXPECT_MSG_EQ (item->GetPacket ()->GetUid (), p5->GetUid (), "Was this the fifth packet ?");
NS_TEST_ASSERT_MSG_EQ ((item != 0), true, "I want to remove the fifth packet");
NS_TEST_ASSERT_MSG_EQ (queue->GetCurrentSize().GetValue (), 1 * modeSize, "There should be one packet in queue");
NS_TEST_ASSERT_MSG_EQ (item->GetPacket ()->GetUid (), p5->GetUid (), "Was this the fifth packet ?");
item = queue->Dequeue ();
NS_TEST_EXPECT_MSG_EQ ((item != 0), true, "I want to remove the last packet");
NS_TEST_EXPECT_MSG_EQ (queue->GetCurrentSize().GetValue (), 0 * modeSize, "There should be zero packet in queue");
NS_TEST_EXPECT_MSG_EQ (item->GetPacket ()->GetUid (), p6->GetUid (), "Was this the sixth packet ?");
NS_TEST_ASSERT_MSG_EQ ((item != 0), true, "I want to remove the last packet");
NS_TEST_ASSERT_MSG_EQ (queue->GetCurrentSize().GetValue (), 0 * modeSize, "There should be zero packet in queue");
NS_TEST_ASSERT_MSG_EQ (item->GetPacket ()->GetUid (), p6->GetUid (), "Was this the sixth packet ?");
item = queue->Dequeue ();
NS_TEST_EXPECT_MSG_EQ ((item == 0), true, "There are really no packets in queue");
NS_TEST_ASSERT_MSG_EQ ((item == 0), true, "There are really no packets in queue");
NS_TEST_EXPECT_MSG_EQ (queue->GetStats ().GetNDroppedPackets (CoDelQueueDisc::TARGET_EXCEEDED_DROP), 0,
NS_TEST_ASSERT_MSG_EQ (queue->GetStats ().GetNDroppedPackets (CoDelQueueDisc::TARGET_EXCEEDED_DROP), 0,
"There should be no packet drops according to CoDel algorithm");
}
@@ -287,9 +287,9 @@ CoDelQueueDiscBasicOverflow::DoRun (void)
p2 = Create<Packet> (pktSize);
p3 = Create<Packet> (pktSize);
NS_TEST_EXPECT_MSG_EQ (queue->SetAttributeFailSafe ("MaxSize", QueueSizeValue (QueueSize (m_mode, modeSize * 500))),
NS_TEST_ASSERT_MSG_EQ (queue->SetAttributeFailSafe ("MaxSize", QueueSizeValue (QueueSize (m_mode, modeSize * 500))),
true, "Verify that we can actually set the attribute MaxSize");
NS_TEST_EXPECT_MSG_EQ (queue->SetAttributeFailSafe ("MinBytes", UintegerValue (pktSize)), true,
NS_TEST_ASSERT_MSG_EQ (queue->SetAttributeFailSafe ("MinBytes", UintegerValue (pktSize)), true,
"Verify that we can actually set the attribute MinBytes");
queue->Initialize ();
@@ -299,8 +299,8 @@ CoDelQueueDiscBasicOverflow::DoRun (void)
queue->Enqueue (Create<CodelQueueDiscTestItem> (p2, dest, false));
queue->Enqueue (Create<CodelQueueDiscTestItem> (p3, dest, false));
NS_TEST_EXPECT_MSG_EQ (queue->GetCurrentSize().GetValue (), 500 * modeSize, "There should be 500 packets in queue");
NS_TEST_EXPECT_MSG_EQ (queue->GetStats ().GetNDroppedPackets (CoDelQueueDisc::OVERLIMIT_DROP),
NS_TEST_ASSERT_MSG_EQ (queue->GetCurrentSize().GetValue (), 500 * modeSize, "There should be 500 packets in queue");
NS_TEST_ASSERT_MSG_EQ (queue->GetStats ().GetNDroppedPackets (CoDelQueueDisc::OVERLIMIT_DROP),
3, "There should be three packets being dropped due to full queue");
}
@@ -403,7 +403,7 @@ CoDelQueueDiscControlLawTest::DoRun (void)
codelTimeVal = queue->Time2CoDel (timeVal);
uint32_t ns3Result = queue->ControlLaw (codelTimeVal, interval, recInvSqrt);
uint32_t linuxResult = _codel_control_law (codelTimeVal, interval, recInvSqrt);
NS_TEST_EXPECT_MSG_EQ (ns3Result, linuxResult, "Linux result for ControlLaw should equal ns-3 result");
NS_TEST_ASSERT_MSG_EQ (ns3Result, linuxResult, "Linux result for ControlLaw should equal ns-3 result");
}
}
}
@@ -477,13 +477,13 @@ CoDelQueueDiscBasicDrop::DoRun (void)
modeSize = 1;
}
NS_TEST_EXPECT_MSG_EQ (queue->SetAttributeFailSafe ("MaxSize", QueueSizeValue (QueueSize (m_mode, modeSize * 500))),
NS_TEST_ASSERT_MSG_EQ (queue->SetAttributeFailSafe ("MaxSize", QueueSizeValue (QueueSize (m_mode, modeSize * 500))),
true, "Verify that we can actually set the attribute MaxSize");
queue->Initialize ();
Enqueue (queue, pktSize, 20);
NS_TEST_EXPECT_MSG_EQ (queue->GetCurrentSize ().GetValue (), 20 * modeSize, "There should be 20 packets in queue.");
NS_TEST_ASSERT_MSG_EQ (queue->GetCurrentSize ().GetValue (), 20 * modeSize, "There should be 20 packets in queue.");
// Although the first dequeue occurs with a sojourn time above target
// the dequeue should be successful in this interval
@@ -659,16 +659,16 @@ CoDelQueueDiscBasicMark::DoRun (void)
modeSize = 1;
}
NS_TEST_EXPECT_MSG_EQ (queue->SetAttributeFailSafe ("MaxSize", QueueSizeValue (QueueSize (m_mode, modeSize * 500))),
NS_TEST_ASSERT_MSG_EQ (queue->SetAttributeFailSafe ("MaxSize", QueueSizeValue (QueueSize (m_mode, modeSize * 500))),
true, "Verify that we can actually set the attribute MaxSize");
NS_TEST_EXPECT_MSG_EQ (queue->SetAttributeFailSafe ("UseEcn", BooleanValue (true)),
NS_TEST_ASSERT_MSG_EQ (queue->SetAttributeFailSafe ("UseEcn", BooleanValue (true)),
true, "Verify that we can actually set the attribute UseEcn");
queue->Initialize ();
// Not-ECT traffic to induce packet drop
Enqueue (queue, pktSize, 20, false);
NS_TEST_EXPECT_MSG_EQ (queue->GetCurrentSize ().GetValue (), 20 * modeSize, "There should be 20 packets in queue.");
NS_TEST_ASSERT_MSG_EQ (queue->GetCurrentSize ().GetValue (), 20 * modeSize, "There should be 20 packets in queue.");
// Although the first dequeue occurs with a sojourn time above target
// there should not be any dropped packets in this interval
@@ -684,16 +684,16 @@ CoDelQueueDiscBasicMark::DoRun (void)
// Test case 2, queue with ECN capable traffic for marking of packets instead of dropping
queue = CreateObject<CoDelQueueDisc> ();
NS_TEST_EXPECT_MSG_EQ (queue->SetAttributeFailSafe ("MaxSize", QueueSizeValue (QueueSize (m_mode, modeSize * 500))),
NS_TEST_ASSERT_MSG_EQ (queue->SetAttributeFailSafe ("MaxSize", QueueSizeValue (QueueSize (m_mode, modeSize * 500))),
true, "Verify that we can actually set the attribute MaxSize");
NS_TEST_EXPECT_MSG_EQ (queue->SetAttributeFailSafe ("UseEcn", BooleanValue (true)),
NS_TEST_ASSERT_MSG_EQ (queue->SetAttributeFailSafe ("UseEcn", BooleanValue (true)),
true, "Verify that we can actually set the attribute UseEcn");
queue->Initialize ();
// ECN capable traffic to induce packets to be marked
Enqueue (queue, pktSize, 20, true);
NS_TEST_EXPECT_MSG_EQ (queue->GetCurrentSize ().GetValue (), 20 * modeSize, "There should be 20 packets in queue.");
NS_TEST_ASSERT_MSG_EQ (queue->GetCurrentSize ().GetValue (), 20 * modeSize, "There should be 20 packets in queue.");
// Although the first dequeue occurs with a sojourn time above target
// there should not be any target exceeded marked packets in this interval
@@ -715,11 +715,11 @@ CoDelQueueDiscBasicMark::DoRun (void)
// Test case 3, some packets are ECN capable, with CE threshold set to 2ms
queue = CreateObject<CoDelQueueDisc> ();
NS_TEST_EXPECT_MSG_EQ (queue->SetAttributeFailSafe ("MaxSize", QueueSizeValue (QueueSize (m_mode, modeSize * 500))),
NS_TEST_ASSERT_MSG_EQ (queue->SetAttributeFailSafe ("MaxSize", QueueSizeValue (QueueSize (m_mode, modeSize * 500))),
true, "Verify that we can actually set the attribute MaxSize");
NS_TEST_EXPECT_MSG_EQ (queue->SetAttributeFailSafe ("UseEcn", BooleanValue (true)),
NS_TEST_ASSERT_MSG_EQ (queue->SetAttributeFailSafe ("UseEcn", BooleanValue (true)),
true, "Verify that we can actually set the attribute UseEcn");
NS_TEST_EXPECT_MSG_EQ (queue->SetAttributeFailSafe ("CeThreshold", TimeValue (MilliSeconds (2))),
NS_TEST_ASSERT_MSG_EQ (queue->SetAttributeFailSafe ("CeThreshold", TimeValue (MilliSeconds (2))),
true, "Verify that we can actually set the attribute CeThreshold");
queue->Initialize ();
@@ -728,7 +728,7 @@ CoDelQueueDiscBasicMark::DoRun (void)
Enqueue (queue, pktSize, 3, true);
// Rest of the packet are not ecnCapable
Enqueue (queue, pktSize, 17, false);
NS_TEST_EXPECT_MSG_EQ (queue->GetCurrentSize ().GetValue (), 20 * modeSize, "There should be 20 packets in queue.");
NS_TEST_ASSERT_MSG_EQ (queue->GetCurrentSize ().GetValue (), 20 * modeSize, "There should be 20 packets in queue.");
// Although the first dequeue occurs with a sojourn time above target
// there should not be any target exceeded marked packets in this interval
@@ -750,18 +750,18 @@ CoDelQueueDiscBasicMark::DoRun (void)
// Test case 4, queue with ECN capable traffic and CeThreshold set for marking of packets instead of dropping
queue = CreateObject<CoDelQueueDisc> ();
NS_TEST_EXPECT_MSG_EQ (queue->SetAttributeFailSafe ("MaxSize", QueueSizeValue (QueueSize (m_mode, modeSize * 500))),
NS_TEST_ASSERT_MSG_EQ (queue->SetAttributeFailSafe ("MaxSize", QueueSizeValue (QueueSize (m_mode, modeSize * 500))),
true, "Verify that we can actually set the attribute MaxSize");
NS_TEST_EXPECT_MSG_EQ (queue->SetAttributeFailSafe ("UseEcn", BooleanValue (true)),
NS_TEST_ASSERT_MSG_EQ (queue->SetAttributeFailSafe ("UseEcn", BooleanValue (true)),
true, "Verify that we can actually set the attribute UseEcn");
NS_TEST_EXPECT_MSG_EQ (queue->SetAttributeFailSafe ("CeThreshold", TimeValue (MilliSeconds (2))),
NS_TEST_ASSERT_MSG_EQ (queue->SetAttributeFailSafe ("CeThreshold", TimeValue (MilliSeconds (2))),
true, "Verify that we can actually set the attribute CeThreshold");
queue->Initialize ();
// ECN capable traffic to induce packets to be marked
Enqueue (queue, pktSize, 20, true);
NS_TEST_EXPECT_MSG_EQ (queue->GetCurrentSize ().GetValue (), 20 * modeSize, "There should be 20 packets in queue.");
NS_TEST_ASSERT_MSG_EQ (queue->GetCurrentSize ().GetValue (), 20 * modeSize, "There should be 20 packets in queue.");
// The first dequeue occurs with a sojourn time below CE threshold
// there should not any be CE threshold exceeded marked packets
@@ -827,8 +827,8 @@ CoDelQueueDiscBasicMark::Dequeue (Ptr<CoDelQueueDisc> queue, uint32_t modeSize,
currentDropCount = queue->GetStats ().GetNDroppedPackets (CoDelQueueDisc::TARGET_EXCEEDED_DROP);
currentTargetMarkCount = queue->GetStats ().GetNMarkedPackets (CoDelQueueDisc::TARGET_EXCEEDED_MARK);
currentCeThreshMarkCount = queue->GetStats ().GetNMarkedPackets (CoDelQueueDisc::CE_THRESHOLD_EXCEEDED_MARK);
NS_TEST_EXPECT_MSG_EQ (queue->GetCurrentSize ().GetValue (), initialQSize - modeSize, "There should be 1 packet dequeued.");
NS_TEST_EXPECT_MSG_EQ (currentDropCount, 0, "There should not be any packet drops");
NS_TEST_ASSERT_MSG_EQ (queue->GetCurrentSize ().GetValue (), initialQSize - modeSize, "There should be 1 packet dequeued.");
NS_TEST_ASSERT_MSG_EQ (currentDropCount, 0, "There should not be any packet drops");
NS_TEST_ASSERT_MSG_EQ (currentTargetMarkCount, 0, "We are not in dropping state."
"Sojourn time has just gone above target from below."
"Hence, there should be no target exceeded marked packets");
@@ -841,11 +841,11 @@ CoDelQueueDiscBasicMark::Dequeue (Ptr<CoDelQueueDisc> queue, uint32_t modeSize,
currentTargetMarkCount = queue->GetStats ().GetNMarkedPackets (CoDelQueueDisc::TARGET_EXCEEDED_MARK);
nPacketsBeforeFirstMark = initialQSize;
currentCeThreshMarkCount = queue->GetStats ().GetNMarkedPackets (CoDelQueueDisc::CE_THRESHOLD_EXCEEDED_MARK);
NS_TEST_EXPECT_MSG_EQ (queue->GetCurrentSize ().GetValue (), initialQSize - modeSize, "Sojourn time has been above target for at least interval."
NS_TEST_ASSERT_MSG_EQ (queue->GetCurrentSize ().GetValue (), initialQSize - modeSize, "Sojourn time has been above target for at least interval."
"We enter the dropping state and perform initial packet marking"
"So there should be only 1 more packet dequeued.");
NS_TEST_EXPECT_MSG_EQ (currentDropCount, 0, "There should not be any packet drops");
NS_TEST_EXPECT_MSG_EQ (currentTargetMarkCount, 1, "There should be 1 target exceeded marked packet");
NS_TEST_ASSERT_MSG_EQ (currentDropCount, 0, "There should not be any packet drops");
NS_TEST_ASSERT_MSG_EQ (currentTargetMarkCount, 1, "There should be 1 target exceeded marked packet");
NS_TEST_ASSERT_MSG_EQ (currentCeThreshMarkCount, 0, "There should not be any CE threshold exceeded marked packet");
}
}
@@ -856,12 +856,12 @@ CoDelQueueDiscBasicMark::Dequeue (Ptr<CoDelQueueDisc> queue, uint32_t modeSize,
currentDropCount = queue->GetStats ().GetNDroppedPackets (CoDelQueueDisc::TARGET_EXCEEDED_DROP);
currentTargetMarkCount = queue->GetStats ().GetNMarkedPackets (CoDelQueueDisc::TARGET_EXCEEDED_MARK);
currentCeThreshMarkCount = queue->GetStats ().GetNMarkedPackets (CoDelQueueDisc::CE_THRESHOLD_EXCEEDED_MARK);
NS_TEST_EXPECT_MSG_EQ (queue->GetCurrentSize ().GetValue (), initialQSize - modeSize, "We are in dropping state."
NS_TEST_ASSERT_MSG_EQ (queue->GetCurrentSize ().GetValue (), initialQSize - modeSize, "We are in dropping state."
"Sojourn is still above target."
"However, it's not time for next target exceeded mark."
"So there should be only 1 more packet dequeued");
NS_TEST_EXPECT_MSG_EQ (currentDropCount, 0, "There should not be any packet drops");
NS_TEST_EXPECT_MSG_EQ (currentTargetMarkCount, 1, "There should still be only 1 target exceeded marked packet from the last dequeue");
NS_TEST_ASSERT_MSG_EQ (currentDropCount, 0, "There should not be any packet drops");
NS_TEST_ASSERT_MSG_EQ (currentTargetMarkCount, 1, "There should still be only 1 target exceeded marked packet from the last dequeue");
NS_TEST_ASSERT_MSG_EQ (currentCeThreshMarkCount, 0, "There should not be any CE threshold exceeded marked packet");
}
else if (currentTime.GetMicroSeconds () >= initialDropNext)
@@ -869,12 +869,12 @@ CoDelQueueDiscBasicMark::Dequeue (Ptr<CoDelQueueDisc> queue, uint32_t modeSize,
currentDropCount = queue->GetStats ().GetNDroppedPackets (CoDelQueueDisc::TARGET_EXCEEDED_DROP);
currentTargetMarkCount = queue->GetStats ().GetNMarkedPackets (CoDelQueueDisc::TARGET_EXCEEDED_MARK);
currentCeThreshMarkCount = queue->GetStats ().GetNMarkedPackets (CoDelQueueDisc::CE_THRESHOLD_EXCEEDED_MARK);
NS_TEST_EXPECT_MSG_EQ (queue->GetCurrentSize ().GetValue (), initialQSize - modeSize, "We are in dropping state."
NS_TEST_ASSERT_MSG_EQ (queue->GetCurrentSize ().GetValue (), initialQSize - modeSize, "We are in dropping state."
"It's time for packet to be marked"
"So there should be only 1 more packet dequeued");
NS_TEST_EXPECT_MSG_EQ (currentDropCount, 0, "There should not be any packet drops");
NS_TEST_EXPECT_MSG_EQ (currentTargetMarkCount, 2, "There should 2 target exceeded marked packet");
NS_TEST_EXPECT_MSG_EQ (nPacketsBeforeFirstDrop, nPacketsBeforeFirstMark, "Number of packets in the queue before drop should be equal"
NS_TEST_ASSERT_MSG_EQ (currentDropCount, 0, "There should not be any packet drops");
NS_TEST_ASSERT_MSG_EQ (currentTargetMarkCount, 2, "There should 2 target exceeded marked packet");
NS_TEST_ASSERT_MSG_EQ (nPacketsBeforeFirstDrop, nPacketsBeforeFirstMark, "Number of packets in the queue before drop should be equal"
"to number of packets in the queue before first mark as the behavior untill packet N should be the same.");
NS_TEST_ASSERT_MSG_EQ (currentCeThreshMarkCount, 0, "There should not be any CE threshold exceeded marked packet");
}
@@ -889,8 +889,8 @@ CoDelQueueDiscBasicMark::Dequeue (Ptr<CoDelQueueDisc> queue, uint32_t modeSize,
currentDropCount = queue->GetStats ().GetNDroppedPackets (CoDelQueueDisc::TARGET_EXCEEDED_DROP);
currentTargetMarkCount = queue->GetStats ().GetNMarkedPackets (CoDelQueueDisc::TARGET_EXCEEDED_MARK);
currentCeThreshMarkCount = queue->GetStats ().GetNMarkedPackets (CoDelQueueDisc::CE_THRESHOLD_EXCEEDED_MARK);
NS_TEST_EXPECT_MSG_EQ (queue->GetCurrentSize ().GetValue (), initialQSize - modeSize, "There should be 1 packet dequeued.");
NS_TEST_EXPECT_MSG_EQ (currentDropCount, 0, "There should not be any packet drops");
NS_TEST_ASSERT_MSG_EQ (queue->GetCurrentSize ().GetValue (), initialQSize - modeSize, "There should be 1 packet dequeued.");
NS_TEST_ASSERT_MSG_EQ (currentDropCount, 0, "There should not be any packet drops");
NS_TEST_ASSERT_MSG_EQ (currentTargetMarkCount, 0, "We are not in dropping state."
"Sojourn time has just gone above target from below."
"Hence, there should be no target exceeded marked packets");
@@ -902,12 +902,12 @@ CoDelQueueDiscBasicMark::Dequeue (Ptr<CoDelQueueDisc> queue, uint32_t modeSize,
currentDropCount = queue->GetStats ().GetNDroppedPackets (CoDelQueueDisc::TARGET_EXCEEDED_DROP);
currentTargetMarkCount = queue->GetStats ().GetNMarkedPackets (CoDelQueueDisc::TARGET_EXCEEDED_MARK);
currentCeThreshMarkCount = queue->GetStats ().GetNMarkedPackets (CoDelQueueDisc::CE_THRESHOLD_EXCEEDED_MARK);
NS_TEST_EXPECT_MSG_EQ (queue->GetCurrentSize ().GetValue (), initialQSize - modeSize, "Sojourn time has been above target for at least interval."
NS_TEST_ASSERT_MSG_EQ (queue->GetCurrentSize ().GetValue (), initialQSize - modeSize, "Sojourn time has been above target for at least interval."
"We enter the dropping state and perform initial packet marking"
"So there should be only 1 more packet dequeued.");
NS_TEST_EXPECT_MSG_EQ (currentDropCount, 0, "There should not be any packet drops");
NS_TEST_EXPECT_MSG_EQ (currentTargetMarkCount, 1, "There should be 1 target exceeded marked packet");
NS_TEST_EXPECT_MSG_EQ (currentCeThreshMarkCount, 1, "There should be 1 CE threshold exceeded marked packets");
NS_TEST_ASSERT_MSG_EQ (currentDropCount, 0, "There should not be any packet drops");
NS_TEST_ASSERT_MSG_EQ (currentTargetMarkCount, 1, "There should be 1 target exceeded marked packet");
NS_TEST_ASSERT_MSG_EQ (currentCeThreshMarkCount, 1, "There should be 1 CE threshold exceeded marked packets");
}
}
else if (initialTargetMarkCount > 0)
@@ -917,25 +917,25 @@ CoDelQueueDiscBasicMark::Dequeue (Ptr<CoDelQueueDisc> queue, uint32_t modeSize,
currentDropCount = queue->GetStats ().GetNDroppedPackets (CoDelQueueDisc::TARGET_EXCEEDED_DROP);
currentTargetMarkCount = queue->GetStats ().GetNMarkedPackets (CoDelQueueDisc::TARGET_EXCEEDED_MARK);
currentCeThreshMarkCount = queue->GetStats ().GetNMarkedPackets (CoDelQueueDisc::CE_THRESHOLD_EXCEEDED_MARK);
NS_TEST_EXPECT_MSG_EQ (queue->GetCurrentSize ().GetValue (), initialQSize - modeSize, "We are in dropping state."
NS_TEST_ASSERT_MSG_EQ (queue->GetCurrentSize ().GetValue (), initialQSize - modeSize, "We are in dropping state."
"Sojourn is still above target."
"However, it's not time for next target exceeded mark."
"So there should be only 1 more packet dequeued");
NS_TEST_EXPECT_MSG_EQ (currentDropCount, 0, "There should not be any packet drops");
NS_TEST_EXPECT_MSG_EQ (currentTargetMarkCount, 1, "There should still be only 1 target exceeded marked packet from the last dequeue");
NS_TEST_EXPECT_MSG_EQ (currentCeThreshMarkCount, 2, "There should be 2 CE threshold exceeded marked packets");
NS_TEST_ASSERT_MSG_EQ (currentDropCount, 0, "There should not be any packet drops");
NS_TEST_ASSERT_MSG_EQ (currentTargetMarkCount, 1, "There should still be only 1 target exceeded marked packet from the last dequeue");
NS_TEST_ASSERT_MSG_EQ (currentCeThreshMarkCount, 2, "There should be 2 CE threshold exceeded marked packets");
}
else if (currentTime.GetMicroSeconds () >= initialDropNext)
{
currentDropCount = queue->GetStats ().GetNDroppedPackets (CoDelQueueDisc::TARGET_EXCEEDED_DROP);
currentTargetMarkCount = queue->GetStats ().GetNMarkedPackets (CoDelQueueDisc::TARGET_EXCEEDED_MARK);
currentCeThreshMarkCount = queue->GetStats ().GetNMarkedPackets (CoDelQueueDisc::CE_THRESHOLD_EXCEEDED_MARK);
NS_TEST_EXPECT_MSG_EQ (queue->GetCurrentSize ().GetValue (), initialQSize - (m_dropNextCount + 1) * modeSize, "We are in dropping state."
NS_TEST_ASSERT_MSG_EQ (queue->GetCurrentSize ().GetValue (), initialQSize - (m_dropNextCount + 1) * modeSize, "We are in dropping state."
"It's time for packet to be dropped as packets are not ecnCapable"
"The number of packets dequeued equals to the number of times m_dropNext is updated plus initial dequeue");
NS_TEST_EXPECT_MSG_EQ (currentDropCount, m_dropNextCount, "The number of drops equals to the number of times m_dropNext is updated");
NS_TEST_EXPECT_MSG_EQ (currentTargetMarkCount, 1, "There should still be only 1 target exceeded marked packet");
NS_TEST_EXPECT_MSG_EQ (currentCeThreshMarkCount, 2, "There should still be 2 CE threshold exceeded marked packet as packets are not ecnCapable");
NS_TEST_ASSERT_MSG_EQ (currentDropCount, m_dropNextCount, "The number of drops equals to the number of times m_dropNext is updated");
NS_TEST_ASSERT_MSG_EQ (currentTargetMarkCount, 1, "There should still be only 1 target exceeded marked packet");
NS_TEST_ASSERT_MSG_EQ (currentCeThreshMarkCount, 2, "There should still be 2 CE threshold exceeded marked packet as packets are not ecnCapable");
}
}
}
@@ -947,8 +947,8 @@ CoDelQueueDiscBasicMark::Dequeue (Ptr<CoDelQueueDisc> queue, uint32_t modeSize,
{
currentDropCount = queue->GetStats ().GetNDroppedPackets (CoDelQueueDisc::TARGET_EXCEEDED_DROP);
currentCeThreshMarkCount = queue->GetStats ().GetNMarkedPackets (CoDelQueueDisc::CE_THRESHOLD_EXCEEDED_MARK);
NS_TEST_EXPECT_MSG_EQ (queue->GetCurrentSize ().GetValue (), initialQSize - modeSize, "There should be 1 packet dequeued.");
NS_TEST_EXPECT_MSG_EQ (currentDropCount, 0, "There should not be any packet drops");
NS_TEST_ASSERT_MSG_EQ (queue->GetCurrentSize ().GetValue (), initialQSize - modeSize, "There should be 1 packet dequeued.");
NS_TEST_ASSERT_MSG_EQ (currentDropCount, 0, "There should not be any packet drops");
NS_TEST_ASSERT_MSG_EQ (currentCeThreshMarkCount, 0, "Sojourn time has not gone above CE threshold."
"Hence, there should not be any CE threshold exceeded marked packet");
}
@@ -956,9 +956,9 @@ CoDelQueueDiscBasicMark::Dequeue (Ptr<CoDelQueueDisc> queue, uint32_t modeSize,
{
currentDropCount = queue->GetStats ().GetNDroppedPackets (CoDelQueueDisc::TARGET_EXCEEDED_DROP);
currentCeThreshMarkCount = queue->GetStats ().GetNMarkedPackets (CoDelQueueDisc::CE_THRESHOLD_EXCEEDED_MARK);
NS_TEST_EXPECT_MSG_EQ (queue->GetCurrentSize ().GetValue (), initialQSize - modeSize, "There should be only 1 more packet dequeued.");
NS_TEST_EXPECT_MSG_EQ (currentDropCount, 0, "There should not be any packet drops");
NS_TEST_EXPECT_MSG_EQ (currentCeThreshMarkCount, 1, "Sojourn time has gone above CE threshold."
NS_TEST_ASSERT_MSG_EQ (queue->GetCurrentSize ().GetValue (), initialQSize - modeSize, "There should be only 1 more packet dequeued.");
NS_TEST_ASSERT_MSG_EQ (currentDropCount, 0, "There should not be any packet drops");
NS_TEST_ASSERT_MSG_EQ (currentCeThreshMarkCount, 1, "Sojourn time has gone above CE threshold."
"There should be 1 CE threshold exceeded marked packet");
}
}
@@ -968,17 +968,17 @@ CoDelQueueDiscBasicMark::Dequeue (Ptr<CoDelQueueDisc> queue, uint32_t modeSize,
{
currentDropCount = queue->GetStats ().GetNDroppedPackets (CoDelQueueDisc::TARGET_EXCEEDED_DROP);
currentCeThreshMarkCount = queue->GetStats ().GetNMarkedPackets (CoDelQueueDisc::CE_THRESHOLD_EXCEEDED_MARK);
NS_TEST_EXPECT_MSG_EQ (queue->GetCurrentSize ().GetValue (), initialQSize - modeSize, "There should be only 1 more packet dequeued.");
NS_TEST_EXPECT_MSG_EQ (currentDropCount, 0, "There should not be any packet drops");
NS_TEST_EXPECT_MSG_EQ (currentCeThreshMarkCount, 2, "There should be 2 CE threshold exceeded marked packets");
NS_TEST_ASSERT_MSG_EQ (queue->GetCurrentSize ().GetValue (), initialQSize - modeSize, "There should be only 1 more packet dequeued.");
NS_TEST_ASSERT_MSG_EQ (currentDropCount, 0, "There should not be any packet drops");
NS_TEST_ASSERT_MSG_EQ (currentCeThreshMarkCount, 2, "There should be 2 CE threshold exceeded marked packets");
}
else
{ // In dropping state
currentDropCount = queue->GetStats ().GetNDroppedPackets (CoDelQueueDisc::TARGET_EXCEEDED_DROP);
currentCeThreshMarkCount = queue->GetStats ().GetNMarkedPackets (CoDelQueueDisc::CE_THRESHOLD_EXCEEDED_MARK);
NS_TEST_EXPECT_MSG_EQ (queue->GetCurrentSize ().GetValue (), initialQSize - modeSize, "There should be only 1 more packet dequeued.");
NS_TEST_EXPECT_MSG_EQ (currentDropCount, 0, "There should not be any packet drops");
NS_TEST_EXPECT_MSG_EQ (currentCeThreshMarkCount, 3, "There should be 3 CE threshold exceeded marked packet");
NS_TEST_ASSERT_MSG_EQ (queue->GetCurrentSize ().GetValue (), initialQSize - modeSize, "There should be only 1 more packet dequeued.");
NS_TEST_ASSERT_MSG_EQ (currentDropCount, 0, "There should not be any packet drops");
NS_TEST_ASSERT_MSG_EQ (currentCeThreshMarkCount, 3, "There should be 3 CE threshold exceeded marked packet");
}
}
}

View File

@@ -123,7 +123,7 @@ FifoQueueDiscTestCase::DoRunFifoTest (Ptr<FifoQueueDisc> q, uint32_t qSize, uint
uint32_t modeSize = (q->GetMaxSize ().GetUnit () == QueueSizeUnit::PACKETS ? 1 : pktSize);
uint32_t numPackets = qSize / modeSize;
NS_TEST_EXPECT_MSG_EQ (q->GetCurrentSize ().GetValue (), 0, "The queue disc should be empty");
NS_TEST_ASSERT_MSG_EQ (q->GetCurrentSize ().GetValue (), 0, "The queue disc should be empty");
// create and enqueue numPackets packets and store their UIDs; check they are all enqueued
for (uint32_t i = 1; i <= numPackets; i++)
@@ -131,24 +131,24 @@ FifoQueueDiscTestCase::DoRunFifoTest (Ptr<FifoQueueDisc> q, uint32_t qSize, uint
p = Create<Packet> (pktSize);
uids.push_back (p->GetUid ());
q->Enqueue (Create<FifoQueueDiscTestItem> (p, dest));
NS_TEST_EXPECT_MSG_EQ (q->GetCurrentSize ().GetValue (), i * modeSize, "There should be " << i << " packet(s) in there");
NS_TEST_ASSERT_MSG_EQ (q->GetCurrentSize ().GetValue (), i * modeSize, "There should be " << i << " packet(s) in there");
}
// no room for another packet
NS_TEST_EXPECT_MSG_EQ (q->Enqueue (Create<FifoQueueDiscTestItem> (p, dest)),
NS_TEST_ASSERT_MSG_EQ (q->Enqueue (Create<FifoQueueDiscTestItem> (p, dest)),
false, "There should be no room for another packet");
// dequeue and check packet order
for (uint32_t i = 1; i <= numPackets; i++)
{
item = q->Dequeue ();
NS_TEST_EXPECT_MSG_EQ ((item != 0), true, "A packet should have been dequeued");
NS_TEST_EXPECT_MSG_EQ (q->GetCurrentSize ().GetValue (), (numPackets-i) * modeSize, "There should be " << numPackets-i << " packet(s) in there");
NS_TEST_EXPECT_MSG_EQ (item->GetPacket ()->GetUid (), uids[i-1], "was this the right packet?");
NS_TEST_ASSERT_MSG_EQ ((item != 0), true, "A packet should have been dequeued");
NS_TEST_ASSERT_MSG_EQ (q->GetCurrentSize ().GetValue (), (numPackets-i) * modeSize, "There should be " << numPackets-i << " packet(s) in there");
NS_TEST_ASSERT_MSG_EQ (item->GetPacket ()->GetUid (), uids[i-1], "was this the right packet?");
}
item = q->Dequeue ();
NS_TEST_EXPECT_MSG_EQ ((item == 0), true, "There are really no packets in there");
NS_TEST_ASSERT_MSG_EQ ((item == 0), true, "There are really no packets in there");
}
void
@@ -162,9 +162,9 @@ FifoQueueDiscTestCase::RunFifoTest (QueueSizeUnit mode)
// test 1: set the limit on the queue disc before initialization
queue = CreateObject<FifoQueueDisc> ();
NS_TEST_EXPECT_MSG_EQ (queue->GetNInternalQueues (), 0, "Verify that the queue disc has no internal queue");
NS_TEST_ASSERT_MSG_EQ (queue->GetNInternalQueues (), 0, "Verify that the queue disc has no internal queue");
NS_TEST_EXPECT_MSG_EQ (queue->SetAttributeFailSafe ("MaxSize",
NS_TEST_ASSERT_MSG_EQ (queue->SetAttributeFailSafe ("MaxSize",
QueueSizeValue (QueueSize (mode, numPackets*modeSize))),
true, "Verify that we can actually set the attribute MaxSize");
@@ -176,11 +176,11 @@ FifoQueueDiscTestCase::RunFifoTest (QueueSizeUnit mode)
// test 2: set the limit on the queue disc after initialization
queue = CreateObject<FifoQueueDisc> ();
NS_TEST_EXPECT_MSG_EQ (queue->GetNInternalQueues (), 0, "Verify that the queue disc has no internal queue");
NS_TEST_ASSERT_MSG_EQ (queue->GetNInternalQueues (), 0, "Verify that the queue disc has no internal queue");
queue->Initialize ();
NS_TEST_EXPECT_MSG_EQ (queue->SetAttributeFailSafe ("MaxSize",
NS_TEST_ASSERT_MSG_EQ (queue->SetAttributeFailSafe ("MaxSize",
QueueSizeValue (QueueSize (mode, numPackets*modeSize))),
true, "Verify that we can actually set the attribute MaxSize");
@@ -190,7 +190,7 @@ FifoQueueDiscTestCase::RunFifoTest (QueueSizeUnit mode)
// test 3: set the limit on the internal queue before initialization
queue = CreateObject<FifoQueueDisc> ();
NS_TEST_EXPECT_MSG_EQ (queue->GetNInternalQueues (), 0, "Verify that the queue disc has no internal queue");
NS_TEST_ASSERT_MSG_EQ (queue->GetNInternalQueues (), 0, "Verify that the queue disc has no internal queue");
ObjectFactory factory;
factory.SetTypeId ("ns3::DropTailQueue<QueueDiscItem>");
@@ -212,23 +212,23 @@ FifoQueueDiscTestCase::RunFifoTest (QueueSizeUnit mode)
// test 4: set the limit on the internal queue after initialization
queue = CreateObject<FifoQueueDisc> ();
NS_TEST_EXPECT_MSG_EQ (queue->GetNInternalQueues (), 0, "Verify that the queue disc has no internal queue");
NS_TEST_ASSERT_MSG_EQ (queue->GetNInternalQueues (), 0, "Verify that the queue disc has no internal queue");
queue->Initialize ();
NS_TEST_EXPECT_MSG_EQ (queue->GetNInternalQueues (), 1, "Verify that the queue disc got an internal queue");
NS_TEST_ASSERT_MSG_EQ (queue->GetNInternalQueues (), 1, "Verify that the queue disc got an internal queue");
Ptr<QueueDisc::InternalQueue> iq = queue->GetInternalQueue (0);
if (mode == QueueSizeUnit::PACKETS)
{
NS_TEST_EXPECT_MSG_EQ (iq->SetAttributeFailSafe ("MaxSize",
NS_TEST_ASSERT_MSG_EQ (iq->SetAttributeFailSafe ("MaxSize",
QueueSizeValue (QueueSize (QueueSizeUnit::PACKETS, numPackets))),
true, "Verify that we can actually set the attribute MaxSize on the internal queue");
}
else
{
NS_TEST_EXPECT_MSG_EQ (iq->SetAttributeFailSafe ("MaxSize",
NS_TEST_ASSERT_MSG_EQ (iq->SetAttributeFailSafe ("MaxSize",
QueueSizeValue (QueueSize (QueueSizeUnit::BYTES, numPackets*pktSize))),
true, "Verify that we can actually set the attribute MaxSize on the internal queue");
}

View File

@@ -202,7 +202,7 @@ PieQueueDiscTestCase::RunPieTest (QueueSizeUnit mode)
qSize = qSize * modeSize;
}
NS_TEST_EXPECT_MSG_EQ (queue->SetAttributeFailSafe ("MaxSize", QueueSizeValue (QueueSize (mode, qSize))),
NS_TEST_ASSERT_MSG_EQ (queue->SetAttributeFailSafe ("MaxSize", QueueSizeValue (QueueSize (mode, qSize))),
true, "Verify that we can actually set the attribute MaxSize");
Ptr<Packet> p1, p2, p3, p4, p5, p6, p7, p8;
@@ -216,35 +216,35 @@ PieQueueDiscTestCase::RunPieTest (QueueSizeUnit mode)
p8 = Create<Packet> (pktSize);
queue->Initialize ();
NS_TEST_EXPECT_MSG_EQ (queue->GetCurrentSize ().GetValue (), 0 * modeSize, "There should be no packets in there");
NS_TEST_ASSERT_MSG_EQ (queue->GetCurrentSize ().GetValue (), 0 * modeSize, "There should be no packets in there");
queue->Enqueue (Create<PieQueueDiscTestItem> (p1, dest, false));
NS_TEST_EXPECT_MSG_EQ (queue->GetCurrentSize ().GetValue (), 1 * modeSize, "There should be one packet in there");
NS_TEST_ASSERT_MSG_EQ (queue->GetCurrentSize ().GetValue (), 1 * modeSize, "There should be one packet in there");
queue->Enqueue (Create<PieQueueDiscTestItem> (p2, dest, false));
NS_TEST_EXPECT_MSG_EQ (queue->GetCurrentSize ().GetValue (), 2 * modeSize, "There should be two packets in there");
NS_TEST_ASSERT_MSG_EQ (queue->GetCurrentSize ().GetValue (), 2 * modeSize, "There should be two packets in there");
queue->Enqueue (Create<PieQueueDiscTestItem> (p3, dest, false));
queue->Enqueue (Create<PieQueueDiscTestItem> (p4, dest, false));
queue->Enqueue (Create<PieQueueDiscTestItem> (p5, dest, false));
queue->Enqueue (Create<PieQueueDiscTestItem> (p6, dest, false));
queue->Enqueue (Create<PieQueueDiscTestItem> (p7, dest, false));
queue->Enqueue (Create<PieQueueDiscTestItem> (p8, dest, false));
NS_TEST_EXPECT_MSG_EQ (queue->GetCurrentSize ().GetValue (), 8 * modeSize, "There should be eight packets in there");
NS_TEST_ASSERT_MSG_EQ (queue->GetCurrentSize ().GetValue (), 8 * modeSize, "There should be eight packets in there");
Ptr<QueueDiscItem> item;
item = queue->Dequeue ();
NS_TEST_EXPECT_MSG_EQ ((item != 0), true, "I want to remove the first packet");
NS_TEST_EXPECT_MSG_EQ (queue->GetCurrentSize ().GetValue (), 7 * modeSize, "There should be seven packets in there");
NS_TEST_EXPECT_MSG_EQ (item->GetPacket ()->GetUid (), p1->GetUid (), "was this the first packet ?");
NS_TEST_ASSERT_MSG_EQ ((item != 0), true, "I want to remove the first packet");
NS_TEST_ASSERT_MSG_EQ (queue->GetCurrentSize ().GetValue (), 7 * modeSize, "There should be seven packets in there");
NS_TEST_ASSERT_MSG_EQ (item->GetPacket ()->GetUid (), p1->GetUid (), "was this the first packet ?");
item = queue->Dequeue ();
NS_TEST_EXPECT_MSG_EQ ((item != 0), true, "I want to remove the second packet");
NS_TEST_EXPECT_MSG_EQ (queue->GetCurrentSize ().GetValue (), 6 * modeSize, "There should be six packet in there");
NS_TEST_EXPECT_MSG_EQ (item->GetPacket ()->GetUid (), p2->GetUid (), "Was this the second packet ?");
NS_TEST_ASSERT_MSG_EQ ((item != 0), true, "I want to remove the second packet");
NS_TEST_ASSERT_MSG_EQ (queue->GetCurrentSize ().GetValue (), 6 * modeSize, "There should be six packet in there");
NS_TEST_ASSERT_MSG_EQ (item->GetPacket ()->GetUid (), p2->GetUid (), "Was this the second packet ?");
item = queue->Dequeue ();
NS_TEST_EXPECT_MSG_EQ ((item != 0), true, "I want to remove the third packet");
NS_TEST_EXPECT_MSG_EQ (queue->GetCurrentSize ().GetValue (), 5 * modeSize, "There should be five packets in there");
NS_TEST_EXPECT_MSG_EQ (item->GetPacket ()->GetUid (), p3->GetUid (), "Was this the third packet ?");
NS_TEST_ASSERT_MSG_EQ ((item != 0), true, "I want to remove the third packet");
NS_TEST_ASSERT_MSG_EQ (queue->GetCurrentSize ().GetValue (), 5 * modeSize, "There should be five packets in there");
NS_TEST_ASSERT_MSG_EQ (item->GetPacket ()->GetUid (), p3->GetUid (), "Was this the third packet ?");
item = queue->Dequeue ();
item = queue->Dequeue ();
@@ -253,7 +253,7 @@ PieQueueDiscTestCase::RunPieTest (QueueSizeUnit mode)
item = queue->Dequeue ();
item = queue->Dequeue ();
NS_TEST_EXPECT_MSG_EQ ((item == 0), true, "There are really no packets in there");
NS_TEST_ASSERT_MSG_EQ ((item == 0), true, "There are really no packets in there");
// test 2: more data with defaults, unforced drops but no forced drops
@@ -261,15 +261,15 @@ PieQueueDiscTestCase::RunPieTest (QueueSizeUnit mode)
// PieQueueDiscItem pointer for attributes
testAttributes = Create<PieQueueDiscTestItem> (Create<Packet> (pktSize), dest, false);
pktSize = 1000; // pktSize != 0 because DequeueThreshold always works in bytes
NS_TEST_EXPECT_MSG_EQ (queue->SetAttributeFailSafe ("MaxSize", QueueSizeValue (QueueSize (mode, qSize))),
NS_TEST_ASSERT_MSG_EQ (queue->SetAttributeFailSafe ("MaxSize", QueueSizeValue (QueueSize (mode, qSize))),
true, "Verify that we can actually set the attribute MaxSize");
NS_TEST_EXPECT_MSG_EQ (queue->SetAttributeFailSafe ("Tupdate", TimeValue (Seconds (0.03))), true,
NS_TEST_ASSERT_MSG_EQ (queue->SetAttributeFailSafe ("Tupdate", TimeValue (Seconds (0.03))), true,
"Verify that we can actually set the attribute Tupdate");
NS_TEST_EXPECT_MSG_EQ (queue->SetAttributeFailSafe ("DequeueThreshold", UintegerValue (10000)), true,
NS_TEST_ASSERT_MSG_EQ (queue->SetAttributeFailSafe ("DequeueThreshold", UintegerValue (10000)), true,
"Verify that we can actually set the attribute DequeueThreshold");
NS_TEST_EXPECT_MSG_EQ (queue->SetAttributeFailSafe ("QueueDelayReference", TimeValue (Seconds (0.02))), true,
NS_TEST_ASSERT_MSG_EQ (queue->SetAttributeFailSafe ("QueueDelayReference", TimeValue (Seconds (0.02))), true,
"Verify that we can actually set the attribute QueueDelayReference");
NS_TEST_EXPECT_MSG_EQ (queue->SetAttributeFailSafe ("MaxBurstAllowance", TimeValue (Seconds (0.1))), true,
NS_TEST_ASSERT_MSG_EQ (queue->SetAttributeFailSafe ("MaxBurstAllowance", TimeValue (Seconds (0.1))), true,
"Verify that we can actually set the attribute MaxBurstAllowance");
queue->Initialize ();
EnqueueWithDelay (queue, pktSize, 400, testAttributes);
@@ -278,23 +278,23 @@ PieQueueDiscTestCase::RunPieTest (QueueSizeUnit mode)
Simulator::Run ();
QueueDisc::Stats st = queue->GetStats ();
uint32_t test2 = st.GetNDroppedPackets (PieQueueDisc::UNFORCED_DROP);
NS_TEST_EXPECT_MSG_NE (test2, 0, "There should be some unforced drops");
NS_TEST_EXPECT_MSG_EQ (st.GetNDroppedPackets (PieQueueDisc::FORCED_DROP), 0, "There should be zero forced drops");
NS_TEST_ASSERT_MSG_NE (test2, 0, "There should be some unforced drops");
NS_TEST_ASSERT_MSG_EQ (st.GetNDroppedPackets (PieQueueDisc::FORCED_DROP), 0, "There should be zero forced drops");
// test 3: same as test 2, but with higher QueueDelayReference
queue = CreateObject<PieQueueDisc> ();
// PieQueueDiscItem pointer for attributes
testAttributes = Create<PieQueueDiscTestItem> (Create<Packet> (pktSize), dest, false);
NS_TEST_EXPECT_MSG_EQ (queue->SetAttributeFailSafe ("MaxSize", QueueSizeValue (QueueSize (mode, qSize))),
NS_TEST_ASSERT_MSG_EQ (queue->SetAttributeFailSafe ("MaxSize", QueueSizeValue (QueueSize (mode, qSize))),
true, "Verify that we can actually set the attribute MaxSize");
NS_TEST_EXPECT_MSG_EQ (queue->SetAttributeFailSafe ("Tupdate", TimeValue (Seconds (0.03))), true,
NS_TEST_ASSERT_MSG_EQ (queue->SetAttributeFailSafe ("Tupdate", TimeValue (Seconds (0.03))), true,
"Verify that we can actually set the attribute Tupdate");
NS_TEST_EXPECT_MSG_EQ (queue->SetAttributeFailSafe ("DequeueThreshold", UintegerValue (10000)), true,
NS_TEST_ASSERT_MSG_EQ (queue->SetAttributeFailSafe ("DequeueThreshold", UintegerValue (10000)), true,
"Verify that we can actually set the attribute DequeueThreshold");
NS_TEST_EXPECT_MSG_EQ (queue->SetAttributeFailSafe ("QueueDelayReference", TimeValue (Seconds (0.08))), true,
NS_TEST_ASSERT_MSG_EQ (queue->SetAttributeFailSafe ("QueueDelayReference", TimeValue (Seconds (0.08))), true,
"Verify that we can actually set the attribute QueueDelayReference");
NS_TEST_EXPECT_MSG_EQ (queue->SetAttributeFailSafe ("MaxBurstAllowance", TimeValue (Seconds (0.1))), true,
NS_TEST_ASSERT_MSG_EQ (queue->SetAttributeFailSafe ("MaxBurstAllowance", TimeValue (Seconds (0.1))), true,
"Verify that we can actually set the attribute MaxBurstAllowance");
queue->Initialize ();
EnqueueWithDelay (queue, pktSize, 400, testAttributes);
@@ -303,23 +303,23 @@ PieQueueDiscTestCase::RunPieTest (QueueSizeUnit mode)
Simulator::Run ();
st = queue->GetStats ();
uint32_t test3 = st.GetNDroppedPackets (PieQueueDisc::UNFORCED_DROP);
NS_TEST_EXPECT_MSG_LT (test3, test2, "Test 3 should have less unforced drops than test 2");
NS_TEST_EXPECT_MSG_EQ (st.GetNDroppedPackets (PieQueueDisc::FORCED_DROP), 0, "There should be zero forced drops");
NS_TEST_ASSERT_MSG_LT (test3, test2, "Test 3 should have less unforced drops than test 2");
NS_TEST_ASSERT_MSG_EQ (st.GetNDroppedPackets (PieQueueDisc::FORCED_DROP), 0, "There should be zero forced drops");
// test 4: same as test 2, but with reduced dequeue rate
queue = CreateObject<PieQueueDisc> ();
// PieQueueDiscItem pointer for attributes
testAttributes = Create<PieQueueDiscTestItem> (Create<Packet> (pktSize), dest, false);
NS_TEST_EXPECT_MSG_EQ (queue->SetAttributeFailSafe ("MaxSize", QueueSizeValue (QueueSize (mode, qSize))),
NS_TEST_ASSERT_MSG_EQ (queue->SetAttributeFailSafe ("MaxSize", QueueSizeValue (QueueSize (mode, qSize))),
true, "Verify that we can actually set the attribute MaxSize");
NS_TEST_EXPECT_MSG_EQ (queue->SetAttributeFailSafe ("Tupdate", TimeValue (Seconds (0.03))), true,
NS_TEST_ASSERT_MSG_EQ (queue->SetAttributeFailSafe ("Tupdate", TimeValue (Seconds (0.03))), true,
"Verify that we can actually set the attribute Tupdate");
NS_TEST_EXPECT_MSG_EQ (queue->SetAttributeFailSafe ("DequeueThreshold", UintegerValue (10000)), true,
NS_TEST_ASSERT_MSG_EQ (queue->SetAttributeFailSafe ("DequeueThreshold", UintegerValue (10000)), true,
"Verify that we can actually set the attribute DequeueThreshold");
NS_TEST_EXPECT_MSG_EQ (queue->SetAttributeFailSafe ("QueueDelayReference", TimeValue (Seconds (0.02))), true,
NS_TEST_ASSERT_MSG_EQ (queue->SetAttributeFailSafe ("QueueDelayReference", TimeValue (Seconds (0.02))), true,
"Verify that we can actually set the attribute QueueDelayReference");
NS_TEST_EXPECT_MSG_EQ (queue->SetAttributeFailSafe ("MaxBurstAllowance", TimeValue (Seconds (0.1))), true,
NS_TEST_ASSERT_MSG_EQ (queue->SetAttributeFailSafe ("MaxBurstAllowance", TimeValue (Seconds (0.1))), true,
"Verify that we can actually set the attribute MaxBurstAllowance");
queue->Initialize ();
EnqueueWithDelay (queue, pktSize, 400, testAttributes);
@@ -328,23 +328,23 @@ PieQueueDiscTestCase::RunPieTest (QueueSizeUnit mode)
Simulator::Run ();
st = queue->GetStats ();
uint32_t test4 = st.GetNDroppedPackets (PieQueueDisc::UNFORCED_DROP);
NS_TEST_EXPECT_MSG_GT (test4, test2, "Test 4 should have more unforced drops than test 2");
NS_TEST_EXPECT_MSG_EQ (st.GetNDroppedPackets (PieQueueDisc::FORCED_DROP), 0, "There should be zero forced drops");
NS_TEST_ASSERT_MSG_GT (test4, test2, "Test 4 should have more unforced drops than test 2");
NS_TEST_ASSERT_MSG_EQ (st.GetNDroppedPackets (PieQueueDisc::FORCED_DROP), 0, "There should be zero forced drops");
// test 5: same dequeue rate as test 4, but with higher Tupdate
queue = CreateObject<PieQueueDisc> ();
// PieQueueDiscItem pointer for attributes
testAttributes = Create<PieQueueDiscTestItem> (Create<Packet> (pktSize), dest, false);
NS_TEST_EXPECT_MSG_EQ (queue->SetAttributeFailSafe ("MaxSize", QueueSizeValue (QueueSize (mode, qSize))),
NS_TEST_ASSERT_MSG_EQ (queue->SetAttributeFailSafe ("MaxSize", QueueSizeValue (QueueSize (mode, qSize))),
true, "Verify that we can actually set the attribute MaxSize");
NS_TEST_EXPECT_MSG_EQ (queue->SetAttributeFailSafe ("Tupdate", TimeValue (Seconds (0.09))), true,
NS_TEST_ASSERT_MSG_EQ (queue->SetAttributeFailSafe ("Tupdate", TimeValue (Seconds (0.09))), true,
"Verify that we can actually set the attribute Tupdate");
NS_TEST_EXPECT_MSG_EQ (queue->SetAttributeFailSafe ("DequeueThreshold", UintegerValue (10000)), true,
NS_TEST_ASSERT_MSG_EQ (queue->SetAttributeFailSafe ("DequeueThreshold", UintegerValue (10000)), true,
"Verify that we can actually set the attribute DequeueThreshold");
NS_TEST_EXPECT_MSG_EQ (queue->SetAttributeFailSafe ("QueueDelayReference", TimeValue (Seconds (0.02))), true,
NS_TEST_ASSERT_MSG_EQ (queue->SetAttributeFailSafe ("QueueDelayReference", TimeValue (Seconds (0.02))), true,
"Verify that we can actually set the attribute QueueDelayReference");
NS_TEST_EXPECT_MSG_EQ (queue->SetAttributeFailSafe ("MaxBurstAllowance", TimeValue (Seconds (0.1))), true,
NS_TEST_ASSERT_MSG_EQ (queue->SetAttributeFailSafe ("MaxBurstAllowance", TimeValue (Seconds (0.1))), true,
"Verify that we can actually set the attribute MaxBurstAllowance");
queue->Initialize ();
EnqueueWithDelay (queue, pktSize, 400, testAttributes);
@@ -353,17 +353,17 @@ PieQueueDiscTestCase::RunPieTest (QueueSizeUnit mode)
Simulator::Run ();
st = queue->GetStats ();
uint32_t test5 = st.GetNDroppedPackets (PieQueueDisc::UNFORCED_DROP);
NS_TEST_EXPECT_MSG_LT (test5, test4, "Test 5 should have less unforced drops than test 4");
NS_TEST_EXPECT_MSG_EQ (st.GetNDroppedPackets (PieQueueDisc::FORCED_DROP), 0, "There should be zero forced drops");
NS_TEST_ASSERT_MSG_LT (test5, test4, "Test 5 should have less unforced drops than test 4");
NS_TEST_ASSERT_MSG_EQ (st.GetNDroppedPackets (PieQueueDisc::FORCED_DROP), 0, "There should be zero forced drops");
// test 6: same as test 2, but with UseDequeueRateEstimator enabled
queue = CreateObject<PieQueueDisc> ();
// PieQueueDiscItem pointer for attributes
testAttributes = Create<PieQueueDiscTestItem> (Create<Packet> (pktSize), dest, false);
NS_TEST_EXPECT_MSG_EQ (queue->SetAttributeFailSafe ("MaxSize", QueueSizeValue (QueueSize (mode, qSize))),
NS_TEST_ASSERT_MSG_EQ (queue->SetAttributeFailSafe ("MaxSize", QueueSizeValue (QueueSize (mode, qSize))),
true, "Verify that we can actually set the attribute MaxSize");
NS_TEST_EXPECT_MSG_EQ (queue->SetAttributeFailSafe ("UseDequeueRateEstimator", BooleanValue (true)), true,
NS_TEST_ASSERT_MSG_EQ (queue->SetAttributeFailSafe ("UseDequeueRateEstimator", BooleanValue (true)), true,
"Verify that we can actually set the attribute UseTimestamp");
queue->Initialize ();
EnqueueWithDelay (queue, pktSize, 400, testAttributes);
@@ -372,17 +372,17 @@ PieQueueDiscTestCase::RunPieTest (QueueSizeUnit mode)
Simulator::Run ();
st = queue->GetStats ();
uint32_t test6 = st.GetNDroppedPackets (PieQueueDisc::UNFORCED_DROP);
NS_TEST_EXPECT_MSG_NE (test6, 0, "There should be some unforced drops");
NS_TEST_EXPECT_MSG_EQ (st.GetNDroppedPackets (PieQueueDisc::FORCED_DROP), 0, "There should be zero forced drops");
NS_TEST_ASSERT_MSG_NE (test6, 0, "There should be some unforced drops");
NS_TEST_ASSERT_MSG_EQ (st.GetNDroppedPackets (PieQueueDisc::FORCED_DROP), 0, "There should be zero forced drops");
// test 7: test with CapDropAdjustment disabled
queue = CreateObject<PieQueueDisc> ();
// PieQueueDiscItem pointer for attributes
testAttributes = Create<PieQueueDiscTestItem> (Create<Packet> (pktSize), dest, false);
NS_TEST_EXPECT_MSG_EQ (queue->SetAttributeFailSafe ("MaxSize", QueueSizeValue (QueueSize (mode, qSize))),
NS_TEST_ASSERT_MSG_EQ (queue->SetAttributeFailSafe ("MaxSize", QueueSizeValue (QueueSize (mode, qSize))),
true, "Verify that we can actually set the attribute MaxSize");
NS_TEST_EXPECT_MSG_EQ (queue->SetAttributeFailSafe ("UseCapDropAdjustment", BooleanValue (false)), true,
NS_TEST_ASSERT_MSG_EQ (queue->SetAttributeFailSafe ("UseCapDropAdjustment", BooleanValue (false)), true,
"Verify that we can actually set the attribute UseCapDropAdjustment");
queue->Initialize ();
testAttributes->m_checkProb = true;
@@ -392,9 +392,9 @@ PieQueueDiscTestCase::RunPieTest (QueueSizeUnit mode)
Simulator::Run ();
st = queue->GetStats ();
uint32_t test7 = st.GetNDroppedPackets (PieQueueDisc::UNFORCED_DROP);
NS_TEST_EXPECT_MSG_NE (test7, 0, "There should be some unforced drops");
NS_TEST_EXPECT_MSG_EQ (st.GetNDroppedPackets (PieQueueDisc::FORCED_DROP), 0, "There should be zero forced drops");
NS_TEST_EXPECT_MSG_GT (testAttributes->m_maxDropProbDiff, 0.02,
NS_TEST_ASSERT_MSG_NE (test7, 0, "There should be some unforced drops");
NS_TEST_ASSERT_MSG_EQ (st.GetNDroppedPackets (PieQueueDisc::FORCED_DROP), 0, "There should be zero forced drops");
NS_TEST_ASSERT_MSG_GT (testAttributes->m_maxDropProbDiff, 0.02,
"Maximum increase in drop probability should be greater than 0.02");
@@ -402,9 +402,9 @@ PieQueueDiscTestCase::RunPieTest (QueueSizeUnit mode)
queue = CreateObject<PieQueueDisc> ();
// PieQueueDiscItem pointer for attributes
testAttributes = Create<PieQueueDiscTestItem> (Create<Packet> (pktSize), dest, false);
NS_TEST_EXPECT_MSG_EQ (queue->SetAttributeFailSafe ("MaxSize", QueueSizeValue (QueueSize (mode, qSize))),
NS_TEST_ASSERT_MSG_EQ (queue->SetAttributeFailSafe ("MaxSize", QueueSizeValue (QueueSize (mode, qSize))),
true, "Verify that we can actually set the attribute MaxSize");
NS_TEST_EXPECT_MSG_EQ (queue->SetAttributeFailSafe ("UseCapDropAdjustment", BooleanValue (true)), true,
NS_TEST_ASSERT_MSG_EQ (queue->SetAttributeFailSafe ("UseCapDropAdjustment", BooleanValue (true)), true,
"Verify that we can actually set the attribute UseCapDropAdjustment");
queue->Initialize ();
testAttributes->m_checkProb = true;
@@ -414,9 +414,9 @@ PieQueueDiscTestCase::RunPieTest (QueueSizeUnit mode)
Simulator::Run ();
st = queue->GetStats ();
uint32_t test8 = st.GetNDroppedPackets (PieQueueDisc::UNFORCED_DROP);
NS_TEST_EXPECT_MSG_NE (test8, 0, "There should be some unforced drops");
NS_TEST_EXPECT_MSG_EQ (st.GetNDroppedPackets (PieQueueDisc::FORCED_DROP), 0, "There should be zero forced drops");
NS_TEST_EXPECT_MSG_LT (testAttributes->m_maxDropProbDiff, 0.0200000000000001,
NS_TEST_ASSERT_MSG_NE (test8, 0, "There should be some unforced drops");
NS_TEST_ASSERT_MSG_EQ (st.GetNDroppedPackets (PieQueueDisc::FORCED_DROP), 0, "There should be zero forced drops");
NS_TEST_ASSERT_MSG_LT (testAttributes->m_maxDropProbDiff, 0.0200000000000001,
"Maximum increase in drop probability should be less than or equal to 0.02");
@@ -424,11 +424,11 @@ PieQueueDiscTestCase::RunPieTest (QueueSizeUnit mode)
queue = CreateObject<PieQueueDisc> ();
// PieQueueDiscItem pointer for attributes
testAttributes = Create<PieQueueDiscTestItem> (Create<Packet> (pktSize), dest, false);
NS_TEST_EXPECT_MSG_EQ (queue->SetAttributeFailSafe ("MaxSize", QueueSizeValue (QueueSize (mode, qSize))),
NS_TEST_ASSERT_MSG_EQ (queue->SetAttributeFailSafe ("MaxSize", QueueSizeValue (QueueSize (mode, qSize))),
true, "Verify that we can actually set the attribute MaxSize");
NS_TEST_EXPECT_MSG_EQ (queue->SetAttributeFailSafe ("UseEcn", BooleanValue (true)), true,
NS_TEST_ASSERT_MSG_EQ (queue->SetAttributeFailSafe ("UseEcn", BooleanValue (true)), true,
"Verify that we can actually set the attribute UseEcn");
NS_TEST_EXPECT_MSG_EQ (queue->SetAttributeFailSafe ("MarkEcnThreshold", DoubleValue (0.3)), true,
NS_TEST_ASSERT_MSG_EQ (queue->SetAttributeFailSafe ("MarkEcnThreshold", DoubleValue (0.3)), true,
"Verify that we can actually set the attribute MarkEcnThreshold");
queue->Initialize ();
EnqueueWithDelay (queue, pktSize, 400, testAttributes);
@@ -437,20 +437,20 @@ PieQueueDiscTestCase::RunPieTest (QueueSizeUnit mode)
Simulator::Run ();
st = queue->GetStats ();
uint32_t test9 = st.GetNMarkedPackets (PieQueueDisc::UNFORCED_MARK);
NS_TEST_EXPECT_MSG_EQ (test9, 0, "There should be zero unforced marks");
NS_TEST_EXPECT_MSG_NE (st.GetNDroppedPackets (PieQueueDisc::UNFORCED_DROP), 0, "There should be some unforced drops");
NS_TEST_EXPECT_MSG_EQ (st.GetNDroppedPackets (PieQueueDisc::FORCED_DROP), 0, "There should be zero forced drops");
NS_TEST_ASSERT_MSG_EQ (test9, 0, "There should be zero unforced marks");
NS_TEST_ASSERT_MSG_NE (st.GetNDroppedPackets (PieQueueDisc::UNFORCED_DROP), 0, "There should be some unforced drops");
NS_TEST_ASSERT_MSG_EQ (st.GetNDroppedPackets (PieQueueDisc::FORCED_DROP), 0, "There should be zero forced drops");
// test 10: Packets are ECN capable, but PIE queue disc is not ECN enabled
queue = CreateObject<PieQueueDisc> ();
// PieQueueDiscItem pointer for attributes
testAttributes = Create<PieQueueDiscTestItem> (Create<Packet> (pktSize), dest, false);
NS_TEST_EXPECT_MSG_EQ (queue->SetAttributeFailSafe ("MaxSize", QueueSizeValue (QueueSize (mode, qSize))),
NS_TEST_ASSERT_MSG_EQ (queue->SetAttributeFailSafe ("MaxSize", QueueSizeValue (QueueSize (mode, qSize))),
true, "Verify that we can actually set the attribute MaxSize");
NS_TEST_EXPECT_MSG_EQ (queue->SetAttributeFailSafe ("UseEcn", BooleanValue (false)), true,
NS_TEST_ASSERT_MSG_EQ (queue->SetAttributeFailSafe ("UseEcn", BooleanValue (false)), true,
"Verify that we can actually set the attribute UseEcn");
NS_TEST_EXPECT_MSG_EQ (queue->SetAttributeFailSafe ("MarkEcnThreshold", DoubleValue (0.3)), true,
NS_TEST_ASSERT_MSG_EQ (queue->SetAttributeFailSafe ("MarkEcnThreshold", DoubleValue (0.3)), true,
"Verify that we can actually set the attribute MarkEcnThreshold");
queue->Initialize ();
testAttributes->m_ecnCapable = true;
@@ -460,20 +460,20 @@ PieQueueDiscTestCase::RunPieTest (QueueSizeUnit mode)
Simulator::Run ();
st = queue->GetStats ();
uint32_t test10 = st.GetNMarkedPackets (PieQueueDisc::UNFORCED_MARK);
NS_TEST_EXPECT_MSG_EQ (test10, 0, "There should be zero unforced marks");
NS_TEST_EXPECT_MSG_NE (st.GetNDroppedPackets (PieQueueDisc::UNFORCED_DROP), 0, "There should be some unforced drops");
NS_TEST_EXPECT_MSG_EQ (st.GetNDroppedPackets (PieQueueDisc::FORCED_DROP), 0, "There should be zero forced drops");
NS_TEST_ASSERT_MSG_EQ (test10, 0, "There should be zero unforced marks");
NS_TEST_ASSERT_MSG_NE (st.GetNDroppedPackets (PieQueueDisc::UNFORCED_DROP), 0, "There should be some unforced drops");
NS_TEST_ASSERT_MSG_EQ (st.GetNDroppedPackets (PieQueueDisc::FORCED_DROP), 0, "There should be zero forced drops");
// test 11: Packets and PIE queue disc both are ECN capable
queue = CreateObject<PieQueueDisc> ();
// PieQueueDiscItem pointer for attributes
testAttributes = Create<PieQueueDiscTestItem> (Create<Packet> (pktSize), dest, false);
NS_TEST_EXPECT_MSG_EQ (queue->SetAttributeFailSafe ("MaxSize", QueueSizeValue (QueueSize (mode, qSize))),
NS_TEST_ASSERT_MSG_EQ (queue->SetAttributeFailSafe ("MaxSize", QueueSizeValue (QueueSize (mode, qSize))),
true, "Verify that we can actually set the attribute MaxSize");
NS_TEST_EXPECT_MSG_EQ (queue->SetAttributeFailSafe ("UseEcn", BooleanValue (true)), true,
NS_TEST_ASSERT_MSG_EQ (queue->SetAttributeFailSafe ("UseEcn", BooleanValue (true)), true,
"Verify that we can actually set the attribute UseEcn");
NS_TEST_EXPECT_MSG_EQ (queue->SetAttributeFailSafe ("MarkEcnThreshold", DoubleValue (0.3)), true,
NS_TEST_ASSERT_MSG_EQ (queue->SetAttributeFailSafe ("MarkEcnThreshold", DoubleValue (0.3)), true,
"Verify that we can actually set the attribute MarkEcnThreshold");
queue->Initialize ();
testAttributes->m_ecnCapable = true;
@@ -484,22 +484,22 @@ PieQueueDiscTestCase::RunPieTest (QueueSizeUnit mode)
Simulator::Run ();
st = queue->GetStats ();
uint32_t test11 = st.GetNMarkedPackets (PieQueueDisc::UNFORCED_MARK);
NS_TEST_EXPECT_MSG_NE (test11, 0, "There should be some unforced marks");
NS_TEST_ASSERT_MSG_NE (test11, 0, "There should be some unforced marks");
// There are unforced drops because the value of m_maxDropProb goes beyond 0.3 in this test.
// PIE drops the packets even when they are ECN capable if drop probability is more than 30%.
NS_TEST_EXPECT_MSG_NE (st.GetNDroppedPackets (PieQueueDisc::UNFORCED_DROP), 0, "There should be some unforced drops");
NS_TEST_ASSERT_MSG_NE (st.GetNDroppedPackets (PieQueueDisc::UNFORCED_DROP), 0, "There should be some unforced drops");
// Confirm that m_maxDropProb goes above 0.3 in this test
NS_TEST_EXPECT_MSG_GT (testAttributes->m_maxDropProb, 0.3, "Maximum Drop probability should be greater than 0.3");
NS_TEST_EXPECT_MSG_EQ (st.GetNDroppedPackets (PieQueueDisc::FORCED_DROP), 0, "There should be zero forced drops");
NS_TEST_ASSERT_MSG_GT (testAttributes->m_maxDropProb, 0.3, "Maximum Drop probability should be greater than 0.3");
NS_TEST_ASSERT_MSG_EQ (st.GetNDroppedPackets (PieQueueDisc::FORCED_DROP), 0, "There should be zero forced drops");
// test 12: test with derandomization enabled
queue = CreateObject<PieQueueDisc> ();
// PieQueueDiscItem pointer for attributes
testAttributes = Create<PieQueueDiscTestItem> (Create<Packet> (pktSize), dest, false);
NS_TEST_EXPECT_MSG_EQ (queue->SetAttributeFailSafe ("MaxSize", QueueSizeValue (QueueSize (mode, qSize))),
NS_TEST_ASSERT_MSG_EQ (queue->SetAttributeFailSafe ("MaxSize", QueueSizeValue (QueueSize (mode, qSize))),
true, "Verify that we can actually set the attribute MaxSize");
NS_TEST_EXPECT_MSG_EQ (queue->SetAttributeFailSafe ("UseDerandomization", BooleanValue (true)), true,
NS_TEST_ASSERT_MSG_EQ (queue->SetAttributeFailSafe ("UseDerandomization", BooleanValue (true)), true,
"Verify that we can actually set the attribute UseDerandomization");
queue->Initialize ();
testAttributes->m_checkAccuProb = true;
@@ -509,18 +509,18 @@ PieQueueDiscTestCase::RunPieTest (QueueSizeUnit mode)
Simulator::Run ();
st = queue->GetStats ();
uint32_t test12 = st.GetNDroppedPackets (PieQueueDisc::UNFORCED_DROP);
NS_TEST_EXPECT_MSG_NE (test12, 0, "There should be some unforced drops");
NS_TEST_EXPECT_MSG_EQ (st.GetNDroppedPackets (PieQueueDisc::FORCED_DROP), 0, "There should be zero forced drops");
NS_TEST_EXPECT_MSG_EQ (testAttributes->m_accuProbError, 0.0, "There should not be any error in setting accuProb");
NS_TEST_ASSERT_MSG_NE (test12, 0, "There should be some unforced drops");
NS_TEST_ASSERT_MSG_EQ (st.GetNDroppedPackets (PieQueueDisc::FORCED_DROP), 0, "There should be zero forced drops");
NS_TEST_ASSERT_MSG_EQ (testAttributes->m_accuProbError, 0.0, "There should not be any error in setting accuProb");
// test 13: same as test 11 but with accumulated drop probability set below the low threshold
queue = CreateObject<PieQueueDisc> ();
// PieQueueDiscItem pointer for attributes
testAttributes = Create<PieQueueDiscTestItem> (Create<Packet> (pktSize), dest, false);
NS_TEST_EXPECT_MSG_EQ (queue->SetAttributeFailSafe ("MaxSize", QueueSizeValue (QueueSize (mode, qSize))),
NS_TEST_ASSERT_MSG_EQ (queue->SetAttributeFailSafe ("MaxSize", QueueSizeValue (QueueSize (mode, qSize))),
true, "Verify that we can actually set the attribute MaxSize");
NS_TEST_EXPECT_MSG_EQ (queue->SetAttributeFailSafe ("UseDerandomization", BooleanValue (true)), true,
NS_TEST_ASSERT_MSG_EQ (queue->SetAttributeFailSafe ("UseDerandomization", BooleanValue (true)), true,
"Verify that we can actually set the attribute UseDerandomization");
queue->Initialize ();
testAttributes->m_constAccuProb = true;
@@ -532,19 +532,19 @@ PieQueueDiscTestCase::RunPieTest (QueueSizeUnit mode)
Simulator::Run ();
st = queue->GetStats ();
uint32_t test13 = st.GetNDroppedPackets (PieQueueDisc::UNFORCED_DROP);
NS_TEST_EXPECT_MSG_EQ (test13, 0, "There should be zero unforced drops");
NS_TEST_EXPECT_MSG_EQ (st.GetNDroppedPackets (PieQueueDisc::FORCED_DROP), 0, "There should be zero forced drops");
NS_TEST_ASSERT_MSG_EQ (test13, 0, "There should be zero unforced drops");
NS_TEST_ASSERT_MSG_EQ (st.GetNDroppedPackets (PieQueueDisc::FORCED_DROP), 0, "There should be zero forced drops");
// test 14: same as test 12 but with accumulated drop probability set above the high threshold
queue = CreateObject<PieQueueDisc> ();
// PieQueueDiscItem pointer for attributes
testAttributes = Create<PieQueueDiscTestItem> (Create<Packet> (pktSize), dest, false);
NS_TEST_EXPECT_MSG_EQ (queue->SetAttributeFailSafe ("MaxSize", QueueSizeValue (QueueSize (mode, qSize))),
NS_TEST_ASSERT_MSG_EQ (queue->SetAttributeFailSafe ("MaxSize", QueueSizeValue (QueueSize (mode, qSize))),
true, "Verify that we can actually set the attribute MaxSize");
NS_TEST_EXPECT_MSG_EQ (queue->SetAttributeFailSafe ("MaxBurstAllowance", TimeValue (Seconds (0.0))), true,
NS_TEST_ASSERT_MSG_EQ (queue->SetAttributeFailSafe ("MaxBurstAllowance", TimeValue (Seconds (0.0))), true,
"Verify that we can actually set the attribute MaxBurstAllowance");
NS_TEST_EXPECT_MSG_EQ (queue->SetAttributeFailSafe ("UseDerandomization", BooleanValue (true)), true,
NS_TEST_ASSERT_MSG_EQ (queue->SetAttributeFailSafe ("UseDerandomization", BooleanValue (true)), true,
"Verify that we can actually set the attribute UseDerandomization");
queue->Initialize ();
testAttributes->m_constAccuProb = true;
@@ -557,9 +557,9 @@ PieQueueDiscTestCase::RunPieTest (QueueSizeUnit mode)
Simulator::Run ();
st = queue->GetStats ();
uint32_t test14 = st.GetNDroppedPackets (PieQueueDisc::UNFORCED_DROP);
NS_TEST_EXPECT_MSG_EQ (test14, testAttributes->m_expectedDrops,
NS_TEST_ASSERT_MSG_EQ (test14, testAttributes->m_expectedDrops,
"The number of unforced drops should be equal to number of expected unforced drops");
NS_TEST_EXPECT_MSG_EQ (st.GetNDroppedPackets (PieQueueDisc::FORCED_DROP), 0, "There should be zero forced drops");
NS_TEST_ASSERT_MSG_EQ (st.GetNDroppedPackets (PieQueueDisc::FORCED_DROP), 0, "There should be zero forced drops");
// test 15: tests Active/Inactive feature, ActiveThreshold set to a high value so PIE never starts and there should
@@ -577,8 +577,8 @@ PieQueueDiscTestCase::RunPieTest (QueueSizeUnit mode)
Simulator::Run ();
st = queue->GetStats ();
uint32_t test15 = st.GetNDroppedPackets (PieQueueDisc::UNFORCED_DROP);
NS_TEST_EXPECT_MSG_EQ (test15, 0, "There should not be any drops.");
NS_TEST_EXPECT_MSG_EQ (st.GetNMarkedPackets (PieQueueDisc::UNFORCED_MARK), 0, "There should be zero marks");
NS_TEST_ASSERT_MSG_EQ (test15, 0, "There should not be any drops.");
NS_TEST_ASSERT_MSG_EQ (st.GetNMarkedPackets (PieQueueDisc::UNFORCED_MARK), 0, "There should be zero marks");
// test 16: tests Active/Inactive feature, ActiveThreshold set to a low value so PIE starts early
@@ -596,8 +596,8 @@ PieQueueDiscTestCase::RunPieTest (QueueSizeUnit mode)
Simulator::Run ();
st = queue->GetStats ();
uint32_t test16 = st.GetNDroppedPackets (PieQueueDisc::UNFORCED_DROP);
NS_TEST_EXPECT_MSG_NE (test16, 0, "There should be some drops.");
NS_TEST_EXPECT_MSG_EQ (st.GetNMarkedPackets (PieQueueDisc::UNFORCED_MARK), 0, "There should be zero marks");
NS_TEST_ASSERT_MSG_NE (test16, 0, "There should be some drops.");
NS_TEST_ASSERT_MSG_EQ (st.GetNMarkedPackets (PieQueueDisc::UNFORCED_MARK), 0, "There should be zero marks");
}
void

View File

@@ -182,16 +182,16 @@ PrioQueueDiscTestCase::DoRun (void)
}
qdisc->Initialize ();
NS_TEST_EXPECT_MSG_EQ (qdisc->GetNQueueDiscClasses (), 4, "Verify that the queue disc has 4 child queue discs");
NS_TEST_ASSERT_MSG_EQ (qdisc->GetNQueueDiscClasses (), 4, "Verify that the queue disc has 4 child queue discs");
NS_TEST_EXPECT_MSG_EQ (qdisc->SetAttributeFailSafe ("Priomap", StringValue (priomap)),
NS_TEST_ASSERT_MSG_EQ (qdisc->SetAttributeFailSafe ("Priomap", StringValue (priomap)),
true, "Verify that we can actually set the attribute Priomap");
StringValue sv;
NS_TEST_EXPECT_MSG_EQ (qdisc->GetAttributeFailSafe ("Priomap", sv),
NS_TEST_ASSERT_MSG_EQ (qdisc->GetAttributeFailSafe ("Priomap", sv),
true, "Verify that we can actually get the attribute Priomap");
NS_TEST_EXPECT_MSG_EQ (sv.Get (), priomap, "Verify that the priomap has been correctly set");
NS_TEST_ASSERT_MSG_EQ (sv.Get (), priomap, "Verify that the priomap has been correctly set");
/*
* Test 2: classify packets based on priomap because no packet filter is installed
@@ -200,7 +200,7 @@ PrioQueueDiscTestCase::DoRun (void)
// create packets with priorities from 0 to 3
for (uint16_t i = 0; i < 4; i++)
{
NS_TEST_EXPECT_MSG_EQ (qdisc->GetQueueDiscClass (i)->GetQueueDisc ()->GetNPackets (),
NS_TEST_ASSERT_MSG_EQ (qdisc->GetQueueDiscClass (i)->GetQueueDisc ()->GetNPackets (),
0, "There should be no packets in the child queue disc " << i);
item = Create<PrioQueueDiscTestItem> (Create<Packet> (100), dest, i);
@@ -208,7 +208,7 @@ PrioQueueDiscTestCase::DoRun (void)
// packet is assigned band i
uids[i].push (item->GetPacket ()->GetUid ());
NS_TEST_EXPECT_MSG_EQ (qdisc->GetQueueDiscClass (i)->GetQueueDisc ()->GetNPackets (),
NS_TEST_ASSERT_MSG_EQ (qdisc->GetQueueDiscClass (i)->GetQueueDisc ()->GetNPackets (),
1, "There should be one packet in the child queue disc " << i);
}
@@ -223,7 +223,7 @@ PrioQueueDiscTestCase::DoRun (void)
// create packets with priorities from 4 to 7
for (uint16_t i = 0; i < 4; i++)
{
NS_TEST_EXPECT_MSG_EQ (qdisc->GetQueueDiscClass (i)->GetQueueDisc ()->GetNPackets (),
NS_TEST_ASSERT_MSG_EQ (qdisc->GetQueueDiscClass (i)->GetQueueDisc ()->GetNPackets (),
1, "There should be one packet in the child queue disc " << i);
item = Create<PrioQueueDiscTestItem> (Create<Packet> (100), dest, i+4);
@@ -231,7 +231,7 @@ PrioQueueDiscTestCase::DoRun (void)
// packet is assigned band i
uids[i].push (item->GetPacket ()->GetUid ());
NS_TEST_EXPECT_MSG_EQ (qdisc->GetQueueDiscClass (i)->GetQueueDisc ()->GetNPackets (),
NS_TEST_ASSERT_MSG_EQ (qdisc->GetQueueDiscClass (i)->GetQueueDisc ()->GetNPackets (),
2, "There should be two packets in the child queue disc " << i);
}
@@ -246,7 +246,7 @@ PrioQueueDiscTestCase::DoRun (void)
for (uint16_t i = 0; i < 4; i++)
{
pf2->SetReturnValue (i);
NS_TEST_EXPECT_MSG_EQ (qdisc->GetQueueDiscClass (i)->GetQueueDisc ()->GetNPackets (),
NS_TEST_ASSERT_MSG_EQ (qdisc->GetQueueDiscClass (i)->GetQueueDisc ()->GetNPackets (),
2, "There should be two packets in the child queue disc " << i);
item = Create<PrioQueueDiscTestItem> (Create<Packet> (100), dest, 0);
@@ -254,7 +254,7 @@ PrioQueueDiscTestCase::DoRun (void)
// packet is assigned band i
uids[i].push (item->GetPacket ()->GetUid ());
NS_TEST_EXPECT_MSG_EQ (qdisc->GetQueueDiscClass (i)->GetQueueDisc ()->GetNPackets (),
NS_TEST_ASSERT_MSG_EQ (qdisc->GetQueueDiscClass (i)->GetQueueDisc ()->GetNPackets (),
3, "There should be three packets in the child queue disc " << i);
}
@@ -268,8 +268,8 @@ PrioQueueDiscTestCase::DoRun (void)
for (uint16_t i = 0; i < 4; i++)
{
pf2->SetReturnValue (4+i);
NS_TEST_EXPECT_MSG_EQ (qdisc->GetBandForPriority (0), 0, "The band for priority 0 must be band 0");
NS_TEST_EXPECT_MSG_EQ (qdisc->GetQueueDiscClass (0)->GetQueueDisc ()->GetNPackets (), i+3u,
NS_TEST_ASSERT_MSG_EQ (qdisc->GetBandForPriority (0), 0, "The band for priority 0 must be band 0");
NS_TEST_ASSERT_MSG_EQ (qdisc->GetQueueDiscClass (0)->GetQueueDisc ()->GetNPackets (), i+3u,
"There should be " << i+3 << " packets in the child queue disc "
<< qdisc->GetBandForPriority (0));
@@ -278,7 +278,7 @@ PrioQueueDiscTestCase::DoRun (void)
// packet is assigned band 0
uids[0].push (item->GetPacket ()->GetUid ());
NS_TEST_EXPECT_MSG_EQ (qdisc->GetQueueDiscClass (0)->GetQueueDisc ()->GetNPackets (), i+4u,
NS_TEST_ASSERT_MSG_EQ (qdisc->GetQueueDiscClass (0)->GetQueueDisc ()->GetNPackets (), i+4u,
"There should be " << i+4 << " packets in the child queue disc "
<< qdisc->GetBandForPriority (0));
}
@@ -293,11 +293,11 @@ PrioQueueDiscTestCase::DoRun (void)
{
if (uids[i].empty ())
{
NS_TEST_EXPECT_MSG_EQ (qdisc->GetQueueDiscClass (i)->GetQueueDisc ()->GetNPackets (),
NS_TEST_ASSERT_MSG_EQ (qdisc->GetQueueDiscClass (i)->GetQueueDisc ()->GetNPackets (),
0, "Band " << i << " should be empty");
continue;
}
NS_TEST_EXPECT_MSG_EQ (uids[i].front (), item->GetPacket ()->GetUid (),
NS_TEST_ASSERT_MSG_EQ (uids[i].front (), item->GetPacket ()->GetUid (),
"The dequeued packet is not the one we expected");
uids[i].pop ();
break;

View File

@@ -362,14 +362,14 @@ QueueDiscTracesTestCase::QueueDiscTracesTestCase ()
void
QueueDiscTracesTestCase::CheckQueued (Ptr<QueueDisc> qd, uint32_t nPackets, uint32_t nBytes)
{
NS_TEST_EXPECT_MSG_EQ (qd->GetNPackets (), nPackets,
NS_TEST_ASSERT_MSG_EQ (qd->GetNPackets (), nPackets,
"Verify that the number of queued packets is computed correctly");
NS_TEST_EXPECT_MSG_EQ (m_counter[qd].m_nPackets, nPackets,
NS_TEST_ASSERT_MSG_EQ (m_counter[qd].m_nPackets, nPackets,
"Verify that the number of queued packets is computed correctly");
NS_TEST_EXPECT_MSG_EQ (qd->GetNBytes (), nBytes,
NS_TEST_ASSERT_MSG_EQ (qd->GetNBytes (), nBytes,
"Verify that the number of queued bytes is computed correctly");
NS_TEST_EXPECT_MSG_EQ (m_counter[qd].m_nBytes, nBytes,
NS_TEST_ASSERT_MSG_EQ (m_counter[qd].m_nBytes, nBytes,
"Verify that the number of queued bytes is computed correctly");
}
@@ -378,14 +378,14 @@ QueueDiscTracesTestCase::CheckDroppedBeforeEnqueue (Ptr<QueueDisc> qd, uint32_t
{
QueueDisc::Stats stats = qd->GetStats ();
NS_TEST_EXPECT_MSG_EQ (stats.nTotalDroppedPacketsBeforeEnqueue, nDbePackets,
NS_TEST_ASSERT_MSG_EQ (stats.nTotalDroppedPacketsBeforeEnqueue, nDbePackets,
"Verify that the number of packets dropped before enqueue is computed correctly");
NS_TEST_EXPECT_MSG_EQ (m_counter[qd].m_nDbePackets, nDbePackets,
NS_TEST_ASSERT_MSG_EQ (m_counter[qd].m_nDbePackets, nDbePackets,
"Verify that the number of packets dropped before enqueue is computed correctly");
NS_TEST_EXPECT_MSG_EQ (stats.nTotalDroppedBytesBeforeEnqueue, nDbeBytes,
NS_TEST_ASSERT_MSG_EQ (stats.nTotalDroppedBytesBeforeEnqueue, nDbeBytes,
"Verify that the number of bytes dropped before enqueue is computed correctly");
NS_TEST_EXPECT_MSG_EQ (m_counter[qd].m_nDbeBytes, nDbeBytes,
NS_TEST_ASSERT_MSG_EQ (m_counter[qd].m_nDbeBytes, nDbeBytes,
"Verify that the number of bytes dropped before enqueue is computed correctly");
}
@@ -394,14 +394,14 @@ QueueDiscTracesTestCase::CheckDroppedAfterDequeue (Ptr<QueueDisc> qd, uint32_t n
{
QueueDisc::Stats stats = qd->GetStats ();
NS_TEST_EXPECT_MSG_EQ (stats.nTotalDroppedPacketsAfterDequeue, nDadPackets,
NS_TEST_ASSERT_MSG_EQ (stats.nTotalDroppedPacketsAfterDequeue, nDadPackets,
"Verify that the number of packets dropped after dequeue is computed correctly");
NS_TEST_EXPECT_MSG_EQ (m_counter[qd].m_nDadPackets, nDadPackets,
NS_TEST_ASSERT_MSG_EQ (m_counter[qd].m_nDadPackets, nDadPackets,
"Verify that the number of packets dropped after dequeue is computed correctly");
NS_TEST_EXPECT_MSG_EQ (stats.nTotalDroppedBytesAfterDequeue, nDadBytes,
NS_TEST_ASSERT_MSG_EQ (stats.nTotalDroppedBytesAfterDequeue, nDadBytes,
"Verify that the number of bytes dropped after dequeue is computed correctly");
NS_TEST_EXPECT_MSG_EQ (m_counter[qd].m_nDadBytes, nDadBytes,
NS_TEST_ASSERT_MSG_EQ (m_counter[qd].m_nDadBytes, nDadBytes,
"Verify that the number of bytes dropped after dequeue is computed correctly");
}
@@ -418,7 +418,7 @@ QueueDiscTracesTestCase::DoRun (void)
Ptr<QueueDisc> child = root->GetQueueDiscClass (0)->GetQueueDisc ();
NS_TEST_EXPECT_MSG_NE (child, 0, "The child queue disc has not been created");
NS_TEST_ASSERT_MSG_NE (child, 0, "The child queue disc has not been created");
// Create counters and connect traces to the counters
m_counter.emplace (root, TestCounter ());
@@ -464,8 +464,8 @@ QueueDiscTracesTestCase::DoRun (void)
// of the child queue disc.
item = root->Peek ();
NS_TEST_EXPECT_MSG_NE (item, 0, "A packet must have been returned");
NS_TEST_EXPECT_MSG_EQ (item->GetSize (), pktSizeUnit * 3, "The peeked packet has not the expected size");
NS_TEST_ASSERT_MSG_NE (item, 0, "A packet must have been returned");
NS_TEST_ASSERT_MSG_EQ (item->GetSize (), pktSizeUnit * 3, "The peeked packet has not the expected size");
CheckQueued (root, 2, pktSizeUnit * 7);
CheckDroppedBeforeEnqueue (root, 1, pktSizeUnit * 5);
@@ -478,8 +478,8 @@ QueueDiscTracesTestCase::DoRun (void)
// Peek again. Nothing changes.
item = root->Peek ();
NS_TEST_EXPECT_MSG_NE (item, 0, "A packet must have been returned");
NS_TEST_EXPECT_MSG_EQ (item->GetSize (), pktSizeUnit * 3, "The peeked packet has not the expected size");
NS_TEST_ASSERT_MSG_NE (item, 0, "A packet must have been returned");
NS_TEST_ASSERT_MSG_EQ (item->GetSize (), pktSizeUnit * 3, "The peeked packet has not the expected size");
CheckQueued (root, 2, pktSizeUnit * 7);
CheckDroppedBeforeEnqueue (root, 1, pktSizeUnit * 5);
@@ -492,8 +492,8 @@ QueueDiscTracesTestCase::DoRun (void)
// Dequeue one packet. The root queue disc returns the previously peeked packet.
item = root->Dequeue ();
NS_TEST_EXPECT_MSG_NE (item, 0, "A packet must have been returned");
NS_TEST_EXPECT_MSG_EQ (item->GetSize (), pktSizeUnit * 3, "The dequeued packet has not the expected size");
NS_TEST_ASSERT_MSG_NE (item, 0, "A packet must have been returned");
NS_TEST_ASSERT_MSG_EQ (item->GetSize (), pktSizeUnit * 3, "The dequeued packet has not the expected size");
CheckQueued (root, 1, pktSizeUnit * 4);
CheckDroppedBeforeEnqueue (root, 1, pktSizeUnit * 5);
@@ -506,8 +506,8 @@ QueueDiscTracesTestCase::DoRun (void)
// Dequeue the last packet.
item = root->Dequeue ();
NS_TEST_EXPECT_MSG_NE (item, 0, "A packet must have been returned");
NS_TEST_EXPECT_MSG_EQ (item->GetSize (), pktSizeUnit * 4, "The dequeued packet has not the expected size");
NS_TEST_ASSERT_MSG_NE (item, 0, "A packet must have been returned");
NS_TEST_ASSERT_MSG_EQ (item->GetSize (), pktSizeUnit * 4, "The dequeued packet has not the expected size");
CheckQueued (root, 0, 0);
CheckDroppedBeforeEnqueue (root, 1, pktSizeUnit * 5);
@@ -520,7 +520,7 @@ QueueDiscTracesTestCase::DoRun (void)
// Peek a packet. No packet is left.
item = root->Peek ();
NS_TEST_EXPECT_MSG_EQ (item, 0, "No packet must have been returned");
NS_TEST_ASSERT_MSG_EQ (item, 0, "No packet must have been returned");
CheckQueued (root, 0, 0);
CheckDroppedBeforeEnqueue (root, 1, pktSizeUnit * 5);
@@ -544,8 +544,8 @@ QueueDiscTracesTestCase::DoRun (void)
// Dequeue one packet.
item = root->Dequeue ();
NS_TEST_EXPECT_MSG_NE (item, 0, "A packet must have been returned");
NS_TEST_EXPECT_MSG_EQ (item->GetSize (), pktSizeUnit, "The dequeued packet has not the expected size");
NS_TEST_ASSERT_MSG_NE (item, 0, "A packet must have been returned");
NS_TEST_ASSERT_MSG_EQ (item->GetSize (), pktSizeUnit, "The dequeued packet has not the expected size");
CheckQueued (root, 0, 0);
CheckDroppedBeforeEnqueue (root, 1, pktSizeUnit * 5);

View File

@@ -131,13 +131,13 @@ RedQueueDiscTestCase::RunRedTest (QueueSizeUnit mode)
Ptr<RedQueueDisc> queue = CreateObject<RedQueueDisc> ();
// test 1: simple enqueue/dequeue with no drops
NS_TEST_EXPECT_MSG_EQ (queue->SetAttributeFailSafe ("MinTh", DoubleValue (minTh)), true,
NS_TEST_ASSERT_MSG_EQ (queue->SetAttributeFailSafe ("MinTh", DoubleValue (minTh)), true,
"Verify that we can actually set the attribute MinTh");
NS_TEST_EXPECT_MSG_EQ (queue->SetAttributeFailSafe ("MaxTh", DoubleValue (maxTh)), true,
NS_TEST_ASSERT_MSG_EQ (queue->SetAttributeFailSafe ("MaxTh", DoubleValue (maxTh)), true,
"Verify that we can actually set the attribute MaxTh");
NS_TEST_EXPECT_MSG_EQ (queue->SetAttributeFailSafe ("MaxSize", QueueSizeValue (QueueSize (mode, qSize))),
NS_TEST_ASSERT_MSG_EQ (queue->SetAttributeFailSafe ("MaxSize", QueueSizeValue (QueueSize (mode, qSize))),
true, "Verify that we can actually set the attribute MaxSize");
NS_TEST_EXPECT_MSG_EQ (queue->SetAttributeFailSafe ("QW", DoubleValue (0.002)), true,
NS_TEST_ASSERT_MSG_EQ (queue->SetAttributeFailSafe ("QW", DoubleValue (0.002)), true,
"Verify that we can actually set the attribute QW");
Address dest;
@@ -162,35 +162,35 @@ RedQueueDiscTestCase::RunRedTest (QueueSizeUnit mode)
p8 = Create<Packet> (pktSize);
queue->Initialize ();
NS_TEST_EXPECT_MSG_EQ (queue->GetCurrentSize ().GetValue (), 0 * modeSize, "There should be no packets in there");
NS_TEST_ASSERT_MSG_EQ (queue->GetCurrentSize ().GetValue (), 0 * modeSize, "There should be no packets in there");
queue->Enqueue (Create<RedQueueDiscTestItem> (p1, dest, false));
NS_TEST_EXPECT_MSG_EQ (queue->GetCurrentSize ().GetValue (), 1 * modeSize, "There should be one packet in there");
NS_TEST_ASSERT_MSG_EQ (queue->GetCurrentSize ().GetValue (), 1 * modeSize, "There should be one packet in there");
queue->Enqueue (Create<RedQueueDiscTestItem> (p2, dest, false));
NS_TEST_EXPECT_MSG_EQ (queue->GetCurrentSize ().GetValue (), 2 * modeSize, "There should be two packets in there");
NS_TEST_ASSERT_MSG_EQ (queue->GetCurrentSize ().GetValue (), 2 * modeSize, "There should be two packets in there");
queue->Enqueue (Create<RedQueueDiscTestItem> (p3, dest, false));
queue->Enqueue (Create<RedQueueDiscTestItem> (p4, dest, false));
queue->Enqueue (Create<RedQueueDiscTestItem> (p5, dest, false));
queue->Enqueue (Create<RedQueueDiscTestItem> (p6, dest, false));
queue->Enqueue (Create<RedQueueDiscTestItem> (p7, dest, false));
queue->Enqueue (Create<RedQueueDiscTestItem> (p8, dest, false));
NS_TEST_EXPECT_MSG_EQ (queue->GetCurrentSize ().GetValue (), 8 * modeSize, "There should be eight packets in there");
NS_TEST_ASSERT_MSG_EQ (queue->GetCurrentSize ().GetValue (), 8 * modeSize, "There should be eight packets in there");
Ptr<QueueDiscItem> item;
item = queue->Dequeue ();
NS_TEST_EXPECT_MSG_EQ ((item != 0), true, "I want to remove the first packet");
NS_TEST_EXPECT_MSG_EQ (queue->GetCurrentSize ().GetValue (), 7 * modeSize, "There should be seven packets in there");
NS_TEST_EXPECT_MSG_EQ (item->GetPacket ()->GetUid (), p1->GetUid (), "was this the first packet ?");
NS_TEST_ASSERT_MSG_EQ ((item != 0), true, "I want to remove the first packet");
NS_TEST_ASSERT_MSG_EQ (queue->GetCurrentSize ().GetValue (), 7 * modeSize, "There should be seven packets in there");
NS_TEST_ASSERT_MSG_EQ (item->GetPacket ()->GetUid (), p1->GetUid (), "was this the first packet ?");
item = queue->Dequeue ();
NS_TEST_EXPECT_MSG_EQ ((item != 0), true, "I want to remove the second packet");
NS_TEST_EXPECT_MSG_EQ (queue->GetCurrentSize ().GetValue (), 6 * modeSize, "There should be six packet in there");
NS_TEST_EXPECT_MSG_EQ (item->GetPacket ()->GetUid (), p2->GetUid (), "Was this the second packet ?");
NS_TEST_ASSERT_MSG_EQ ((item != 0), true, "I want to remove the second packet");
NS_TEST_ASSERT_MSG_EQ (queue->GetCurrentSize ().GetValue (), 6 * modeSize, "There should be six packet in there");
NS_TEST_ASSERT_MSG_EQ (item->GetPacket ()->GetUid (), p2->GetUid (), "Was this the second packet ?");
item = queue->Dequeue ();
NS_TEST_EXPECT_MSG_EQ ((item != 0), true, "I want to remove the third packet");
NS_TEST_EXPECT_MSG_EQ (queue->GetCurrentSize ().GetValue (), 5 * modeSize, "There should be five packets in there");
NS_TEST_EXPECT_MSG_EQ (item->GetPacket ()->GetUid (), p3->GetUid (), "Was this the third packet ?");
NS_TEST_ASSERT_MSG_EQ ((item != 0), true, "I want to remove the third packet");
NS_TEST_ASSERT_MSG_EQ (queue->GetCurrentSize ().GetValue (), 5 * modeSize, "There should be five packets in there");
NS_TEST_ASSERT_MSG_EQ (item->GetPacket ()->GetUid (), p3->GetUid (), "Was this the third packet ?");
item = queue->Dequeue ();
item = queue->Dequeue ();
@@ -199,7 +199,7 @@ RedQueueDiscTestCase::RunRedTest (QueueSizeUnit mode)
item = queue->Dequeue ();
item = queue->Dequeue ();
NS_TEST_EXPECT_MSG_EQ ((item == 0), true, "There are really no packets in there");
NS_TEST_ASSERT_MSG_EQ ((item == 0), true, "There are really no packets in there");
// test 2: more data, but with no drops
@@ -207,20 +207,20 @@ RedQueueDiscTestCase::RunRedTest (QueueSizeUnit mode)
minTh = 70 * modeSize;
maxTh = 150 * modeSize;
qSize = 300 * modeSize;
NS_TEST_EXPECT_MSG_EQ (queue->SetAttributeFailSafe ("MinTh", DoubleValue (minTh)), true,
NS_TEST_ASSERT_MSG_EQ (queue->SetAttributeFailSafe ("MinTh", DoubleValue (minTh)), true,
"Verify that we can actually set the attribute MinTh");
NS_TEST_EXPECT_MSG_EQ (queue->SetAttributeFailSafe ("MaxTh", DoubleValue (maxTh)), true,
NS_TEST_ASSERT_MSG_EQ (queue->SetAttributeFailSafe ("MaxTh", DoubleValue (maxTh)), true,
"Verify that we can actually set the attribute MaxTh");
NS_TEST_EXPECT_MSG_EQ (queue->SetAttributeFailSafe ("MaxSize", QueueSizeValue (QueueSize (mode, qSize))),
NS_TEST_ASSERT_MSG_EQ (queue->SetAttributeFailSafe ("MaxSize", QueueSizeValue (QueueSize (mode, qSize))),
true, "Verify that we can actually set the attribute MaxSize");
queue->Initialize ();
Enqueue (queue, pktSize, 300, false);
QueueDisc::Stats st = queue->GetStats ();
NS_TEST_EXPECT_MSG_EQ (st.GetNDroppedPackets (RedQueueDisc::UNFORCED_DROP), 0,
NS_TEST_ASSERT_MSG_EQ (st.GetNDroppedPackets (RedQueueDisc::UNFORCED_DROP), 0,
"There should be zero unforced drops");
NS_TEST_EXPECT_MSG_EQ (st.GetNDroppedPackets (RedQueueDisc::FORCED_DROP), 0,
NS_TEST_ASSERT_MSG_EQ (st.GetNDroppedPackets (RedQueueDisc::FORCED_DROP), 0,
"There should be zero forced dropps");
NS_TEST_EXPECT_MSG_EQ (st.GetNDroppedPackets (QueueDisc::INTERNAL_QUEUE_DROP), 0,
NS_TEST_ASSERT_MSG_EQ (st.GetNDroppedPackets (QueueDisc::INTERNAL_QUEUE_DROP), 0,
"There should be zero drops due to queue limit");
// save number of drops from tests
@@ -238,13 +238,13 @@ RedQueueDiscTestCase::RunRedTest (QueueSizeUnit mode)
// test 3: more data, now drops due QW change
queue = CreateObject<RedQueueDisc> ();
NS_TEST_EXPECT_MSG_EQ (queue->SetAttributeFailSafe ("MinTh", DoubleValue (minTh)), true,
NS_TEST_ASSERT_MSG_EQ (queue->SetAttributeFailSafe ("MinTh", DoubleValue (minTh)), true,
"Verify that we can actually set the attribute MinTh");
NS_TEST_EXPECT_MSG_EQ (queue->SetAttributeFailSafe ("MaxTh", DoubleValue (maxTh)), true,
NS_TEST_ASSERT_MSG_EQ (queue->SetAttributeFailSafe ("MaxTh", DoubleValue (maxTh)), true,
"Verify that we can actually set the attribute MaxTh");
NS_TEST_EXPECT_MSG_EQ (queue->SetAttributeFailSafe ("MaxSize", QueueSizeValue (QueueSize (mode, qSize))),
NS_TEST_ASSERT_MSG_EQ (queue->SetAttributeFailSafe ("MaxSize", QueueSizeValue (QueueSize (mode, qSize))),
true, "Verify that we can actually set the attribute MaxSize");
NS_TEST_EXPECT_MSG_EQ (queue->SetAttributeFailSafe ("QW", DoubleValue (0.020)), true,
NS_TEST_ASSERT_MSG_EQ (queue->SetAttributeFailSafe ("QW", DoubleValue (0.020)), true,
"Verify that we can actually set the attribute QW");
queue->Initialize ();
Enqueue (queue, pktSize, 300, false);
@@ -252,19 +252,19 @@ RedQueueDiscTestCase::RunRedTest (QueueSizeUnit mode)
drop.test3 = st.GetNDroppedPackets (RedQueueDisc::UNFORCED_DROP)
+ st.GetNDroppedPackets (RedQueueDisc::FORCED_DROP)
+ st.GetNDroppedPackets (QueueDisc::INTERNAL_QUEUE_DROP);
NS_TEST_EXPECT_MSG_NE (drop.test3, 0, "There should be some dropped packets");
NS_TEST_ASSERT_MSG_NE (drop.test3, 0, "There should be some dropped packets");
// test 4: reduced maxTh, this causes more drops
maxTh = 100 * modeSize;
queue = CreateObject<RedQueueDisc> ();
NS_TEST_EXPECT_MSG_EQ (queue->SetAttributeFailSafe ("MinTh", DoubleValue (minTh)), true,
NS_TEST_ASSERT_MSG_EQ (queue->SetAttributeFailSafe ("MinTh", DoubleValue (minTh)), true,
"Verify that we can actually set the attribute MinTh");
NS_TEST_EXPECT_MSG_EQ (queue->SetAttributeFailSafe ("MaxTh", DoubleValue (maxTh)), true,
NS_TEST_ASSERT_MSG_EQ (queue->SetAttributeFailSafe ("MaxTh", DoubleValue (maxTh)), true,
"Verify that we can actually set the attribute MaxTh");
NS_TEST_EXPECT_MSG_EQ (queue->SetAttributeFailSafe ("MaxSize", QueueSizeValue (QueueSize (mode, qSize))),
NS_TEST_ASSERT_MSG_EQ (queue->SetAttributeFailSafe ("MaxSize", QueueSizeValue (QueueSize (mode, qSize))),
true, "Verify that we can actually set the attribute MaxSize");
NS_TEST_EXPECT_MSG_EQ (queue->SetAttributeFailSafe ("QW", DoubleValue (0.020)), true,
NS_TEST_ASSERT_MSG_EQ (queue->SetAttributeFailSafe ("QW", DoubleValue (0.020)), true,
"Verify that we can actually set the attribute QW");
queue->Initialize ();
Enqueue (queue, pktSize, 300, false);
@@ -272,21 +272,21 @@ RedQueueDiscTestCase::RunRedTest (QueueSizeUnit mode)
drop.test4 = st.GetNDroppedPackets (RedQueueDisc::UNFORCED_DROP)
+ st.GetNDroppedPackets (RedQueueDisc::FORCED_DROP)
+ st.GetNDroppedPackets (QueueDisc::INTERNAL_QUEUE_DROP);
NS_TEST_EXPECT_MSG_GT (drop.test4, drop.test3, "Test 4 should have more drops than test 3");
NS_TEST_ASSERT_MSG_GT (drop.test4, drop.test3, "Test 4 should have more drops than test 3");
// test 5: change drop probability to a high value (LInterm)
maxTh = 150 * modeSize;
queue = CreateObject<RedQueueDisc> ();
NS_TEST_EXPECT_MSG_EQ (queue->SetAttributeFailSafe ("MinTh", DoubleValue (minTh)), true,
NS_TEST_ASSERT_MSG_EQ (queue->SetAttributeFailSafe ("MinTh", DoubleValue (minTh)), true,
"Verify that we can actually set the attribute MinTh");
NS_TEST_EXPECT_MSG_EQ (queue->SetAttributeFailSafe ("MaxTh", DoubleValue (maxTh)), true,
NS_TEST_ASSERT_MSG_EQ (queue->SetAttributeFailSafe ("MaxTh", DoubleValue (maxTh)), true,
"Verify that we can actually set the attribute MaxTh");
NS_TEST_EXPECT_MSG_EQ (queue->SetAttributeFailSafe ("MaxSize", QueueSizeValue (QueueSize (mode, qSize))),
NS_TEST_ASSERT_MSG_EQ (queue->SetAttributeFailSafe ("MaxSize", QueueSizeValue (QueueSize (mode, qSize))),
true, "Verify that we can actually set the attribute MaxSize");
NS_TEST_EXPECT_MSG_EQ (queue->SetAttributeFailSafe ("QW", DoubleValue (0.020)), true,
NS_TEST_ASSERT_MSG_EQ (queue->SetAttributeFailSafe ("QW", DoubleValue (0.020)), true,
"Verify that we can actually set the attribute QW");
NS_TEST_EXPECT_MSG_EQ (queue->SetAttributeFailSafe ("LInterm", DoubleValue (5)), true,
NS_TEST_ASSERT_MSG_EQ (queue->SetAttributeFailSafe ("LInterm", DoubleValue (5)), true,
"Verify that we can actually set the attribute LInterm");
queue->Initialize ();
Enqueue (queue, pktSize, 300, false);
@@ -294,20 +294,20 @@ RedQueueDiscTestCase::RunRedTest (QueueSizeUnit mode)
drop.test5 = st.GetNDroppedPackets (RedQueueDisc::UNFORCED_DROP)
+ st.GetNDroppedPackets (RedQueueDisc::FORCED_DROP)
+ st.GetNDroppedPackets (QueueDisc::INTERNAL_QUEUE_DROP);
NS_TEST_EXPECT_MSG_GT (drop.test5, drop.test3, "Test 5 should have more drops than test 3");
NS_TEST_ASSERT_MSG_GT (drop.test5, drop.test3, "Test 5 should have more drops than test 3");
// test 6: disable Gentle param
queue = CreateObject<RedQueueDisc> ();
NS_TEST_EXPECT_MSG_EQ (queue->SetAttributeFailSafe ("MinTh", DoubleValue (minTh)), true,
NS_TEST_ASSERT_MSG_EQ (queue->SetAttributeFailSafe ("MinTh", DoubleValue (minTh)), true,
"Verify that we can actually set the attribute MinTh");
NS_TEST_EXPECT_MSG_EQ (queue->SetAttributeFailSafe ("MaxTh", DoubleValue (maxTh)), true,
NS_TEST_ASSERT_MSG_EQ (queue->SetAttributeFailSafe ("MaxTh", DoubleValue (maxTh)), true,
"Verify that we can actually set the attribute MaxTh");
NS_TEST_EXPECT_MSG_EQ (queue->SetAttributeFailSafe ("MaxSize", QueueSizeValue (QueueSize (mode, qSize))),
NS_TEST_ASSERT_MSG_EQ (queue->SetAttributeFailSafe ("MaxSize", QueueSizeValue (QueueSize (mode, qSize))),
true, "Verify that we can actually set the attribute MaxSize");
NS_TEST_EXPECT_MSG_EQ (queue->SetAttributeFailSafe ("QW", DoubleValue (0.020)), true,
NS_TEST_ASSERT_MSG_EQ (queue->SetAttributeFailSafe ("QW", DoubleValue (0.020)), true,
"Verify that we can actually set the attribute QW");
NS_TEST_EXPECT_MSG_EQ (queue->SetAttributeFailSafe ("Gentle", BooleanValue (false)), true,
NS_TEST_ASSERT_MSG_EQ (queue->SetAttributeFailSafe ("Gentle", BooleanValue (false)), true,
"Verify that we can actually set the attribute Gentle");
queue->Initialize ();
Enqueue (queue, pktSize, 300, false);
@@ -315,20 +315,20 @@ RedQueueDiscTestCase::RunRedTest (QueueSizeUnit mode)
drop.test6 = st.GetNDroppedPackets (RedQueueDisc::UNFORCED_DROP)
+ st.GetNDroppedPackets (RedQueueDisc::FORCED_DROP)
+ st.GetNDroppedPackets (QueueDisc::INTERNAL_QUEUE_DROP);
NS_TEST_EXPECT_MSG_GT (drop.test6, drop.test3, "Test 6 should have more drops than test 3");
NS_TEST_ASSERT_MSG_GT (drop.test6, drop.test3, "Test 6 should have more drops than test 3");
// test 7: disable Wait param
queue = CreateObject<RedQueueDisc> ();
NS_TEST_EXPECT_MSG_EQ (queue->SetAttributeFailSafe ("MinTh", DoubleValue (minTh)), true,
NS_TEST_ASSERT_MSG_EQ (queue->SetAttributeFailSafe ("MinTh", DoubleValue (minTh)), true,
"Verify that we can actually set the attribute MinTh");
NS_TEST_EXPECT_MSG_EQ (queue->SetAttributeFailSafe ("MaxTh", DoubleValue (maxTh)), true,
NS_TEST_ASSERT_MSG_EQ (queue->SetAttributeFailSafe ("MaxTh", DoubleValue (maxTh)), true,
"Verify that we can actually set the attribute MaxTh");
NS_TEST_EXPECT_MSG_EQ (queue->SetAttributeFailSafe ("MaxSize", QueueSizeValue (QueueSize (mode, qSize))),
NS_TEST_ASSERT_MSG_EQ (queue->SetAttributeFailSafe ("MaxSize", QueueSizeValue (QueueSize (mode, qSize))),
true, "Verify that we can actually set the attribute MaxSize");
NS_TEST_EXPECT_MSG_EQ (queue->SetAttributeFailSafe ("QW", DoubleValue (0.020)), true,
NS_TEST_ASSERT_MSG_EQ (queue->SetAttributeFailSafe ("QW", DoubleValue (0.020)), true,
"Verify that we can actually set the attribute QW");
NS_TEST_EXPECT_MSG_EQ (queue->SetAttributeFailSafe ("Wait", BooleanValue (false)), true,
NS_TEST_ASSERT_MSG_EQ (queue->SetAttributeFailSafe ("Wait", BooleanValue (false)), true,
"Verify that we can actually set the attribute Wait");
queue->Initialize ();
Enqueue (queue, pktSize, 300, false);
@@ -336,86 +336,86 @@ RedQueueDiscTestCase::RunRedTest (QueueSizeUnit mode)
drop.test7 = st.GetNDroppedPackets (RedQueueDisc::UNFORCED_DROP)
+ st.GetNDroppedPackets (RedQueueDisc::FORCED_DROP)
+ st.GetNDroppedPackets (QueueDisc::INTERNAL_QUEUE_DROP);
NS_TEST_EXPECT_MSG_GT (drop.test7, drop.test3, "Test 7 should have more drops than test 3");
NS_TEST_ASSERT_MSG_GT (drop.test7, drop.test3, "Test 7 should have more drops than test 3");
// test 8: RED queue disc is ECN enabled, but packets are not ECN capable
queue = CreateObject<RedQueueDisc> ();
minTh = 30 * modeSize;
maxTh = 90 * modeSize;
NS_TEST_EXPECT_MSG_EQ (queue->SetAttributeFailSafe ("MinTh", DoubleValue (minTh)), true,
NS_TEST_ASSERT_MSG_EQ (queue->SetAttributeFailSafe ("MinTh", DoubleValue (minTh)), true,
"Verify that we can actually set the attribute MinTh");
NS_TEST_EXPECT_MSG_EQ (queue->SetAttributeFailSafe ("MaxTh", DoubleValue (maxTh)), true,
NS_TEST_ASSERT_MSG_EQ (queue->SetAttributeFailSafe ("MaxTh", DoubleValue (maxTh)), true,
"Verify that we can actually set the attribute MaxTh");
NS_TEST_EXPECT_MSG_EQ (queue->SetAttributeFailSafe ("MaxSize", QueueSizeValue (QueueSize (mode, qSize))),
NS_TEST_ASSERT_MSG_EQ (queue->SetAttributeFailSafe ("MaxSize", QueueSizeValue (QueueSize (mode, qSize))),
true, "Verify that we can actually set the attribute MaxSize");
NS_TEST_EXPECT_MSG_EQ (queue->SetAttributeFailSafe ("QW", DoubleValue (0.002)), true,
NS_TEST_ASSERT_MSG_EQ (queue->SetAttributeFailSafe ("QW", DoubleValue (0.002)), true,
"Verify that we can actually set the attribute QW");
NS_TEST_EXPECT_MSG_EQ (queue->SetAttributeFailSafe ("LInterm", DoubleValue (2)), true,
NS_TEST_ASSERT_MSG_EQ (queue->SetAttributeFailSafe ("LInterm", DoubleValue (2)), true,
"Verify that we can actually set the attribute LInterm");
NS_TEST_EXPECT_MSG_EQ (queue->SetAttributeFailSafe ("Gentle", BooleanValue (true)), true,
NS_TEST_ASSERT_MSG_EQ (queue->SetAttributeFailSafe ("Gentle", BooleanValue (true)), true,
"Verify that we can actually set the attribute Gentle");
NS_TEST_EXPECT_MSG_EQ (queue->SetAttributeFailSafe ("UseEcn", BooleanValue (true)), true,
NS_TEST_ASSERT_MSG_EQ (queue->SetAttributeFailSafe ("UseEcn", BooleanValue (true)), true,
"Verify that we can actually set the attribute UseECN");
queue->Initialize ();
Enqueue (queue, pktSize, 300, false);
st = queue->GetStats ();
// Packets are not ECN capable, so there should be only unforced drops, no unforced marks
NS_TEST_EXPECT_MSG_NE (st.GetNDroppedPackets (RedQueueDisc::UNFORCED_DROP), 0,
NS_TEST_ASSERT_MSG_NE (st.GetNDroppedPackets (RedQueueDisc::UNFORCED_DROP), 0,
"There should be some unforced drops");
NS_TEST_EXPECT_MSG_EQ (st.GetNMarkedPackets (RedQueueDisc::UNFORCED_MARK), 0,
NS_TEST_ASSERT_MSG_EQ (st.GetNMarkedPackets (RedQueueDisc::UNFORCED_MARK), 0,
"There should be no unforced marks");
// test 9: Packets are ECN capable, but RED queue disc is not ECN enabled
queue = CreateObject<RedQueueDisc> ();
NS_TEST_EXPECT_MSG_EQ (queue->SetAttributeFailSafe ("MinTh", DoubleValue (minTh)), true,
NS_TEST_ASSERT_MSG_EQ (queue->SetAttributeFailSafe ("MinTh", DoubleValue (minTh)), true,
"Verify that we can actually set the attribute MinTh");
NS_TEST_EXPECT_MSG_EQ (queue->SetAttributeFailSafe ("MaxTh", DoubleValue (maxTh)), true,
NS_TEST_ASSERT_MSG_EQ (queue->SetAttributeFailSafe ("MaxTh", DoubleValue (maxTh)), true,
"Verify that we can actually set the attribute MaxTh");
NS_TEST_EXPECT_MSG_EQ (queue->SetAttributeFailSafe ("MaxSize", QueueSizeValue (QueueSize (mode, qSize))),
NS_TEST_ASSERT_MSG_EQ (queue->SetAttributeFailSafe ("MaxSize", QueueSizeValue (QueueSize (mode, qSize))),
true, "Verify that we can actually set the attribute MaxSize");
NS_TEST_EXPECT_MSG_EQ (queue->SetAttributeFailSafe ("QW", DoubleValue (0.002)), true,
NS_TEST_ASSERT_MSG_EQ (queue->SetAttributeFailSafe ("QW", DoubleValue (0.002)), true,
"Verify that we can actually set the attribute QW");
NS_TEST_EXPECT_MSG_EQ (queue->SetAttributeFailSafe ("LInterm", DoubleValue (2)), true,
NS_TEST_ASSERT_MSG_EQ (queue->SetAttributeFailSafe ("LInterm", DoubleValue (2)), true,
"Verify that we can actually set the attribute LInterm");
NS_TEST_EXPECT_MSG_EQ (queue->SetAttributeFailSafe ("Gentle", BooleanValue (true)), true,
NS_TEST_ASSERT_MSG_EQ (queue->SetAttributeFailSafe ("Gentle", BooleanValue (true)), true,
"Verify that we can actually set the attribute Gentle");
NS_TEST_EXPECT_MSG_EQ (queue->SetAttributeFailSafe ("UseEcn", BooleanValue (false)), true,
NS_TEST_ASSERT_MSG_EQ (queue->SetAttributeFailSafe ("UseEcn", BooleanValue (false)), true,
"Verify that we can actually set the attribute UseECN");
queue->Initialize ();
Enqueue (queue, pktSize, 300, true);
st = queue->GetStats ();
// RED queue disc is not ECN enabled, so there should be only unforced drops, no unforced marks
NS_TEST_EXPECT_MSG_NE (st.GetNDroppedPackets (RedQueueDisc::UNFORCED_DROP), 0,
NS_TEST_ASSERT_MSG_NE (st.GetNDroppedPackets (RedQueueDisc::UNFORCED_DROP), 0,
"There should be some unforced drops");
NS_TEST_EXPECT_MSG_EQ (st.GetNMarkedPackets (RedQueueDisc::UNFORCED_MARK), 0,
NS_TEST_ASSERT_MSG_EQ (st.GetNMarkedPackets (RedQueueDisc::UNFORCED_MARK), 0,
"There should be no unforced marks");
// test 10: Packets are ECN capable and RED queue disc is ECN enabled
queue = CreateObject<RedQueueDisc> ();
NS_TEST_EXPECT_MSG_EQ (queue->SetAttributeFailSafe ("MinTh", DoubleValue (minTh)), true,
NS_TEST_ASSERT_MSG_EQ (queue->SetAttributeFailSafe ("MinTh", DoubleValue (minTh)), true,
"Verify that we can actually set the attribute MinTh");
NS_TEST_EXPECT_MSG_EQ (queue->SetAttributeFailSafe ("MaxTh", DoubleValue (maxTh)), true,
NS_TEST_ASSERT_MSG_EQ (queue->SetAttributeFailSafe ("MaxTh", DoubleValue (maxTh)), true,
"Verify that we can actually set the attribute MaxTh");
NS_TEST_EXPECT_MSG_EQ (queue->SetAttributeFailSafe ("MaxSize", QueueSizeValue (QueueSize (mode, qSize))),
NS_TEST_ASSERT_MSG_EQ (queue->SetAttributeFailSafe ("MaxSize", QueueSizeValue (QueueSize (mode, qSize))),
true, "Verify that we can actually set the attribute MaxSize");
NS_TEST_EXPECT_MSG_EQ (queue->SetAttributeFailSafe ("QW", DoubleValue (0.002)), true,
NS_TEST_ASSERT_MSG_EQ (queue->SetAttributeFailSafe ("QW", DoubleValue (0.002)), true,
"Verify that we can actually set the attribute QW");
NS_TEST_EXPECT_MSG_EQ (queue->SetAttributeFailSafe ("LInterm", DoubleValue (2)), true,
NS_TEST_ASSERT_MSG_EQ (queue->SetAttributeFailSafe ("LInterm", DoubleValue (2)), true,
"Verify that we can actually set the attribute LInterm");
NS_TEST_EXPECT_MSG_EQ (queue->SetAttributeFailSafe ("Gentle", BooleanValue (true)), true,
NS_TEST_ASSERT_MSG_EQ (queue->SetAttributeFailSafe ("Gentle", BooleanValue (true)), true,
"Verify that we can actually set the attribute Gentle");
NS_TEST_EXPECT_MSG_EQ (queue->SetAttributeFailSafe ("UseEcn", BooleanValue (true)), true,
NS_TEST_ASSERT_MSG_EQ (queue->SetAttributeFailSafe ("UseEcn", BooleanValue (true)), true,
"Verify that we can actually set the attribute UseECN");
queue->Initialize ();
Enqueue (queue, pktSize, 300, true);
st = queue->GetStats ();
// Packets are ECN capable, RED queue disc is ECN enabled; there should be only unforced marks, no unforced drops
NS_TEST_EXPECT_MSG_EQ (st.GetNDroppedPackets (RedQueueDisc::UNFORCED_DROP), 0,
NS_TEST_ASSERT_MSG_EQ (st.GetNDroppedPackets (RedQueueDisc::UNFORCED_DROP), 0,
"There should be no unforced drops");
NS_TEST_EXPECT_MSG_NE (st.GetNMarkedPackets (RedQueueDisc::UNFORCED_MARK), 0,
NS_TEST_ASSERT_MSG_NE (st.GetNMarkedPackets (RedQueueDisc::UNFORCED_MARK), 0,
"There should be some unforced marks");
@@ -423,71 +423,71 @@ RedQueueDiscTestCase::RunRedTest (QueueSizeUnit mode)
queue = CreateObject<RedQueueDisc> ();
minTh = 30 * modeSize;
maxTh = 90 * modeSize;
NS_TEST_EXPECT_MSG_EQ (queue->SetAttributeFailSafe ("MinTh", DoubleValue (minTh)), true,
NS_TEST_ASSERT_MSG_EQ (queue->SetAttributeFailSafe ("MinTh", DoubleValue (minTh)), true,
"Verify that we can actually set the attribute MinTh");
NS_TEST_EXPECT_MSG_EQ (queue->SetAttributeFailSafe ("MaxTh", DoubleValue (maxTh)), true,
NS_TEST_ASSERT_MSG_EQ (queue->SetAttributeFailSafe ("MaxTh", DoubleValue (maxTh)), true,
"Verify that we can actually set the attribute MaxTh");
NS_TEST_EXPECT_MSG_EQ (queue->SetAttributeFailSafe ("MaxSize", QueueSizeValue (QueueSize (mode, qSize))),
NS_TEST_ASSERT_MSG_EQ (queue->SetAttributeFailSafe ("MaxSize", QueueSizeValue (QueueSize (mode, qSize))),
true, "Verify that we can actually set the attribute MaxSize");
NS_TEST_EXPECT_MSG_EQ (queue->SetAttributeFailSafe ("QW", DoubleValue (0.002)), true,
NS_TEST_ASSERT_MSG_EQ (queue->SetAttributeFailSafe ("QW", DoubleValue (0.002)), true,
"Verify that we can actually set the attribute QW");
NS_TEST_EXPECT_MSG_EQ (queue->SetAttributeFailSafe ("LInterm", DoubleValue (2)), true,
NS_TEST_ASSERT_MSG_EQ (queue->SetAttributeFailSafe ("LInterm", DoubleValue (2)), true,
"Verify that we can actually set the attribute LInterm");
NS_TEST_EXPECT_MSG_EQ (queue->SetAttributeFailSafe ("Gentle", BooleanValue (true)), true,
NS_TEST_ASSERT_MSG_EQ (queue->SetAttributeFailSafe ("Gentle", BooleanValue (true)), true,
"Verify that we can actually set the attribute Gentle");
queue->Initialize ();
Enqueue (queue, pktSize, 300, false);
st = queue->GetStats ();
drop.test11 = st.GetNDroppedPackets (RedQueueDisc::UNFORCED_DROP);
NS_TEST_EXPECT_MSG_NE (drop.test11, 0, "There should some dropped packets due to probability mark");
NS_TEST_ASSERT_MSG_NE (drop.test11, 0, "There should some dropped packets due to probability mark");
// test 12: Feng's Adaptive RED with default parameter settings and varying m_curMaxP
queue = CreateObject<RedQueueDisc> ();
NS_TEST_EXPECT_MSG_EQ (queue->SetAttributeFailSafe ("MinTh", DoubleValue (minTh)), true,
NS_TEST_ASSERT_MSG_EQ (queue->SetAttributeFailSafe ("MinTh", DoubleValue (minTh)), true,
"Verify that we can actually set the attribute MinTh");
NS_TEST_EXPECT_MSG_EQ (queue->SetAttributeFailSafe ("MaxTh", DoubleValue (maxTh)), true,
NS_TEST_ASSERT_MSG_EQ (queue->SetAttributeFailSafe ("MaxTh", DoubleValue (maxTh)), true,
"Verify that we can actually set the attribute MaxTh");
NS_TEST_EXPECT_MSG_EQ (queue->SetAttributeFailSafe ("MaxSize", QueueSizeValue (QueueSize (mode, qSize))),
NS_TEST_ASSERT_MSG_EQ (queue->SetAttributeFailSafe ("MaxSize", QueueSizeValue (QueueSize (mode, qSize))),
true, "Verify that we can actually set the attribute MaxSize");
NS_TEST_EXPECT_MSG_EQ (queue->SetAttributeFailSafe ("QW", DoubleValue (0.002)), true,
NS_TEST_ASSERT_MSG_EQ (queue->SetAttributeFailSafe ("QW", DoubleValue (0.002)), true,
"Verify that we can actually set the attribute QW");
NS_TEST_EXPECT_MSG_EQ (queue->SetAttributeFailSafe ("LInterm", DoubleValue (2)), true,
NS_TEST_ASSERT_MSG_EQ (queue->SetAttributeFailSafe ("LInterm", DoubleValue (2)), true,
"Verify that we can actually set the attribute LInterm");
NS_TEST_EXPECT_MSG_EQ (queue->SetAttributeFailSafe ("Gentle", BooleanValue (true)), true,
NS_TEST_ASSERT_MSG_EQ (queue->SetAttributeFailSafe ("Gentle", BooleanValue (true)), true,
"Verify that we can actually set the attribute Gentle");
NS_TEST_EXPECT_MSG_EQ (queue->SetAttributeFailSafe ("FengAdaptive", BooleanValue (true)), true,
NS_TEST_ASSERT_MSG_EQ (queue->SetAttributeFailSafe ("FengAdaptive", BooleanValue (true)), true,
"Verify that we can actually set the attribute FengAdaptive");
queue->Initialize ();
Enqueue (queue, pktSize, 300, false);
st = queue->GetStats ();
drop.test12 = st.GetNDroppedPackets (RedQueueDisc::UNFORCED_DROP);
NS_TEST_EXPECT_MSG_LT (drop.test12, drop.test11, "Test 12 should have less drops due to probability mark than test 11");
NS_TEST_ASSERT_MSG_LT (drop.test12, drop.test11, "Test 12 should have less drops due to probability mark than test 11");
// test 13: RED with Nonlinear drop probability
queue = CreateObject<RedQueueDisc> ();
minTh = 30 * modeSize;
maxTh = 90 * modeSize;
NS_TEST_EXPECT_MSG_EQ (queue->SetAttributeFailSafe ("MinTh", DoubleValue (minTh)), true,
NS_TEST_ASSERT_MSG_EQ (queue->SetAttributeFailSafe ("MinTh", DoubleValue (minTh)), true,
"Verify that we can actually set the attribute MinTh");
NS_TEST_EXPECT_MSG_EQ (queue->SetAttributeFailSafe ("MaxTh", DoubleValue (maxTh)), true,
NS_TEST_ASSERT_MSG_EQ (queue->SetAttributeFailSafe ("MaxTh", DoubleValue (maxTh)), true,
"Verify that we can actually set the attribute MaxTh");
NS_TEST_EXPECT_MSG_EQ (queue->SetAttributeFailSafe ("MaxSize", QueueSizeValue (QueueSize (mode, qSize))),
NS_TEST_ASSERT_MSG_EQ (queue->SetAttributeFailSafe ("MaxSize", QueueSizeValue (QueueSize (mode, qSize))),
true, "Verify that we can actually set the attribute MaxSize");
NS_TEST_EXPECT_MSG_EQ (queue->SetAttributeFailSafe ("QW", DoubleValue (0.002)), true,
NS_TEST_ASSERT_MSG_EQ (queue->SetAttributeFailSafe ("QW", DoubleValue (0.002)), true,
"Verify that we can actually set the attribute QW");
NS_TEST_EXPECT_MSG_EQ (queue->SetAttributeFailSafe ("LInterm", DoubleValue (2)), true,
NS_TEST_ASSERT_MSG_EQ (queue->SetAttributeFailSafe ("LInterm", DoubleValue (2)), true,
"Verify that we can actually set the attribute LInterm");
NS_TEST_EXPECT_MSG_EQ (queue->SetAttributeFailSafe ("Gentle", BooleanValue (true)), true,
NS_TEST_ASSERT_MSG_EQ (queue->SetAttributeFailSafe ("Gentle", BooleanValue (true)), true,
"Verify that we can actually set the attribute Gentle");
NS_TEST_EXPECT_MSG_EQ (queue->SetAttributeFailSafe ("NLRED", BooleanValue (true)), true,
NS_TEST_ASSERT_MSG_EQ (queue->SetAttributeFailSafe ("NLRED", BooleanValue (true)), true,
"Verify that we can actually set the attribute NLRED");
queue->Initialize ();
Enqueue (queue, pktSize, 300, false);
st = queue->GetStats ();
drop.test13 = st.GetNDroppedPackets (RedQueueDisc::UNFORCED_DROP);
NS_TEST_EXPECT_MSG_LT (drop.test13, drop.test11, "Test 13 should have less drops due to probability mark than test 11");
NS_TEST_ASSERT_MSG_LT (drop.test13, drop.test11, "Test 13 should have less drops due to probability mark than test 11");
}

View File

@@ -152,15 +152,15 @@ TbfQueueDiscTestCase::RunTbfTest (QueueSizeUnit mode)
qSize = qSize * modeSize;
}
NS_TEST_EXPECT_MSG_EQ (queue->SetAttributeFailSafe ("MaxSize", QueueSizeValue (QueueSize (mode, qSize))),
NS_TEST_ASSERT_MSG_EQ (queue->SetAttributeFailSafe ("MaxSize", QueueSizeValue (QueueSize (mode, qSize))),
true, "Verify that we can actually set the attribute MaxSize");
NS_TEST_EXPECT_MSG_EQ (queue->SetAttributeFailSafe ("Burst", UintegerValue (burst)), true,
NS_TEST_ASSERT_MSG_EQ (queue->SetAttributeFailSafe ("Burst", UintegerValue (burst)), true,
"Verify that we can actually set the attribute Burst");
NS_TEST_EXPECT_MSG_EQ (queue->SetAttributeFailSafe ("Mtu", UintegerValue (mtu)), true,
NS_TEST_ASSERT_MSG_EQ (queue->SetAttributeFailSafe ("Mtu", UintegerValue (mtu)), true,
"Verify that we can actually set the attribute Mtu");
NS_TEST_EXPECT_MSG_EQ (queue->SetAttributeFailSafe ("Rate", DataRateValue (rate)), true,
NS_TEST_ASSERT_MSG_EQ (queue->SetAttributeFailSafe ("Rate", DataRateValue (rate)), true,
"Verify that we can actually set the attribute Rate");
NS_TEST_EXPECT_MSG_EQ (queue->SetAttributeFailSafe ("PeakRate", DataRateValue (peakRate)), true,
NS_TEST_ASSERT_MSG_EQ (queue->SetAttributeFailSafe ("PeakRate", DataRateValue (peakRate)), true,
"Verify that we can actually set the attribute PeakRate");
Address dest;
@@ -173,47 +173,47 @@ TbfQueueDiscTestCase::RunTbfTest (QueueSizeUnit mode)
p5 = Create<Packet> (pktSize);
queue->Initialize ();
NS_TEST_EXPECT_MSG_EQ (queue->GetCurrentSize ().GetValue (), 0 * modeSize, "There should be no packets in there");
NS_TEST_ASSERT_MSG_EQ (queue->GetCurrentSize ().GetValue (), 0 * modeSize, "There should be no packets in there");
queue->Enqueue (Create<TbfQueueDiscTestItem> (p1, dest));
NS_TEST_EXPECT_MSG_EQ (queue->GetCurrentSize ().GetValue (), 1 * modeSize, "There should be one packet in there");
NS_TEST_ASSERT_MSG_EQ (queue->GetCurrentSize ().GetValue (), 1 * modeSize, "There should be one packet in there");
queue->Enqueue (Create<TbfQueueDiscTestItem> (p2, dest));
NS_TEST_EXPECT_MSG_EQ (queue->GetCurrentSize ().GetValue (), 2 * modeSize, "There should be two packets in there");
NS_TEST_ASSERT_MSG_EQ (queue->GetCurrentSize ().GetValue (), 2 * modeSize, "There should be two packets in there");
queue->Enqueue (Create<TbfQueueDiscTestItem> (p3, dest));
NS_TEST_EXPECT_MSG_EQ (queue->GetCurrentSize ().GetValue (), 3 * modeSize, "There should be three packets in there");
NS_TEST_ASSERT_MSG_EQ (queue->GetCurrentSize ().GetValue (), 3 * modeSize, "There should be three packets in there");
queue->Enqueue (Create<TbfQueueDiscTestItem> (p4, dest));
NS_TEST_EXPECT_MSG_EQ (queue->GetCurrentSize ().GetValue (), 4 * modeSize, "There should be four packets in there");
NS_TEST_ASSERT_MSG_EQ (queue->GetCurrentSize ().GetValue (), 4 * modeSize, "There should be four packets in there");
queue->Enqueue (Create<TbfQueueDiscTestItem> (p5, dest));
NS_TEST_EXPECT_MSG_EQ (queue->GetCurrentSize ().GetValue (), 4 * modeSize,
NS_TEST_ASSERT_MSG_EQ (queue->GetCurrentSize ().GetValue (), 4 * modeSize,
"There should still be four packets in there as this enqueue cannot happen since QueueLimit will be exceeded");
Ptr<QueueDiscItem> item;
NS_TEST_EXPECT_MSG_EQ (queue->GetFirstBucketTokens (), burst, "The first token bucket should be full");
NS_TEST_ASSERT_MSG_EQ (queue->GetFirstBucketTokens (), burst, "The first token bucket should be full");
item = queue->Dequeue ();
NS_TEST_EXPECT_MSG_EQ ((item != 0), true, "I want to remove the first packet");
NS_TEST_EXPECT_MSG_EQ (queue->GetCurrentSize ().GetValue (), 3 * modeSize, "There should be three packets in there");
NS_TEST_EXPECT_MSG_EQ (item->GetPacket ()->GetUid (), p1->GetUid (), "was this the first packet ?");
NS_TEST_EXPECT_MSG_EQ (queue->GetFirstBucketTokens (), burst - (1 * pktSize),
NS_TEST_ASSERT_MSG_EQ ((item != 0), true, "I want to remove the first packet");
NS_TEST_ASSERT_MSG_EQ (queue->GetCurrentSize ().GetValue (), 3 * modeSize, "There should be three packets in there");
NS_TEST_ASSERT_MSG_EQ (item->GetPacket ()->GetUid (), p1->GetUid (), "was this the first packet ?");
NS_TEST_ASSERT_MSG_EQ (queue->GetFirstBucketTokens (), burst - (1 * pktSize),
"The number of tokens in the first bucket should be one pktSize lesser");
item = queue->Dequeue ();
NS_TEST_EXPECT_MSG_EQ ((item != 0), true, "I want to remove the second packet");
NS_TEST_EXPECT_MSG_EQ (queue->GetCurrentSize ().GetValue (), 2 * modeSize, "There should be two packets in there");
NS_TEST_EXPECT_MSG_EQ (item->GetPacket ()->GetUid (), p2->GetUid (), "Was this the second packet ?");
NS_TEST_EXPECT_MSG_EQ (queue->GetFirstBucketTokens (), burst - (2 * pktSize),
NS_TEST_ASSERT_MSG_EQ ((item != 0), true, "I want to remove the second packet");
NS_TEST_ASSERT_MSG_EQ (queue->GetCurrentSize ().GetValue (), 2 * modeSize, "There should be two packets in there");
NS_TEST_ASSERT_MSG_EQ (item->GetPacket ()->GetUid (), p2->GetUid (), "Was this the second packet ?");
NS_TEST_ASSERT_MSG_EQ (queue->GetFirstBucketTokens (), burst - (2 * pktSize),
"The number of tokens in the first bucket should be two pktSizes lesser");
item = queue->Dequeue ();
NS_TEST_EXPECT_MSG_EQ ((item != 0), true, "I want to remove the third packet");
NS_TEST_EXPECT_MSG_EQ (queue->GetCurrentSize ().GetValue (), 1 * modeSize, "There should be one packet in there");
NS_TEST_EXPECT_MSG_EQ (item->GetPacket ()->GetUid (), p3->GetUid (), "Was this the third packet ?");
NS_TEST_EXPECT_MSG_EQ (queue->GetFirstBucketTokens (), burst - (3 * pktSize),
NS_TEST_ASSERT_MSG_EQ ((item != 0), true, "I want to remove the third packet");
NS_TEST_ASSERT_MSG_EQ (queue->GetCurrentSize ().GetValue (), 1 * modeSize, "There should be one packet in there");
NS_TEST_ASSERT_MSG_EQ (item->GetPacket ()->GetUid (), p3->GetUid (), "Was this the third packet ?");
NS_TEST_ASSERT_MSG_EQ (queue->GetFirstBucketTokens (), burst - (3 * pktSize),
"The number of tokens in the first bucket should be three pktSizes lesser");
item = queue->Dequeue ();
NS_TEST_EXPECT_MSG_EQ ((item != 0), true, "I want to remove the fourth packet");
NS_TEST_EXPECT_MSG_EQ (queue->GetCurrentSize ().GetValue (), 0 * modeSize, "There should be zero packet in there");
NS_TEST_EXPECT_MSG_EQ (item->GetPacket ()->GetUid (), p4->GetUid (), "Was this the fourth packet ?");
NS_TEST_EXPECT_MSG_EQ (queue->GetFirstBucketTokens (), burst - (4 * pktSize),
NS_TEST_ASSERT_MSG_EQ ((item != 0), true, "I want to remove the fourth packet");
NS_TEST_ASSERT_MSG_EQ (queue->GetCurrentSize ().GetValue (), 0 * modeSize, "There should be zero packet in there");
NS_TEST_ASSERT_MSG_EQ (item->GetPacket ()->GetUid (), p4->GetUid (), "Was this the fourth packet ?");
NS_TEST_ASSERT_MSG_EQ (queue->GetFirstBucketTokens (), burst - (4 * pktSize),
"The number of tokens in the first bucket should be four pktSizes lesser");
// test 2 : When DataRate == FirstBucketTokenRate; packets should pass smoothly.
@@ -232,15 +232,15 @@ TbfQueueDiscTestCase::RunTbfTest (QueueSizeUnit mode)
qSize = qSize * modeSize;
}
NS_TEST_EXPECT_MSG_EQ (queue->SetAttributeFailSafe ("MaxSize", QueueSizeValue (QueueSize (mode, qSize))),
NS_TEST_ASSERT_MSG_EQ (queue->SetAttributeFailSafe ("MaxSize", QueueSizeValue (QueueSize (mode, qSize))),
true, "Verify that we can actually set the attribute MaxSize");
NS_TEST_EXPECT_MSG_EQ (queue->SetAttributeFailSafe ("Burst", UintegerValue (burst)), true,
NS_TEST_ASSERT_MSG_EQ (queue->SetAttributeFailSafe ("Burst", UintegerValue (burst)), true,
"Verify that we can actually set the attribute Burst");
NS_TEST_EXPECT_MSG_EQ (queue->SetAttributeFailSafe ("Mtu", UintegerValue (mtu)), true,
NS_TEST_ASSERT_MSG_EQ (queue->SetAttributeFailSafe ("Mtu", UintegerValue (mtu)), true,
"Verify that we can actually set the attribute Mtu");
NS_TEST_EXPECT_MSG_EQ (queue->SetAttributeFailSafe ("Rate", DataRateValue (rate)), true,
NS_TEST_ASSERT_MSG_EQ (queue->SetAttributeFailSafe ("Rate", DataRateValue (rate)), true,
"Verify that we can actually set the attribute Rate");
NS_TEST_EXPECT_MSG_EQ (queue->SetAttributeFailSafe ("PeakRate", DataRateValue (peakRate)), true,
NS_TEST_ASSERT_MSG_EQ (queue->SetAttributeFailSafe ("PeakRate", DataRateValue (peakRate)), true,
"Verify that we can actually set the attribute PeakRate");
queue->Initialize ();
@@ -295,15 +295,15 @@ TbfQueueDiscTestCase::RunTbfTest (QueueSizeUnit mode)
qSize = qSize * modeSize;
}
NS_TEST_EXPECT_MSG_EQ (queue->SetAttributeFailSafe ("MaxSize", QueueSizeValue (QueueSize (mode, qSize))),
NS_TEST_ASSERT_MSG_EQ (queue->SetAttributeFailSafe ("MaxSize", QueueSizeValue (QueueSize (mode, qSize))),
true, "Verify that we can actually set the attribute MaxSize");
NS_TEST_EXPECT_MSG_EQ (queue->SetAttributeFailSafe ("Burst", UintegerValue (burst)), true,
NS_TEST_ASSERT_MSG_EQ (queue->SetAttributeFailSafe ("Burst", UintegerValue (burst)), true,
"Verify that we can actually set the attribute Burst");
NS_TEST_EXPECT_MSG_EQ (queue->SetAttributeFailSafe ("Mtu", UintegerValue (mtu)), true,
NS_TEST_ASSERT_MSG_EQ (queue->SetAttributeFailSafe ("Mtu", UintegerValue (mtu)), true,
"Verify that we can actually set the attribute Mtu");
NS_TEST_EXPECT_MSG_EQ (queue->SetAttributeFailSafe ("Rate", DataRateValue (rate)), true,
NS_TEST_ASSERT_MSG_EQ (queue->SetAttributeFailSafe ("Rate", DataRateValue (rate)), true,
"Verify that we can actually set the attribute Rate");
NS_TEST_EXPECT_MSG_EQ (queue->SetAttributeFailSafe ("PeakRate", DataRateValue (peakRate)), true,
NS_TEST_ASSERT_MSG_EQ (queue->SetAttributeFailSafe ("PeakRate", DataRateValue (peakRate)), true,
"Verify that we can actually set the attribute PeakRate");
delay = 0.09;
@@ -369,15 +369,15 @@ TbfQueueDiscTestCase::RunTbfTest (QueueSizeUnit mode)
qSize = qSize * modeSize;
}
NS_TEST_EXPECT_MSG_EQ (queue->SetAttributeFailSafe ("MaxSize", QueueSizeValue (QueueSize (mode, qSize))),
NS_TEST_ASSERT_MSG_EQ (queue->SetAttributeFailSafe ("MaxSize", QueueSizeValue (QueueSize (mode, qSize))),
true, "Verify that we can actually set the attribute MaxSize");
NS_TEST_EXPECT_MSG_EQ (queue->SetAttributeFailSafe ("Burst", UintegerValue (burst)), true,
NS_TEST_ASSERT_MSG_EQ (queue->SetAttributeFailSafe ("Burst", UintegerValue (burst)), true,
"Verify that we can actually set the attribute Burst");
NS_TEST_EXPECT_MSG_EQ (queue->SetAttributeFailSafe ("Mtu", UintegerValue (mtu)), true,
NS_TEST_ASSERT_MSG_EQ (queue->SetAttributeFailSafe ("Mtu", UintegerValue (mtu)), true,
"Verify that we can actually set the attribute Mtu");
NS_TEST_EXPECT_MSG_EQ (queue->SetAttributeFailSafe ("Rate", DataRateValue (rate)), true,
NS_TEST_ASSERT_MSG_EQ (queue->SetAttributeFailSafe ("Rate", DataRateValue (rate)), true,
"Verify that we can actually set the attribute Rate");
NS_TEST_EXPECT_MSG_EQ (queue->SetAttributeFailSafe ("PeakRate", DataRateValue (peakRate)), true,
NS_TEST_ASSERT_MSG_EQ (queue->SetAttributeFailSafe ("PeakRate", DataRateValue (peakRate)), true,
"Verify that we can actually set the attribute PeakRate");
queue->Initialize ();