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 * This program is free software; you can redistribute it and/or modify | 3 * This program is free software; you can redistribute it and/or modify |
4 * it under the terms of the GNU General Public License version 2 as | 4 * it under the terms of the GNU General Public License version 2 as |
5 * published by the Free Software Foundation; | 5 * published by the Free Software Foundation; |
6 * | 6 * |
7 * This program is distributed in the hope that it will be useful, | 7 * This program is distributed in the hope that it will be useful, |
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 8 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
10 * GNU General Public License for more details. | 10 * GNU General Public License for more details. |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 : TestCase ("channel-coordination") | 122 : TestCase ("channel-coordination") |
123 { | 123 { |
124 } | 124 } |
125 ChannelCoordinationTestCase::~ChannelCoordinationTestCase (void) | 125 ChannelCoordinationTestCase::~ChannelCoordinationTestCase (void) |
126 { | 126 { |
127 } | 127 } |
128 | 128 |
129 void | 129 void |
130 ChannelCoordinationTestCase::TestIntervalAfter (bool cchi, bool schi, bool guard
i) | 130 ChannelCoordinationTestCase::TestIntervalAfter (bool cchi, bool schi, bool guard
i) |
131 { | 131 { |
132 uint32_t now = Now ().GetMilliSeconds (); | 132 uint32_t now = static_cast<uint32_t> (Now ().GetMilliSeconds ()); |
133 NS_TEST_EXPECT_MSG_EQ (m_coordinator->IsCchInterval (), cchi, "now is " << now
<< "ms " | 133 NS_TEST_EXPECT_MSG_EQ (m_coordinator->IsCchInterval (), cchi, "now is " << now
<< "ms " |
134 "check whether is CCH interval"); | 134 "check whether is CCH interval"); |
135 NS_TEST_EXPECT_MSG_EQ (m_coordinator->IsSchInterval (), schi, "now is " << now
<< "ms " | 135 NS_TEST_EXPECT_MSG_EQ (m_coordinator->IsSchInterval (), schi, "now is " << now
<< "ms " |
136 "check whether is SCH interval"); | 136 "check whether is SCH interval"); |
137 NS_TEST_EXPECT_MSG_EQ (m_coordinator->IsGuardInterval (), guardi, "now is " <<
now << "ms " | 137 NS_TEST_EXPECT_MSG_EQ (m_coordinator->IsGuardInterval (), guardi, "now is " <<
now << "ms " |
138 "check whether is Guard interval"); | 138 "check whether is Guard interval"); |
139 } | 139 } |
140 void | 140 void |
141 ChannelCoordinationTestCase::NotifyCchStartNow (Time duration) | 141 ChannelCoordinationTestCase::NotifyCchStartNow (Time duration) |
142 { | 142 { |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
285 mobility.SetMobilityModel ("ns3::ConstantPositionMobilityModel"); | 285 mobility.SetMobilityModel ("ns3::ConstantPositionMobilityModel"); |
286 mobility.Install (nodes); | 286 mobility.Install (nodes); |
287 // this is a circle with radius 10 | 287 // this is a circle with radius 10 |
288 Ptr<MobilityModel> model = NodeList::GetNode (0)->GetObject<MobilityModel> (); | 288 Ptr<MobilityModel> model = NodeList::GetNode (0)->GetObject<MobilityModel> (); |
289 model->SetPosition (Vector (0, 0, 0)); | 289 model->SetPosition (Vector (0, 0, 0)); |
290 for (uint32_t n = 1; n != nodesNumber; ++n) | 290 for (uint32_t n = 1; n != nodesNumber; ++n) |
291 { | 291 { |
292 double angle = (PI / 180) * (360 / (nodesNumber - 1) * n); | 292 double angle = (PI / 180) * (360 / (nodesNumber - 1) * n); |
293 double x = cos (angle) * 10; | 293 double x = cos (angle) * 10; |
294 double y = sin (angle) * 10; | 294 double y = sin (angle) * 10; |
295 Ptr<MobilityModel> model = NodeList::GetNode (n)->GetObject<MobilityModel>
(); | 295 model = NodeList::GetNode (n)->GetObject<MobilityModel> (); |
296 model->SetPosition (Vector (x, y,0)); | 296 model->SetPosition (Vector (x, y,0)); |
297 } | 297 } |
298 | 298 |
299 YansWifiChannelHelper wifiChannel = YansWifiChannelHelper::Default (); | 299 YansWifiChannelHelper wifiChannel = YansWifiChannelHelper::Default (); |
300 YansWavePhyHelper wifiPhy = YansWavePhyHelper::Default (); | 300 YansWavePhyHelper wifiPhy = YansWavePhyHelper::Default (); |
301 wifiPhy.SetChannel (wifiChannel.Create ()); | 301 wifiPhy.SetChannel (wifiChannel.Create ()); |
302 QosWaveMacHelper waveMac = QosWaveMacHelper::Default (); | 302 QosWaveMacHelper waveMac = QosWaveMacHelper::Default (); |
303 WaveHelper waveHelper = WaveHelper::Default (); | 303 WaveHelper waveHelper = WaveHelper::Default (); |
304 NetDeviceContainer devices = waveHelper.Install (wifiPhy, waveMac, nodes); | 304 NetDeviceContainer devices = waveHelper.Install (wifiPhy, waveMac, nodes); |
305 return devices; | 305 return devices; |
(...skipping 363 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
669 Ptr<Packet> p = Create<Packet> (data, 112); | 669 Ptr<Packet> p = Create<Packet> (data, 112); |
670 | 670 |
671 m_sender->SendX (p, dest, WSMP_PROT_NUMBER, txInfo); | 671 m_sender->SendX (p, dest, WSMP_PROT_NUMBER, txInfo); |
672 | 672 |
673 delete [] data; | 673 delete [] data; |
674 } | 674 } |
675 | 675 |
676 bool | 676 bool |
677 ChannelAccessTestCase::Receive (Ptr<NetDevice> dev, Ptr<const Packet> pkt, uint1
6_t mode, const Address &sender) | 677 ChannelAccessTestCase::Receive (Ptr<NetDevice> dev, Ptr<const Packet> pkt, uint1
6_t mode, const Address &sender) |
678 { | 678 { |
| 679 NS_UNUSED (mode); |
| 680 NS_UNUSED (sender); |
679 uint8_t *data = new uint8_t [pkt->GetSize ()]; | 681 uint8_t *data = new uint8_t [pkt->GetSize ()]; |
680 pkt->CopyData(data, pkt->GetSize ()); | 682 pkt->CopyData(data, pkt->GetSize ()); |
681 | 683 |
682 uint32_t seq = data [0]; | 684 uint32_t seq = data [0]; |
683 seq <<= 8; | 685 seq <<= 8; |
684 seq |= data [1]; | 686 seq |= data [1]; |
685 seq <<= 8; | 687 seq <<= 8; |
686 seq |= data [2]; | 688 seq |= data [2]; |
687 seq <<= 8; | 689 seq <<= 8; |
688 seq |= data [3]; | 690 seq |= data [3]; |
(...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1083 Ptr<Packet> p = Create<Packet> (data, packetSize); | 1085 Ptr<Packet> p = Create<Packet> (data, packetSize); |
1084 | 1086 |
1085 m_sender->SendX (p, dest, WSMP_PROT_NUMBER, txInfo); | 1087 m_sender->SendX (p, dest, WSMP_PROT_NUMBER, txInfo); |
1086 | 1088 |
1087 delete [] data; | 1089 delete [] data; |
1088 } | 1090 } |
1089 | 1091 |
1090 bool | 1092 bool |
1091 AnnexC_TestCase::Receive (Ptr<NetDevice> dev, Ptr<const Packet> pkt, uint16_t mo
de, const Address &sender) | 1093 AnnexC_TestCase::Receive (Ptr<NetDevice> dev, Ptr<const Packet> pkt, uint16_t mo
de, const Address &sender) |
1092 { | 1094 { |
| 1095 NS_UNUSED (mode); |
| 1096 NS_UNUSED (sender); |
1093 uint8_t *data = new uint8_t [pkt->GetSize ()]; | 1097 uint8_t *data = new uint8_t [pkt->GetSize ()]; |
1094 pkt->CopyData(data, pkt->GetSize ()); | 1098 pkt->CopyData(data, pkt->GetSize ()); |
1095 | 1099 |
1096 uint32_t seq = data [0]; | 1100 uint32_t seq = data [0]; |
1097 seq <<= 8; | 1101 seq <<= 8; |
1098 seq |= data [1]; | 1102 seq |= data [1]; |
1099 seq <<= 8; | 1103 seq <<= 8; |
1100 seq |= data [2]; | 1104 seq |= data [2]; |
1101 seq <<= 8; | 1105 seq <<= 8; |
1102 seq |= data [3]; | 1106 seq |= data [3]; |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1198 { | 1202 { |
1199 // TestDuration for TestCase can be QUICK, EXTENSIVE or TAKES_FOREVER | 1203 // TestDuration for TestCase can be QUICK, EXTENSIVE or TAKES_FOREVER |
1200 AddTestCase (new ChannelCoordinationTestCase, TestCase::QUICK); | 1204 AddTestCase (new ChannelCoordinationTestCase, TestCase::QUICK); |
1201 AddTestCase (new ChannelRoutingTestCase, TestCase::QUICK); | 1205 AddTestCase (new ChannelRoutingTestCase, TestCase::QUICK); |
1202 AddTestCase (new ChannelAccessTestCase, TestCase::QUICK); | 1206 AddTestCase (new ChannelAccessTestCase, TestCase::QUICK); |
1203 AddTestCase (new AnnexC_TestCase, TestCase::QUICK); | 1207 AddTestCase (new AnnexC_TestCase, TestCase::QUICK); |
1204 } | 1208 } |
1205 | 1209 |
1206 // Do not forget to allocate an instance of this TestSuite | 1210 // Do not forget to allocate an instance of this TestSuite |
1207 static WaveMacTestSuite waveMacTestSuite; ///< the test suite | 1211 static WaveMacTestSuite waveMacTestSuite; ///< the test suite |
LEFT | RIGHT |