Compare commits
1
Commits
master
...
hotfix-0.4.1
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
704430ca07 |
No files matched your search
@@ -1,6 +1,6 @@
|
||||
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
|
||||
/**
|
||||
* Copyright (c) 2014-2015, Regents of the University of California,
|
||||
* Copyright (c) 2014-2016, Regents of the University of California,
|
||||
* Arizona Board of Regents,
|
||||
* Colorado State University,
|
||||
* University Pierre & Marie Curie, Sorbonne University,
|
||||
@@ -36,7 +36,9 @@ class NameTree;
|
||||
|
||||
namespace name_tree {
|
||||
class Entry;
|
||||
}
|
||||
} // namespace name_tree
|
||||
|
||||
class Pit;
|
||||
|
||||
namespace pit {
|
||||
|
||||
@@ -183,6 +185,7 @@ private:
|
||||
|
||||
friend class nfd::NameTree;
|
||||
friend class nfd::name_tree::Entry;
|
||||
friend class nfd::Pit;
|
||||
};
|
||||
|
||||
inline const Interest&
|
||||
|
||||
@@ -113,7 +113,7 @@ Pit::findAllDataMatches(const Data& data) const
|
||||
void
|
||||
Pit::erase(shared_ptr<pit::Entry> pitEntry)
|
||||
{
|
||||
shared_ptr<name_tree::Entry> nameTreeEntry = m_nameTree.get(*pitEntry);
|
||||
shared_ptr<name_tree::Entry> nameTreeEntry = pitEntry->m_nameTreeEntry;
|
||||
BOOST_ASSERT(static_cast<bool>(nameTreeEntry));
|
||||
|
||||
nameTreeEntry->erasePitEntry(pitEntry);
|
||||
|
||||
@@ -431,6 +431,34 @@ BOOST_AUTO_TEST_CASE(EraseNameTreeEntry)
|
||||
BOOST_CHECK_EQUAL(nameTree.size(), nNameTreeEntriesBefore);
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(EraseWithFullName)
|
||||
{
|
||||
shared_ptr<Data> data = makeData("/test");
|
||||
shared_ptr<Interest> interest = makeInterest(data->getFullName());
|
||||
|
||||
NameTree nameTree(16);
|
||||
Pit pit(nameTree);
|
||||
|
||||
BOOST_CHECK_EQUAL(pit.size(), 0);
|
||||
|
||||
BOOST_CHECK_EQUAL(pit.insert(*interest).second, true);
|
||||
BOOST_CHECK_EQUAL(pit.size(), 1);
|
||||
BOOST_CHECK(pit.find(*interest) != nullptr);
|
||||
|
||||
BOOST_CHECK_EQUAL(pit.insert(*interest).second, false);
|
||||
BOOST_CHECK_EQUAL(pit.size(), 1);
|
||||
shared_ptr<pit::Entry> pitEntry = pit.find(*interest);
|
||||
BOOST_REQUIRE(pitEntry != nullptr);
|
||||
|
||||
pit.erase(pitEntry);
|
||||
BOOST_CHECK_EQUAL(pit.size(), 0);
|
||||
BOOST_CHECK(pit.find(*interest) == nullptr);
|
||||
|
||||
BOOST_CHECK_EQUAL(pit.insert(*interest).second, true);
|
||||
BOOST_CHECK_EQUAL(pit.size(), 1);
|
||||
BOOST_CHECK(pit.find(*interest) != nullptr);
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(FindAllDataMatches)
|
||||
{
|
||||
Name nameA ("ndn:/A");
|
||||
|
||||
Reference in new issue
Block a user