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) 2010 Hemanth Narra | 3 * Copyright (c) 2010 Hemanth Narra |
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 30 matching lines...) Expand all Loading... |
41 #include "ns3/boolean.h" | 41 #include "ns3/boolean.h" |
42 #include "ns3/yans-wifi-helper.h" | 42 #include "ns3/yans-wifi-helper.h" |
43 #include "ns3/pcap-file.h" | 43 #include "ns3/pcap-file.h" |
44 #include "ns3/internet-stack-helper.h" | 44 #include "ns3/internet-stack-helper.h" |
45 #include "ns3/ipv4-address-helper.h" | 45 #include "ns3/ipv4-address-helper.h" |
46 #include "ns3/dsdv-packet.h" | 46 #include "ns3/dsdv-packet.h" |
47 #include "ns3/dsdv-rtable.h" | 47 #include "ns3/dsdv-rtable.h" |
48 | 48 |
49 using namespace ns3; | 49 using namespace ns3; |
50 | 50 |
| 51 /** |
| 52 * \ingroup dsdv-test |
| 53 * \defgroup dsdv-test DSDV module tests |
| 54 */ |
| 55 |
| 56 |
| 57 /** |
| 58 * \ingroup dsdv-test |
| 59 * \ingroup tests |
| 60 * |
| 61 * \brief DSDV header test case |
| 62 * |
| 63 */ |
51 class DsdvHeaderTestCase : public TestCase | 64 class DsdvHeaderTestCase : public TestCase |
52 { | 65 { |
53 public: | 66 public: |
54 DsdvHeaderTestCase (); | 67 DsdvHeaderTestCase (); |
55 ~DsdvHeaderTestCase (); | 68 ~DsdvHeaderTestCase (); |
56 virtual void | 69 virtual void |
57 DoRun (void); | 70 DoRun (void); |
58 }; | 71 }; |
59 DsdvHeaderTestCase::DsdvHeaderTestCase () | 72 DsdvHeaderTestCase::DsdvHeaderTestCase () |
60 : TestCase ("Verifying the DSDV header") | 73 : TestCase ("Verifying the DSDV header") |
(...skipping 30 matching lines...) Expand all Loading... |
91 NS_TEST_ASSERT_MSG_EQ (hdr2.GetHopCount (),1,"005"); | 104 NS_TEST_ASSERT_MSG_EQ (hdr2.GetHopCount (),1,"005"); |
92 dsdv::DsdvHeader hdr1; | 105 dsdv::DsdvHeader hdr1; |
93 packet->RemoveHeader (hdr1); | 106 packet->RemoveHeader (hdr1); |
94 NS_TEST_ASSERT_MSG_EQ (hdr1.GetSerializedSize (),12,"006"); | 107 NS_TEST_ASSERT_MSG_EQ (hdr1.GetSerializedSize (),12,"006"); |
95 NS_TEST_ASSERT_MSG_EQ (hdr1.GetDst (),Ipv4Address ("10.1.1.2"),"008"); | 108 NS_TEST_ASSERT_MSG_EQ (hdr1.GetDst (),Ipv4Address ("10.1.1.2"),"008"); |
96 NS_TEST_ASSERT_MSG_EQ (hdr1.GetDstSeqno (),2,"009"); | 109 NS_TEST_ASSERT_MSG_EQ (hdr1.GetDstSeqno (),2,"009"); |
97 NS_TEST_ASSERT_MSG_EQ (hdr1.GetHopCount (),2,"010"); | 110 NS_TEST_ASSERT_MSG_EQ (hdr1.GetHopCount (),2,"010"); |
98 } | 111 } |
99 } | 112 } |
100 | 113 |
| 114 /** |
| 115 * \ingroup dsdv-test |
| 116 * \ingroup tests |
| 117 * |
| 118 * \brief DSDV table test case |
| 119 */ |
101 class DsdvTableTestCase : public TestCase | 120 class DsdvTableTestCase : public TestCase |
102 { | 121 { |
103 public: | 122 public: |
104 DsdvTableTestCase (); | 123 DsdvTableTestCase (); |
105 ~DsdvTableTestCase (); | 124 ~DsdvTableTestCase (); |
106 virtual void | 125 virtual void |
107 DoRun (void); | 126 DoRun (void); |
108 }; | 127 }; |
109 | 128 |
110 DsdvTableTestCase::DsdvTableTestCase () | 129 DsdvTableTestCase::DsdvTableTestCase () |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
177 { | 196 { |
178 NS_TEST_ASSERT_MSG_EQ (rEntry.GetDestination (),Ipv4Address ("10.1.1.255
"),"109"); | 197 NS_TEST_ASSERT_MSG_EQ (rEntry.GetDestination (),Ipv4Address ("10.1.1.255
"),"109"); |
179 } | 198 } |
180 NS_TEST_ASSERT_MSG_EQ (rEntry.GetInterface ().GetLocal (),Ipv4Address ("10.1
.1.1"),"110"); | 199 NS_TEST_ASSERT_MSG_EQ (rEntry.GetInterface ().GetLocal (),Ipv4Address ("10.1
.1.1"),"110"); |
181 NS_TEST_ASSERT_MSG_EQ (rEntry.GetInterface ().GetBroadcast (),Ipv4Address ("
10.1.1.255"),"111"); | 200 NS_TEST_ASSERT_MSG_EQ (rEntry.GetInterface ().GetBroadcast (),Ipv4Address ("
10.1.1.255"),"111"); |
182 NS_TEST_ASSERT_MSG_EQ (rtable.RoutingTableSize (),4,"Rtable size incorrect")
; | 201 NS_TEST_ASSERT_MSG_EQ (rtable.RoutingTableSize (),4,"Rtable size incorrect")
; |
183 } | 202 } |
184 Simulator::Destroy (); | 203 Simulator::Destroy (); |
185 } | 204 } |
186 | 205 |
| 206 /** |
| 207 * \ingroup dsdv-test |
| 208 * \ingroup tests |
| 209 * |
| 210 * \brief DSDV test suite |
| 211 */ |
187 class DsdvTestSuite : public TestSuite | 212 class DsdvTestSuite : public TestSuite |
188 { | 213 { |
189 public: | 214 public: |
190 DsdvTestSuite () : TestSuite ("routing-dsdv", UNIT) | 215 DsdvTestSuite () : TestSuite ("routing-dsdv", UNIT) |
191 { | 216 { |
192 AddTestCase (new DsdvHeaderTestCase (), TestCase::QUICK); | 217 AddTestCase (new DsdvHeaderTestCase (), TestCase::QUICK); |
193 AddTestCase (new DsdvTableTestCase (), TestCase::QUICK); | 218 AddTestCase (new DsdvTableTestCase (), TestCase::QUICK); |
194 } | 219 } |
195 } g_dsdvTestSuite; | 220 } g_dsdvTestSuite; ///< the test suite |
OLD | NEW |