tests: move makeInterest/makeData/etc to ndn::tests namespace
refs #2376
Change-Id: If824388f1e2859d7d2199cd622db2aa1a3277798
diff --git a/tests/unit-tests/face.t.cpp b/tests/unit-tests/face.t.cpp
index 877e6bd..1fc9c86 100644
--- a/tests/unit-tests/face.t.cpp
+++ b/tests/unit-tests/face.t.cpp
@@ -78,8 +78,8 @@
advanceClocks(time::milliseconds(1), 40);
- face.receive(*util::makeData("/Bye/World/a"));
- face.receive(*util::makeData("/Hello/World/a"));
+ face.receive(*makeData("/Bye/World/a"));
+ face.receive(*makeData("/Hello/World/a"));
advanceClocks(time::milliseconds(1), 100);
@@ -113,8 +113,8 @@
advanceClocks(time::milliseconds(1), 40);
- face.receive(*util::makeData("/Bye/World/a"));
- face.receive(*util::makeData("/Hello/World/a"));
+ face.receive(*makeData("/Bye/World/a"));
+ face.receive(*makeData("/Hello/World/a"));
advanceClocks(time::milliseconds(1), 100);
@@ -131,7 +131,7 @@
BOOST_FAIL("Unexpected timeout");
}));
advanceClocks(time::milliseconds(1), 40);
- face.receive(*util::makeData("/Hello/World/a/1/xxxxx"));
+ face.receive(*makeData("/Hello/World/a/1/xxxxx"));
advanceClocks(time::milliseconds(1), 100);
@@ -241,7 +241,7 @@
face.removePendingInterest(interestId);
advanceClocks(time::milliseconds(10));
- face.receive(*util::makeData("/Hello/World/!"));
+ face.receive(*makeData("/Hello/World/!"));
advanceClocks(time::milliseconds(10), 100);
}
@@ -264,8 +264,8 @@
BOOST_CHECK_EQUAL(face.getNPendingInterests(), 0);
- face.receive(*util::makeData("/Hello/World/0"));
- face.receive(*util::makeData("/Hello/World/1"));
+ face.receive(*makeData("/Hello/World/0"));
+ face.receive(*makeData("/Hello/World/1"));
advanceClocks(time::milliseconds(10), 100);
}
diff --git a/tests/unit-tests/make-interest-data.cpp b/tests/unit-tests/make-interest-data.cpp
new file mode 100644
index 0000000..ab9c6ff
--- /dev/null
+++ b/tests/unit-tests/make-interest-data.cpp
@@ -0,0 +1,80 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/**
+ * Copyright (c) 2013-2016 Regents of the University of California.
+ *
+ * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
+ *
+ * ndn-cxx library is free software: you can redistribute it and/or modify it under the
+ * terms of the GNU Lesser General Public License as published by the Free Software
+ * Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * ndn-cxx library is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ *
+ * You should have received copies of the GNU General Public License and GNU Lesser
+ * General Public License along with ndn-cxx, e.g., in COPYING.md file. If not, see
+ * <http://www.gnu.org/licenses/>.
+ *
+ * See AUTHORS.md for complete list of ndn-cxx authors and contributors.
+ */
+
+#include "make-interest-data.hpp"
+#include "security/signature-sha256-with-rsa.hpp"
+
+namespace ndn {
+namespace tests {
+
+shared_ptr<Interest>
+makeInterest(const Name& name, uint32_t nonce)
+{
+ auto interest = make_shared<Interest>(name);
+ if (nonce != 0) {
+ interest->setNonce(nonce);
+ }
+ return interest;
+}
+
+shared_ptr<Data>
+makeData(const Name& name)
+{
+ auto data = make_shared<Data>(name);
+ return signData(data);
+}
+
+Data&
+signData(Data& data)
+{
+ ndn::SignatureSha256WithRsa fakeSignature;
+ fakeSignature.setValue(ndn::encoding::makeEmptyBlock(tlv::SignatureValue));
+ data.setSignature(fakeSignature);
+ data.wireEncode();
+ return data;
+}
+
+shared_ptr<Link>
+makeLink(const Name& name, std::initializer_list<std::pair<uint32_t, Name>> delegations)
+{
+ auto link = make_shared<Link>(name, delegations);
+ signData(link);
+ return link;
+}
+
+lp::Nack
+makeNack(const Interest& interest, lp::NackReason reason)
+{
+ lp::Nack nack(interest);
+ nack.setReason(reason);
+ return nack;
+}
+
+lp::Nack
+makeNack(const Name& name, uint32_t nonce, lp::NackReason reason)
+{
+ Interest interest(name);
+ interest.setNonce(nonce);
+ return makeNack(interest, reason);
+}
+
+} // namespace tests
+} // namespace ndn
diff --git a/tests/unit-tests/make-interest-data.hpp b/tests/unit-tests/make-interest-data.hpp
index d5770af..36c8deb 100644
--- a/tests/unit-tests/make-interest-data.hpp
+++ b/tests/unit-tests/make-interest-data.hpp
@@ -1,11 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/**
- * Copyright (c) 2013-2015 Regents of the University of California,
- * Arizona Board of Regents,
- * Colorado State University,
- * University Pierre & Marie Curie, Sorbonne University,
- * Washington University in St. Louis,
- * Beijing Institute of Technology
+ * Copyright (c) 2013-2016 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -27,66 +22,66 @@
#ifndef NDN_TESTS_UNIT_TESTS_MAKE_INTEREST_DATA_HPP
#define NDN_TESTS_UNIT_TESTS_MAKE_INTEREST_DATA_HPP
-#include "boost-test.hpp"
-
-#include "security/key-chain.hpp"
+#include "interest.hpp"
+#include "data.hpp"
+#include "link.hpp"
#include "lp/nack.hpp"
namespace ndn {
-namespace util {
+namespace tests {
-inline shared_ptr<Interest>
-makeInterest(const Name& name, uint32_t nonce = 0)
-{
- auto interest = make_shared<Interest>(name);
- if (nonce != 0) {
- interest->setNonce(nonce);
- }
- return interest;
-}
+/** \brief create an Interest
+ * \param name Interest name
+ * \param nonce if non-zero, set Nonce to this value
+ * (useful for creating Nack with same Nonce)
+ */
+shared_ptr<Interest>
+makeInterest(const Name& name, uint32_t nonce = 0);
+/** \brief create a Data with fake signature
+ * \note Data may be modified afterwards without losing the fake signature.
+ * If a real signature is desired, sign again with KeyChain.
+ */
+shared_ptr<Data>
+makeData(const Name& name);
+
+/** \brief add a fake signature to Data
+ */
+Data&
+signData(Data& data);
+
+/** \brief add a fake signature to Data
+ */
inline shared_ptr<Data>
signData(shared_ptr<Data> data)
{
- SignatureSha256WithRsa fakeSignature;
- fakeSignature.setValue(encoding::makeEmptyBlock(tlv::SignatureValue));
- data->setSignature(fakeSignature);
- data->wireEncode();
+ signData(*data);
return data;
}
-inline shared_ptr<Data>
-makeData(const Name& name)
-{
- auto data = make_shared<Data>(name);
- return signData(data);
-}
+/** \brief create a Link object with fake signature
+ * \note Link may be modified afterwards without losing the fake signature.
+ * If a real signature is desired, sign again with KeyChain.
+ */
+shared_ptr<Link>
+makeLink(const Name& name, std::initializer_list<std::pair<uint32_t, Name>> delegations);
-inline shared_ptr<Link>
-makeLink(const Name& name, std::initializer_list<std::pair<uint32_t, Name>> delegations)
-{
- auto link = make_shared<Link>(name, delegations);
- signData(link);
- return link;
-}
+/** \brief create a Nack
+ * \param interest Interest
+ * \param reason Nack reason
+ */
+lp::Nack
+makeNack(const Interest& interest, lp::NackReason reason);
-inline lp::Nack
-makeNack(const Interest& interest, lp::NackReason reason)
-{
- lp::Nack nack(interest);
- nack.setReason(reason);
- return nack;
-}
+/** \brief create a Nack
+ * \param name Interest name
+ * \param nonce Interest nonce
+ * \param reason Nack reason
+ */
+lp::Nack
+makeNack(const Name& name, uint32_t nonce, lp::NackReason reason);
-inline lp::Nack
-makeNack(const Name& name, uint32_t nonce, lp::NackReason reason)
-{
- Interest interest(name);
- interest.setNonce(nonce);
- return makeNack(interest, reason);
-}
-
-} // namespace util
+} // namespace tests
} // namespace ndn
#endif // NDN_TESTS_UNIT_TESTS_MAKE_INTEREST_DATA_HPP
diff --git a/tests/unit-tests/management/nfd-controller.t.cpp b/tests/unit-tests/management/nfd-controller.t.cpp
index 1beb5db..bc9aa1a 100644
--- a/tests/unit-tests/management/nfd-controller.t.cpp
+++ b/tests/unit-tests/management/nfd-controller.t.cpp
@@ -31,8 +31,7 @@
namespace nfd {
namespace tests {
-using ndn::util::makeData;
-using ndn::util::makeNack;
+using namespace ndn::tests;
BOOST_AUTO_TEST_SUITE(Management)
diff --git a/tests/unit-tests/management/nfd-status-dataset.t.cpp b/tests/unit-tests/management/nfd-status-dataset.t.cpp
index 4288d4a..a836746 100644
--- a/tests/unit-tests/management/nfd-status-dataset.t.cpp
+++ b/tests/unit-tests/management/nfd-status-dataset.t.cpp
@@ -29,8 +29,7 @@
namespace nfd {
namespace tests {
-using ndn::util::makeData;
-using ndn::util::signData;
+using namespace ndn::tests;
BOOST_AUTO_TEST_SUITE(Management)
diff --git a/tests/unit-tests/mgmt/dispatcher.t.cpp b/tests/unit-tests/mgmt/dispatcher.t.cpp
index 8f9207d..d7e4efc 100644
--- a/tests/unit-tests/mgmt/dispatcher.t.cpp
+++ b/tests/unit-tests/mgmt/dispatcher.t.cpp
@@ -158,7 +158,7 @@
bind([] { return true; }),
bind([&nCallbackCalled] { ++nCallbackCalled["test/2"]; }));
- face.receive(*util::makeInterest("/root/1/test/1/%80%00"));
+ face.receive(*makeInterest("/root/1/test/1/%80%00"));
advanceClocks(time::milliseconds(1));
BOOST_CHECK_EQUAL(nCallbackCalled["test/1"], 0);
BOOST_CHECK_EQUAL(nCallbackCalled["test/2"], 0);
@@ -166,18 +166,18 @@
dispatcher.addTopPrefix("/root/1");
advanceClocks(time::milliseconds(1));
- face.receive(*util::makeInterest("/root/1/test/1/%80%00"));
+ face.receive(*makeInterest("/root/1/test/1/%80%00"));
advanceClocks(time::milliseconds(1));
BOOST_CHECK_EQUAL(nCallbackCalled["test/1"], 1);
BOOST_CHECK_EQUAL(nCallbackCalled["test/2"], 0);
- face.receive(*util::makeInterest("/root/1/test/2/%80%00"));
+ face.receive(*makeInterest("/root/1/test/2/%80%00"));
advanceClocks(time::milliseconds(1));
BOOST_CHECK_EQUAL(nCallbackCalled["test/1"], 1);
BOOST_CHECK_EQUAL(nCallbackCalled["test/2"], 1);
- face.receive(*util::makeInterest("/root/2/test/1/%80%00"));
- face.receive(*util::makeInterest("/root/2/test/2/%80%00"));
+ face.receive(*makeInterest("/root/2/test/1/%80%00"));
+ face.receive(*makeInterest("/root/2/test/2/%80%00"));
advanceClocks(time::milliseconds(1));
BOOST_CHECK_EQUAL(nCallbackCalled["test/1"], 1);
BOOST_CHECK_EQUAL(nCallbackCalled["test/2"], 1);
@@ -185,22 +185,22 @@
dispatcher.addTopPrefix("/root/2");
advanceClocks(time::milliseconds(1));
- face.receive(*util::makeInterest("/root/1/test/1/%80%00"));
+ face.receive(*makeInterest("/root/1/test/1/%80%00"));
advanceClocks(time::milliseconds(1));
BOOST_CHECK_EQUAL(nCallbackCalled["test/1"], 2);
- face.receive(*util::makeInterest("/root/2/test/1/%80%00"));
+ face.receive(*makeInterest("/root/2/test/1/%80%00"));
advanceClocks(time::milliseconds(1));
BOOST_CHECK_EQUAL(nCallbackCalled["test/1"], 3);
dispatcher.removeTopPrefix("/root/1");
advanceClocks(time::milliseconds(1));
- face.receive(*util::makeInterest("/root/1/test/1/%80%00"));
+ face.receive(*makeInterest("/root/1/test/1/%80%00"));
advanceClocks(time::milliseconds(1));
BOOST_CHECK_EQUAL(nCallbackCalled["test/1"], 3);
- face.receive(*util::makeInterest("/root/2/test/1/%80%00"));
+ face.receive(*makeInterest("/root/2/test/1/%80%00"));
advanceClocks(time::milliseconds(1));
BOOST_CHECK_EQUAL(nCallbackCalled["test/1"], 4);
}
@@ -218,11 +218,11 @@
advanceClocks(time::milliseconds(1));
face.sentData.clear();
- face.receive(*util::makeInterest("/root/test/%80%00")); // returns 403
- face.receive(*util::makeInterest("/root/test/%80%00/invalid")); // returns 403
- face.receive(*util::makeInterest("/root/test/%80%00/silent")); // silently ignored
- face.receive(*util::makeInterest("/root/test/.../invalid")); // silently ignored (wrong format)
- face.receive(*util::makeInterest("/root/test/.../valid")); // silently ignored (wrong format)
+ face.receive(*makeInterest("/root/test/%80%00")); // returns 403
+ face.receive(*makeInterest("/root/test/%80%00/invalid")); // returns 403
+ face.receive(*makeInterest("/root/test/%80%00/silent")); // silently ignored
+ face.receive(*makeInterest("/root/test/.../invalid")); // silently ignored (wrong format)
+ face.receive(*makeInterest("/root/test/.../valid")); // silently ignored (wrong format)
advanceClocks(time::milliseconds(1), 20);
BOOST_CHECK_EQUAL(nCallbackCalled, 0);
BOOST_CHECK_EQUAL(face.sentData.size(), 2);
@@ -232,7 +232,7 @@
BOOST_CHECK(face.sentData[1].getContentType() == tlv::ContentType_Blob);
BOOST_CHECK_EQUAL(ControlResponse(face.sentData[1].getContent().blockFromValue()).getCode(), 403);
- face.receive(*util::makeInterest("/root/test/%80%00/valid"));
+ face.receive(*makeInterest("/root/test/%80%00/valid"));
advanceClocks(time::milliseconds(1), 10);
BOOST_CHECK_EQUAL(nCallbackCalled, 1);
}
@@ -281,9 +281,9 @@
advanceClocks(time::milliseconds(1));
face.sentData.clear();
- face.receive(*util::makeInterest("/root/test/small/%80%00")); // returns 403
- face.receive(*util::makeInterest("/root/test/small/%80%00/invalid")); // returns 403
- face.receive(*util::makeInterest("/root/test/small/%80%00/silent")); // silently ignored
+ face.receive(*makeInterest("/root/test/small/%80%00")); // returns 403
+ face.receive(*makeInterest("/root/test/small/%80%00/invalid")); // returns 403
+ face.receive(*makeInterest("/root/test/small/%80%00/silent")); // silently ignored
advanceClocks(time::milliseconds(1), 20);
BOOST_CHECK_EQUAL(face.sentData.size(), 2);
@@ -294,7 +294,7 @@
face.sentData.clear();
- auto interestSmall = *util::makeInterest("/root/test/small/valid");
+ auto interestSmall = *makeInterest("/root/test/small/valid");
face.receive(interestSmall);
advanceClocks(time::milliseconds(1), 10);
@@ -306,8 +306,8 @@
BOOST_REQUIRE(fetchedData != nullptr);
BOOST_CHECK(face.sentData[0].wireEncode() == fetchedData->wireEncode());
- face.receive(*util::makeInterest(Name("/root/test/small/valid").appendVersion(10))); // should be ignored
- face.receive(*util::makeInterest(Name("/root/test/small/valid").appendSegment(20))); // should be ignored
+ face.receive(*makeInterest(Name("/root/test/small/valid").appendVersion(10))); // should be ignored
+ face.receive(*makeInterest(Name("/root/test/small/valid").appendSegment(20))); // should be ignored
advanceClocks(time::milliseconds(1), 10);
BOOST_CHECK_EQUAL(face.sentData.size(), 1);
BOOST_CHECK_EQUAL(storage.size(), 1);
@@ -322,7 +322,7 @@
storage.erase("/", true); // clear the storage
face.sentData.clear();
- face.receive(*util::makeInterest("/root/test/large/valid"));
+ face.receive(*makeInterest("/root/test/large/valid"));
advanceClocks(time::milliseconds(1), 10);
// two data packets are generated, the first one will be sent to both places
@@ -361,7 +361,7 @@
storage.erase("/", true);// clear the storage
face.sentData.clear();
- face.receive(*util::makeInterest("/root/test/reject/%80%00/valid")); // returns nack
+ face.receive(*makeInterest("/root/test/reject/%80%00/valid")); // returns nack
advanceClocks(time::milliseconds(1));
BOOST_CHECK_EQUAL(face.sentData.size(), 1);
BOOST_CHECK(face.sentData[0].getContentType() == tlv::ContentType_Nack);
diff --git a/tests/unit-tests/mgmt/status-dataset-context.t.cpp b/tests/unit-tests/mgmt/status-dataset-context.t.cpp
index d7c0716..b1876db 100644
--- a/tests/unit-tests/mgmt/status-dataset-context.t.cpp
+++ b/tests/unit-tests/mgmt/status-dataset-context.t.cpp
@@ -27,6 +27,8 @@
namespace mgmt {
namespace tests {
+using namespace ndn::tests;
+
class StatusDatasetContextFixture
{
public:
@@ -39,7 +41,7 @@
};
StatusDatasetContextFixture()
- : interest(util::makeInterest("/test/context/interest"))
+ : interest(makeInterest("/test/context/interest"))
, contentBlock(makeStringBlock(tlv::Content, "/test/data/content"))
, context(*interest,
[this] (const Name& dataName, const Block& content,
diff --git a/tests/unit-tests/security/validator-config.t.cpp b/tests/unit-tests/security/validator-config.t.cpp
index 028d790..63b0142 100644
--- a/tests/unit-tests/security/validator-config.t.cpp
+++ b/tests/unit-tests/security/validator-config.t.cpp
@@ -601,25 +601,25 @@
conf::Checker& checker1 = *validator.m_dataRules.front()->m_checkers[1];
conf::Checker& checker2 = *validator.m_dataRules.front()->m_checkers[2];
- auto data1 = util::makeData(Name(identity1).append("Test"));
+ auto data1 = makeData(Name(identity1).append("Test"));
BOOST_CHECK_NO_THROW(m_keyChain.sign(*data1, security::signingByIdentity(identity1)));
BOOST_CHECK_EQUAL(checker0.check(*data1), 0);
BOOST_CHECK_EQUAL(checker1.check(*data1), 0);
BOOST_CHECK_EQUAL(checker2.check(*data1), 1);
- auto data2 = util::makeData(Name(identity2).append("Data2"));
+ auto data2 = makeData(Name(identity2).append("Data2"));
BOOST_CHECK_NO_THROW(m_keyChain.sign(*data2, security::signingByIdentity(identity2)));
BOOST_CHECK_EQUAL(checker0.check(*data2), -1);
BOOST_CHECK_EQUAL(checker1.check(*data2), 0);
BOOST_CHECK_EQUAL(checker2.check(*data2), -1);
- auto data3 = util::makeData(Name(identity2).append("Data3"));
+ auto data3 = makeData(Name(identity2).append("Data3"));
BOOST_CHECK_NO_THROW(m_keyChain.sign(*data3, security::signingByIdentity(identity1)));
BOOST_CHECK_EQUAL(checker0.check(*data3), 0);
BOOST_CHECK_EQUAL(checker1.check(*data3), -1);
BOOST_CHECK_EQUAL(checker2.check(*data3), 1);
- auto data4 = util::makeData("/Data4");
+ auto data4 = makeData("/Data4");
BOOST_CHECK_NO_THROW(m_keyChain.sign(*data4, security::signingByIdentity(identity2)));
BOOST_CHECK_EQUAL(checker0.check(*data4), -1);
BOOST_CHECK_EQUAL(checker1.check(*data4), -1);
diff --git a/tests/unit-tests/util/test-in-memory-storage-common.cpp b/tests/unit-tests/util/in-memory-storage-common.t.cpp
similarity index 97%
rename from tests/unit-tests/util/test-in-memory-storage-common.cpp
rename to tests/unit-tests/util/in-memory-storage-common.t.cpp
index ea78f29..9e7c814 100644
--- a/tests/unit-tests/util/test-in-memory-storage-common.cpp
+++ b/tests/unit-tests/util/in-memory-storage-common.t.cpp
@@ -33,9 +33,12 @@
namespace ndn {
namespace util {
+namespace tests {
-BOOST_AUTO_TEST_SUITE(UtilInMemoryStorage)
+using namespace ndn::tests;
+BOOST_AUTO_TEST_SUITE(Util)
+BOOST_AUTO_TEST_SUITE(TestInMemoryStorage)
BOOST_AUTO_TEST_SUITE(Common)
typedef boost::mpl::list<InMemoryStoragePersistent, InMemoryStorageFifo, InMemoryStorageLfu,
@@ -124,8 +127,7 @@
shared_ptr<Interest> interest = makeInterest(name);
shared_ptr<const Data> found = ims.find(*interest);
-
- BOOST_CHECK(static_cast<bool>(found));
+ BOOST_CHECK(found != nullptr);
BOOST_CHECK_EQUAL(data->getName(), found->getName());
}
@@ -155,8 +157,7 @@
ims.insert(*data);
shared_ptr<const Data> found = ims.find(name);
-
- BOOST_CHECK(static_cast<bool>(found));
+ BOOST_CHECK(found != nullptr);
BOOST_CHECK_EQUAL(data->getName(), found->getName());
}
@@ -170,8 +171,7 @@
ims.insert(*data);
shared_ptr<const Data> found = ims.find(data->getFullName());
-
- BOOST_CHECK(static_cast<bool>(found));
+ BOOST_CHECK(found != nullptr);
BOOST_CHECK_EQUAL(data->getFullName(), found->getFullName());
}
@@ -186,8 +186,7 @@
Name name2("/not/find");
shared_ptr<const Data> found = ims.find(name2);
-
- BOOST_CHECK(!static_cast<bool>(found));
+ BOOST_CHECK(found == nullptr);
}
BOOST_AUTO_TEST_CASE_TEMPLATE(InsertAndNotFindByFullName, T, InMemoryStorages)
@@ -207,8 +206,7 @@
signData(data2);
shared_ptr<const Data> found = ims.find(data2->getFullName());
-
- BOOST_CHECK(!static_cast<bool>(found));
+ BOOST_CHECK(found == nullptr);
}
BOOST_AUTO_TEST_CASE_TEMPLATE(InsertAndEraseByName, T, InMemoryStorages)
@@ -407,7 +405,7 @@
interest->setMaxSuffixComponents(0);
shared_ptr<const Data> found = ims.find(*interest);
- BOOST_REQUIRE(static_cast<bool>(found));
+ BOOST_REQUIRE(found != nullptr);
BOOST_CHECK_EQUAL(found->getName(), name);
shared_ptr<Interest> interest2 = makeInterest("");
@@ -418,7 +416,7 @@
interest2->setMaxSuffixComponents(0);
shared_ptr<const Data> notfound = ims.find(*interest2);
- BOOST_CHECK(static_cast<bool>(found));
+ BOOST_CHECK(notfound == nullptr);
}
BOOST_AUTO_TEST_CASE_TEMPLATE(ChildSelector, T, InMemoryStorages)
@@ -494,7 +492,7 @@
interest->setPublisherPublicKeyLocator(locator);
shared_ptr<const Data> found = ims.find(*interest);
- BOOST_CHECK(!static_cast<bool>(found));
+ BOOST_CHECK(found == nullptr);
}
BOOST_AUTO_TEST_CASE_TEMPLATE(PublisherKeySelector2, T, InMemoryStorages)
@@ -523,7 +521,7 @@
interest->setPublisherPublicKeyLocator(locator);
shared_ptr<const Data> found = ims.find(*interest);
- BOOST_CHECK(static_cast<bool>(found));
+ BOOST_CHECK(found != nullptr);
BOOST_CHECK_EQUAL(found->getName(), data2->getName());
}
@@ -696,7 +694,7 @@
shared_ptr<Interest> interest = makeInterest(name);
shared_ptr<const Data> found = ims.find(*interest);
- BOOST_CHECK(!static_cast<bool>(found));
+ BOOST_CHECK(found == nullptr);
}
///as Find function is implemented at the base case, therefore testing for one derived class is
@@ -1056,7 +1054,9 @@
BOOST_AUTO_TEST_SUITE_END() // Find
BOOST_AUTO_TEST_SUITE_END() // Common
-BOOST_AUTO_TEST_SUITE_END() // UtilInMemoryStorage
+BOOST_AUTO_TEST_SUITE_END() // TestInMemoryStorage
+BOOST_AUTO_TEST_SUITE_END() // Util
+} // namespace tests
} // namespace util
} // namespace ndn
diff --git a/tests/unit-tests/util/in-memory-storage-fifo.t.cpp b/tests/unit-tests/util/in-memory-storage-fifo.t.cpp
index f090169..4404b51 100644
--- a/tests/unit-tests/util/in-memory-storage-fifo.t.cpp
+++ b/tests/unit-tests/util/in-memory-storage-fifo.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/**
- * Copyright (c) 2013-2015 Regents of the University of California.
+ * Copyright (c) 2013-2016 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -29,7 +29,10 @@
namespace util {
namespace tests {
-BOOST_AUTO_TEST_SUITE(UtilInMemoryStorage)
+using namespace ndn::tests;
+
+BOOST_AUTO_TEST_SUITE(Util)
+BOOST_AUTO_TEST_SUITE(TestInMemoryStorage)
BOOST_AUTO_TEST_SUITE(Fifo)
BOOST_AUTO_TEST_CASE(ArrivalQueue)
@@ -45,7 +48,7 @@
shared_ptr<Interest> interest = makeInterest("/1");
shared_ptr<const Data> found = ims.find(*interest);
- BOOST_CHECK(!static_cast<bool>(found));
+ BOOST_CHECK(found == nullptr);
}
BOOST_AUTO_TEST_CASE(ArrivalQueue2)
@@ -61,7 +64,7 @@
shared_ptr<Interest> interest1 = makeInterest("/1");
shared_ptr<const Data> found1 = ims.find(*interest1);
- BOOST_CHECK(!static_cast<bool>(found1));
+ BOOST_CHECK(found1 == nullptr);
ims.insert(*makeData("/4"));
@@ -70,11 +73,12 @@
shared_ptr<Interest> interest2 = makeInterest("/2");
shared_ptr<const Data> found2 = ims.find(*interest2);
- BOOST_CHECK(!static_cast<bool>(found2));
+ BOOST_CHECK(found2 == nullptr);
}
BOOST_AUTO_TEST_SUITE_END() // Fifo
-BOOST_AUTO_TEST_SUITE_END() // UtilInMemoryStorage
+BOOST_AUTO_TEST_SUITE_END() // TestInMemoryStorage
+BOOST_AUTO_TEST_SUITE_END() // Util
} // namespace tests
} // namespace util
diff --git a/tests/unit-tests/util/in-memory-storage-lfu.t.cpp b/tests/unit-tests/util/in-memory-storage-lfu.t.cpp
index b8d08c6..bc52b30 100644
--- a/tests/unit-tests/util/in-memory-storage-lfu.t.cpp
+++ b/tests/unit-tests/util/in-memory-storage-lfu.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/**
- * Copyright (c) 2013-2015 Regents of the University of California.
+ * Copyright (c) 2013-2016 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -29,7 +29,10 @@
namespace util {
namespace tests {
-BOOST_AUTO_TEST_SUITE(UtilInMemoryStorage)
+using namespace ndn::tests;
+
+BOOST_AUTO_TEST_SUITE(Util)
+BOOST_AUTO_TEST_SUITE(TestInMemoryStorage)
BOOST_AUTO_TEST_SUITE(Lfu)
BOOST_AUTO_TEST_CASE(FrequencyQueue)
@@ -63,7 +66,7 @@
BOOST_CHECK_EQUAL(ims.size(), 2);
shared_ptr<const Data> found2 = ims.find(*interest2);
- BOOST_CHECK(!static_cast<bool>(found2));
+ BOOST_CHECK(found2 == nullptr);
shared_ptr<const Data> found1 = ims.find(*interest1);
BOOST_CHECK_EQUAL(found1->getName(), name1);
@@ -102,7 +105,7 @@
BOOST_CHECK_EQUAL(ims.size(), 2);
shared_ptr<const Data> found2 = ims.find(*interest2);
- BOOST_CHECK(!static_cast<bool>(found2));
+ BOOST_CHECK(found2 == nullptr);
shared_ptr<const Data> found1 = ims.find(*interest1);
BOOST_CHECK_EQUAL(found1->getName(), name1);
@@ -120,7 +123,7 @@
BOOST_CHECK_EQUAL(ims.size(), 2);
shared_ptr<const Data> found4 = ims.find(*interest4);
- BOOST_CHECK(!static_cast<bool>(found4));
+ BOOST_CHECK(found4 == nullptr);
found1 = ims.find(*interest1);
BOOST_CHECK_EQUAL(found1->getName(), name1);
@@ -129,8 +132,9 @@
}
BOOST_AUTO_TEST_SUITE_END() // Lfu
-BOOST_AUTO_TEST_SUITE_END() // UtilInMemoryStorage
+BOOST_AUTO_TEST_SUITE_END() // TestInMemoryStorage
+BOOST_AUTO_TEST_SUITE_END() // Util
} // namespace tests
-} // namesapce util
+} // namespace util
} // namespace ndn
diff --git a/tests/unit-tests/util/in-memory-storage-lru.t.cpp b/tests/unit-tests/util/in-memory-storage-lru.t.cpp
index 1cbffb8..7585987 100644
--- a/tests/unit-tests/util/in-memory-storage-lru.t.cpp
+++ b/tests/unit-tests/util/in-memory-storage-lru.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/**
- * Copyright (c) 2013-2015 Regents of the University of California.
+ * Copyright (c) 2013-2016 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -29,7 +29,10 @@
namespace util {
namespace tests {
-BOOST_AUTO_TEST_SUITE(UtilInMemoryStorage)
+using namespace ndn::tests;
+
+BOOST_AUTO_TEST_SUITE(Util)
+BOOST_AUTO_TEST_SUITE(TestInMemoryStorage)
BOOST_AUTO_TEST_SUITE(Lru)
BOOST_AUTO_TEST_CASE(UsedTimeQueue)
@@ -63,7 +66,7 @@
BOOST_CHECK_EQUAL(ims.size(), 2);
shared_ptr<const Data> found2 = ims.find(*interest2);
- BOOST_CHECK(!static_cast<bool>(found2));
+ BOOST_CHECK(found2 == nullptr);
shared_ptr<const Data> found1 = ims.find(*interest1);
BOOST_CHECK_EQUAL(found1->getName(), name1);
@@ -102,7 +105,7 @@
BOOST_CHECK_EQUAL(ims.size(), 2);
shared_ptr<const Data> found2 = ims.find(*interest2);
- BOOST_CHECK(!static_cast<bool>(found2));
+ BOOST_CHECK(found2 == nullptr);
shared_ptr<const Data> found1 = ims.find(*interest1);
BOOST_CHECK_EQUAL(found1->getName(), name1);
@@ -122,7 +125,7 @@
BOOST_CHECK_EQUAL(ims.size(), 2);
shared_ptr<const Data> found4 = ims.find(*interest4);
- BOOST_CHECK(!static_cast<bool>(found4));
+ BOOST_CHECK(found4 == nullptr);
found1 = ims.find(*interest1);
BOOST_CHECK_EQUAL(found1->getName(), name1);
@@ -131,7 +134,8 @@
}
BOOST_AUTO_TEST_SUITE_END() // Lru
-BOOST_AUTO_TEST_SUITE_END() // UtilInMemoryStorage
+BOOST_AUTO_TEST_SUITE_END() // TestInMemoryStorage
+BOOST_AUTO_TEST_SUITE_END() // Util
} // namespace tests
} // namespace util
diff --git a/tests/unit-tests/util/in-memory-storage-persistent.t.cpp b/tests/unit-tests/util/in-memory-storage-persistent.t.cpp
index 1734774..af33ab3 100644
--- a/tests/unit-tests/util/in-memory-storage-persistent.t.cpp
+++ b/tests/unit-tests/util/in-memory-storage-persistent.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/**
- * Copyright (c) 2013-2015 Regents of the University of California.
+ * Copyright (c) 2013-2016 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -29,7 +29,10 @@
namespace util {
namespace tests {
-BOOST_AUTO_TEST_SUITE(UtilInMemoryStorage)
+using namespace ndn::tests;
+
+BOOST_AUTO_TEST_SUITE(Util)
+BOOST_AUTO_TEST_SUITE(TestInMemoryStorage)
BOOST_AUTO_TEST_SUITE(Persistent)
BOOST_AUTO_TEST_CASE(GetLimit)
@@ -59,7 +62,8 @@
}
BOOST_AUTO_TEST_SUITE_END() // Persistent
-BOOST_AUTO_TEST_SUITE_END() // UtilInMemoryStorage
+BOOST_AUTO_TEST_SUITE_END() // TestInMemoryStorage
+BOOST_AUTO_TEST_SUITE_END() // Util
} // namespace tests
} // namespace util