Update OLSR test traces due to random variable perturbations
authorTom Henderson <tomh@tomh.org>
Fri, 24 Aug 2012 16:01:24 -0700
changeset 9009 51db70f73dc1
parent 9008 6dde77dcd178
child 9010 d6cc76205833
Update OLSR test traces due to random variable perturbations
src/olsr/test/bug780-0-0.pcap
src/olsr/test/bug780-1-0.pcap
src/olsr/test/bug780-2-0.pcap
src/olsr/test/bug780-test.cc
src/olsr/test/hello-regression-test.cc
Binary file src/olsr/test/bug780-0-0.pcap has changed
Binary file src/olsr/test/bug780-1-0.pcap has changed
Binary file src/olsr/test/bug780-2-0.pcap has changed
--- a/src/olsr/test/bug780-test.cc	Fri Aug 24 15:52:46 2012 -0700
+++ b/src/olsr/test/bug780-test.cc	Fri Aug 24 16:01:24 2012 -0700
@@ -89,6 +89,7 @@
   int nWifis = 3;
   double SimTime = 200.0;
   std::string phyMode ("DsssRate1Mbps");
+  int64_t streamsUsed = 0;
 
   //sending one packets per sec
   // Fix non-unicast data rate to be the same as that of unicast
@@ -103,7 +104,8 @@
   YansWifiChannelHelper wifiChannel;
   wifiChannel.SetPropagationDelay ("ns3::ConstantSpeedPropagationDelayModel");
   wifiChannel.AddPropagationLoss ("ns3::FriisPropagationLossModel");
-  wifiPhy.SetChannel (wifiChannel.Create ());
+  Ptr<YansWifiChannel> chan = wifiChannel.Create ();
+  wifiPhy.SetChannel (chan);
 
   // Add a non-QoS upper mac, and disable rate control
   NqosWifiMacHelper wifiMac = NqosWifiMacHelper::Default ();
@@ -120,13 +122,21 @@
   wifiMac.SetType ("ns3::AdhocWifiMac");
   NetDeviceContainer adhocDevices = wifi.Install (wifiPhy, wifiMac, adhocNodes);
 
+  // Assign fixed stream numbers to wifi and channel random variables
+  streamsUsed += wifi.AssignStreams (adhocDevices, streamsUsed);
+  // Assign 6 streams per Wifi device
+  NS_TEST_ASSERT_MSG_EQ (streamsUsed, (adhocDevices.GetN () * 6), "Stream assignment mismatch");
+  streamsUsed += wifiChannel.AssignStreams (chan, streamsUsed);
+  // Assign 0 streams per channel for this configuration 
+  NS_TEST_ASSERT_MSG_EQ (streamsUsed, (adhocDevices.GetN () * 6), "Stream assignment mismatch");
+
   OlsrHelper olsr;
 
   InternetStackHelper internet;
   internet.SetRoutingHelper (olsr);
   internet.Install (adhocNodes);
-  int64_t streamsUsed = olsr.AssignStreams (adhocNodes, 0);
-  NS_TEST_EXPECT_MSG_EQ (streamsUsed, nWifis, "Should have assigned 3 streams");
+  streamsUsed += olsr.AssignStreams (adhocNodes, 0);
+  NS_TEST_ASSERT_MSG_EQ (streamsUsed, ((adhocDevices.GetN () * 6) + nWifis), "Should have assigned 3 streams");
 
   Ipv4AddressHelper addressAdhoc;
   addressAdhoc.SetBase ("10.1.1.0", "255.255.255.0");
--- a/src/olsr/test/hello-regression-test.cc	Fri Aug 24 15:52:46 2012 -0700
+++ b/src/olsr/test/hello-regression-test.cc	Fri Aug 24 16:01:24 2012 -0700
@@ -75,8 +75,9 @@
   InternetStackHelper internet;
   internet.SetRoutingHelper (olsr);
   internet.Install (c);
+  // Assign OLSR RVs to specific streams
   int64_t streamsUsed = olsr.AssignStreams (c, 0);
-  NS_TEST_EXPECT_MSG_EQ (streamsUsed, 2, "Should have assigned 2 streams");
+  NS_TEST_ASSERT_MSG_EQ (streamsUsed, 2, "Should have assigned 2 streams");
   // create p2p channel & devices
   PointToPointHelper p2p;
   p2p.SetDeviceAttribute ("DataRate", StringValue ("5Mbps"));