OLD | NEW |
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ | 1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
2 /* | 2 /* |
3 * Copyright (c) 2016 NITK Surathkal | 3 * Copyright (c) 2016 NITK Surathkal |
4 * | 4 * |
5 * This program is free software; you can redistribute it and/or modify | 5 * This program is free software; you can redistribute it and/or modify |
6 * it under the terms of the GNU General Public License version 2 as | 6 * it under the terms of the GNU General Public License version 2 as |
7 * published by the Free Software Foundation; | 7 * published by the Free Software Foundation; |
8 * | 8 * |
9 * This program is distributed in the hope that it will be useful, | 9 * This program is distributed in the hope that it will be useful, |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
(...skipping 13 matching lines...) Expand all Loading... |
24 #include "ns3/test.h" | 24 #include "ns3/test.h" |
25 #include "ns3/pie-queue-disc.h" | 25 #include "ns3/pie-queue-disc.h" |
26 #include "ns3/uinteger.h" | 26 #include "ns3/uinteger.h" |
27 #include "ns3/string.h" | 27 #include "ns3/string.h" |
28 #include "ns3/double.h" | 28 #include "ns3/double.h" |
29 #include "ns3/log.h" | 29 #include "ns3/log.h" |
30 #include "ns3/simulator.h" | 30 #include "ns3/simulator.h" |
31 | 31 |
32 using namespace ns3; | 32 using namespace ns3; |
33 | 33 |
| 34 /** |
| 35 * \ingroup traffic-control-test |
| 36 * \ingroup tests |
| 37 * |
| 38 * \brief Pie Queue Disc Test Item |
| 39 */ |
34 class PieQueueDiscTestItem : public QueueDiscItem | 40 class PieQueueDiscTestItem : public QueueDiscItem |
35 { | 41 { |
36 public: | 42 public: |
| 43 /** |
| 44 * Constructor |
| 45 * |
| 46 * \param p the packet |
| 47 * \param addr the address |
| 48 * \param protocol the protocol |
| 49 */ |
37 PieQueueDiscTestItem (Ptr<Packet> p, const Address & addr, uint16_t protocol); | 50 PieQueueDiscTestItem (Ptr<Packet> p, const Address & addr, uint16_t protocol); |
38 virtual ~PieQueueDiscTestItem (); | 51 virtual ~PieQueueDiscTestItem (); |
39 virtual void AddHeader (void); | 52 virtual void AddHeader (void); |
40 virtual bool Mark (void); | 53 virtual bool Mark (void); |
41 | 54 |
42 private: | 55 private: |
43 PieQueueDiscTestItem (); | 56 PieQueueDiscTestItem (); |
| 57 /// type conversion operator |
44 PieQueueDiscTestItem (const PieQueueDiscTestItem &); | 58 PieQueueDiscTestItem (const PieQueueDiscTestItem &); |
| 59 /// assignment operator |
45 PieQueueDiscTestItem &operator = (const PieQueueDiscTestItem &); | 60 PieQueueDiscTestItem &operator = (const PieQueueDiscTestItem &); |
46 }; | 61 }; |
47 | 62 |
48 PieQueueDiscTestItem::PieQueueDiscTestItem (Ptr<Packet> p, const Address & addr,
uint16_t protocol) | 63 PieQueueDiscTestItem::PieQueueDiscTestItem (Ptr<Packet> p, const Address & addr,
uint16_t protocol) |
49 : QueueDiscItem (p, addr, protocol) | 64 : QueueDiscItem (p, addr, protocol) |
50 { | 65 { |
51 } | 66 } |
52 | 67 |
53 PieQueueDiscTestItem::~PieQueueDiscTestItem () | 68 PieQueueDiscTestItem::~PieQueueDiscTestItem () |
54 { | 69 { |
55 } | 70 } |
56 | 71 |
57 void | 72 void |
58 PieQueueDiscTestItem::AddHeader (void) | 73 PieQueueDiscTestItem::AddHeader (void) |
59 { | 74 { |
60 } | 75 } |
61 | 76 |
62 bool | 77 bool |
63 PieQueueDiscTestItem::Mark (void) | 78 PieQueueDiscTestItem::Mark (void) |
64 { | 79 { |
65 return false; | 80 return false; |
66 } | 81 } |
67 | 82 |
| 83 /** |
| 84 * \ingroup traffic-control-test |
| 85 * \ingroup tests |
| 86 * |
| 87 * \brief Pie Queue Disc Test Case |
| 88 */ |
68 class PieQueueDiscTestCase : public TestCase | 89 class PieQueueDiscTestCase : public TestCase |
69 { | 90 { |
70 public: | 91 public: |
71 PieQueueDiscTestCase (); | 92 PieQueueDiscTestCase (); |
72 virtual void DoRun (void); | 93 virtual void DoRun (void); |
73 private: | 94 private: |
| 95 /** |
| 96 * Enqueue function |
| 97 * \param queue Ptr<PieQueueDisc> |
| 98 * \param size the size |
| 99 * \param nPkt the number of packets |
| 100 */ |
74 void Enqueue (Ptr<PieQueueDisc> queue, uint32_t size, uint32_t nPkt); | 101 void Enqueue (Ptr<PieQueueDisc> queue, uint32_t size, uint32_t nPkt); |
| 102 /** |
| 103 * Enqueue with delay function |
| 104 * \param queue Ptr<PieQueueDisc> |
| 105 * \param size the size |
| 106 * \param nPkt the number of packets |
| 107 */ |
75 void EnqueueWithDelay (Ptr<PieQueueDisc> queue, uint32_t size, uint32_t nPkt); | 108 void EnqueueWithDelay (Ptr<PieQueueDisc> queue, uint32_t size, uint32_t nPkt); |
| 109 /** |
| 110 * Dequeue function |
| 111 * \param queue Ptr<PieQueueDisc> |
| 112 * \param nPkt the number of packets |
| 113 */ |
76 void Dequeue (Ptr<PieQueueDisc> queue, uint32_t nPkt); | 114 void Dequeue (Ptr<PieQueueDisc> queue, uint32_t nPkt); |
| 115 /** |
| 116 * Dequeue with delay function |
| 117 * \param queue Ptr<PieQueueDisc> |
| 118 * \param delay the delay |
| 119 * \param nPkt the number of packets |
| 120 */ |
77 void DequeueWithDelay (Ptr<PieQueueDisc> queue, double delay, uint32_t nPkt); | 121 void DequeueWithDelay (Ptr<PieQueueDisc> queue, double delay, uint32_t nPkt); |
| 122 /** |
| 123 * Run test function |
| 124 * \param mode the test mode |
| 125 */ |
78 void RunPieTest (StringValue mode); | 126 void RunPieTest (StringValue mode); |
79 }; | 127 }; |
80 | 128 |
81 PieQueueDiscTestCase::PieQueueDiscTestCase () | 129 PieQueueDiscTestCase::PieQueueDiscTestCase () |
82 : TestCase ("Sanity check on the pie queue disc implementation") | 130 : TestCase ("Sanity check on the pie queue disc implementation") |
83 { | 131 { |
84 } | 132 } |
85 | 133 |
86 void | 134 void |
87 PieQueueDiscTestCase::RunPieTest (StringValue mode) | 135 PieQueueDiscTestCase::RunPieTest (StringValue mode) |
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
328 } | 376 } |
329 | 377 |
330 void | 378 void |
331 PieQueueDiscTestCase::DoRun (void) | 379 PieQueueDiscTestCase::DoRun (void) |
332 { | 380 { |
333 RunPieTest (StringValue ("QUEUE_MODE_PACKETS")); | 381 RunPieTest (StringValue ("QUEUE_MODE_PACKETS")); |
334 RunPieTest (StringValue ("QUEUE_MODE_BYTES")); | 382 RunPieTest (StringValue ("QUEUE_MODE_BYTES")); |
335 Simulator::Destroy (); | 383 Simulator::Destroy (); |
336 } | 384 } |
337 | 385 |
| 386 /** |
| 387 * \ingroup traffic-control-test |
| 388 * \ingroup tests |
| 389 * |
| 390 * \brief Pie Queue Disc Test Suite |
| 391 */ |
338 static class PieQueueDiscTestSuite : public TestSuite | 392 static class PieQueueDiscTestSuite : public TestSuite |
339 { | 393 { |
340 public: | 394 public: |
341 PieQueueDiscTestSuite () | 395 PieQueueDiscTestSuite () |
342 : TestSuite ("pie-queue-disc", UNIT) | 396 : TestSuite ("pie-queue-disc", UNIT) |
343 { | 397 { |
344 AddTestCase (new PieQueueDiscTestCase (), TestCase::QUICK); | 398 AddTestCase (new PieQueueDiscTestCase (), TestCase::QUICK); |
345 } | 399 } |
346 } g_pieQueueTestSuite; | 400 } g_pieQueueTestSuite; ///< the test suite |
OLD | NEW |