build: switch to C++17
Change-Id: I119767c48c085c62556347ba6c11a85e30c32ced
diff --git a/tests/clock-fixture.cpp b/tests/clock-fixture.cpp
index f0f407b..abad20c 100644
--- a/tests/clock-fixture.cpp
+++ b/tests/clock-fixture.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2020, Regents of the University of California
+ * Copyright (c) 2014-2022, Regents of the University of California
*
* NAC 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
@@ -19,9 +19,7 @@
#include "tests/clock-fixture.hpp"
-namespace ndn {
-namespace nac {
-namespace tests {
+namespace ndn::nac::tests {
ClockFixture::ClockFixture()
: m_steadyClock(make_shared<time::UnitTestSteadyClock>())
@@ -51,6 +49,4 @@
}
}
-} // namespace tests
-} // namespace nac
-} // namespace ndn
+} // namespace ndn::nac::tests
diff --git a/tests/clock-fixture.hpp b/tests/clock-fixture.hpp
index c20b8d9..b6b40b1 100644
--- a/tests/clock-fixture.hpp
+++ b/tests/clock-fixture.hpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2020, Regents of the University of California
+ * Copyright (c) 2014-2022, Regents of the University of California
*
* NAC 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
@@ -22,11 +22,10 @@
#include <ndn-cxx/util/time-unit-test-clock.hpp>
-namespace ndn {
-namespace nac {
-namespace tests {
+namespace ndn::nac::tests {
-/** \brief A test fixture that overrides steady clock and system clock.
+/**
+ * \brief A test fixture that overrides steady clock and system clock.
*/
class ClockFixture
{
@@ -78,8 +77,6 @@
shared_ptr<time::UnitTestSystemClock> m_systemClock;
};
-} // namespace tests
-} // namespace nac
-} // namespace ndn
+} // namespace ndn::nac::tests
#endif // NAC_TESTS_CLOCK_FIXTURE_HPP
diff --git a/tests/io-key-chain-fixture.hpp b/tests/io-key-chain-fixture.hpp
index fa5beab..c88a700 100644
--- a/tests/io-key-chain-fixture.hpp
+++ b/tests/io-key-chain-fixture.hpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2020, Regents of the University of California
+ * Copyright (c) 2014-2022, Regents of the University of California
*
* NAC 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
@@ -25,9 +25,7 @@
#include <boost/asio/io_service.hpp>
-namespace ndn {
-namespace nac {
-namespace tests {
+namespace ndn::nac::tests {
class IoKeyChainFixture : public ClockFixture, public KeyChainFixture
{
@@ -49,8 +47,6 @@
boost::asio::io_service m_io;
};
-} // namespace tests
-} // namespace nac
-} // namespace ndn
+} // namespace ndn::nac::tests
#endif // NAC_TESTS_IO_KEY_CHAIN_FIXTURE_HPP
diff --git a/tests/key-chain-fixture.cpp b/tests/key-chain-fixture.cpp
index b416524..3db4c8a 100644
--- a/tests/key-chain-fixture.cpp
+++ b/tests/key-chain-fixture.cpp
@@ -23,9 +23,7 @@
#include <boost/filesystem.hpp>
-namespace ndn {
-namespace nac {
-namespace tests {
+namespace ndn::nac::tests {
using namespace ndn::security;
@@ -42,30 +40,6 @@
}
}
-Certificate
-KeyChainFixture::makeCert(const Key& key, const std::string& issuer, const Key& signingKey)
-{
- Certificate cert;
- cert.setName(Name(key.getName())
- .append(issuer)
- .appendVersion());
-
- // set metainfo
- cert.setContentType(tlv::ContentType_Key);
- cert.setFreshnessPeriod(1_h);
-
- // set content
- cert.setContent(key.getPublicKey());
-
- // set signature info
- ndn::SignatureInfo info;
- auto now = time::system_clock::now();
- info.setValidityPeriod(ValidityPeriod(now - 30_days, now + 30_days));
-
- m_keyChain.sign(cert, signingByKey(signingKey ? signingKey : key).setSignatureInfo(info));
- return cert;
-}
-
bool
KeyChainFixture::saveCert(const Data& cert, const std::string& filename)
{
@@ -114,6 +88,4 @@
return saveIdentityCert(id, filename);
}
-} // namespace tests
-} // namespace nac
-} // namespace ndn
+} // namespace ndn::nac::tests
diff --git a/tests/key-chain-fixture.hpp b/tests/key-chain-fixture.hpp
index ad3c6a1..7d6c16b 100644
--- a/tests/key-chain-fixture.hpp
+++ b/tests/key-chain-fixture.hpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2020, Regents of the University of California
+ * Copyright (c) 2014-2022, Regents of the University of California
*
* NAC 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
@@ -21,11 +21,8 @@
#define NAC_TESTS_KEY_CHAIN_FIXTURE_HPP
#include <ndn-cxx/security/key-chain.hpp>
-#include <ndn-cxx/security/signing-helpers.hpp>
-namespace ndn {
-namespace nac {
-namespace tests {
+namespace ndn::nac::tests {
/**
* @brief A fixture providing an in-memory KeyChain.
@@ -42,16 +39,6 @@
public:
/**
- * @brief Creates and returns a certificate for a given key
- * @param key The key for which to make a certificate
- * @param issuer The IssuerId to include in the certificate name
- * @param signingKey The key with which to sign the certificate; if not provided, the
- * certificate will be self-signed
- */
- Certificate
- makeCert(const Key& key, const std::string& issuer, const Key& signingKey = Key());
-
- /**
* @brief Saves an NDN certificate to a file
* @return true if successful, false otherwise
*/
@@ -88,8 +75,6 @@
std::vector<std::string> m_certFiles;
};
-} // namespace tests
-} // namespace nac
-} // namespace ndn
+} // namespace ndn::nac::tests
#endif // NAC_TESTS_KEY_CHAIN_FIXTURE_HPP
diff --git a/tests/unit/common.t.cpp b/tests/unit/common.t.cpp
index 3297cd4..c4d995f 100644
--- a/tests/unit/common.t.cpp
+++ b/tests/unit/common.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2020, Regents of the University of California
+ * Copyright (c) 2014-2022, Regents of the University of California
*
* This file is part of NAC (Name-Based Access Control for NDN).
* See AUTHORS.md for complete list of NAC authors and contributors.
@@ -21,16 +21,14 @@
#include "tests/boost-test.hpp"
-namespace ndn {
-namespace nac {
-namespace tests {
+namespace ndn::nac::tests {
BOOST_AUTO_TEST_SUITE(TestCommon)
BOOST_AUTO_TEST_CASE(Helpers)
{
bool hasFailed = false;
- auto onFailed = [&] (auto...) { hasFailed = true; };
+ auto onFailed = [&] (auto&&...) { hasFailed = true; };
auto kdkPrefix = convertKekNameToKdkPrefix(Name("/access/prefix/NAC/dataset/KEK/id"), onFailed);
@@ -62,6 +60,4 @@
BOOST_AUTO_TEST_SUITE_END()
-} // namespace tests
-} // namespace nac
-} // namespace ndn
+} // namespace ndn::nac::tests
diff --git a/tests/unit/encryptor.t.cpp b/tests/unit/encryptor.t.cpp
index d9bafba..02ae88b 100644
--- a/tests/unit/encryptor.t.cpp
+++ b/tests/unit/encryptor.t.cpp
@@ -23,10 +23,12 @@
#include "tests/io-key-chain-fixture.hpp"
#include "tests/unit/static-data.hpp"
-#include <iostream>
+#include <ndn-cxx/security/signing-helpers.hpp>
#include <ndn-cxx/util/dummy-client-face.hpp>
#include <ndn-cxx/util/string-helper.hpp>
+#include <iostream>
+
namespace ndn {
namespace nac {
namespace tests {