LEFT | RIGHT |
(no file at all) | |
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) 2011 Yufei Cheng | 3 * Copyright (c) 2011 Yufei Cheng |
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 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
269 { | 269 { |
270 } | 270 } |
271 DsrAckReqHeaderTest::~DsrAckReqHeaderTest () | 271 DsrAckReqHeaderTest::~DsrAckReqHeaderTest () |
272 { | 272 { |
273 } | 273 } |
274 void | 274 void |
275 DsrAckReqHeaderTest::DoRun () | 275 DsrAckReqHeaderTest::DoRun () |
276 { | 276 { |
277 dsr::DsrOptionAckReqHeader h; | 277 dsr::DsrOptionAckReqHeader h; |
278 | 278 |
279 h.SetId (1); | 279 h.SetAckId (1); |
280 NS_TEST_EXPECT_MSG_EQ (h.GetId (), 1, "trivial"); | 280 NS_TEST_EXPECT_MSG_EQ (h.GetAckId (), 1, "trivial"); |
281 | 281 |
282 Ptr<Packet> p = Create<Packet> (); | 282 Ptr<Packet> p = Create<Packet> (); |
283 dsr::DsrRoutingHeader header; | 283 dsr::DsrRoutingHeader header; |
284 header.AddDsrOption (h); | 284 header.AddDsrOption (h); |
285 p->AddHeader (header); | 285 p->AddHeader (header); |
286 p->RemoveAtStart (8); | 286 p->RemoveAtStart (8); |
287 p->AddHeader (header); | 287 p->AddHeader (header); |
288 dsr::DsrOptionAckReqHeader h2; | 288 dsr::DsrOptionAckReqHeader h2; |
289 p->RemoveAtStart (8); | 289 p->RemoveAtStart (8); |
290 uint32_t bytes = p->RemoveHeader (h2); | 290 uint32_t bytes = p->RemoveHeader (h2); |
(...skipping 18 matching lines...) Expand all Loading... |
309 } | 309 } |
310 void | 310 void |
311 DsrAckHeaderTest::DoRun () | 311 DsrAckHeaderTest::DoRun () |
312 { | 312 { |
313 dsr::DsrOptionAckHeader h; | 313 dsr::DsrOptionAckHeader h; |
314 | 314 |
315 h.SetRealSrc (Ipv4Address ("1.1.1.0")); | 315 h.SetRealSrc (Ipv4Address ("1.1.1.0")); |
316 NS_TEST_EXPECT_MSG_EQ (h.GetRealSrc (), Ipv4Address ("1.1.1.0"), "trivial"); | 316 NS_TEST_EXPECT_MSG_EQ (h.GetRealSrc (), Ipv4Address ("1.1.1.0"), "trivial"); |
317 h.SetRealDst (Ipv4Address ("1.1.1.1")); | 317 h.SetRealDst (Ipv4Address ("1.1.1.1")); |
318 NS_TEST_EXPECT_MSG_EQ (h.GetRealDst (), Ipv4Address ("1.1.1.1"), "trivial"); | 318 NS_TEST_EXPECT_MSG_EQ (h.GetRealDst (), Ipv4Address ("1.1.1.1"), "trivial"); |
319 h.SetId (1); | 319 h.SetAckId (1); |
320 NS_TEST_EXPECT_MSG_EQ (h.GetId (), 1, "trivial"); | 320 NS_TEST_EXPECT_MSG_EQ (h.GetAckId (), 1, "trivial"); |
321 | 321 |
322 Ptr<Packet> p = Create<Packet> (); | 322 Ptr<Packet> p = Create<Packet> (); |
323 dsr::DsrRoutingHeader header; | 323 dsr::DsrRoutingHeader header; |
324 header.AddDsrOption (h); | 324 header.AddDsrOption (h); |
325 p->AddHeader (header); | 325 p->AddHeader (header); |
326 p->RemoveAtStart (8); | 326 p->RemoveAtStart (8); |
327 p->AddHeader (header); | 327 p->AddHeader (header); |
328 dsr::DsrOptionAckHeader h2; | 328 dsr::DsrOptionAckHeader h2; |
329 p->RemoveAtStart (8); | 329 p->RemoveAtStart (8); |
330 uint32_t bytes = p->RemoveHeader (h2); | 330 uint32_t bytes = p->RemoveHeader (h2); |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
490 DsrRreqTableTest::DsrRreqTableTest () | 490 DsrRreqTableTest::DsrRreqTableTest () |
491 : TestCase ("DSR RreqTable") | 491 : TestCase ("DSR RreqTable") |
492 { | 492 { |
493 } | 493 } |
494 DsrRreqTableTest::~DsrRreqTableTest () | 494 DsrRreqTableTest::~DsrRreqTableTest () |
495 { | 495 { |
496 } | 496 } |
497 void | 497 void |
498 DsrRreqTableTest::DoRun () | 498 DsrRreqTableTest::DoRun () |
499 { | 499 { |
500 Ipv4Address dst = Ipv4Address ("0.0.0.1"); | |
501 dsr::RreqTableEntry rt; | 500 dsr::RreqTableEntry rt; |
502 | 501 |
503 rt.m_dst = Ipv4Address ("1.1.1.1"); | |
504 NS_TEST_EXPECT_MSG_EQ (rt.m_dst, Ipv4Address ("1.1.1.1"), "trivial"); | |
505 rt.m_ttl = 7; | |
506 NS_TEST_EXPECT_MSG_EQ (rt.m_ttl, 7, "trivial"); | |
507 rt.m_reqNo = 2; | 502 rt.m_reqNo = 2; |
508 NS_TEST_EXPECT_MSG_EQ (rt.m_reqNo, 2, "trivial"); | 503 NS_TEST_EXPECT_MSG_EQ (rt.m_reqNo, 2, "trivial"); |
509 } | 504 } |
510 // ----------------------------------------------------------------------------- | 505 // ----------------------------------------------------------------------------- |
511 class DsrTestSuite : public TestSuite | 506 class DsrTestSuite : public TestSuite |
512 { | 507 { |
513 public: | 508 public: |
514 DsrTestSuite () : TestSuite ("routing-dsr", UNIT) | 509 DsrTestSuite () : TestSuite ("routing-dsr", UNIT) |
515 { | 510 { |
516 AddTestCase (new DsrFsHeaderTest); | 511 AddTestCase (new DsrFsHeaderTest); |
517 AddTestCase (new DsrRreqHeaderTest); | 512 AddTestCase (new DsrRreqHeaderTest); |
518 AddTestCase (new DsrRrepHeaderTest); | 513 AddTestCase (new DsrRrepHeaderTest); |
519 AddTestCase (new DsrSRHeaderTest); | 514 AddTestCase (new DsrSRHeaderTest); |
520 AddTestCase (new DsrRerrHeaderTest); | 515 AddTestCase (new DsrRerrHeaderTest); |
521 AddTestCase (new DsrAckReqHeaderTest); | 516 AddTestCase (new DsrAckReqHeaderTest); |
522 AddTestCase (new DsrAckHeaderTest); | 517 AddTestCase (new DsrAckHeaderTest); |
523 AddTestCase (new DsrCacheEntryTest); | 518 AddTestCase (new DsrCacheEntryTest); |
524 AddTestCase (new DsrSendBuffTest); | 519 AddTestCase (new DsrSendBuffTest); |
525 } | 520 } |
526 } g_dsrTestSuite; | 521 } g_dsrTestSuite; |
527 } // namespace dsr | 522 } // namespace dsr |
528 } // namespace ns3 | 523 } // namespace ns3 |
LEFT | RIGHT |