cs+fw: omitted FreshnessPeriod implies always stale
refs #3944
Change-Id: I018242b3ba5850e8a126f956af4150b512406efd
diff --git a/tests/daemon/table/cs.t.cpp b/tests/daemon/table/cs.t.cpp
index ecbbf38..0e14b0f 100644
--- a/tests/daemon/table/cs.t.cpp
+++ b/tests/daemon/table/cs.t.cpp
@@ -47,7 +47,6 @@
insert(uint32_t id, const Name& name, const std::function<void(Data&)>& modifyData = nullptr)
{
shared_ptr<Data> data = makeData(name);
- data->setFreshnessPeriod(time::milliseconds(99999));
data->setContent(reinterpret_cast<const uint8_t*>(&id), sizeof(id));
if (modifyData != nullptr) {
@@ -253,15 +252,12 @@
CHECK_CS_FIND(6);
}
-BOOST_AUTO_TEST_CASE_EXPECTED_FAILURES(MustBeFresh, 1)
BOOST_AUTO_TEST_CASE(MustBeFresh)
{
- ///\todo #3944 add /A/1 without FreshnessPeriod, which is same as FreshnessPeriod=0ms
+ insert(1, "/A/1"); // omitted FreshnessPeriod means FreshnessPeriod = 0 ms
insert(2, "/A/2", [] (Data& data) { data.setFreshnessPeriod(time::seconds(0)); });
insert(3, "/A/3", [] (Data& data) { data.setFreshnessPeriod(time::seconds(1)); });
insert(4, "/A/4", [] (Data& data) { data.setFreshnessPeriod(time::seconds(3600)); });
- insert(5, "/A/5"); // omitted FreshnessPeriod means infinite
- ///\todo #3944 delete /A/5
// lookup at exact same moment as insertion is not tested because this won't happen in reality
@@ -283,8 +279,7 @@
this->advanceClocks(time::seconds(3500)); // @7002s
startInterest("/A")
.setMustBeFresh(true);
- CHECK_CS_FIND(5); // expected failure https://redmine.named-data.net/issues/3944#note-2
- ///\todo #3944 this should not find any Data
+ CHECK_CS_FIND(0);
}
BOOST_AUTO_TEST_CASE(DigestOrder)
diff --git a/tests/daemon/table/pit-entry.t.cpp b/tests/daemon/table/pit-entry.t.cpp
index fad1528..73cf7de 100644
--- a/tests/daemon/table/pit-entry.t.cpp
+++ b/tests/daemon/table/pit-entry.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/**
- * Copyright (c) 2014-2016, Regents of the University of California,
+ * Copyright (c) 2014-2017, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -178,8 +178,6 @@
BOOST_AUTO_TEST_CASE(Lifetime)
{
shared_ptr<Interest> interest = makeInterest("ndn:/7oIEurbgy6");
- // library uses -1 to indicate unset lifetime
- BOOST_ASSERT(interest->getInterestLifetime() < time::milliseconds::zero());
shared_ptr<Face> face = make_shared<DummyFace>();
Entry entry(*interest);
diff --git a/tests/daemon/table/pit.t.cpp b/tests/daemon/table/pit.t.cpp
index 8a784f6..a468ed0 100644
--- a/tests/daemon/table/pit.t.cpp
+++ b/tests/daemon/table/pit.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/**
- * Copyright (c) 2014-2016, Regents of the University of California,
+ * Copyright (c) 2014-2017, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -78,6 +78,12 @@
BOOST_CHECK_EQUAL(insertResult.second, true);
BOOST_CHECK_EQUAL(pit.size(), 1);
+ // same as A
+ shared_ptr<Interest> interestA2 = make_shared<Interest>(*interestA);
+ insertResult = pit.insert(*interestA2);
+ BOOST_CHECK_EQUAL(insertResult.second, false); // sharing the same PIT entry
+ BOOST_CHECK_EQUAL(pit.size(), 1);
+
// A+MinSuffixComponents
shared_ptr<Interest> interestB = make_shared<Interest>(*interestA);
interestB->setMinSuffixComponents(2);
@@ -120,47 +126,40 @@
BOOST_CHECK_EQUAL(insertResult.second, true);
BOOST_CHECK_EQUAL(pit.size(), 7);
- // A+ChildSelector0
- shared_ptr<Interest> interestH = make_shared<Interest>(*interestA);
- interestH->setChildSelector(0);
- insertResult = pit.insert(*interestH);
- BOOST_CHECK_EQUAL(insertResult.second, true);
- BOOST_CHECK_EQUAL(pit.size(), 8);
-
// A+ChildSelector1
shared_ptr<Interest> interestI = make_shared<Interest>(*interestA);
interestI->setChildSelector(1);
insertResult = pit.insert(*interestI);
BOOST_CHECK_EQUAL(insertResult.second, true);
- BOOST_CHECK_EQUAL(pit.size(), 9);
+ BOOST_CHECK_EQUAL(pit.size(), 8);
// A+MustBeFresh
shared_ptr<Interest> interestJ = make_shared<Interest>(*interestA);
interestJ->setMustBeFresh(true);
insertResult = pit.insert(*interestJ);
BOOST_CHECK_EQUAL(insertResult.second, true);
- BOOST_CHECK_EQUAL(pit.size(), 10);
+ BOOST_CHECK_EQUAL(pit.size(), 9);
// A+InterestLifetime
shared_ptr<Interest> interestK = make_shared<Interest>(*interestA);
interestK->setInterestLifetime(time::milliseconds(1000));
insertResult = pit.insert(*interestK);
- BOOST_CHECK_EQUAL(insertResult.second, false);// only guiders differ
- BOOST_CHECK_EQUAL(pit.size(), 10);
+ BOOST_CHECK_EQUAL(insertResult.second, false); // only guiders differ
+ BOOST_CHECK_EQUAL(pit.size(), 9);
// A+Nonce
shared_ptr<Interest> interestL = make_shared<Interest>(*interestA);
interestL->setNonce(2192);
insertResult = pit.insert(*interestL);
- BOOST_CHECK_EQUAL(insertResult.second, false);// only guiders differ
- BOOST_CHECK_EQUAL(pit.size(), 10);
+ BOOST_CHECK_EQUAL(insertResult.second, false); // only guiders differ
+ BOOST_CHECK_EQUAL(pit.size(), 9);
// different Name+Exclude1
shared_ptr<Interest> interestM = make_shared<Interest>(name2);
interestM->setExclude(exclude1);
insertResult = pit.insert(*interestM);
BOOST_CHECK_EQUAL(insertResult.second, true);
- BOOST_CHECK_EQUAL(pit.size(), 11);
+ BOOST_CHECK_EQUAL(pit.size(), 10);
}
BOOST_AUTO_TEST_CASE(Erase)