Use more C++17 features
Mainly structured bindings, inline variables, and class template
argument deduction, plus many more smaller things.
Change-Id: I810d17e0adb470426e4e30c898e03b3140ad052f
diff --git a/tests/daemon/mgmt/fib-manager.t.cpp b/tests/daemon/mgmt/fib-manager.t.cpp
index 6131670..544eda5 100644
--- a/tests/daemon/mgmt/fib-manager.t.cpp
+++ b/tests/daemon/mgmt/fib-manager.t.cpp
@@ -438,8 +438,7 @@
}
BOOST_CHECK_EQUAL(actualPrefixes.size(), 0);
- BOOST_CHECK_EQUAL_COLLECTIONS(receivedRecords.begin(), receivedRecords.end(),
- expectedRecords.begin(), expectedRecords.end());
+ BOOST_TEST(receivedRecords == expectedRecords, boost::test_tools::per_element());
}
BOOST_AUTO_TEST_SUITE_END() // List
diff --git a/tests/daemon/mgmt/manager-common-fixture.cpp b/tests/daemon/mgmt/manager-common-fixture.cpp
index 83136be..3188ee4 100644
--- a/tests/daemon/mgmt/manager-common-fixture.cpp
+++ b/tests/daemon/mgmt/manager-common-fixture.cpp
@@ -28,8 +28,6 @@
namespace nfd {
namespace tests {
-const Name CommandInterestSignerFixture::DEFAULT_COMMAND_SIGNER_IDENTITY("/CommandInterestSignerFixture-identity");
-
CommandInterestSignerFixture::CommandInterestSignerFixture()
: m_signer(m_keyChain)
{
diff --git a/tests/daemon/mgmt/manager-common-fixture.hpp b/tests/daemon/mgmt/manager-common-fixture.hpp
index e717172..005d456 100644
--- a/tests/daemon/mgmt/manager-common-fixture.hpp
+++ b/tests/daemon/mgmt/manager-common-fixture.hpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2021, Regents of the University of California,
+ * Copyright (c) 2014-2022, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -65,7 +65,7 @@
const Name& identity = DEFAULT_COMMAND_SIGNER_IDENTITY);
protected:
- static const Name DEFAULT_COMMAND_SIGNER_IDENTITY;
+ static inline const Name DEFAULT_COMMAND_SIGNER_IDENTITY{"/CommandInterestSignerFixture-identity"};
private:
ndn::security::InterestSigner m_signer;
@@ -188,7 +188,7 @@
}
};
-template<int CODE>
+template<auto CODE>
class CommandFailure
{
public:
diff --git a/tests/daemon/mgmt/rib-manager-sl-announce.t.cpp b/tests/daemon/mgmt/rib-manager-sl-announce.t.cpp
index 4d15659..ebfe7d0 100644
--- a/tests/daemon/mgmt/rib-manager-sl-announce.t.cpp
+++ b/tests/daemon/mgmt/rib-manager-sl-announce.t.cpp
@@ -274,7 +274,7 @@
BOOST_AUTO_TEST_CASE(AnnounceExpired)
{
- auto pa = makeTrustedAnn("/awrVv6V7", 1_h, std::make_pair(-3_h, -1_h));
+ auto pa = makeTrustedAnn("/awrVv6V7", 1_h, std::pair(-3_h, -1_h));
BOOST_CHECK_EQUAL(slAnnounceSync(pa, 9087, 1_h), SlAnnounceResult::EXPIRED);
BOOST_CHECK(findAnnRoute("/awrVv6V7", 9087) == nullptr);
diff --git a/tests/daemon/mgmt/rib-manager.t.cpp b/tests/daemon/mgmt/rib-manager.t.cpp
index 682eb30..be4638f 100644
--- a/tests/daemon/mgmt/rib-manager.t.cpp
+++ b/tests/daemon/mgmt/rib-manager.t.cpp
@@ -494,8 +494,7 @@
}
BOOST_CHECK_EQUAL(actualPrefixes.size(), 0);
- BOOST_CHECK_EQUAL_COLLECTIONS(receivedRecords.begin(), receivedRecords.end(),
- expectedRecords.begin(), expectedRecords.end());
+ BOOST_TEST(receivedRecords == expectedRecords, boost::test_tools::per_element());
}
BOOST_FIXTURE_TEST_SUITE(FaceMonitor, LocalhostAuthorizedRibManagerFixture)
diff --git a/tests/daemon/mgmt/strategy-choice-manager.t.cpp b/tests/daemon/mgmt/strategy-choice-manager.t.cpp
index 7fdd8fa..3e42d1c 100644
--- a/tests/daemon/mgmt/strategy-choice-manager.t.cpp
+++ b/tests/daemon/mgmt/strategy-choice-manager.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2021, Regents of the University of California,
+ * Copyright (c) 2014-2022, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -62,12 +62,8 @@
Name
getInstanceName(const Name& name) const
{
- bool hasEntry = false;
- Name instanceName;
- std::tie(hasEntry, instanceName) = sc.get(name);
- return hasEntry ?
- instanceName :
- Name("/no-StrategyChoice-entry-at").append(name);
+ auto [hasEntry, instanceName] = sc.get(name);
+ return hasEntry ? instanceName : Name("/no-StrategyChoice-entry-at").append(name);
}
protected: