src/devices/wifi/wifi-test.cc
author Mitch Watrous <watrous@u.washington.edu>
Mon, 10 Jan 2011 15:55:29 -0800
changeset 6774 034f362af24d
parent 6674 52f8688d6d01
child 6775 0783f42a364b
permissions -rw-r--r--
Make all TestSuite instances be static
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
4325
acc6c801f785 bug 548: missing license header
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4257
diff changeset
     1
/* -*-  Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
acc6c801f785 bug 548: missing license header
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4257
diff changeset
     2
/*
acc6c801f785 bug 548: missing license header
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4257
diff changeset
     3
 * Copyright (c) 2005,2006 INRIA
6665
27dab861cb2a TestCase for bug 991
Quincy Tse <quincy.tse@nicta.com.au>
parents: 6600
diff changeset
     4
 *               2010      NICTA
4325
acc6c801f785 bug 548: missing license header
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4257
diff changeset
     5
 *
acc6c801f785 bug 548: missing license header
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4257
diff changeset
     6
 * This program is free software; you can redistribute it and/or modify
acc6c801f785 bug 548: missing license header
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4257
diff changeset
     7
 * it under the terms of the GNU General Public License version 2 as 
acc6c801f785 bug 548: missing license header
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4257
diff changeset
     8
 * published by the Free Software Foundation;
acc6c801f785 bug 548: missing license header
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4257
diff changeset
     9
 *
acc6c801f785 bug 548: missing license header
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4257
diff changeset
    10
 * This program is distributed in the hope that it will be useful,
acc6c801f785 bug 548: missing license header
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4257
diff changeset
    11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
acc6c801f785 bug 548: missing license header
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4257
diff changeset
    12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
acc6c801f785 bug 548: missing license header
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4257
diff changeset
    13
 * GNU General Public License for more details.
acc6c801f785 bug 548: missing license header
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4257
diff changeset
    14
 *
acc6c801f785 bug 548: missing license header
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4257
diff changeset
    15
 * You should have received a copy of the GNU General Public License
acc6c801f785 bug 548: missing license header
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4257
diff changeset
    16
 * along with this program; if not, write to the Free Software
acc6c801f785 bug 548: missing license header
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4257
diff changeset
    17
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
acc6c801f785 bug 548: missing license header
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4257
diff changeset
    18
 *
acc6c801f785 bug 548: missing license header
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4257
diff changeset
    19
 * Author: Mathieu Lacage <[email protected]>
6665
27dab861cb2a TestCase for bug 991
Quincy Tse <quincy.tse@nicta.com.au>
parents: 6600
diff changeset
    20
 *         Quincy Tse <[email protected]> (Case for Bug 991)
4325
acc6c801f785 bug 548: missing license header
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4257
diff changeset
    21
 */
2626
bc07dd340992 A bunch of wifi smoke tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    22
bc07dd340992 A bunch of wifi smoke tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    23
#include "wifi-net-device.h"
3893
94f771c1373a split WifiChannel in WifiChannel + YansWifiChannel
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3888
diff changeset
    24
#include "yans-wifi-channel.h"
2626
bc07dd340992 A bunch of wifi smoke tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    25
#include "adhoc-wifi-mac.h"
3888
a15618dcd0eb rename WifiPhy to YansWifiPhy and add WifiPhy abstract base class.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3174
diff changeset
    26
#include "yans-wifi-phy.h"
2626
bc07dd340992 A bunch of wifi smoke tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    27
#include "arf-wifi-manager.h"
5944
b1a245ae00d4 Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents: 5919
diff changeset
    28
#include "ns3/propagation-delay-model.h"
b1a245ae00d4 Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents: 5919
diff changeset
    29
#include "ns3/propagation-loss-model.h"
3912
4d1a61f80745 new wifi API
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3893
diff changeset
    30
#include "error-rate-model.h"
4038
c6f634d0fc6f virtualize ErrorRateModel
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3912
diff changeset
    31
#include "yans-error-rate-model.h"
4257
3e8f8052e155 StaticMobilityModel -> ConstantPositionMobilityModel, StaticSpeedMobilityModel -> ConstantVelocityMobilityModel
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4038
diff changeset
    32
#include "ns3/constant-position-mobility-model.h"
2626
bc07dd340992 A bunch of wifi smoke tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    33
#include "ns3/node.h"
bc07dd340992 A bunch of wifi smoke tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    34
#include "ns3/simulator.h"
bc07dd340992 A bunch of wifi smoke tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    35
#include "ns3/test.h"
bc07dd340992 A bunch of wifi smoke tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    36
#include "ns3/object-factory.h"
4406
39f119de91ef Add WifiMacHelper
Mirko Banchi <mk.banchi@gmail.com>
parents: 4325
diff changeset
    37
#include "dca-txop.h"
5320
0fb5a9f1a9c0 wifi unit tests ported to new framework
Pavel Boyko <boyko@iitp.ru>
parents: 4720
diff changeset
    38
#include "mac-rx-middle.h"
4406
39f119de91ef Add WifiMacHelper
Mirko Banchi <mk.banchi@gmail.com>
parents: 4325
diff changeset
    39
#include "ns3/pointer.h"
2626
bc07dd340992 A bunch of wifi smoke tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    40
bc07dd340992 A bunch of wifi smoke tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    41
namespace ns3 {
bc07dd340992 A bunch of wifi smoke tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    42
5320
0fb5a9f1a9c0 wifi unit tests ported to new framework
Pavel Boyko <boyko@iitp.ru>
parents: 4720
diff changeset
    43
class WifiTest : public TestCase
2626
bc07dd340992 A bunch of wifi smoke tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    44
{
bc07dd340992 A bunch of wifi smoke tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    45
public:
bc07dd340992 A bunch of wifi smoke tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    46
  WifiTest ();
bc07dd340992 A bunch of wifi smoke tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    47
5320
0fb5a9f1a9c0 wifi unit tests ported to new framework
Pavel Boyko <boyko@iitp.ru>
parents: 4720
diff changeset
    48
  virtual bool DoRun (void);
2626
bc07dd340992 A bunch of wifi smoke tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    49
private:
bc07dd340992 A bunch of wifi smoke tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    50
  void RunOne (void);
3912
4d1a61f80745 new wifi API
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3893
diff changeset
    51
  void CreateOne (Vector pos, Ptr<YansWifiChannel> channel);
2626
bc07dd340992 A bunch of wifi smoke tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    52
  void SendOnePacket (Ptr<WifiNetDevice> dev);
bc07dd340992 A bunch of wifi smoke tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    53
bc07dd340992 A bunch of wifi smoke tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    54
  ObjectFactory m_manager;
bc07dd340992 A bunch of wifi smoke tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    55
  ObjectFactory m_mac;
bc07dd340992 A bunch of wifi smoke tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    56
  ObjectFactory m_propDelay;
bc07dd340992 A bunch of wifi smoke tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    57
};
bc07dd340992 A bunch of wifi smoke tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    58
bc07dd340992 A bunch of wifi smoke tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    59
WifiTest::WifiTest ()
5320
0fb5a9f1a9c0 wifi unit tests ported to new framework
Pavel Boyko <boyko@iitp.ru>
parents: 4720
diff changeset
    60
  : TestCase ("Wifi")
6674
52f8688d6d01 Bug 978: Run check-style.py on files touched in the reorganisation
Dean Armstrong <deanarm@gmail.com>
parents: 6673
diff changeset
    61
{
52f8688d6d01 Bug 978: Run check-style.py on files touched in the reorganisation
Dean Armstrong <deanarm@gmail.com>
parents: 6673
diff changeset
    62
}
2626
bc07dd340992 A bunch of wifi smoke tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    63
6674
52f8688d6d01 Bug 978: Run check-style.py on files touched in the reorganisation
Dean Armstrong <deanarm@gmail.com>
parents: 6673
diff changeset
    64
void
2626
bc07dd340992 A bunch of wifi smoke tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    65
WifiTest::SendOnePacket (Ptr<WifiNetDevice> dev)
bc07dd340992 A bunch of wifi smoke tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    66
{
bc07dd340992 A bunch of wifi smoke tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    67
  Ptr<Packet> p = Create<Packet> ();
bc07dd340992 A bunch of wifi smoke tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    68
  dev->Send (p, dev->GetBroadcast (), 1);
bc07dd340992 A bunch of wifi smoke tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    69
}
bc07dd340992 A bunch of wifi smoke tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    70
6674
52f8688d6d01 Bug 978: Run check-style.py on files touched in the reorganisation
Dean Armstrong <deanarm@gmail.com>
parents: 6673
diff changeset
    71
void
3912
4d1a61f80745 new wifi API
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3893
diff changeset
    72
WifiTest::CreateOne (Vector pos, Ptr<YansWifiChannel> channel)
2626
bc07dd340992 A bunch of wifi smoke tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    73
{
bc07dd340992 A bunch of wifi smoke tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    74
  Ptr<Node> node = CreateObject<Node> ();
bc07dd340992 A bunch of wifi smoke tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    75
  Ptr<WifiNetDevice> dev = CreateObject<WifiNetDevice> ();
bc07dd340992 A bunch of wifi smoke tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    76
bc07dd340992 A bunch of wifi smoke tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    77
  Ptr<WifiMac> mac = m_mac.Create<WifiMac> ();
4720
15221757964f bug 641: CwMin setting for 802.11b
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4406
diff changeset
    78
  mac->ConfigureStandard (WIFI_PHY_STANDARD_80211a);
4257
3e8f8052e155 StaticMobilityModel -> ConstantPositionMobilityModel, StaticSpeedMobilityModel -> ConstantVelocityMobilityModel
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4038
diff changeset
    79
  Ptr<ConstantPositionMobilityModel> mobility = CreateObject<ConstantPositionMobilityModel> ();
3912
4d1a61f80745 new wifi API
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3893
diff changeset
    80
  Ptr<YansWifiPhy> phy = CreateObject<YansWifiPhy> ();
4038
c6f634d0fc6f virtualize ErrorRateModel
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3912
diff changeset
    81
  Ptr<ErrorRateModel> error = CreateObject<YansErrorRateModel> ();
3912
4d1a61f80745 new wifi API
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3893
diff changeset
    82
  phy->SetErrorRateModel (error);
4d1a61f80745 new wifi API
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3893
diff changeset
    83
  phy->SetChannel (channel);
4d1a61f80745 new wifi API
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3893
diff changeset
    84
  phy->SetDevice (dev);
4d1a61f80745 new wifi API
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3893
diff changeset
    85
  phy->SetMobility (node);
4720
15221757964f bug 641: CwMin setting for 802.11b
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4406
diff changeset
    86
  phy->ConfigureStandard (WIFI_PHY_STANDARD_80211a);
2626
bc07dd340992 A bunch of wifi smoke tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    87
  Ptr<WifiRemoteStationManager> manager = m_manager.Create<WifiRemoteStationManager> ();
bc07dd340992 A bunch of wifi smoke tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    88
bc07dd340992 A bunch of wifi smoke tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    89
  mobility->SetPosition (pos);
bc07dd340992 A bunch of wifi smoke tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    90
  node->AggregateObject (mobility);
bc07dd340992 A bunch of wifi smoke tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    91
  mac->SetAddress (Mac48Address::Allocate ());
bc07dd340992 A bunch of wifi smoke tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    92
  dev->SetMac (mac);
bc07dd340992 A bunch of wifi smoke tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    93
  dev->SetPhy (phy);
bc07dd340992 A bunch of wifi smoke tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    94
  dev->SetRemoteStationManager (manager);
bc07dd340992 A bunch of wifi smoke tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    95
  node->AddDevice (dev);
bc07dd340992 A bunch of wifi smoke tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    96
bc07dd340992 A bunch of wifi smoke tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    97
  Simulator::Schedule (Seconds (1.0), &WifiTest::SendOnePacket, this, dev);
bc07dd340992 A bunch of wifi smoke tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    98
}
bc07dd340992 A bunch of wifi smoke tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    99
bc07dd340992 A bunch of wifi smoke tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   100
void
bc07dd340992 A bunch of wifi smoke tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   101
WifiTest::RunOne (void)
bc07dd340992 A bunch of wifi smoke tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   102
{
3893
94f771c1373a split WifiChannel in WifiChannel + YansWifiChannel
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3888
diff changeset
   103
  Ptr<YansWifiChannel> channel = CreateObject<YansWifiChannel> ();
2626
bc07dd340992 A bunch of wifi smoke tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   104
  Ptr<PropagationDelayModel> propDelay = m_propDelay.Create<PropagationDelayModel> ();
bc07dd340992 A bunch of wifi smoke tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   105
  Ptr<PropagationLossModel> propLoss = CreateObject<RandomPropagationLossModel> ();
bc07dd340992 A bunch of wifi smoke tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   106
  channel->SetPropagationDelayModel (propDelay);
bc07dd340992 A bunch of wifi smoke tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   107
  channel->SetPropagationLossModel (propLoss);
bc07dd340992 A bunch of wifi smoke tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   108
bc07dd340992 A bunch of wifi smoke tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   109
  CreateOne (Vector (0.0, 0.0, 0.0), channel);
bc07dd340992 A bunch of wifi smoke tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   110
  CreateOne (Vector (5.0, 0.0, 0.0), channel);
bc07dd340992 A bunch of wifi smoke tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   111
  CreateOne (Vector (5.0, 0.0, 0.0), channel);
bc07dd340992 A bunch of wifi smoke tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   112
bc07dd340992 A bunch of wifi smoke tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   113
  Simulator::Run ();
bc07dd340992 A bunch of wifi smoke tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   114
  Simulator::Destroy ();
bc07dd340992 A bunch of wifi smoke tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   115
3174
efeb6e5c276d Make Application::Start/Stop times relative, Simulator::StopAt(time) renamed to Simulator::Stop(time) and time also made relative, to improve consistency of the API which uses relative times everywhere else. Closes bug #191.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 2627
diff changeset
   116
  Simulator::Stop (Seconds (10.0));
2626
bc07dd340992 A bunch of wifi smoke tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   117
}
bc07dd340992 A bunch of wifi smoke tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   118
bc07dd340992 A bunch of wifi smoke tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   119
bool
5320
0fb5a9f1a9c0 wifi unit tests ported to new framework
Pavel Boyko <boyko@iitp.ru>
parents: 4720
diff changeset
   120
WifiTest::DoRun (void)
2626
bc07dd340992 A bunch of wifi smoke tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   121
{
bc07dd340992 A bunch of wifi smoke tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   122
  m_mac.SetTypeId ("ns3::AdhocWifiMac");
bc07dd340992 A bunch of wifi smoke tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   123
  m_propDelay.SetTypeId ("ns3::ConstantSpeedPropagationDelayModel");
6674
52f8688d6d01 Bug 978: Run check-style.py on files touched in the reorganisation
Dean Armstrong <deanarm@gmail.com>
parents: 6673
diff changeset
   124
2626
bc07dd340992 A bunch of wifi smoke tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   125
  m_manager.SetTypeId ("ns3::ArfWifiManager");
bc07dd340992 A bunch of wifi smoke tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   126
  RunOne ();
bc07dd340992 A bunch of wifi smoke tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   127
  m_manager.SetTypeId ("ns3::AarfWifiManager");
bc07dd340992 A bunch of wifi smoke tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   128
  RunOne ();
bc07dd340992 A bunch of wifi smoke tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   129
  m_manager.SetTypeId ("ns3::ConstantRateWifiManager");
bc07dd340992 A bunch of wifi smoke tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   130
  RunOne ();
bc07dd340992 A bunch of wifi smoke tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   131
  m_manager.SetTypeId ("ns3::OnoeWifiManager");
bc07dd340992 A bunch of wifi smoke tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   132
  RunOne ();
bc07dd340992 A bunch of wifi smoke tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   133
  m_manager.SetTypeId ("ns3::AmrrWifiManager");
bc07dd340992 A bunch of wifi smoke tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   134
  RunOne ();
bc07dd340992 A bunch of wifi smoke tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   135
  m_manager.SetTypeId ("ns3::IdealWifiManager");
bc07dd340992 A bunch of wifi smoke tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   136
  RunOne ();
bc07dd340992 A bunch of wifi smoke tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   137
bc07dd340992 A bunch of wifi smoke tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   138
  m_mac.SetTypeId ("ns3::AdhocWifiMac");
bc07dd340992 A bunch of wifi smoke tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   139
  RunOne ();
6673
ec22aa763e2d Bug 978: Consolidate Wi-Fi MAC high functionality
Dean Armstrong <deanarm@gmail.com>
parents: 6665
diff changeset
   140
  m_mac.SetTypeId ("ns3::ApWifiMac");
2626
bc07dd340992 A bunch of wifi smoke tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   141
  RunOne ();
6673
ec22aa763e2d Bug 978: Consolidate Wi-Fi MAC high functionality
Dean Armstrong <deanarm@gmail.com>
parents: 6665
diff changeset
   142
  m_mac.SetTypeId ("ns3::StaWifiMac");
2626
bc07dd340992 A bunch of wifi smoke tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   143
  RunOne ();
bc07dd340992 A bunch of wifi smoke tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   144
bc07dd340992 A bunch of wifi smoke tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   145
bc07dd340992 A bunch of wifi smoke tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   146
  m_propDelay.SetTypeId ("ns3::RandomPropagationDelayModel");
bc07dd340992 A bunch of wifi smoke tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   147
  m_mac.SetTypeId ("ns3::AdhocWifiMac");
bc07dd340992 A bunch of wifi smoke tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   148
  RunOne ();
5919
b89ce2e9eed5 Bug 793: remove remaining memory leaks due to not cleaned Simulator
Faker Moatamri <faker.moatamri@sophia.inria.fr>
parents: 5320
diff changeset
   149
  Simulator::Destroy ();
5320
0fb5a9f1a9c0 wifi unit tests ported to new framework
Pavel Boyko <boyko@iitp.ru>
parents: 4720
diff changeset
   150
  return false;
2626
bc07dd340992 A bunch of wifi smoke tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   151
}
bc07dd340992 A bunch of wifi smoke tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   152
5320
0fb5a9f1a9c0 wifi unit tests ported to new framework
Pavel Boyko <boyko@iitp.ru>
parents: 4720
diff changeset
   153
//-----------------------------------------------------------------------------
6600
e438f9b17c66 Replace MacRxMiddle::SequenceControlSmaller with QosUtilsIsOldPacket method
Mirko Banchi <mk.banchi@gmail.com>
parents: 5944
diff changeset
   154
class QosUtilsIsOldPacketTest : public TestCase
5320
0fb5a9f1a9c0 wifi unit tests ported to new framework
Pavel Boyko <boyko@iitp.ru>
parents: 4720
diff changeset
   155
{
0fb5a9f1a9c0 wifi unit tests ported to new framework
Pavel Boyko <boyko@iitp.ru>
parents: 4720
diff changeset
   156
public:
6600
e438f9b17c66 Replace MacRxMiddle::SequenceControlSmaller with QosUtilsIsOldPacket method
Mirko Banchi <mk.banchi@gmail.com>
parents: 5944
diff changeset
   157
  QosUtilsIsOldPacketTest () : TestCase ("QosUtilsIsOldPacket") {}
e438f9b17c66 Replace MacRxMiddle::SequenceControlSmaller with QosUtilsIsOldPacket method
Mirko Banchi <mk.banchi@gmail.com>
parents: 5944
diff changeset
   158
  virtual bool DoRun (void)
5320
0fb5a9f1a9c0 wifi unit tests ported to new framework
Pavel Boyko <boyko@iitp.ru>
parents: 4720
diff changeset
   159
  {
6600
e438f9b17c66 Replace MacRxMiddle::SequenceControlSmaller with QosUtilsIsOldPacket method
Mirko Banchi <mk.banchi@gmail.com>
parents: 5944
diff changeset
   160
    // startingSeq=0, seqNum=2047
e438f9b17c66 Replace MacRxMiddle::SequenceControlSmaller with QosUtilsIsOldPacket method
Mirko Banchi <mk.banchi@gmail.com>
parents: 5944
diff changeset
   161
    NS_TEST_EXPECT_MSG_EQ (QosUtilsIsOldPacket (0, 2047), false, "2047 is new in comparison to 0");
e438f9b17c66 Replace MacRxMiddle::SequenceControlSmaller with QosUtilsIsOldPacket method
Mirko Banchi <mk.banchi@gmail.com>
parents: 5944
diff changeset
   162
    // startingSeq=0, seqNum=2048
e438f9b17c66 Replace MacRxMiddle::SequenceControlSmaller with QosUtilsIsOldPacket method
Mirko Banchi <mk.banchi@gmail.com>
parents: 5944
diff changeset
   163
    NS_TEST_EXPECT_MSG_EQ (QosUtilsIsOldPacket (0, 2048), true, "2048 is old in comparison to 0");
e438f9b17c66 Replace MacRxMiddle::SequenceControlSmaller with QosUtilsIsOldPacket method
Mirko Banchi <mk.banchi@gmail.com>
parents: 5944
diff changeset
   164
    // startingSeq=2048, seqNum=0
e438f9b17c66 Replace MacRxMiddle::SequenceControlSmaller with QosUtilsIsOldPacket method
Mirko Banchi <mk.banchi@gmail.com>
parents: 5944
diff changeset
   165
    NS_TEST_EXPECT_MSG_EQ (QosUtilsIsOldPacket (2048, 0), true, "0 is old in comparison to 2048");
e438f9b17c66 Replace MacRxMiddle::SequenceControlSmaller with QosUtilsIsOldPacket method
Mirko Banchi <mk.banchi@gmail.com>
parents: 5944
diff changeset
   166
    // startingSeq=4095, seqNum=0
e438f9b17c66 Replace MacRxMiddle::SequenceControlSmaller with QosUtilsIsOldPacket method
Mirko Banchi <mk.banchi@gmail.com>
parents: 5944
diff changeset
   167
    NS_TEST_EXPECT_MSG_EQ (QosUtilsIsOldPacket (4095, 0), false, "0 is new in comparison to 4095");
e438f9b17c66 Replace MacRxMiddle::SequenceControlSmaller with QosUtilsIsOldPacket method
Mirko Banchi <mk.banchi@gmail.com>
parents: 5944
diff changeset
   168
    // startingSeq=0, seqNum=4095
e438f9b17c66 Replace MacRxMiddle::SequenceControlSmaller with QosUtilsIsOldPacket method
Mirko Banchi <mk.banchi@gmail.com>
parents: 5944
diff changeset
   169
    NS_TEST_EXPECT_MSG_EQ (QosUtilsIsOldPacket (0, 4095), true, "4095 is old in comparison to 0");
e438f9b17c66 Replace MacRxMiddle::SequenceControlSmaller with QosUtilsIsOldPacket method
Mirko Banchi <mk.banchi@gmail.com>
parents: 5944
diff changeset
   170
    // startingSeq=4095 seqNum=2047
e438f9b17c66 Replace MacRxMiddle::SequenceControlSmaller with QosUtilsIsOldPacket method
Mirko Banchi <mk.banchi@gmail.com>
parents: 5944
diff changeset
   171
    NS_TEST_EXPECT_MSG_EQ (QosUtilsIsOldPacket (4095, 2047), true, "2047 is old in comparison to 4095");
e438f9b17c66 Replace MacRxMiddle::SequenceControlSmaller with QosUtilsIsOldPacket method
Mirko Banchi <mk.banchi@gmail.com>
parents: 5944
diff changeset
   172
    // startingSeq=2048 seqNum=4095
e438f9b17c66 Replace MacRxMiddle::SequenceControlSmaller with QosUtilsIsOldPacket method
Mirko Banchi <mk.banchi@gmail.com>
parents: 5944
diff changeset
   173
    NS_TEST_EXPECT_MSG_EQ (QosUtilsIsOldPacket (2048, 4095), false, "4095 is new in comparison to 2048");
e438f9b17c66 Replace MacRxMiddle::SequenceControlSmaller with QosUtilsIsOldPacket method
Mirko Banchi <mk.banchi@gmail.com>
parents: 5944
diff changeset
   174
    // startingSeq=2049 seqNum=0
e438f9b17c66 Replace MacRxMiddle::SequenceControlSmaller with QosUtilsIsOldPacket method
Mirko Banchi <mk.banchi@gmail.com>
parents: 5944
diff changeset
   175
    NS_TEST_EXPECT_MSG_EQ (QosUtilsIsOldPacket (2049, 0), false, "0 is new in comparison to 2049");
5320
0fb5a9f1a9c0 wifi unit tests ported to new framework
Pavel Boyko <boyko@iitp.ru>
parents: 4720
diff changeset
   176
0fb5a9f1a9c0 wifi unit tests ported to new framework
Pavel Boyko <boyko@iitp.ru>
parents: 4720
diff changeset
   177
    return GetErrorStatus ();
0fb5a9f1a9c0 wifi unit tests ported to new framework
Pavel Boyko <boyko@iitp.ru>
parents: 4720
diff changeset
   178
  }
0fb5a9f1a9c0 wifi unit tests ported to new framework
Pavel Boyko <boyko@iitp.ru>
parents: 4720
diff changeset
   179
};
0fb5a9f1a9c0 wifi unit tests ported to new framework
Pavel Boyko <boyko@iitp.ru>
parents: 4720
diff changeset
   180
0fb5a9f1a9c0 wifi unit tests ported to new framework
Pavel Boyko <boyko@iitp.ru>
parents: 4720
diff changeset
   181
//-----------------------------------------------------------------------------
6665
27dab861cb2a TestCase for bug 991
Quincy Tse <quincy.tse@nicta.com.au>
parents: 6600
diff changeset
   182
class InterferenceHelperSequenceTest : public TestCase
27dab861cb2a TestCase for bug 991
Quincy Tse <quincy.tse@nicta.com.au>
parents: 6600
diff changeset
   183
{
27dab861cb2a TestCase for bug 991
Quincy Tse <quincy.tse@nicta.com.au>
parents: 6600
diff changeset
   184
public:
27dab861cb2a TestCase for bug 991
Quincy Tse <quincy.tse@nicta.com.au>
parents: 6600
diff changeset
   185
  InterferenceHelperSequenceTest ();
27dab861cb2a TestCase for bug 991
Quincy Tse <quincy.tse@nicta.com.au>
parents: 6600
diff changeset
   186
27dab861cb2a TestCase for bug 991
Quincy Tse <quincy.tse@nicta.com.au>
parents: 6600
diff changeset
   187
  virtual bool DoRun (void);
27dab861cb2a TestCase for bug 991
Quincy Tse <quincy.tse@nicta.com.au>
parents: 6600
diff changeset
   188
private:
27dab861cb2a TestCase for bug 991
Quincy Tse <quincy.tse@nicta.com.au>
parents: 6600
diff changeset
   189
  Ptr<Node> CreateOne (Vector pos, Ptr<YansWifiChannel> channel);
27dab861cb2a TestCase for bug 991
Quincy Tse <quincy.tse@nicta.com.au>
parents: 6600
diff changeset
   190
  void SendOnePacket (Ptr<WifiNetDevice> dev);
27dab861cb2a TestCase for bug 991
Quincy Tse <quincy.tse@nicta.com.au>
parents: 6600
diff changeset
   191
  void SwitchCh (Ptr<WifiNetDevice> dev);
27dab861cb2a TestCase for bug 991
Quincy Tse <quincy.tse@nicta.com.au>
parents: 6600
diff changeset
   192
27dab861cb2a TestCase for bug 991
Quincy Tse <quincy.tse@nicta.com.au>
parents: 6600
diff changeset
   193
  ObjectFactory m_manager;
27dab861cb2a TestCase for bug 991
Quincy Tse <quincy.tse@nicta.com.au>
parents: 6600
diff changeset
   194
  ObjectFactory m_mac;
27dab861cb2a TestCase for bug 991
Quincy Tse <quincy.tse@nicta.com.au>
parents: 6600
diff changeset
   195
  ObjectFactory m_propDelay;
27dab861cb2a TestCase for bug 991
Quincy Tse <quincy.tse@nicta.com.au>
parents: 6600
diff changeset
   196
};
27dab861cb2a TestCase for bug 991
Quincy Tse <quincy.tse@nicta.com.au>
parents: 6600
diff changeset
   197
27dab861cb2a TestCase for bug 991
Quincy Tse <quincy.tse@nicta.com.au>
parents: 6600
diff changeset
   198
InterferenceHelperSequenceTest::InterferenceHelperSequenceTest ()
27dab861cb2a TestCase for bug 991
Quincy Tse <quincy.tse@nicta.com.au>
parents: 6600
diff changeset
   199
  : TestCase ("InterferenceHelperSequence")
6674
52f8688d6d01 Bug 978: Run check-style.py on files touched in the reorganisation
Dean Armstrong <deanarm@gmail.com>
parents: 6673
diff changeset
   200
{
52f8688d6d01 Bug 978: Run check-style.py on files touched in the reorganisation
Dean Armstrong <deanarm@gmail.com>
parents: 6673
diff changeset
   201
}
6665
27dab861cb2a TestCase for bug 991
Quincy Tse <quincy.tse@nicta.com.au>
parents: 6600
diff changeset
   202
6674
52f8688d6d01 Bug 978: Run check-style.py on files touched in the reorganisation
Dean Armstrong <deanarm@gmail.com>
parents: 6673
diff changeset
   203
void
6665
27dab861cb2a TestCase for bug 991
Quincy Tse <quincy.tse@nicta.com.au>
parents: 6600
diff changeset
   204
InterferenceHelperSequenceTest::SendOnePacket (Ptr<WifiNetDevice> dev)
27dab861cb2a TestCase for bug 991
Quincy Tse <quincy.tse@nicta.com.au>
parents: 6600
diff changeset
   205
{
27dab861cb2a TestCase for bug 991
Quincy Tse <quincy.tse@nicta.com.au>
parents: 6600
diff changeset
   206
  Ptr<Packet> p = Create<Packet> (9999);
27dab861cb2a TestCase for bug 991
Quincy Tse <quincy.tse@nicta.com.au>
parents: 6600
diff changeset
   207
  dev->Send (p, dev->GetBroadcast (), 1);
27dab861cb2a TestCase for bug 991
Quincy Tse <quincy.tse@nicta.com.au>
parents: 6600
diff changeset
   208
}
27dab861cb2a TestCase for bug 991
Quincy Tse <quincy.tse@nicta.com.au>
parents: 6600
diff changeset
   209
27dab861cb2a TestCase for bug 991
Quincy Tse <quincy.tse@nicta.com.au>
parents: 6600
diff changeset
   210
void
27dab861cb2a TestCase for bug 991
Quincy Tse <quincy.tse@nicta.com.au>
parents: 6600
diff changeset
   211
InterferenceHelperSequenceTest::SwitchCh (Ptr<WifiNetDevice> dev)
27dab861cb2a TestCase for bug 991
Quincy Tse <quincy.tse@nicta.com.au>
parents: 6600
diff changeset
   212
{
27dab861cb2a TestCase for bug 991
Quincy Tse <quincy.tse@nicta.com.au>
parents: 6600
diff changeset
   213
  Time now = Simulator::Now();
27dab861cb2a TestCase for bug 991
Quincy Tse <quincy.tse@nicta.com.au>
parents: 6600
diff changeset
   214
  Ptr<WifiPhy> p = dev->GetPhy ();
27dab861cb2a TestCase for bug 991
Quincy Tse <quincy.tse@nicta.com.au>
parents: 6600
diff changeset
   215
  p->SetChannelNumber (1);
27dab861cb2a TestCase for bug 991
Quincy Tse <quincy.tse@nicta.com.au>
parents: 6600
diff changeset
   216
}
27dab861cb2a TestCase for bug 991
Quincy Tse <quincy.tse@nicta.com.au>
parents: 6600
diff changeset
   217
27dab861cb2a TestCase for bug 991
Quincy Tse <quincy.tse@nicta.com.au>
parents: 6600
diff changeset
   218
Ptr<Node>
27dab861cb2a TestCase for bug 991
Quincy Tse <quincy.tse@nicta.com.au>
parents: 6600
diff changeset
   219
InterferenceHelperSequenceTest::CreateOne (Vector pos, Ptr<YansWifiChannel> channel)
27dab861cb2a TestCase for bug 991
Quincy Tse <quincy.tse@nicta.com.au>
parents: 6600
diff changeset
   220
{
27dab861cb2a TestCase for bug 991
Quincy Tse <quincy.tse@nicta.com.au>
parents: 6600
diff changeset
   221
  Ptr<Node> node = CreateObject<Node> ();
27dab861cb2a TestCase for bug 991
Quincy Tse <quincy.tse@nicta.com.au>
parents: 6600
diff changeset
   222
  Ptr<WifiNetDevice> dev = CreateObject<WifiNetDevice> ();
27dab861cb2a TestCase for bug 991
Quincy Tse <quincy.tse@nicta.com.au>
parents: 6600
diff changeset
   223
27dab861cb2a TestCase for bug 991
Quincy Tse <quincy.tse@nicta.com.au>
parents: 6600
diff changeset
   224
  Ptr<WifiMac> mac = m_mac.Create<WifiMac> ();
27dab861cb2a TestCase for bug 991
Quincy Tse <quincy.tse@nicta.com.au>
parents: 6600
diff changeset
   225
  mac->ConfigureStandard (WIFI_PHY_STANDARD_80211a);
27dab861cb2a TestCase for bug 991
Quincy Tse <quincy.tse@nicta.com.au>
parents: 6600
diff changeset
   226
  Ptr<ConstantPositionMobilityModel> mobility = CreateObject<ConstantPositionMobilityModel> ();
27dab861cb2a TestCase for bug 991
Quincy Tse <quincy.tse@nicta.com.au>
parents: 6600
diff changeset
   227
  Ptr<YansWifiPhy> phy = CreateObject<YansWifiPhy> ();
27dab861cb2a TestCase for bug 991
Quincy Tse <quincy.tse@nicta.com.au>
parents: 6600
diff changeset
   228
  Ptr<ErrorRateModel> error = CreateObject<YansErrorRateModel> ();
27dab861cb2a TestCase for bug 991
Quincy Tse <quincy.tse@nicta.com.au>
parents: 6600
diff changeset
   229
  phy->SetErrorRateModel (error);
27dab861cb2a TestCase for bug 991
Quincy Tse <quincy.tse@nicta.com.au>
parents: 6600
diff changeset
   230
  phy->SetChannel (channel);
27dab861cb2a TestCase for bug 991
Quincy Tse <quincy.tse@nicta.com.au>
parents: 6600
diff changeset
   231
  phy->SetDevice (dev);
27dab861cb2a TestCase for bug 991
Quincy Tse <quincy.tse@nicta.com.au>
parents: 6600
diff changeset
   232
  phy->SetMobility (node);
27dab861cb2a TestCase for bug 991
Quincy Tse <quincy.tse@nicta.com.au>
parents: 6600
diff changeset
   233
  phy->ConfigureStandard (WIFI_PHY_STANDARD_80211a);
27dab861cb2a TestCase for bug 991
Quincy Tse <quincy.tse@nicta.com.au>
parents: 6600
diff changeset
   234
  Ptr<WifiRemoteStationManager> manager = m_manager.Create<WifiRemoteStationManager> ();
27dab861cb2a TestCase for bug 991
Quincy Tse <quincy.tse@nicta.com.au>
parents: 6600
diff changeset
   235
27dab861cb2a TestCase for bug 991
Quincy Tse <quincy.tse@nicta.com.au>
parents: 6600
diff changeset
   236
  mobility->SetPosition (pos);
27dab861cb2a TestCase for bug 991
Quincy Tse <quincy.tse@nicta.com.au>
parents: 6600
diff changeset
   237
  node->AggregateObject (mobility);
27dab861cb2a TestCase for bug 991
Quincy Tse <quincy.tse@nicta.com.au>
parents: 6600
diff changeset
   238
  mac->SetAddress (Mac48Address::Allocate ());
27dab861cb2a TestCase for bug 991
Quincy Tse <quincy.tse@nicta.com.au>
parents: 6600
diff changeset
   239
  dev->SetMac (mac);
27dab861cb2a TestCase for bug 991
Quincy Tse <quincy.tse@nicta.com.au>
parents: 6600
diff changeset
   240
  dev->SetPhy (phy);
27dab861cb2a TestCase for bug 991
Quincy Tse <quincy.tse@nicta.com.au>
parents: 6600
diff changeset
   241
  dev->SetRemoteStationManager (manager);
27dab861cb2a TestCase for bug 991
Quincy Tse <quincy.tse@nicta.com.au>
parents: 6600
diff changeset
   242
  node->AddDevice (dev);
27dab861cb2a TestCase for bug 991
Quincy Tse <quincy.tse@nicta.com.au>
parents: 6600
diff changeset
   243
27dab861cb2a TestCase for bug 991
Quincy Tse <quincy.tse@nicta.com.au>
parents: 6600
diff changeset
   244
  return node;
27dab861cb2a TestCase for bug 991
Quincy Tse <quincy.tse@nicta.com.au>
parents: 6600
diff changeset
   245
}
27dab861cb2a TestCase for bug 991
Quincy Tse <quincy.tse@nicta.com.au>
parents: 6600
diff changeset
   246
27dab861cb2a TestCase for bug 991
Quincy Tse <quincy.tse@nicta.com.au>
parents: 6600
diff changeset
   247
bool
27dab861cb2a TestCase for bug 991
Quincy Tse <quincy.tse@nicta.com.au>
parents: 6600
diff changeset
   248
InterferenceHelperSequenceTest::DoRun (void)
27dab861cb2a TestCase for bug 991
Quincy Tse <quincy.tse@nicta.com.au>
parents: 6600
diff changeset
   249
{
27dab861cb2a TestCase for bug 991
Quincy Tse <quincy.tse@nicta.com.au>
parents: 6600
diff changeset
   250
  m_mac.SetTypeId ("ns3::AdhocWifiMac");
27dab861cb2a TestCase for bug 991
Quincy Tse <quincy.tse@nicta.com.au>
parents: 6600
diff changeset
   251
  m_propDelay.SetTypeId ("ns3::ConstantSpeedPropagationDelayModel");
27dab861cb2a TestCase for bug 991
Quincy Tse <quincy.tse@nicta.com.au>
parents: 6600
diff changeset
   252
  m_manager.SetTypeId ("ns3::ConstantRateWifiManager");
27dab861cb2a TestCase for bug 991
Quincy Tse <quincy.tse@nicta.com.au>
parents: 6600
diff changeset
   253
27dab861cb2a TestCase for bug 991
Quincy Tse <quincy.tse@nicta.com.au>
parents: 6600
diff changeset
   254
  Ptr<YansWifiChannel> channel = CreateObject<YansWifiChannel> ();
27dab861cb2a TestCase for bug 991
Quincy Tse <quincy.tse@nicta.com.au>
parents: 6600
diff changeset
   255
  Ptr<PropagationDelayModel> propDelay = m_propDelay.Create<PropagationDelayModel> ();
27dab861cb2a TestCase for bug 991
Quincy Tse <quincy.tse@nicta.com.au>
parents: 6600
diff changeset
   256
  Ptr<MatrixPropagationLossModel> propLoss = CreateObject<MatrixPropagationLossModel> ();
27dab861cb2a TestCase for bug 991
Quincy Tse <quincy.tse@nicta.com.au>
parents: 6600
diff changeset
   257
  channel->SetPropagationDelayModel (propDelay);
27dab861cb2a TestCase for bug 991
Quincy Tse <quincy.tse@nicta.com.au>
parents: 6600
diff changeset
   258
  channel->SetPropagationLossModel (propLoss);
27dab861cb2a TestCase for bug 991
Quincy Tse <quincy.tse@nicta.com.au>
parents: 6600
diff changeset
   259
27dab861cb2a TestCase for bug 991
Quincy Tse <quincy.tse@nicta.com.au>
parents: 6600
diff changeset
   260
  Ptr<Node> rxOnly = CreateOne (Vector (0.0, 0.0, 0.0), channel);
27dab861cb2a TestCase for bug 991
Quincy Tse <quincy.tse@nicta.com.au>
parents: 6600
diff changeset
   261
  Ptr<Node> senderA = CreateOne (Vector (5.0, 0.0, 0.0), channel);
27dab861cb2a TestCase for bug 991
Quincy Tse <quincy.tse@nicta.com.au>
parents: 6600
diff changeset
   262
  Ptr<Node> senderB = CreateOne (Vector (-5.0, 0.0, 0.0), channel);
27dab861cb2a TestCase for bug 991
Quincy Tse <quincy.tse@nicta.com.au>
parents: 6600
diff changeset
   263
27dab861cb2a TestCase for bug 991
Quincy Tse <quincy.tse@nicta.com.au>
parents: 6600
diff changeset
   264
  propLoss->SetLoss (senderB, rxOnly, 0, true);
27dab861cb2a TestCase for bug 991
Quincy Tse <quincy.tse@nicta.com.au>
parents: 6600
diff changeset
   265
  propLoss->SetDefaultLoss (999);
27dab861cb2a TestCase for bug 991
Quincy Tse <quincy.tse@nicta.com.au>
parents: 6600
diff changeset
   266
27dab861cb2a TestCase for bug 991
Quincy Tse <quincy.tse@nicta.com.au>
parents: 6600
diff changeset
   267
  Simulator::Schedule (Seconds (1.0),
6674
52f8688d6d01 Bug 978: Run check-style.py on files touched in the reorganisation
Dean Armstrong <deanarm@gmail.com>
parents: 6673
diff changeset
   268
                       &InterferenceHelperSequenceTest::SendOnePacket, this,
52f8688d6d01 Bug 978: Run check-style.py on files touched in the reorganisation
Dean Armstrong <deanarm@gmail.com>
parents: 6673
diff changeset
   269
                       DynamicCast<WifiNetDevice> (senderB->GetDevice (0)));
6665
27dab861cb2a TestCase for bug 991
Quincy Tse <quincy.tse@nicta.com.au>
parents: 6600
diff changeset
   270
27dab861cb2a TestCase for bug 991
Quincy Tse <quincy.tse@nicta.com.au>
parents: 6600
diff changeset
   271
  Simulator::Schedule (Seconds (1.0000001),
6674
52f8688d6d01 Bug 978: Run check-style.py on files touched in the reorganisation
Dean Armstrong <deanarm@gmail.com>
parents: 6673
diff changeset
   272
                       &InterferenceHelperSequenceTest::SwitchCh, this,
52f8688d6d01 Bug 978: Run check-style.py on files touched in the reorganisation
Dean Armstrong <deanarm@gmail.com>
parents: 6673
diff changeset
   273
                       DynamicCast<WifiNetDevice> (rxOnly->GetDevice (0)));
6665
27dab861cb2a TestCase for bug 991
Quincy Tse <quincy.tse@nicta.com.au>
parents: 6600
diff changeset
   274
27dab861cb2a TestCase for bug 991
Quincy Tse <quincy.tse@nicta.com.au>
parents: 6600
diff changeset
   275
  Simulator::Schedule (Seconds (5.0),
6674
52f8688d6d01 Bug 978: Run check-style.py on files touched in the reorganisation
Dean Armstrong <deanarm@gmail.com>
parents: 6673
diff changeset
   276
                       &InterferenceHelperSequenceTest::SendOnePacket, this,
52f8688d6d01 Bug 978: Run check-style.py on files touched in the reorganisation
Dean Armstrong <deanarm@gmail.com>
parents: 6673
diff changeset
   277
                       DynamicCast<WifiNetDevice> (senderA->GetDevice (0)));
6665
27dab861cb2a TestCase for bug 991
Quincy Tse <quincy.tse@nicta.com.au>
parents: 6600
diff changeset
   278
27dab861cb2a TestCase for bug 991
Quincy Tse <quincy.tse@nicta.com.au>
parents: 6600
diff changeset
   279
  Simulator::Schedule (Seconds (7.0),
6674
52f8688d6d01 Bug 978: Run check-style.py on files touched in the reorganisation
Dean Armstrong <deanarm@gmail.com>
parents: 6673
diff changeset
   280
                       &InterferenceHelperSequenceTest::SendOnePacket, this,
52f8688d6d01 Bug 978: Run check-style.py on files touched in the reorganisation
Dean Armstrong <deanarm@gmail.com>
parents: 6673
diff changeset
   281
                       DynamicCast<WifiNetDevice> (senderB->GetDevice (0)));
6665
27dab861cb2a TestCase for bug 991
Quincy Tse <quincy.tse@nicta.com.au>
parents: 6600
diff changeset
   282
27dab861cb2a TestCase for bug 991
Quincy Tse <quincy.tse@nicta.com.au>
parents: 6600
diff changeset
   283
  Simulator::Stop (Seconds (100.0));
27dab861cb2a TestCase for bug 991
Quincy Tse <quincy.tse@nicta.com.au>
parents: 6600
diff changeset
   284
  Simulator::Run ();
27dab861cb2a TestCase for bug 991
Quincy Tse <quincy.tse@nicta.com.au>
parents: 6600
diff changeset
   285
27dab861cb2a TestCase for bug 991
Quincy Tse <quincy.tse@nicta.com.au>
parents: 6600
diff changeset
   286
  Simulator::Destroy ();
27dab861cb2a TestCase for bug 991
Quincy Tse <quincy.tse@nicta.com.au>
parents: 6600
diff changeset
   287
  return false;
27dab861cb2a TestCase for bug 991
Quincy Tse <quincy.tse@nicta.com.au>
parents: 6600
diff changeset
   288
}
27dab861cb2a TestCase for bug 991
Quincy Tse <quincy.tse@nicta.com.au>
parents: 6600
diff changeset
   289
27dab861cb2a TestCase for bug 991
Quincy Tse <quincy.tse@nicta.com.au>
parents: 6600
diff changeset
   290
//-----------------------------------------------------------------------------
5320
0fb5a9f1a9c0 wifi unit tests ported to new framework
Pavel Boyko <boyko@iitp.ru>
parents: 4720
diff changeset
   291
0fb5a9f1a9c0 wifi unit tests ported to new framework
Pavel Boyko <boyko@iitp.ru>
parents: 4720
diff changeset
   292
class WifiTestSuite : public TestSuite
0fb5a9f1a9c0 wifi unit tests ported to new framework
Pavel Boyko <boyko@iitp.ru>
parents: 4720
diff changeset
   293
{
0fb5a9f1a9c0 wifi unit tests ported to new framework
Pavel Boyko <boyko@iitp.ru>
parents: 4720
diff changeset
   294
public:
0fb5a9f1a9c0 wifi unit tests ported to new framework
Pavel Boyko <boyko@iitp.ru>
parents: 4720
diff changeset
   295
  WifiTestSuite ();
0fb5a9f1a9c0 wifi unit tests ported to new framework
Pavel Boyko <boyko@iitp.ru>
parents: 4720
diff changeset
   296
};
0fb5a9f1a9c0 wifi unit tests ported to new framework
Pavel Boyko <boyko@iitp.ru>
parents: 4720
diff changeset
   297
0fb5a9f1a9c0 wifi unit tests ported to new framework
Pavel Boyko <boyko@iitp.ru>
parents: 4720
diff changeset
   298
WifiTestSuite::WifiTestSuite ()
0fb5a9f1a9c0 wifi unit tests ported to new framework
Pavel Boyko <boyko@iitp.ru>
parents: 4720
diff changeset
   299
  : TestSuite ("devices-wifi", UNIT)
0fb5a9f1a9c0 wifi unit tests ported to new framework
Pavel Boyko <boyko@iitp.ru>
parents: 4720
diff changeset
   300
{
0fb5a9f1a9c0 wifi unit tests ported to new framework
Pavel Boyko <boyko@iitp.ru>
parents: 4720
diff changeset
   301
  AddTestCase (new WifiTest);
6600
e438f9b17c66 Replace MacRxMiddle::SequenceControlSmaller with QosUtilsIsOldPacket method
Mirko Banchi <mk.banchi@gmail.com>
parents: 5944
diff changeset
   302
  AddTestCase (new QosUtilsIsOldPacketTest);
6665
27dab861cb2a TestCase for bug 991
Quincy Tse <quincy.tse@nicta.com.au>
parents: 6600
diff changeset
   303
  AddTestCase (new InterferenceHelperSequenceTest); // Bug 991
5320
0fb5a9f1a9c0 wifi unit tests ported to new framework
Pavel Boyko <boyko@iitp.ru>
parents: 4720
diff changeset
   304
}
0fb5a9f1a9c0 wifi unit tests ported to new framework
Pavel Boyko <boyko@iitp.ru>
parents: 4720
diff changeset
   305
6774
034f362af24d Make all TestSuite instances be static
Mitch Watrous <watrous@u.washington.edu>
parents: 6674
diff changeset
   306
static WifiTestSuite g_wifiTestSuite;
2626
bc07dd340992 A bunch of wifi smoke tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   307
bc07dd340992 A bunch of wifi smoke tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   308
} // namespace ns3