Migrate to C++17 and misc code cleanups
Change-Id: I6b63385c92361a7ef5803d2bfd00f39c77e88d34
diff --git a/tests/unit/read-handle.t.cpp b/tests/unit/read-handle.t.cpp
index 60a2ee2..a6bfed5 100644
--- a/tests/unit/read-handle.t.cpp
+++ b/tests/unit/read-handle.t.cpp
@@ -35,8 +35,7 @@
BOOST_CHECK_EQUAL(didMatch, EXPECTED); \
} while (false)
-namespace repo {
-namespace tests {
+namespace repo::tests {
BOOST_AUTO_TEST_SUITE(TestReadHandle)
@@ -57,7 +56,7 @@
}
static bool
- containsNameComponent(const Name& name, const ndn::name::Component& component)
+ containsNameComponent(const Name& name, const Name::Component& component)
{
for (const auto& c : name) {
if (c == component)
@@ -91,42 +90,41 @@
keyChain.createIdentity(identity);
keyChain.sign(*data1, ndn::security::SigningInfo(ndn::security::SigningInfo::SIGNER_TYPE_ID,
- identity));
+ identity));
keyChain.sign(*data2, ndn::security::SigningInfo(ndn::security::SigningInfo::SIGNER_TYPE_ID,
- identity));
+ identity));
face.sentInterests.clear();
handle->insertData(*data1);
face.processEvents(-1_ms);
- CHECK_INTERESTS(interest.getName(), name::Component{"register"}, true);
+ CHECK_INTERESTS(interest.getName(), Name::Component{"register"}, true);
face.sentInterests.clear();
handle->deleteData(data1->getFullName());
face.processEvents(-1_ms);
- CHECK_INTERESTS(interest.getName(), name::Component{"unregister"}, true);
+ CHECK_INTERESTS(interest.getName(), Name::Component{"unregister"}, true);
face.sentInterests.clear();
handle->insertData(*data1);
face.processEvents(-1_ms);
- CHECK_INTERESTS(interest.getName(), name::Component{"register"}, true);
+ CHECK_INTERESTS(interest.getName(), Name::Component{"register"}, true);
face.sentInterests.clear();
handle->insertData(*data2);
face.processEvents(-1_ms);
- CHECK_INTERESTS(interest.getName(), name::Component{"register"}, false);
+ CHECK_INTERESTS(interest.getName(), Name::Component{"register"}, false);
face.sentInterests.clear();
handle->deleteData(data1->getFullName());
face.processEvents(-1_ms);
- CHECK_INTERESTS(interest.getName(), name::Component{"unregister"}, false);
+ CHECK_INTERESTS(interest.getName(), Name::Component{"unregister"}, false);
face.sentInterests.clear();
handle->deleteData(data2->getFullName());
face.processEvents(-1_ms);
- CHECK_INTERESTS(interest.getName(), name::Component{"unregister"}, true);
+ CHECK_INTERESTS(interest.getName(), Name::Component{"unregister"}, true);
}
BOOST_AUTO_TEST_SUITE_END() // TestReadHandle
-} // namespace tests
-} // namespace repo
+} // namespace repo::tests
diff --git a/tests/unit/repo-command-parameter.cpp b/tests/unit/repo-command-parameter.cpp
index f01832a..94429fe 100644
--- a/tests/unit/repo-command-parameter.cpp
+++ b/tests/unit/repo-command-parameter.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2018, Regents of the University of California.
+ * Copyright (c) 2014-2022, Regents of the University of California.
*
* This file is part of NDN repo-ng (Next generation of NDN repository).
* See AUTHORS.md for complete list of repo-ng authors and contributors.
@@ -18,17 +18,14 @@
*/
#include "repo-command-parameter.hpp"
-
#include "common.hpp"
-#include <ndn-cxx/encoding/block.hpp>
#include <ndn-cxx/encoding/block-helpers.hpp>
#include <boost/lexical_cast.hpp>
#include <boost/test/unit_test.hpp>
-namespace repo {
-namespace tests {
+namespace repo::tests {
BOOST_AUTO_TEST_SUITE(RepoCommandParameter)
@@ -58,5 +55,4 @@
BOOST_AUTO_TEST_SUITE_END()
-} // namespace tests
-} // namespace repo
+} // namespace repo::tests
diff --git a/tests/unit/repo-command-response.cpp b/tests/unit/repo-command-response.cpp
index 057b180..1fc9f5d 100644
--- a/tests/unit/repo-command-response.cpp
+++ b/tests/unit/repo-command-response.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2018, Regents of the University of California.
+ * Copyright (c) 2018-2022, Regents of the University of California.
*
* This file is part of NDN repo-ng (Next generation of NDN repository).
* See AUTHORS.md for complete list of repo-ng authors and contributors.
@@ -23,8 +23,7 @@
#include <boost/test/unit_test.hpp>
-namespace repo {
-namespace tests {
+namespace repo::tests {
BOOST_AUTO_TEST_SUITE(RepoCommandResponse)
@@ -59,5 +58,4 @@
BOOST_AUTO_TEST_SUITE_END()
-} // namespace tests
-} // namespace repo
+} // namespace repo::tests
diff --git a/tests/unit/repo-storage.cpp b/tests/unit/repo-storage.cpp
index 4f89d6b..9743933 100644
--- a/tests/unit/repo-storage.cpp
+++ b/tests/unit/repo-storage.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2019, Regents of the University of California.
+ * Copyright (c) 2014-2022, Regents of the University of California.
*
* This file is part of NDN repo-ng (Next generation of NDN repository).
* See AUTHORS.md for complete list of repo-ng authors and contributors.
@@ -18,17 +18,12 @@
*/
#include "storage/repo-storage.hpp"
-#include "storage/sqlite-storage.hpp"
#include "../dataset-fixtures.hpp"
#include "../repo-storage-fixture.hpp"
-#include <boost/mpl/push_back.hpp>
#include <boost/test/unit_test.hpp>
-#include <iostream>
-#include <string.h>
-namespace repo {
-namespace tests {
+namespace repo::tests {
BOOST_AUTO_TEST_SUITE(RepoStorage)
@@ -37,11 +32,8 @@
{
};
-
BOOST_FIXTURE_TEST_CASE_TEMPLATE(Bulk, T, CommonDatasets, Fixture<T>)
{
- BOOST_TEST_MESSAGE(T::getName());
-
// Insert data into repo
for (auto i = this->data.begin(); i != this->data.end(); ++i) {
BOOST_CHECK_EQUAL(this->handle->insertData(**i), true);
@@ -52,7 +44,7 @@
// Read
for (auto i = this->interests.begin(); i != this->interests.end(); ++i) {
- std::shared_ptr<ndn::Data> dataTest = this->handle->readData(i->first);
+ auto dataTest = this->handle->readData(i->first);
BOOST_CHECK_EQUAL(*dataTest, *i->second);
}
@@ -73,10 +65,8 @@
std::vector<Name> names;
handle->afterDataInsertion.connect([&] (const Name& name) {
- names.push_back(name);
- BOOST_TEST_MESSAGE("Got notification about " << name);
- });
-
+ names.push_back(name);
+ });
handle->notifyAboutExistingData();
BOOST_CHECK_EQUAL(names.size(), this->data.size());
@@ -84,5 +74,4 @@
BOOST_AUTO_TEST_SUITE_END()
-} // namespace tests
-} // namespace repo
+} // namespace repo::tests
diff --git a/tests/unit/sqlite-handle.cpp b/tests/unit/sqlite-handle.cpp
index 9cfb0bf..d3ae687 100644
--- a/tests/unit/sqlite-handle.cpp
+++ b/tests/unit/sqlite-handle.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2018, Regents of the University of California.
+ * Copyright (c) 2014-2022, Regents of the University of California.
*
* This file is part of NDN repo-ng (Next generation of NDN repository).
* See AUTHORS.md for complete list of repo-ng authors and contributors.
@@ -25,8 +25,7 @@
#include <boost/test/unit_test.hpp>
#include <random>
-namespace repo {
-namespace tests {
+namespace repo::tests {
BOOST_AUTO_TEST_SUITE(SqliteStorage)
@@ -39,13 +38,10 @@
BOOST_FIXTURE_TEST_CASE_TEMPLATE(InsertReadDelete, T, CommonDatasets, Fixture<T>)
{
- BOOST_TEST_CHECKPOINT(T::getName());
-
std::vector<Name> names;
// Insert
- for (auto i = this->data.begin();
- i != this->data.end(); ++i) {
+ for (auto i = this->data.begin(); i != this->data.end(); ++i) {
Name name = Name();
this->handle->insert(**i);
name = (*i)->getFullName();
@@ -76,5 +72,4 @@
BOOST_AUTO_TEST_SUITE_END()
-} // namespace tests
-} // namespace repo
+} // namespace repo::tests
diff --git a/tests/unit/tcp-bulk-insert-handle.cpp b/tests/unit/tcp-bulk-insert-handle.cpp
index da90117..9b7b796 100644
--- a/tests/unit/tcp-bulk-insert-handle.cpp
+++ b/tests/unit/tcp-bulk-insert-handle.cpp
@@ -24,8 +24,7 @@
#include <boost/test/unit_test.hpp>
-namespace repo {
-namespace tests {
+namespace repo::tests {
BOOST_AUTO_TEST_SUITE(TcpBulkInsertHandle)
@@ -149,8 +148,6 @@
BOOST_FIXTURE_TEST_CASE_TEMPLATE(BulkInsertAndRead, T, CommonDatasets, TcpBulkInsertFixture<T>)
{
- BOOST_TEST_MESSAGE(T::getName());
-
// start bulk inserter
this->bulkInserter.listen("localhost", "17376");
@@ -168,5 +165,4 @@
BOOST_AUTO_TEST_SUITE_END()
-} // namespace tests
-} // namespace repo
+} // namespace repo::tests