void DsrCacheEntryTest::DoRun () { Ptr<dsr::RouteCache> rcache = CreateObject<dsr::RouteCache> (); std::vector<Ipv4Address> ip; ip.push_back (Ipv4Address ("0.0.0.0")); ip.push_back (Ipv4Address ("0.0.0.1")); Ipv4Address dst = Ipv4Address ("0.0.0.1"); dsr::RouteCacheEntry entry (ip, dst, Seconds (1)); NS_TEST_EXPECT_MSG_EQ (entry.GetVector ().size (), 2, "trivial"); NS_TEST_EXPECT_MSG_EQ (entry.GetDestination (), Ipv4Address ("0.0.0.1"), "trivial"); NS_TEST_EXPECT_MSG_EQ (entry.GetExpireTime (), Seconds (1), "trivial"); entry.SetExpireTime (Seconds (3)); NS_TEST_EXPECT_MSG_EQ (entry.GetExpireTime (), Seconds (3), "trivial"); entry.SetDestination (Ipv4Address ("1.1.1.1")); NS_TEST_EXPECT_MSG_EQ (entry.GetDestination (), Ipv4Address ("1.1.1.1"), "trivial"); ip.push_back (Ipv4Address ("0.0.0.2")); entry.SetVector (ip); NS_TEST_EXPECT_MSG_EQ (entry.GetVector ().size (), 3, "trivial"); NS_TEST_EXPECT_MSG_EQ (rcache->AddRoute (entry), true, "trivial"); std::vector<Ipv4Address> ip2; ip2.push_back (Ipv4Address ("1.1.1.0")); ip2.push_back (Ipv4Address ("1.1.1.1")); Ipv4Address dst2 = Ipv4Address ("1.1.1.1"); dsr::RouteCacheEntry entry2 (ip2, dst2, Seconds (2)); dsr::RouteCacheEntry newEntry; NS_TEST_EXPECT_MSG_EQ (rcache->AddRoute (entry2), true, "trivial"); NS_TEST_EXPECT_MSG_EQ (rcache->LookupRoute (dst2, newEntry), true, "trivial"); NS_TEST_EXPECT_MSG_EQ (rcache->DeleteRoute (Ipv4Address ("2.2.2.2")), false, "trivial"); NS_TEST_EXPECT_MSG_EQ (rcache->DeleteRoute (Ipv4Address ("1.1.1.1")), true, "trivial"); NS_TEST_EXPECT_MSG_EQ (rcache->DeleteRoute (Ipv4Address ("1.1.1.1")), false, "trivial"); }