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) 2007,2008, 2009 INRIA, UDcast | 3 * Copyright (c) 2007,2008, 2009 INRIA, UDcast |
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 20 matching lines...) Expand all Loading... |
31 #include "ns3/udp-client-server-helper.h" | 31 #include "ns3/udp-client-server-helper.h" |
32 #include "ns3/udp-echo-helper.h" | 32 #include "ns3/udp-echo-helper.h" |
33 #include "ns3/simple-net-device.h" | 33 #include "ns3/simple-net-device.h" |
34 #include "ns3/simple-channel.h" | 34 #include "ns3/simple-channel.h" |
35 #include "ns3/test.h" | 35 #include "ns3/test.h" |
36 #include "ns3/simulator.h" | 36 #include "ns3/simulator.h" |
37 | 37 |
38 using namespace ns3; | 38 using namespace ns3; |
39 | 39 |
40 /** | 40 /** |
41 * Test that all the udp packets generated by an udpClient application are | 41 * \ingroup applications |
| 42 * \defgroup applications-test appliation module tests |
| 43 */ |
| 44 |
| 45 |
| 46 /** |
| 47 * \ingroup applications-test |
| 48 * \ingroup tests |
| 49 * |
| 50 * \brief Test that all the udp packets generated by an udpClient application ar
e |
42 * correctly received by an udpServer application | 51 * correctly received by an udpServer application |
43 */ | 52 */ |
44 | 53 |
45 class UdpClientServerTestCase : public TestCase | 54 class UdpClientServerTestCase : public TestCase |
46 { | 55 { |
47 public: | 56 public: |
48 UdpClientServerTestCase (); | 57 UdpClientServerTestCase (); |
49 virtual ~UdpClientServerTestCase (); | 58 virtual ~UdpClientServerTestCase (); |
50 | 59 |
51 private: | 60 private: |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 apps.Stop (Seconds (10.0)); | 114 apps.Stop (Seconds (10.0)); |
106 | 115 |
107 Simulator::Run (); | 116 Simulator::Run (); |
108 Simulator::Destroy (); | 117 Simulator::Destroy (); |
109 | 118 |
110 NS_TEST_ASSERT_MSG_EQ (server.GetServer ()->GetLost (), 0, "Packets were lost
!"); | 119 NS_TEST_ASSERT_MSG_EQ (server.GetServer ()->GetLost (), 0, "Packets were lost
!"); |
111 NS_TEST_ASSERT_MSG_EQ (server.GetServer ()->GetReceived (), 8, "Did not receiv
e expected number of packets !"); | 120 NS_TEST_ASSERT_MSG_EQ (server.GetServer ()->GetReceived (), 8, "Did not receiv
e expected number of packets !"); |
112 } | 121 } |
113 | 122 |
114 /** | 123 /** |
115 * Test that all the udp packets generated by an udpTraceClient application are | 124 * \ingroup applications-test |
| 125 * \ingroup tests |
| 126 * |
| 127 * \brief Test that all the udp packets generated by an udpTraceClient applicati
on are |
116 * correctly received by an udpServer application | 128 * correctly received by an udpServer application |
117 */ | 129 */ |
118 | 130 |
119 class UdpTraceClientServerTestCase : public TestCase | 131 class UdpTraceClientServerTestCase : public TestCase |
120 { | 132 { |
121 public: | 133 public: |
122 UdpTraceClientServerTestCase (); | 134 UdpTraceClientServerTestCase (); |
123 virtual ~UdpTraceClientServerTestCase (); | 135 virtual ~UdpTraceClientServerTestCase (); |
124 | 136 |
125 private: | 137 private: |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
175 | 187 |
176 Simulator::Run (); | 188 Simulator::Run (); |
177 Simulator::Destroy (); | 189 Simulator::Destroy (); |
178 | 190 |
179 NS_TEST_ASSERT_MSG_EQ (server.GetServer ()->GetLost (), 0, "Packets were lost
!"); | 191 NS_TEST_ASSERT_MSG_EQ (server.GetServer ()->GetLost (), 0, "Packets were lost
!"); |
180 NS_TEST_ASSERT_MSG_EQ (server.GetServer ()->GetReceived (), 247, "Did not rece
ive expected number of packets !"); | 192 NS_TEST_ASSERT_MSG_EQ (server.GetServer ()->GetReceived (), 247, "Did not rece
ive expected number of packets !"); |
181 } | 193 } |
182 | 194 |
183 | 195 |
184 /** | 196 /** |
185 * Test that all the PacketLossCounter class checks loss correctly in different
cases | 197 * \ingroup applications-test |
| 198 * \ingroup tests |
| 199 * |
| 200 * \brief Test that all the PacketLossCounter class checks loss correctly in dif
ferent cases |
186 */ | 201 */ |
187 | 202 |
188 class PacketLossCounterTestCase : public TestCase | 203 class PacketLossCounterTestCase : public TestCase |
189 { | 204 { |
190 public: | 205 public: |
191 PacketLossCounterTestCase (); | 206 PacketLossCounterTestCase (); |
192 virtual ~PacketLossCounterTestCase (); | 207 virtual ~PacketLossCounterTestCase (); |
193 | 208 |
194 private: | 209 private: |
195 virtual void DoRun (void); | 210 virtual void DoRun (void); |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
250 lossCounter.NotifyReceived (253); | 265 lossCounter.NotifyReceived (253); |
251 lossCounter.NotifyReceived (254); | 266 lossCounter.NotifyReceived (254); |
252 for (uint32_t i = 256; i < 300; i++) | 267 for (uint32_t i = 256; i < 300; i++) |
253 { | 268 { |
254 lossCounter.NotifyReceived (i); | 269 lossCounter.NotifyReceived (i); |
255 } | 270 } |
256 NS_TEST_ASSERT_MSG_EQ (lossCounter.GetLost (), 9, "Check that 9 (6+1+2) packet
are lost"); | 271 NS_TEST_ASSERT_MSG_EQ (lossCounter.GetLost (), 9, "Check that 9 (6+1+2) packet
are lost"); |
257 } | 272 } |
258 | 273 |
259 /** | 274 /** |
260 * Test fix for \bugid{1378} | 275 * \ingroup applications-test |
| 276 * \ingroup tests |
| 277 * |
| 278 * \brief Test fix for \bugid{1378} |
261 */ | 279 */ |
262 | 280 |
263 class UdpEchoClientSetFillTestCase : public TestCase | 281 class UdpEchoClientSetFillTestCase : public TestCase |
264 { | 282 { |
265 public: | 283 public: |
266 UdpEchoClientSetFillTestCase (); | 284 UdpEchoClientSetFillTestCase (); |
267 virtual ~UdpEchoClientSetFillTestCase (); | 285 virtual ~UdpEchoClientSetFillTestCase (); |
268 | 286 |
269 private: | 287 private: |
270 virtual void DoRun (void); | 288 virtual void DoRun (void); |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
324 } | 342 } |
325 echoClient.SetFill (clientApps.Get (0), &(arry[0]), (uint32_t)64, (uint32_t)64
); | 343 echoClient.SetFill (clientApps.Get (0), &(arry[0]), (uint32_t)64, (uint32_t)64
); |
326 | 344 |
327 clientApps.Start (Seconds (2.0)); | 345 clientApps.Start (Seconds (2.0)); |
328 clientApps.Stop (Seconds (10.0)); | 346 clientApps.Stop (Seconds (10.0)); |
329 | 347 |
330 Simulator::Run (); | 348 Simulator::Run (); |
331 Simulator::Destroy (); | 349 Simulator::Destroy (); |
332 } | 350 } |
333 | 351 |
| 352 /** |
| 353 * \ingroup applications-test |
| 354 * \ingroup tests |
| 355 * |
| 356 * \brief UDP client / server test suite |
| 357 */ |
334 class UdpClientServerTestSuite : public TestSuite | 358 class UdpClientServerTestSuite : public TestSuite |
335 { | 359 { |
336 public: | 360 public: |
337 UdpClientServerTestSuite (); | 361 UdpClientServerTestSuite (); |
338 }; | 362 }; |
339 | 363 |
340 UdpClientServerTestSuite::UdpClientServerTestSuite () | 364 UdpClientServerTestSuite::UdpClientServerTestSuite () |
341 : TestSuite ("udp-client-server", UNIT) | 365 : TestSuite ("udp-client-server", UNIT) |
342 { | 366 { |
343 AddTestCase (new UdpTraceClientServerTestCase, TestCase::QUICK); | 367 AddTestCase (new UdpTraceClientServerTestCase, TestCase::QUICK); |
344 AddTestCase (new UdpClientServerTestCase, TestCase::QUICK); | 368 AddTestCase (new UdpClientServerTestCase, TestCase::QUICK); |
345 AddTestCase (new PacketLossCounterTestCase, TestCase::QUICK); | 369 AddTestCase (new PacketLossCounterTestCase, TestCase::QUICK); |
346 AddTestCase (new UdpEchoClientSetFillTestCase, TestCase::QUICK); | 370 AddTestCase (new UdpEchoClientSetFillTestCase, TestCase::QUICK); |
347 } | 371 } |
348 | 372 |
349 static UdpClientServerTestSuite udpClientServerTestSuite; | 373 static UdpClientServerTestSuite udpClientServerTestSuite; |
OLD | NEW |