build: migrate to C++17
Change-Id: Ic5c01274f62556764ea96fc232cf3d835c4ab659
diff --git a/tests/identity-management-fixture.cpp b/tests/identity-management-fixture.cpp
index 007b35b..f545710 100644
--- a/tests/identity-management-fixture.cpp
+++ b/tests/identity-management-fixture.cpp
@@ -1,6 +1,6 @@
/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil -*- */
/*
- * Copyright (c) 2012-2017 University of California, Los Angeles
+ * Copyright (c) 2012-2022 University of California, Los Angeles
*
* This file is part of ChronoSync, synchronization library for distributed realtime
* applications for NDN.
@@ -22,8 +22,7 @@
#include <ndn-cxx/util/io.hpp>
#include <boost/filesystem.hpp>
-namespace ndn {
-namespace tests {
+namespace ndn::tests {
IdentityManagementFixture::IdentityManagementFixture()
: m_keyChain("pib-memory:", "tpm-memory:")
@@ -75,5 +74,4 @@
}
}
-} // namespace tests
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/identity-management-fixture.hpp b/tests/identity-management-fixture.hpp
index 7bb39f8..6b81859 100644
--- a/tests/identity-management-fixture.hpp
+++ b/tests/identity-management-fixture.hpp
@@ -1,6 +1,6 @@
/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil -*- */
/*
- * Copyright (c) 2012-2021 University of California, Los Angeles
+ * Copyright (c) 2012-2022 University of California, Los Angeles
*
* This file is part of ChronoSync, synchronization library for distributed realtime
* applications for NDN.
@@ -17,15 +17,14 @@
* ChronoSync, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef NDN_TESTS_IDENTITY_MANAGEMENT_FIXTURE_HPP
-#define NDN_TESTS_IDENTITY_MANAGEMENT_FIXTURE_HPP
+#ifndef CHRONOSYNC_TESTS_IDENTITY_MANAGEMENT_FIXTURE_HPP
+#define CHRONOSYNC_TESTS_IDENTITY_MANAGEMENT_FIXTURE_HPP
#include "detail/common.hpp"
#include "unit-test-time-fixture.hpp"
-namespace ndn {
-namespace tests {
+namespace ndn::tests {
/** \brief a fixture that cleans up KeyChain identities and certificate files upon destruction
*/
@@ -69,7 +68,6 @@
{
};
-} // namespace tests
-} // namespace ndn
+} // namespace ndn::tests
-#endif // NDN_TESTS_IDENTITY_MANAGEMENT_FIXTURE_HPP
+#endif // CHRONOSYNC_TESTS_IDENTITY_MANAGEMENT_FIXTURE_HPP
diff --git a/tests/unit-test-time-fixture.hpp b/tests/unit-test-time-fixture.hpp
index f172cff..a8b46f7 100644
--- a/tests/unit-test-time-fixture.hpp
+++ b/tests/unit-test-time-fixture.hpp
@@ -1,6 +1,6 @@
/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil -*- */
/*
- * Copyright (c) 2012-2017 University of California, Los Angeles
+ * Copyright (c) 2012-2022 University of California, Los Angeles
*
* This file is part of ChronoSync, synchronization library for distributed realtime
* applications for NDN.
@@ -17,15 +17,14 @@
* ChronoSync, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef NDN_TESTS_UNIT_TESTS_UNIT_TEST_TIME_FIXTURE_HPP
-#define NDN_TESTS_UNIT_TESTS_UNIT_TEST_TIME_FIXTURE_HPP
+#ifndef CHRONOSYNC_TESTS_UNIT_TEST_TIME_FIXTURE_HPP
+#define CHRONOSYNC_TESTS_UNIT_TEST_TIME_FIXTURE_HPP
#include <ndn-cxx/util/time-unit-test-clock.hpp>
#include <boost/asio.hpp>
-namespace ndn {
-namespace tests {
+namespace ndn::tests {
class UnitTestTimeFixture
{
@@ -61,7 +60,6 @@
boost::asio::io_service io;
};
-} // namespace tests
-} // namespace ndn
+} // namespace ndn::tests
-#endif // NDN_TESTS_UNIT_TESTS_UNIT_TEST_TIME_FIXTURE_HPP
+#endif // CHRONOSYNC_TESTS_UNIT_TEST_TIME_FIXTURE_HPP
diff --git a/tests/unit-tests/test-logic.cpp b/tests/unit-tests/test-logic.cpp
index 8459158..d883fe7 100644
--- a/tests/unit-tests/test-logic.cpp
+++ b/tests/unit-tests/test-logic.cpp
@@ -432,12 +432,12 @@
{
unsetenv("CHRONOSYNC_MAX_PACKET_SIZE");
if (oldSize) {
- setenv("CHRONOSYNC_MAX_PACKET_SIZE", oldSize->c_str(), 1);
+ setenv("CHRONOSYNC_MAX_PACKET_SIZE", oldSize->data(), 1);
}
}
private:
- ndn::optional<std::string> oldSize;
+ std::optional<std::string> oldSize;
};
BOOST_FIXTURE_TEST_CASE(MaxPacketCustomization, MaxPacketCustomizationFixture)
@@ -447,7 +447,7 @@
setenv("CHRONOSYNC_MAX_PACKET_SIZE", "1500", 1);
BOOST_CHECK_EQUAL(getMaxPacketLimit(), 1500);
- setenv("CHRONOSYNC_MAX_PACKET_SIZE", ndn::to_string(ndn::MAX_NDN_PACKET_SIZE * 100).c_str(), 1);
+ setenv("CHRONOSYNC_MAX_PACKET_SIZE", std::to_string(ndn::MAX_NDN_PACKET_SIZE * 100).data(), 1);
BOOST_CHECK_EQUAL(getMaxPacketLimit(), ndn::MAX_NDN_PACKET_SIZE);
setenv("CHRONOSYNC_MAX_PACKET_SIZE", "1", 1);
diff --git a/tests/unit-tests/test-multiple-user.cpp b/tests/unit-tests/test-multiple-user.cpp
index db8ffcf..b8a5dbd 100644
--- a/tests/unit-tests/test-multiple-user.cpp
+++ b/tests/unit-tests/test-multiple-user.cpp
@@ -1,6 +1,6 @@
/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil -*- */
/*
- * Copyright (c) 2012-2019 University of California, Los Angeles
+ * Copyright (c) 2012-2022 University of California, Los Angeles
*
* This file is part of ChronoSync, synchronization library for distributed realtime
* applications for NDN.
@@ -27,18 +27,8 @@
class Handler
{
public:
- Handler(ndn::Face& face,
- const Name& syncPrefix,
- const Name& userPrefix)
- : logic(face,
- syncPrefix,
- userPrefix,
- bind(&Handler::onUpdate, this, _1))
- {
- }
-
- void
- onUpdate(const std::vector<MissingDataInfo>& v)
+ Handler(ndn::Face& face, const Name& syncPrefix, const Name& userPrefix)
+ : logic(face, syncPrefix, userPrefix, [] (auto&&...) {})
{
}
@@ -76,7 +66,7 @@
userPrefix[1] = Name("/user1");
userPrefix[2] = Name("/user2");
- face = make_shared<ndn::Face>(ref(io));
+ face = std::make_shared<ndn::Face>(io);
}
Name syncPrefix;
@@ -92,7 +82,7 @@
BOOST_AUTO_TEST_CASE(ThreeUserNode)
{
- handler = make_shared<Handler>(ref(*face), syncPrefix, userPrefix[0]);
+ handler = std::make_shared<Handler>(*face, syncPrefix, userPrefix[0]);
handler->addUserNode(userPrefix[1]);
handler->addUserNode(userPrefix[2]);
handler->removeUserNode(userPrefix[0]);
diff --git a/tests/unit-tests/test-socket.cpp b/tests/unit-tests/test-socket.cpp
index 3b16939..67f1c3e 100644
--- a/tests/unit-tests/test-socket.cpp
+++ b/tests/unit-tests/test-socket.cpp
@@ -1,6 +1,6 @@
/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil -*- */
/*
- * Copyright (c) 2012-2019 University of California, Los Angeles
+ * Copyright (c) 2012-2022 University of California, Los Angeles
*
* This file is part of ChronoSync, synchronization library for distributed realtime
* applications for NDN.
@@ -48,7 +48,7 @@
userPrefix,
face,
isNum ? bind(&SocketTestApp::fetchNumbers, this, _1) :
- bind(&SocketTestApp::fetchAll, this, _1),
+ bind(&SocketTestApp::fetchAll, this, _1),
Logic::DEFAULT_NAME,
Logic::DEFAULT_VALIDATOR,
Logic::DEFAULT_SYNC_INTEREST_LIFETIME,
@@ -63,14 +63,14 @@
Name dataName(dataPacket.getName());
string str2(reinterpret_cast<const char*>(dataPacket.getContent().value()),
dataPacket.getContent().value_size());
- data.insert(make_pair(dataName, str2));
+ data.emplace(dataName, str2);
}
void
set(Name name, const char* buf, int len)
{
string str2(buf, len);
- data.insert(make_pair(name, str2));
+ data.emplace(name, str2);
}
void
@@ -139,7 +139,7 @@
}
public:
- std::map<ndn::Name, string> data;
+ std::map<Name, string> data;
uint32_t sum;
Socket socket;
};
@@ -194,7 +194,7 @@
void
createSocket(size_t idx, bool isNum)
{
- app[idx] = make_shared<SocketTestApp>(syncPrefix, userPrefix[idx], ref(*faces[idx]), isNum);
+ app[idx] = make_shared<SocketTestApp>(syncPrefix, userPrefix[idx], std::ref(*faces[idx]), isNum);
sessionName[idx] = app[idx]->socket.getLogic().getSessionName();
}