src/devices/mesh/dot11s/ie-dot11s-prep.cc
changeset 5004 29928e8d1a1c
parent 4951 acaf07eb8542
child 5018 aecd3eedd65f
equal deleted inserted replaced
5003:ad4576d966a6 5004:29928e8d1a1c
   226 }
   226 }
   227 
   227 
   228 #ifdef RUN_SELF_TESTS
   228 #ifdef RUN_SELF_TESTS
   229 
   229 
   230 /// Built-in self test for IePrep
   230 /// Built-in self test for IePrep
   231 struct IePrepBist : public Test 
   231 struct IePrepBist : public IeTest 
   232 {
   232 {
   233   IePrepBist () : Test ("Mesh/802.11s/IE/PREP") {};
   233   IePrepBist () : IeTest ("Mesh/802.11s/IE/PREP") {};
   234   virtual bool RunTests(); 
   234   virtual bool RunTests(); 
   235 };
   235 };
   236 
   236 
   237 /// Test instance
   237 /// Test instance
   238 static IePrepBist g_IePrepBist;
   238 static IePrepBist g_IePrepBist;
   250   a.SetDestinationSeqNumber (123);
   250   a.SetDestinationSeqNumber (123);
   251   a.SetLifetime (5000);
   251   a.SetLifetime (5000);
   252   a.SetMetric (4321);
   252   a.SetMetric (4321);
   253   a.SetOriginatorAddress (Mac48Address("33:00:22:00:11:00"));
   253   a.SetOriginatorAddress (Mac48Address("33:00:22:00:11:00"));
   254   a.SetOriginatorSeqNumber (666);
   254   a.SetOriginatorSeqNumber (666);
   255   // test roundtrip serialization
   255   
   256   Ptr<Packet> packet = Create<Packet> ();
   256   result = result && TestRoundtripSerialization (a);
   257   packet->AddHeader (a);
       
   258   IePrep b;
       
   259   packet->RemoveHeader (b);
       
   260   NS_TEST_ASSERT_EQUAL (a, b);
       
   261   // test FindFirst()
       
   262   packet->AddHeader (a);
       
   263   IePrep c;
       
   264   bool ok = c.FindFirst(packet);
       
   265   NS_TEST_ASSERT (ok);
       
   266   NS_TEST_ASSERT_EQUAL (a, c);
       
   267   return result;
   257   return result;
   268 }
   258 }
   269 
   259 
   270 #endif // RUN_SELF_TESTS
   260 #endif // RUN_SELF_TESTS
   271  
   261