Making regression tests valid.
authorMitch Watrous <watrous@u.washington.edu>
Tue, 05 Oct 2010 15:00:57 -0700
changeset 6712 3380cef280c7
parent 6711 f2373af3ae17
child 6713 f53610bd0498
Making regression tests valid.
src/test/csma-test-suite.cc
--- a/src/test/csma-test-suite.cc	Tue Oct 05 14:50:13 2010 -0700
+++ b/src/test/csma-test-suite.cc	Tue Oct 05 15:00:57 2010 -0700
@@ -760,14 +760,16 @@
   ip.SetBase ("192.168.1.0", "255.255.255.0");
   Ipv4InterfaceContainer addresses = ip.Assign (devs);
 
+  // Create the OnOff application to send UDP datagrams from n0 to n1.
+  //
+  // Make packets be sent about every DefaultPacketSize / DataRate = 
+  // 4096 bits / (5000 bits/second) = 0.82 second.
   Config::SetDefault ("ns3::Ipv4RawSocketImpl::Protocol", StringValue ("2"));
   InetSocketAddress dst = InetSocketAddress (addresses.GetAddress (3));
   OnOffHelper onoff = OnOffHelper ("ns3::Ipv4RawSocketFactory", dst);
   onoff.SetAttribute ("OnTime", RandomVariableValue (ConstantVariable (1.0)));
   onoff.SetAttribute ("OffTime", RandomVariableValue (ConstantVariable (0.0)));
-  onoff.SetAttribute ("DataRate", DataRateValue (DataRate (15000)));
-  onoff.SetAttribute ("PacketSize", UintegerValue (1200));
-
+  onoff.SetAttribute ("DataRate", DataRateValue (DataRate (5000)));
 
   ApplicationContainer apps = onoff.Install (c.Get (0));
   apps.Start (Seconds (1.0));
@@ -787,15 +789,21 @@
   apps.Start (Seconds (2.0));
   apps.Stop (Seconds (5.0));
 
+  // Trace receptions
   Config::ConnectWithoutContext ("/NodeList/3/ApplicationList/0/$ns3::PacketSink/Rx", 
                                  MakeCallback (&CsmaPingTestCase::SinkRx, this));
+
+  // Trace pings
   Config::Connect ("/NodeList/*/ApplicationList/*/$ns3::V4Ping/Rtt",
                    MakeCallback (&CsmaPingTestCase::PingRtt, this));
 
   Simulator::Run ();
   Simulator::Destroy ();
 
-  // We have 3 pingers that ping every second for 3 seconds.
+  // We should have sent and received 10 packets
+  NS_TEST_ASSERT_MSG_EQ (m_countSinkRx, 10, "Node 3 should have received 10 packets");
+
+  // We should have 3 pingers that ping every second for 3 seconds.
   NS_TEST_ASSERT_MSG_EQ (m_countPingRtt, 9, "Node 2 should have been pinged 9 times");
 
   return false;