build fixes for gcc 4.6
authorAndrey Mazo <mazo@iitp.ru>
Sun, 17 Apr 2011 14:54:42 +0200
changeset 7061 15f40cfaf3b3
parent 7060 f08a90113dd5
child 7062 bfac4de27c06
build fixes for gcc 4.6
src/aodv/model/aodv-routing-protocol.cc
src/aodv/model/aodv-rqueue.cc
src/core/model/map-scheduler.cc
src/dsdv/model/dsdv-packet-queue.cc
src/energy/test/basic-energy-model-test.cc
src/internet/model/icmpv4.cc
src/internet/model/icmpv6-header.cc
src/internet/model/ipv4-static-routing.cc
src/internet/model/rtt-estimator.cc
src/mesh/model/dot11s/hwmp-protocol-mac.cc
src/mesh/model/dot11s/ie-dot11s-configuration.cc
src/mesh/model/dot11s/peer-management-protocol-mac.cc
src/mesh/model/mesh-wifi-interface-mac.cc
src/mobility/helper/ns2-mobility-helper.cc
src/network/model/buffer.cc
src/network/test/packet-metadata-test.cc
src/nix-vector-routing/examples/nms-p2p-nix.cc
src/point-to-point/model/point-to-point-remote-channel.cc
src/spectrum/test/spectrum-value-test.cc
src/topology-read/model/rocketfuel-topology-reader.cc
src/uan/model/uan-phy-gen.cc
src/uan/test/uan-test.cc
src/wifi/model/dcf-manager.cc
src/wifi/model/wifi-net-device.cc
src/wifi/test/wifi-test.cc
src/wimax/model/bs-scheduler-rtps.cc
src/wimax/model/bs-uplink-scheduler-mbqos.cc
src/wimax/model/ss-link-manager.cc
src/wimax/model/ss-net-device.cc
src/wimax/model/ss-scheduler.cc
src/wimax/test/wimax-fragmentation-test.cc
--- a/src/aodv/model/aodv-routing-protocol.cc	Sun Apr 17 14:34:40 2011 +0200
+++ b/src/aodv/model/aodv-routing-protocol.cc	Sun Apr 17 14:54:42 2011 +0200
@@ -1397,7 +1397,6 @@
             {
               if (i->first == un.first)
                 {
-                  Ipv4Address dst = un.first;
                   unreachable.insert (un);
                 }
             }
--- a/src/aodv/model/aodv-rqueue.cc	Sun Apr 17 14:34:40 2011 +0200
+++ b/src/aodv/model/aodv-rqueue.cc	Sun Apr 17 14:54:42 2011 +0200
@@ -72,7 +72,6 @@
 {
   NS_LOG_FUNCTION (this << dst);
   Purge ();
-  const Ipv4Address addr = dst;
   for (std::vector<QueueEntry>::iterator i = m_queue.begin (); i
       != m_queue.end (); ++i)
     {
--- a/src/core/model/map-scheduler.cc	Sun Apr 17 14:34:40 2011 +0200
+++ b/src/core/model/map-scheduler.cc	Sun Apr 17 14:54:42 2011 +0200
@@ -82,7 +82,6 @@
   NS_LOG_FUNCTION (this);
   EventMapI i = m_list.begin ();
   NS_ASSERT (i != m_list.end ());
-  std::pair<Scheduler::EventKey, EventImpl*> next = *i;
   Event ev;
   ev.impl = i->second;
   ev.key = i->first;
--- a/src/dsdv/model/dsdv-packet-queue.cc	Sun Apr 17 14:34:40 2011 +0200
+++ b/src/dsdv/model/dsdv-packet-queue.cc	Sun Apr 17 14:54:42 2011 +0200
@@ -84,7 +84,6 @@
 {
   NS_LOG_FUNCTION ("Dropping packet to " << dst);
   Purge ();
-  const Ipv4Address addr = dst;
   for (std::vector<QueueEntry>::iterator i = m_queue.begin (); i
        != m_queue.end (); ++i)
     {
--- a/src/energy/test/basic-energy-model-test.cc	Sun Apr 17 14:34:40 2011 +0200
+++ b/src/energy/test/basic-energy-model-test.cc	Sun Apr 17 14:54:42 2011 +0200
@@ -334,7 +334,6 @@
   // set energy to 0 so that we deplete energy at the beginning of simulation
   basicSourceHelper.Set ("BasicEnergySourceInitialEnergyJ", DoubleValue (0.0));
   // set update interval
-  Time updateInterval = Seconds (1.0);
   basicSourceHelper.Set ("PeriodicEnergyUpdateInterval",
                          TimeValue (Seconds (updateIntervalS)));
   // install source
--- a/src/internet/model/icmpv4.cc	Sun Apr 17 14:34:40 2011 +0200
+++ b/src/internet/model/icmpv4.cc	Sun Apr 17 14:54:42 2011 +0200
@@ -82,8 +82,7 @@
 {
   m_type = start.ReadU8 ();
   m_code = start.ReadU8 ();
-  uint16_t checksum;
-  checksum = start.ReadNtohU16 ();
+  start.Next (2); // uint16_t checksum = start.ReadNtohU16 ();
   return 4;
 }
 void 
--- a/src/internet/model/icmpv6-header.cc	Sun Apr 17 14:34:40 2011 +0200
+++ b/src/internet/model/icmpv6-header.cc	Sun Apr 17 14:54:42 2011 +0200
@@ -1368,13 +1368,11 @@
 
 uint32_t Icmpv6OptionHeader::Deserialize (Buffer::Iterator start)
 {
-  Buffer::Iterator i = start;
   return GetSerializedSize ();
 }
 
 void Icmpv6OptionHeader::Serialize (Buffer::Iterator start) const
 {
-  Buffer::Iterator i = start;
 }
 
 NS_OBJECT_ENSURE_REGISTERED (Icmpv6OptionMtu);
--- a/src/internet/model/ipv4-static-routing.cc	Sun Apr 17 14:34:40 2011 +0200
+++ b/src/internet/model/ipv4-static-routing.cc	Sun Apr 17 14:54:42 2011 +0200
@@ -371,7 +371,6 @@
     uint32_t metric = i->second;
     Ipv4Mask mask = (j)->GetDestNetworkMask ();
     uint16_t masklen = mask.GetPrefixLength ();
-    Ipv4Address entry = (j)->GetDestNetwork ();
     if (masklen != 0)
       {
         continue;
--- a/src/internet/model/rtt-estimator.cc	Sun Apr 17 14:34:40 2011 +0200
+++ b/src/internet/model/rtt-estimator.cc	Sun Apr 17 14:54:42 2011 +0200
@@ -170,10 +170,6 @@
 
 void RttEstimator::IncreaseMultiplier ()
 {
-  double a;
-  a = multiplier * 2.0;
-  double b;
-  b = m_maxMultiplier * 2.0;
   multiplier = std::min (multiplier * 2.0, m_maxMultiplier);
 }
 
--- a/src/mesh/model/dot11s/hwmp-protocol-mac.cc	Sun Apr 17 14:34:40 2011 +0200
+++ b/src/mesh/model/dot11s/hwmp-protocol-mac.cc	Sun Apr 17 14:54:42 2011 +0200
@@ -97,7 +97,6 @@
   m_stats.rxMgtBytes += packet->GetSize ();
   WifiActionHeader actionHdr;
   packet->RemoveHeader (actionHdr);
-  WifiActionHeader::ActionValue actionValue = actionHdr.GetAction ();
   if (actionHdr.GetCategory () != WifiActionHeader::MESH_PATH_SELECTION)
     {
       return true;
--- a/src/mesh/model/dot11s/ie-dot11s-configuration.cc	Sun Apr 17 14:34:40 2011 +0200
+++ b/src/mesh/model/dot11s/ie-dot11s-configuration.cc	Sun Apr 17 14:54:42 2011 +0200
@@ -139,6 +139,10 @@
   Buffer::Iterator start = i;
   uint8_t version;
   version = i.ReadU8 ();
+  if (version != 1)
+    {
+      NS_FATAL_ERROR ("Other versions not supported yet");
+    }
   // Active Path Selection Protocol ID:
   m_APSPId = (dot11sPathSelectionProtocol) i.ReadLsbtohU32 ();
   // Active Path Metric ID:
--- a/src/mesh/model/dot11s/peer-management-protocol-mac.cc	Sun Apr 17 14:34:40 2011 +0200
+++ b/src/mesh/model/dot11s/peer-management-protocol-mac.cc	Sun Apr 17 14:54:42 2011 +0200
@@ -158,7 +158,6 @@
     {
       WifiActionHeader actionHdr;
       packet->PeekHeader (actionHdr);
-      WifiActionHeader::ActionValue actionValue = actionHdr.GetAction ();
       if (actionHdr.GetCategory () == WifiActionHeader::MESH_PEERING_MGT)
         {
           return true;
--- a/src/mesh/model/mesh-wifi-interface-mac.cc	Sun Apr 17 14:34:40 2011 +0200
+++ b/src/mesh/model/mesh-wifi-interface-mac.cc	Sun Apr 17 14:54:42 2011 +0200
@@ -405,7 +405,6 @@
     {
       m_stats.recvBeacons++;
       MgtBeaconHeader beacon_hdr;
-      Mac48Address from = hdr->GetAddr2 ();
 
       packet->PeekHeader (beacon_hdr);
 
--- a/src/mobility/helper/ns2-mobility-helper.cc	Sun Apr 17 14:34:40 2011 +0200
+++ b/src/mobility/helper/ns2-mobility-helper.cc	Sun Apr 17 14:54:42 2011 +0200
@@ -399,8 +399,7 @@
 IsNumber (const string& s)
 {
   char *endp;
-  double unused;
-  unused = strtod (s.c_str (), &endp); // declared with warn_unused_result
+  (void) strtod (s.c_str (), &endp); // declared with warn_unused_result
   return endp == s.c_str () + s.size ();
 }
 
--- a/src/network/model/buffer.cc	Sun Apr 17 14:34:40 2011 +0200
+++ b/src/network/model/buffer.cc	Sun Apr 17 14:54:42 2011 +0200
@@ -843,7 +843,6 @@
   NS_ASSERT (start.m_zeroEnd == end.m_zeroEnd);
   NS_ASSERT (m_data != start.m_data);
   uint32_t size = end.m_current - start.m_current;
-  Iterator cur = start;
   NS_ASSERT_MSG (CheckNoZero (m_current, m_current + size),
                  GetWriteErrorMessage ());
   if (start.m_current <= start.m_zeroStart)
--- a/src/network/test/packet-metadata-test.cc	Sun Apr 17 14:34:40 2011 +0200
+++ b/src/network/test/packet-metadata-test.cc	Sun Apr 17 14:54:42 2011 +0200
@@ -784,6 +784,8 @@
   p1 = p->CreateFragment (0,6);
   p2 = p->CreateFragment (6,535-6);
   p1->AddAtEnd(p2);
+
+  NS_TEST_EXPECT_MSG_EQ(result, true, "PacketMetadataTest failed");
 }
 //-----------------------------------------------------------------------------
 class PacketMetadataTestSuite : public TestSuite
--- a/src/nix-vector-routing/examples/nms-p2p-nix.cc	Sun Apr 17 14:34:40 2011 +0200
+++ b/src/nix-vector-routing/examples/nms-p2p-nix.cc	Sun Apr 17 14:54:42 2011 +0200
@@ -60,7 +60,6 @@
 
 void Progress ()
 {
-  Time now = Simulator::Now ();
   Simulator::Schedule (Seconds (0.1), Progress);
 }
 
--- a/src/point-to-point/model/point-to-point-remote-channel.cc	Sun Apr 17 14:34:40 2011 +0200
+++ b/src/point-to-point/model/point-to-point-remote-channel.cc	Sun Apr 17 14:54:42 2011 +0200
@@ -67,9 +67,9 @@
   uint32_t wire = src == GetSource (0) ? 0 : 1;
   Ptr<PointToPointNetDevice> dst = GetDestination (wire);
 
+#ifdef NS3_MPI
   // Calculate the rxTime (absolute)
   Time rxTime = Simulator::Now () + txTime + GetDelay ();
-#ifdef NS3_MPI
   MpiInterface::SendPacket (p, rxTime, dst->GetNode ()->GetId (), dst->GetIfIndex ());
 #else
   NS_FATAL_ERROR ("Can't use distributed simulator without MPI compiled in");
--- a/src/spectrum/test/spectrum-value-test.cc	Sun Apr 17 14:34:40 2011 +0200
+++ b/src/spectrum/test/spectrum-value-test.cc	Sun Apr 17 14:54:42 2011 +0200
@@ -118,7 +118,6 @@
   Ptr<SpectrumModel> f = Create<SpectrumModel> (freqs);
 
   SpectrumValue v1 (f), v2 (f), v3 (f), v4 (f), v5 (f), v6 (f), v7 (f), v8 (f), v9 (f), v10 (f);
-  double nv1, nv2;
 
   double doubleValue;
 
@@ -185,16 +184,6 @@
   v10[3] = -0.794244913190;
   v10[4] =  0.878579343459;
 
-  nv1 =  1.76957619675970;
-  nv2 =  1.68451062071783;
-
-
-
-
-  // std::cerr.precision(15);
-
-  // std::cerr<< nv1 << " "<<   v1.Norm() << std::endl;
-
   SpectrumValue tv3 (f), tv4 (f), tv5 (f), tv6 (f);
 
   tv3 = v1 + v2;
--- a/src/topology-read/model/rocketfuel-topology-reader.cc	Sun Apr 17 14:34:40 2011 +0200
+++ b/src/topology-read/model/rocketfuel-topology-reader.cc	Sun Apr 17 14:54:42 2011 +0200
@@ -86,8 +86,8 @@
   std::string nuid;
   bool dns = false;
   bool bb = false;
-  int num_neigh = 0;
-  int ext_conn = 0;
+  int num_neigh_s = 0;
+  unsigned int num_neigh = 0;
   int radius = 0;
   std::vector <std::string> neigh_list;
   NodeContainer nodes;
@@ -101,12 +101,15 @@
   if (argv[3])
     bb = true;
 
-  num_neigh = ::atoi (argv[4]);
-
-  /* the first char should be '&' */
-  if (argv[5])
+  num_neigh_s = ::atoi (argv[4]);
+  if (num_neigh_s < 0)
     {
-      ext_conn = ::atoi (&argv[5][1]);
+      num_neigh = 0;
+      NS_LOG_WARN ("Negative number of neighbors given");
+    }
+  else
+    {
+      num_neigh = num_neigh_s;
     }
 
   /* neighbors */
@@ -120,6 +123,10 @@
           neigh_list.push_back (nbr + 1);
         }
     }
+  if (num_neigh != neigh_list.size ())
+    {
+      NS_LOG_WARN ("Given number of neighbors = " << num_neigh << " != size of neighbors list = " << neigh_list.size ());
+    }
 
   /* externs */
   if (argv[7])
@@ -187,13 +194,12 @@
   /* uid @loc [+] [bb] (num_neigh) [&ext] -> <nuid-1> <nuid-2> ... {-euid} ... =name[!] rn */
   std::string sname;
   std::string tname;
-  double weight;
   char *endptr;
   NodeContainer nodes;
 
   sname = argv[0];
   tname = argv[1];
-  weight = strtod (argv[2], &endptr);
+  (void) strtod (argv[2], &endptr); // weight
   if (*endptr != '\0')
     {
       NS_LOG_WARN ("invalid weight: " << argv[2]);
--- a/src/uan/model/uan-phy-gen.cc	Sun Apr 17 14:34:40 2011 +0200
+++ b/src/uan/model/uan-phy-gen.cc	Sun Apr 17 14:54:42 2011 +0200
@@ -139,8 +139,6 @@
   double clearingTime = (m_hops - 1.0) * ts;
   double csp = pdp.SumTapsFromMaxNc (Seconds (0), Seconds (ts));
 
-  UanPdp::Iterator tmpIt = pdp.GetBegin ();
-
   // Get maximum arrival offset
   double maxAmp = -1;
   double maxTapDelay = 0.0;
--- a/src/uan/test/uan-test.cc	Sun Apr 17 14:34:40 2011 +0200
+++ b/src/uan/test/uan-test.cc	Sun Apr 17 14:54:42 2011 +0200
@@ -245,8 +245,7 @@
 
 #endif // UAN_PROP_BH_INSTALLED
 
-  bool phyTestsError;
-  phyTestsError = DoPhyTests ();
+  DoPhyTests ();
 }
 
 
--- a/src/wifi/model/dcf-manager.cc	Sun Apr 17 14:34:40 2011 +0200
+++ b/src/wifi/model/dcf-manager.cc	Sun Apr 17 14:54:42 2011 +0200
@@ -390,8 +390,6 @@
 void
 DcfManager::DoGrantAccess (void)
 {
-  Time accessGrantStart = GetAccessGrantStart ();
-
   uint32_t k = 0;
   for (States::const_iterator i = m_states.begin (); i != m_states.end (); k++)
     {
--- a/src/wifi/model/wifi-net-device.cc	Sun Apr 17 14:34:40 2011 +0200
+++ b/src/wifi/model/wifi-net-device.cc	Sun Apr 17 14:54:42 2011 +0200
@@ -253,7 +253,6 @@
   NS_ASSERT (Mac48Address::IsMatchingType (dest));
 
   Mac48Address realTo = Mac48Address::ConvertFrom (dest);
-  Mac48Address realFrom = Mac48Address::ConvertFrom (GetAddress ());
 
   LlcSnapHeader llc;
   llc.SetType (protocolNumber);
--- a/src/wifi/test/wifi-test.cc	Sun Apr 17 14:34:40 2011 +0200
+++ b/src/wifi/test/wifi-test.cc	Sun Apr 17 14:54:42 2011 +0200
@@ -207,7 +207,6 @@
 void
 InterferenceHelperSequenceTest::SwitchCh (Ptr<WifiNetDevice> dev)
 {
-  Time now = Simulator::Now();
   Ptr<WifiPhy> p = dev->GetPhy ();
   p->SetChannelNumber (1);
 }
--- a/src/wimax/model/bs-scheduler-rtps.cc	Sun Apr 17 14:34:40 2011 +0200
+++ b/src/wimax/model/bs-scheduler-rtps.cc	Sun Apr 17 14:54:42 2011 +0200
@@ -627,13 +627,11 @@
   Ptr<PacketBurst> burst = Create<PacketBurst> ();
 
   std::vector<ServiceFlow*>::iterator iter;
-  ServiceFlowRecord *serviceFlowRecord;
   std::vector<ServiceFlow*> serviceFlows;
 
   serviceFlows = GetBs ()->GetServiceFlowManager ()->GetServiceFlows (ServiceFlow::SF_TYPE_NRTPS);
   for (iter = serviceFlows.begin (); iter != serviceFlows.end (); ++iter)
     {
-      serviceFlowRecord = (*iter)->GetRecord ();
       connection = (*iter)->GetConnection ();
 
       while ((*iter)->HasPackets () && availableSymbols > 0)
@@ -684,13 +682,11 @@
   Ptr<PacketBurst> burst = Create<PacketBurst> ();
 
   std::vector<ServiceFlow*>::iterator iter;
-  ServiceFlowRecord *serviceFlowRecord;
   std::vector<ServiceFlow*> serviceFlows;
 
   serviceFlows = GetBs ()->GetServiceFlowManager ()->GetServiceFlows (ServiceFlow::SF_TYPE_BE);
   for (iter = serviceFlows.begin (); iter != serviceFlows.end (); ++iter)
     {
-      serviceFlowRecord = (*iter)->GetRecord ();
       connection = (*iter)->GetConnection ();
 
       while ((*iter)->HasPackets () && availableSymbols > 0)
--- a/src/wimax/model/bs-uplink-scheduler-mbqos.cc	Sun Apr 17 14:34:40 2011 +0200
+++ b/src/wimax/model/bs-uplink-scheduler-mbqos.cc	Sun Apr 17 14:54:42 2011 +0200
@@ -310,9 +310,6 @@
                       timestamp =
                         (*(ssRecord->GetServiceFlows (ServiceFlow::SF_TYPE_UGS).begin ()))->GetRecord ()->GetLastGrantTime ()
                         + MilliSeconds ((*(ssRecord->GetServiceFlows (ServiceFlow::SF_TYPE_UGS).begin ()))->GetUnsolicitedGrantInterval ());
-                      Time
-                      uInterval =
-                        MilliSeconds ((*(ssRecord->GetServiceFlows (ServiceFlow::SF_TYPE_UGS).begin ()))->GetUnsolicitedGrantInterval ());
                       
                       Time frame = Time ((timestamp - Simulator::Now ()) / frame_duration);
 
@@ -500,10 +497,8 @@
 {
   uint32_t allocSizeBytes = allocationSizeBytes;
   uint32_t allocSizeSymbols = 0;
-  uint16_t sduSize = 0;
 
   ServiceFlowRecord *record = serviceFlow->GetRecord ();
-  sduSize = serviceFlow->GetSduSize ();
 
   uint32_t requiredBandwidth = record->GetRequestedBandwidth ();
 
@@ -656,7 +651,6 @@
   if (m_uplinkJobs_inter.size () > 0)
     {
       std::list<Ptr<UlJob> >::iterator iter = m_uplinkJobs_inter.begin ();
-      std::list<Ptr<UlJob> >::iterator iterPrev = m_uplinkJobs_inter.begin ();
 
       while (iter != m_uplinkJobs_inter.end () && availableSymbols)
         {
--- a/src/wimax/model/ss-link-manager.cc	Sun Apr 17 14:34:40 2011 +0200
+++ b/src/wimax/model/ss-link-manager.cc	Sun Apr 17 14:54:42 2011 +0200
@@ -438,6 +438,7 @@
 void
 SSLinkManager::AdjustRangingParameters (const RngRsp &rngrsp)
 {
+#if 0 /* a template for future implementation following */
   bool successful = true;
   uint8_t temp = rngrsp.GetTimingAdjust ();
   temp = rngrsp.GetPowerLevelAdjust ();
@@ -449,6 +450,7 @@
     {
       // code for setting ranging anomalies goes here
     }
+#endif
 }
 
 void
--- a/src/wimax/model/ss-net-device.cc	Sun Apr 17 14:34:40 2011 +0200
+++ b/src/wimax/model/ss-net-device.cc	Sun Apr 17 14:54:42 2011 +0200
@@ -1081,9 +1081,11 @@
            mechanism automatically passes it as parameter.*/
         }
 
+#if 0 /* a template for future implementation following */
       uint8_t temp = iter->GetDiuc ();
       temp = iter->GetPreamblePresent ();
       temp = iter->GetStartTime ();
+#endif
     }
 }
 
--- a/src/wimax/model/ss-scheduler.cc	Sun Apr 17 14:34:40 2011 +0200
+++ b/src/wimax/model/ss-scheduler.cc	Sun Apr 17 14:54:42 2011 +0200
@@ -85,12 +85,10 @@
     }
 
   Ptr<Packet> packet;
-  ServiceFlow *serviceFlow;
 
   while (connection && connection->HasPackets (packetType))
     {
       NS_LOG_INFO ("FRAG_DEBUG: SS Scheduler" << std::endl);
-      serviceFlow = connection->GetServiceFlow ();
 
       uint32_t availableByte = m_ss->GetPhy ()->
         GetNrBytes (availableSymbols, modulationType);
--- a/src/wimax/test/wimax-fragmentation-test.cc	Sun Apr 17 14:34:40 2011 +0200
+++ b/src/wimax/test/wimax-fragmentation-test.cc	Sun Apr 17 14:54:42 2011 +0200
@@ -76,7 +76,6 @@
   Cid cid;
   WimaxConnection *connectionTx = new WimaxConnection (cid, Cid::TRANSPORT);
   WimaxConnection *connectionRx = new WimaxConnection (cid, Cid::TRANSPORT);
-  bool testResult = false;
 
   // A Packet of 1000 bytes has been created.
   // It will be fragmentated into 4 fragments and then defragmentated into fullPacket.
@@ -111,39 +110,16 @@
       if (type)
         {
           // Check if there is a fragmentation Subheader
-          uint8_t tmpType = type;
-          if (((tmpType >> 2) & 1) != 1)
-            {
-              // The packet is not a fragment
-              testResult = true;
-              break;
-            }
+          NS_TEST_EXPECT_MSG_EQ (((type >> 2) & 1), 1, "The packet is not a fragment");
         }
 
       // remove header from the received fragment
       fragment->RemoveHeader (fragSubhdr);
       uint32_t fc = fragSubhdr.GetFc ();
 
-
-      if (fc == 1 && i != 0)
-        {
-          // the fragment in not the first one
-          testResult = true;
-          break;
-        }
-      if (fc == 2 && i != 3)
-        {
-          // the fragment in not the latest one
-          testResult = true;
-          break;
-        }
-      if ((fc == 3 && i != 1) && (fc == 3 && i != 2))
-        {
-          // the fragment in not the middle one
-          testResult = true;
-          break;
-        }
-
+      NS_TEST_EXPECT_MSG_EQ ((fc == 1 && i != 0), false, "The fragment in not the first one");
+      NS_TEST_EXPECT_MSG_EQ ((fc == 2 && i != 3), false, "The fragment in not the latest one");
+      NS_TEST_EXPECT_MSG_EQ (((fc == 3 && i != 1) && (fc == 3 && i != 2)), false, "The fragment in not the middle one");
 
       if (fc != 2)
         {
@@ -167,12 +143,7 @@
             }
           connectionRx->ClearFragmentsQueue ();
 
-          if (fullPacket->GetSize () != 1000)
-            {
-              // The defragmentation is correct.
-              testResult = true; // Test is passed
-              break;
-            }
+          NS_TEST_EXPECT_MSG_EQ (fullPacket->GetSize (), 1000, "The defragmentation is incorrect");
         }
     }
   delete connectionTx;