Refactor and modernize namespace declarations
* Completely remove inline namespace v2
* Flatten some unnecessarily deep namespace nesting
* Move DummyClientFace, Segmenter, SegmentFetcher to namespace ndn
* Move all unit tests to namespace ndn::tests
Change-Id: I8bcfcf9fd669936a3277d2d5d505f765b4b05742
diff --git a/tests/benchmarks/encoding-bench.cpp b/tests/benchmarks/encoding-bench.cpp
index 1adb452..a3e0b5e 100644
--- a/tests/benchmarks/encoding-bench.cpp
+++ b/tests/benchmarks/encoding-bench.cpp
@@ -30,11 +30,7 @@
#include <iostream>
-namespace ndn {
-namespace tlv {
-namespace tests {
-
-using namespace ndn::tests;
+namespace ndn::tests {
template<size_t WIRE_SIZE>
struct ReadVarNumberTest;
@@ -112,7 +108,7 @@
uint64_t number = 0;
for (int i = 0; i < N_ITERATIONS; ++i) {
const uint8_t* begin2 = begin; // make a copy because readVarNumber increments the pointer
- nOks += readVarNumber(begin2, end, number);
+ nOks += tlv::readVarNumber(begin2, end, number);
nCorrects += number == Test::VALUE;
// use the number and the return value, so compiler won't optimize out their computation
}
@@ -124,6 +120,4 @@
<< " " << d << std::endl;
}
-} // namespace tests
-} // namespace tlv
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/benchmarks/scheduler-bench.cpp b/tests/benchmarks/scheduler-bench.cpp
index 8897920..46af278 100644
--- a/tests/benchmarks/scheduler-bench.cpp
+++ b/tests/benchmarks/scheduler-bench.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2013-2020 Regents of the University of California.
+ * Copyright (c) 2013-2023 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -28,11 +28,7 @@
#include <boost/asio/io_service.hpp>
#include <iostream>
-namespace ndn {
-namespace scheduler {
-namespace tests {
-
-using namespace ndn::tests;
+namespace ndn::tests {
BOOST_AUTO_TEST_CASE(ScheduleCancel)
{
@@ -40,7 +36,7 @@
Scheduler sched(io);
const size_t nEvents = 1000000;
- std::vector<EventId> eventIds(nEvents);
+ std::vector<scheduler::EventId> eventIds(nEvents);
auto d1 = timedExecute([&] {
for (size_t i = 0; i < nEvents; ++i) {
@@ -67,8 +63,8 @@
size_t nExpired = 0;
// Events should expire at t1, but execution finishes at t2. The difference is the overhead.
- time::steady_clock::TimePoint t1 = time::steady_clock::now() + 5_s;
- time::steady_clock::TimePoint t2;
+ time::steady_clock::time_point t1 = time::steady_clock::now() + 5_s;
+ time::steady_clock::time_point t2;
// +1ms ensures this extra event is executed last. In case the overhead is less than 1ms,
// it will be reported as 1ms.
sched.schedule(t1 - time::steady_clock::now() + 1_ms, [&] {
@@ -86,6 +82,4 @@
std::cout << "execute " << nEvents << " events: " << (t2 - t1) << std::endl;
}
-} // namespace tests
-} // namespace scheduler
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/benchmarks/timed-execute.hpp b/tests/benchmarks/timed-execute.hpp
index b33873d..7ce5a82 100644
--- a/tests/benchmarks/timed-execute.hpp
+++ b/tests/benchmarks/timed-execute.hpp
@@ -24,8 +24,7 @@
#include "ndn-cxx/util/time.hpp"
-namespace ndn {
-namespace tests {
+namespace ndn::tests {
template<typename F>
time::nanoseconds
@@ -37,7 +36,6 @@
return after - before;
}
-} // namespace tests
-} // namespace ndn
+} // namespace ndn::tests
#endif // NDN_CXX_TESTS_BENCHMARKS_TIMED_EXECUTE_HPP
diff --git a/tests/integration/face.cpp b/tests/integration/face.cpp
index 9357094..7bd2408 100644
--- a/tests/integration/face.cpp
+++ b/tests/integration/face.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2013-2022 Regents of the University of California.
+ * Copyright (c) 2013-2023 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -37,8 +37,7 @@
#include <boost/mpl/vector.hpp>
-namespace ndn {
-namespace tests {
+namespace ndn::tests {
static Name
makeVeryLongName(Name prefix = Name())
@@ -377,5 +376,4 @@
BOOST_AUTO_TEST_SUITE_END() // IoRoutine
-} // namespace tests
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/integration/network-monitor.cpp b/tests/integration/network-monitor.cpp
index 0e7be10..cf6d8bd 100644
--- a/tests/integration/network-monitor.cpp
+++ b/tests/integration/network-monitor.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2013-2020 Regents of the University of California.
+ * Copyright (c) 2013-2023 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -33,9 +33,9 @@
#include <boost/asio/io_service.hpp>
#include <iostream>
-namespace ndn {
-namespace net {
-namespace tests {
+namespace ndn::tests {
+
+using namespace ndn::net;
static std::ostream&
logEvent(const shared_ptr<const NetworkInterface>& ni = nullptr, std::ostream& os = std::cout)
@@ -66,7 +66,7 @@
monitor.onInterfaceAdded.connect([] (const shared_ptr<const NetworkInterface>& ni) {
logEvent(ni) << "onInterfaceAdded\n" << *ni;
- logEvent(ni) << "link-type: " << detail::getLinkType(ni->getName()) << std::endl;
+ logEvent(ni) << "link-type: " << net::detail::getLinkType(ni->getName()) << std::endl;
ni->onAddressAdded.connect([ni] (const NetworkAddress& address) {
logEvent(ni) << "onAddressAdded " << address << std::endl;
@@ -78,7 +78,7 @@
ni->onStateChanged.connect([ni] (InterfaceState oldState, InterfaceState newState) {
logEvent(ni) << "onStateChanged " << oldState << " -> " << newState << std::endl;
- logEvent(ni) << "link-type: " << detail::getLinkType(ni->getName()) << std::endl;
+ logEvent(ni) << "link-type: " << net::detail::getLinkType(ni->getName()) << std::endl;
});
ni->onMtuChanged.connect([ni] (uint32_t oldMtu, uint32_t newMtu) {
@@ -93,6 +93,4 @@
io.run();
}
-} // namespace tests
-} // namespace net
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/key-chain-fixture.cpp b/tests/key-chain-fixture.cpp
index 7bbcf6a..fefc7cf 100644
--- a/tests/key-chain-fixture.cpp
+++ b/tests/key-chain-fixture.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2013-2022 Regents of the University of California.
+ * Copyright (c) 2013-2023 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -25,8 +25,7 @@
#include <boost/filesystem/operations.hpp>
-namespace ndn {
-namespace tests {
+namespace ndn::tests {
using namespace ndn::security;
@@ -91,5 +90,4 @@
return saveIdentityCert(id, filename);
}
-} // namespace tests
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/key-chain-fixture.hpp b/tests/key-chain-fixture.hpp
index ec1cac3..dc3a444 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) 2013-2022 Regents of the University of California.
+ * Copyright (c) 2013-2023 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -27,8 +27,7 @@
#include "tests/test-home-fixture.hpp"
-namespace ndn {
-namespace tests {
+namespace ndn::tests {
/**
* @brief A fixture providing an in-memory KeyChain.
@@ -81,7 +80,6 @@
std::vector<std::string> m_certFiles;
};
-} // namespace tests
-} // namespace ndn
+} // namespace ndn::tests
#endif // NDN_CXX_TESTS_KEY_CHAIN_FIXTURE_HPP
diff --git a/tests/test-common.cpp b/tests/test-common.cpp
index b0d06ea..e6c726e 100644
--- a/tests/test-common.cpp
+++ b/tests/test-common.cpp
@@ -21,8 +21,7 @@
#include "tests/test-common.hpp"
-namespace ndn {
-namespace tests {
+namespace ndn::tests {
shared_ptr<Interest>
makeInterest(const Name& name, bool canBePrefix, std::optional<time::milliseconds> lifetime,
@@ -61,5 +60,4 @@
return nack;
}
-} // namespace tests
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/test-common.hpp b/tests/test-common.hpp
index 7b74f35..202fb18 100644
--- a/tests/test-common.hpp
+++ b/tests/test-common.hpp
@@ -27,8 +27,7 @@
#include "ndn-cxx/lp/nack.hpp"
#include "tests/boost-test.hpp"
-namespace ndn {
-namespace tests {
+namespace ndn::tests {
/**
* \brief Create an Interest
@@ -74,16 +73,15 @@
* \param index the index of the name component to replace
* \param args arguments to name::Component constructor
*/
-template<typename Packet, typename ...Args>
+template<typename Packet, typename... Args>
void
-setNameComponent(Packet& pkt, ssize_t index, Args&& ...args)
+setNameComponent(Packet& pkt, ssize_t index, Args&&... args)
{
Name name = pkt.getName();
name.set(index, name::Component(std::forward<Args>(args)...));
pkt.setName(name);
}
-} // namespace tests
-} // namespace ndn
+} // namespace ndn::tests
#endif // NDN_CXX_TESTS_TEST_COMMON_HPP
diff --git a/tests/test-home-fixture.hpp b/tests/test-home-fixture.hpp
index 5778a6e..9801c92 100644
--- a/tests/test-home-fixture.hpp
+++ b/tests/test-home-fixture.hpp
@@ -32,8 +32,7 @@
#include <boost/filesystem/operations.hpp>
#include <boost/filesystem/path.hpp>
-namespace ndn {
-namespace tests {
+namespace ndn::tests {
/**
* @brief Fixture to adjust/restore NDN_CLIENT_PIB and NDN_CLIENT_TPM paths
@@ -121,7 +120,6 @@
static constexpr std::string_view PATH{"build/keys"};
};
-} // namespace tests
-} // namespace ndn
+} // namespace ndn::tests
#endif // NDN_CXX_TESTS_TEST_HOME_FIXTURE_HPP
diff --git a/tests/unit/clock-fixture.cpp b/tests/unit/clock-fixture.cpp
index 3f543ff..0efe19c 100644
--- a/tests/unit/clock-fixture.cpp
+++ b/tests/unit/clock-fixture.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2013-2020 Regents of the University of California.
+ * Copyright (c) 2013-2023 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -21,8 +21,7 @@
#include "tests/unit/clock-fixture.hpp"
-namespace ndn {
-namespace tests {
+namespace ndn::tests {
ClockFixture::ClockFixture()
: m_steadyClock(make_shared<time::UnitTestSteadyClock>())
@@ -52,5 +51,4 @@
}
}
-} // namespace tests
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/clock-fixture.hpp b/tests/unit/clock-fixture.hpp
index 68dabbf..a0309ae 100644
--- a/tests/unit/clock-fixture.hpp
+++ b/tests/unit/clock-fixture.hpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2013-2020 Regents of the University of California.
+ * Copyright (c) 2013-2023 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -24,8 +24,7 @@
#include "ndn-cxx/util/time-unit-test-clock.hpp"
-namespace ndn {
-namespace tests {
+namespace ndn::tests {
/** \brief A test fixture that overrides steady clock and system clock.
*/
@@ -79,7 +78,6 @@
shared_ptr<time::UnitTestSystemClock> m_systemClock;
};
-} // namespace tests
-} // namespace ndn
+} // namespace ndn::tests
#endif // NDN_CXX_TESTS_UNIT_CLOCK_FIXTURE_HPP
diff --git a/tests/unit/data.t.cpp b/tests/unit/data.t.cpp
index 5706a3e..4672a83 100644
--- a/tests/unit/data.t.cpp
+++ b/tests/unit/data.t.cpp
@@ -34,8 +34,7 @@
#include <boost/lexical_cast.hpp>
-namespace ndn {
-namespace tests {
+namespace ndn::tests {
BOOST_CONCEPT_ASSERT((boost::EqualityComparable<Data>));
BOOST_CONCEPT_ASSERT((WireEncodable<Data>));
@@ -668,5 +667,4 @@
BOOST_AUTO_TEST_SUITE_END() // TestData
-} // namespace tests
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/detail/cancel-handle.t.cpp b/tests/unit/detail/cancel-handle.t.cpp
index 2e951dd..e35fe55 100644
--- a/tests/unit/detail/cancel-handle.t.cpp
+++ b/tests/unit/detail/cancel-handle.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2013-2019 Regents of the University of California.
+ * Copyright (c) 2013-2023 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -23,9 +23,9 @@
#include "tests/boost-test.hpp"
-namespace ndn {
-namespace detail {
-namespace tests {
+namespace ndn::tests {
+
+using ndn::detail::CancelHandle;
BOOST_AUTO_TEST_SUITE(Detail)
BOOST_AUTO_TEST_SUITE(TestCancelHandle)
@@ -55,7 +55,7 @@
BOOST_AUTO_TEST_SUITE(ScopedHandle)
-using ScopedTestHandle = ScopedCancelHandle<CancelHandle>;
+using ScopedTestHandle = detail::ScopedCancelHandle<CancelHandle>;
BOOST_AUTO_TEST_CASE(ManualCancel)
{
@@ -134,6 +134,4 @@
BOOST_AUTO_TEST_SUITE_END() // TestCancelHandle
BOOST_AUTO_TEST_SUITE_END() // Detail
-} // namespace tests
-} // namespace detail
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/detail/packet-base.t.cpp b/tests/unit/detail/packet-base.t.cpp
index 41d47db..32e7e42 100644
--- a/tests/unit/detail/packet-base.t.cpp
+++ b/tests/unit/detail/packet-base.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2013-2018 Regents of the University of California.
+ * Copyright (c) 2013-2023 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -25,8 +25,7 @@
#include "tests/boost-test.hpp"
-namespace ndn {
-namespace tests {
+namespace ndn::tests {
BOOST_AUTO_TEST_SUITE(Detail)
BOOST_AUTO_TEST_SUITE(TestPacketBase)
@@ -62,5 +61,4 @@
BOOST_AUTO_TEST_SUITE_END() // TestPacketBase
BOOST_AUTO_TEST_SUITE_END() // Detail
-} // namespace tests
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/detail/tag-host.t.cpp b/tests/unit/detail/tag-host.t.cpp
index 72caa7e..c597203 100644
--- a/tests/unit/detail/tag-host.t.cpp
+++ b/tests/unit/detail/tag-host.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2013-2018 Regents of the University of California.
+ * Copyright (c) 2013-2023 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -27,8 +27,7 @@
#include <boost/mpl/vector.hpp>
-namespace ndn {
-namespace tests {
+namespace ndn::tests {
BOOST_AUTO_TEST_SUITE(Detail)
BOOST_AUTO_TEST_SUITE(TestTagHost)
@@ -53,7 +52,7 @@
}
};
-typedef boost::mpl::vector<TagHost, Interest, Data> Fixtures;
+using Fixtures = boost::mpl::vector<TagHost, Interest, Data>;
BOOST_FIXTURE_TEST_CASE_TEMPLATE(Basic, T, Fixtures, T)
{
@@ -84,5 +83,4 @@
BOOST_AUTO_TEST_SUITE_END() // TestTagHost
BOOST_AUTO_TEST_SUITE_END() // Detail
-} // namespace tests
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/dummy-validator.hpp b/tests/unit/dummy-validator.hpp
index 63b7556..903fcea 100644
--- a/tests/unit/dummy-validator.hpp
+++ b/tests/unit/dummy-validator.hpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2013-2022 Regents of the University of California.
+ * Copyright (c) 2013-2023 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -26,8 +26,7 @@
#include "ndn-cxx/security/validation-policy.hpp"
#include "ndn-cxx/security/certificate-fetcher-offline.hpp"
-namespace ndn {
-namespace tests {
+namespace ndn::tests {
/**
* \brief A dummy validation policy for unit testing.
@@ -109,7 +108,6 @@
}
};
-} // namespace tests
-} // namespace ndn
+} // namespace ndn::tests
#endif // NDN_CXX_TESTS_UNIT_DUMMY_VALIDATOR_HPP
diff --git a/tests/unit/encoding/block-helpers.t.cpp b/tests/unit/encoding/block-helpers.t.cpp
index ed8641e..18fce9a 100644
--- a/tests/unit/encoding/block-helpers.t.cpp
+++ b/tests/unit/encoding/block-helpers.t.cpp
@@ -24,9 +24,9 @@
#include "tests/boost-test.hpp"
-namespace ndn {
-namespace encoding {
-namespace tests {
+namespace ndn::tests {
+
+using namespace ndn::encoding;
BOOST_AUTO_TEST_SUITE(Encoding)
BOOST_AUTO_TEST_SUITE(TestBlockHelpers)
@@ -181,6 +181,4 @@
BOOST_AUTO_TEST_SUITE_END() // TestBlockHelpers
BOOST_AUTO_TEST_SUITE_END() // Encoding
-} // namespace tests
-} // namespace encoding
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/encoding/block.t.cpp b/tests/unit/encoding/block.t.cpp
index 8dd21d3..c93a307 100644
--- a/tests/unit/encoding/block.t.cpp
+++ b/tests/unit/encoding/block.t.cpp
@@ -31,8 +31,7 @@
#include <cstring>
#include <sstream>
-namespace ndn {
-namespace tests {
+namespace ndn::tests {
BOOST_CONCEPT_ASSERT((boost::EqualityComparable<Block>));
@@ -751,5 +750,4 @@
BOOST_AUTO_TEST_SUITE_END() // TestBlock
BOOST_AUTO_TEST_SUITE_END() // Encoding
-} // namespace tests
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/encoding/buffer-stream.t.cpp b/tests/unit/encoding/buffer-stream.t.cpp
index 3f67d50..7442299 100644
--- a/tests/unit/encoding/buffer-stream.t.cpp
+++ b/tests/unit/encoding/buffer-stream.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2013-2022 Regents of the University of California.
+ * Copyright (c) 2013-2023 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -23,8 +23,7 @@
#include "tests/boost-test.hpp"
-namespace ndn {
-namespace tests {
+namespace ndn::tests {
BOOST_AUTO_TEST_SUITE(Encoding)
BOOST_AUTO_TEST_SUITE(TestBufferStream)
@@ -84,5 +83,4 @@
BOOST_AUTO_TEST_SUITE_END() // TestBufferStream
BOOST_AUTO_TEST_SUITE_END() // Encoding
-} // namespace tests
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/encoding/encoder.t.cpp b/tests/unit/encoding/encoder.t.cpp
index 0402f14..5e71e2c 100644
--- a/tests/unit/encoding/encoder.t.cpp
+++ b/tests/unit/encoding/encoder.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2013-2022 Regents of the University of California.
+ * Copyright (c) 2013-2023 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -23,9 +23,9 @@
#include "tests/boost-test.hpp"
-namespace ndn {
-namespace encoding {
-namespace tests {
+namespace ndn::tests {
+
+using namespace ndn::encoding;
BOOST_AUTO_TEST_SUITE(Encoding)
BOOST_AUTO_TEST_SUITE(TestEncoder)
@@ -155,6 +155,4 @@
BOOST_AUTO_TEST_SUITE_END() // TestEncoder
BOOST_AUTO_TEST_SUITE_END() // Encoding
-} // namespace tests
-} // namespace encoding
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/encoding/encoding-buffer.t.cpp b/tests/unit/encoding/encoding-buffer.t.cpp
index c0997b4..a5fa639 100644
--- a/tests/unit/encoding/encoding-buffer.t.cpp
+++ b/tests/unit/encoding/encoding-buffer.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2013-2018 Regents of the University of California.
+ * Copyright (c) 2013-2023 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -24,15 +24,7 @@
#include "tests/boost-test.hpp"
-namespace ndn {
-namespace tests {
-
-class BufferEstimatorFixture
-{
-public:
- EncodingBuffer buffer;
- EncodingEstimator estimator;
-};
+namespace ndn::tests {
BOOST_AUTO_TEST_SUITE(Encoding)
BOOST_AUTO_TEST_SUITE(TestEncodingBuffer)
@@ -61,6 +53,13 @@
}
}
+class BufferEstimatorFixture
+{
+public:
+ EncodingBuffer buffer;
+ EncodingEstimator estimator;
+};
+
BOOST_FIXTURE_TEST_SUITE(PrependVarNumber, BufferEstimatorFixture)
BOOST_AUTO_TEST_CASE(OneByte1)
@@ -198,5 +197,4 @@
BOOST_AUTO_TEST_SUITE_END() // TestEncodingBuffer
BOOST_AUTO_TEST_SUITE_END() // Encoding
-} // namespace tests
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/encoding/estimator.t.cpp b/tests/unit/encoding/estimator.t.cpp
index cb86424..12a369b 100644
--- a/tests/unit/encoding/estimator.t.cpp
+++ b/tests/unit/encoding/estimator.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2013-2022 Regents of the University of California.
+ * Copyright (c) 2013-2023 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -23,9 +23,9 @@
#include "tests/boost-test.hpp"
-namespace ndn {
-namespace encoding {
-namespace tests {
+namespace ndn::tests {
+
+using namespace ndn::encoding;
BOOST_AUTO_TEST_SUITE(Encoding)
BOOST_AUTO_TEST_SUITE(TestEstimator)
@@ -103,6 +103,4 @@
BOOST_AUTO_TEST_SUITE_END() // TestEstimator
BOOST_AUTO_TEST_SUITE_END() // Encoding
-} // namespace tests
-} // namespace encoding
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/encoding/nfd-constants.t.cpp b/tests/unit/encoding/nfd-constants.t.cpp
index e1bc111..6821c44 100644
--- a/tests/unit/encoding/nfd-constants.t.cpp
+++ b/tests/unit/encoding/nfd-constants.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2013-2020 Regents of the University of California.
+ * Copyright (c) 2013-2023 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -27,9 +27,9 @@
#include <iomanip>
#include <sstream>
-namespace ndn {
-namespace nfd {
-namespace tests {
+namespace ndn::tests {
+
+using namespace ndn::nfd;
BOOST_AUTO_TEST_SUITE(Encoding)
BOOST_AUTO_TEST_SUITE(TestNfdConstants)
@@ -142,6 +142,4 @@
BOOST_AUTO_TEST_SUITE_END() // TestNfdConstants
BOOST_AUTO_TEST_SUITE_END() // Encoding
-} // namespace tests
-} // namespace nfd
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/encoding/tlv.t.cpp b/tests/unit/encoding/tlv.t.cpp
index 9cd7cc4..e38b5f2 100644
--- a/tests/unit/encoding/tlv.t.cpp
+++ b/tests/unit/encoding/tlv.t.cpp
@@ -34,9 +34,9 @@
#include <boost/iostreams/device/array.hpp>
#include <boost/lexical_cast.hpp>
-namespace ndn {
-namespace tlv {
-namespace tests {
+namespace ndn::tests {
+
+using namespace ndn::tlv;
BOOST_AUTO_TEST_SUITE(Encoding)
BOOST_AUTO_TEST_SUITE(TestTlv)
@@ -59,9 +59,9 @@
using StreamIterator = std::istream_iterator<uint8_t>;
#define ASSERT_READ_NUMBER_IS_FAST(T) \
- static_assert(detail::IsContiguousIterator<T>, #T " is not fast")
+ static_assert(ndn::tlv::detail::IsContiguousIterator<T>, #T " is not fast")
#define ASSERT_READ_NUMBER_IS_SLOW(T) \
- static_assert(!detail::IsContiguousIterator<T>, #T " is not slow")
+ static_assert(!ndn::tlv::detail::IsContiguousIterator<T>, #T " is not slow")
ASSERT_READ_NUMBER_IS_FAST(const uint8_t*);
ASSERT_READ_NUMBER_IS_FAST(uint8_t*);
@@ -605,6 +605,4 @@
BOOST_AUTO_TEST_SUITE_END() // TestTlv
BOOST_AUTO_TEST_SUITE_END() // Encoding
-} // namespace tests
-} // namespace tlv
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/face.t.cpp b/tests/unit/face.t.cpp
index 9d622ed..c4ae026 100644
--- a/tests/unit/face.t.cpp
+++ b/tests/unit/face.t.cpp
@@ -31,10 +31,7 @@
#include <boost/logic/tribool.hpp>
-namespace ndn {
-namespace tests {
-
-using ndn::util::DummyClientFace;
+namespace ndn::tests {
struct WantPrefixRegReply;
struct NoPrefixRegReply;
@@ -912,7 +909,7 @@
{
};
-typedef boost::mpl::vector<WithEnv, WithConfig> ConfigOptions;
+using ConfigOptions = boost::mpl::vector<WithEnv, WithConfig>;
BOOST_FIXTURE_TEST_CASE(NoConfig, WithEnvAndConfig) // fixture configures test HOME and PIB/TPM path
{
@@ -978,5 +975,4 @@
BOOST_AUTO_TEST_SUITE_END() // TestFace
-} // namespace tests
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/ims/in-memory-storage-fifo.t.cpp b/tests/unit/ims/in-memory-storage-fifo.t.cpp
index bdf86ea..632a566 100644
--- a/tests/unit/ims/in-memory-storage-fifo.t.cpp
+++ b/tests/unit/ims/in-memory-storage-fifo.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2013-2020 Regents of the University of California.
+ * Copyright (c) 2013-2023 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -23,10 +23,7 @@
#include "tests/test-common.hpp"
-namespace ndn {
-namespace tests {
-
-using namespace ndn::tests;
+namespace ndn::tests {
BOOST_AUTO_TEST_SUITE(Ims)
BOOST_AUTO_TEST_SUITE(TestInMemoryStorageFifo)
@@ -90,5 +87,4 @@
BOOST_AUTO_TEST_SUITE_END() // TestInMemoryStorageFifo
BOOST_AUTO_TEST_SUITE_END() // Ims
-} // namespace tests
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/ims/in-memory-storage-lfu.t.cpp b/tests/unit/ims/in-memory-storage-lfu.t.cpp
index 17aa9a6..34285dc 100644
--- a/tests/unit/ims/in-memory-storage-lfu.t.cpp
+++ b/tests/unit/ims/in-memory-storage-lfu.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2013-2020 Regents of the University of California.
+ * Copyright (c) 2013-2023 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -23,10 +23,7 @@
#include "tests/test-common.hpp"
-namespace ndn {
-namespace tests {
-
-using namespace ndn::tests;
+namespace ndn::tests {
BOOST_AUTO_TEST_SUITE(Ims)
BOOST_AUTO_TEST_SUITE(TestInMemoryStorageLfu)
@@ -130,5 +127,4 @@
BOOST_AUTO_TEST_SUITE_END() // TestInMemoryStorageLfu
BOOST_AUTO_TEST_SUITE_END() // Ims
-} // namespace tests
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/ims/in-memory-storage-lru.t.cpp b/tests/unit/ims/in-memory-storage-lru.t.cpp
index cbf2bab..5a37ca7 100644
--- a/tests/unit/ims/in-memory-storage-lru.t.cpp
+++ b/tests/unit/ims/in-memory-storage-lru.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2013-2020 Regents of the University of California.
+ * Copyright (c) 2013-2023 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -23,10 +23,7 @@
#include "tests/test-common.hpp"
-namespace ndn {
-namespace tests {
-
-using namespace ndn::tests;
+namespace ndn::tests {
BOOST_AUTO_TEST_SUITE(Ims)
BOOST_AUTO_TEST_SUITE(TestInMemoryStorageLru)
@@ -132,5 +129,4 @@
BOOST_AUTO_TEST_SUITE_END() // TestInMemoryStorageLru
BOOST_AUTO_TEST_SUITE_END() // Ims
-} // namespace tests
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/ims/in-memory-storage-persistent.t.cpp b/tests/unit/ims/in-memory-storage-persistent.t.cpp
index d0cabf9..33a3afb 100644
--- a/tests/unit/ims/in-memory-storage-persistent.t.cpp
+++ b/tests/unit/ims/in-memory-storage-persistent.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2013-2020 Regents of the University of California.
+ * Copyright (c) 2013-2023 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -23,10 +23,7 @@
#include "tests/test-common.hpp"
-namespace ndn {
-namespace tests {
-
-using namespace ndn::tests;
+namespace ndn::tests {
BOOST_AUTO_TEST_SUITE(Ims)
BOOST_AUTO_TEST_SUITE(TestInMemoryStoragePersistent)
@@ -78,5 +75,4 @@
BOOST_AUTO_TEST_SUITE_END() // TestInMemoryStoragePersistent
BOOST_AUTO_TEST_SUITE_END() // Ims
-} // namespace tests
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/ims/in-memory-storage.t.cpp b/tests/unit/ims/in-memory-storage.t.cpp
index 27caa34..ac1c7c2 100644
--- a/tests/unit/ims/in-memory-storage.t.cpp
+++ b/tests/unit/ims/in-memory-storage.t.cpp
@@ -31,10 +31,7 @@
#include <boost/mpl/vector.hpp>
-namespace ndn {
-namespace tests {
-
-using namespace ndn::tests;
+namespace ndn::tests {
BOOST_AUTO_TEST_SUITE(Ims)
BOOST_AUTO_TEST_SUITE(TestInMemoryStorage)
@@ -601,5 +598,4 @@
BOOST_AUTO_TEST_SUITE_END() // TestInMemoryStorage
BOOST_AUTO_TEST_SUITE_END() // Ims
-} // namespace tests
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/interest-filter.t.cpp b/tests/unit/interest-filter.t.cpp
index 12aba0a..f4354e7 100644
--- a/tests/unit/interest-filter.t.cpp
+++ b/tests/unit/interest-filter.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2013-2020 Regents of the University of California.
+ * Copyright (c) 2013-2023 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -26,8 +26,7 @@
#include "tests/test-common.hpp"
-namespace ndn {
-namespace tests {
+namespace ndn::tests {
BOOST_AUTO_TEST_SUITE(TestInterestFilter)
@@ -52,7 +51,7 @@
BOOST_AUTO_TEST_CASE(RegexConvertToName)
{
- util::DummyClientFace face;
+ DummyClientFace face;
face.setInterestFilter(InterestFilter("/Hello/World", "<><b><c>?"),
[] (const Name&, const Interest&) { BOOST_ERROR("unexpected Interest"); });
face.processEvents(1_ms);
@@ -69,5 +68,4 @@
BOOST_AUTO_TEST_SUITE_END() // TestInterestFilter
-} // namespace tests
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/interest.t.cpp b/tests/unit/interest.t.cpp
index 73afe60..036dc72 100644
--- a/tests/unit/interest.t.cpp
+++ b/tests/unit/interest.t.cpp
@@ -24,8 +24,7 @@
#include "tests/test-common.hpp"
-namespace ndn {
-namespace tests {
+namespace ndn::tests {
BOOST_CONCEPT_ASSERT((WireEncodable<Interest>));
BOOST_CONCEPT_ASSERT((WireEncodableWithEncodingBuffer<Interest>));
@@ -1172,5 +1171,4 @@
BOOST_AUTO_TEST_SUITE_END() // TestInterest
-} // namespace tests
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/io-fixture.hpp b/tests/unit/io-fixture.hpp
index 1c872c4..4934954 100644
--- a/tests/unit/io-fixture.hpp
+++ b/tests/unit/io-fixture.hpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2013-2020 Regents of the University of California.
+ * Copyright (c) 2013-2023 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -26,8 +26,7 @@
#include <boost/asio/io_service.hpp>
-namespace ndn {
-namespace tests {
+namespace ndn::tests {
class IoFixture : public ClockFixture
{
@@ -49,7 +48,6 @@
boost::asio::io_service m_io;
};
-} // namespace tests
-} // namespace ndn
+} // namespace ndn::tests
#endif // NDN_CXX_TESTS_UNIT_IO_FIXTURE_HPP
diff --git a/tests/unit/io-key-chain-fixture.hpp b/tests/unit/io-key-chain-fixture.hpp
index 2df51b1..3ac2edf 100644
--- a/tests/unit/io-key-chain-fixture.hpp
+++ b/tests/unit/io-key-chain-fixture.hpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2013-2020 Regents of the University of California.
+ * Copyright (c) 2013-2023 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -25,14 +25,12 @@
#include "tests/key-chain-fixture.hpp"
#include "tests/unit/io-fixture.hpp"
-namespace ndn {
-namespace tests {
+namespace ndn::tests {
class IoKeyChainFixture : public IoFixture, public KeyChainFixture
{
};
-} // namespace tests
-} // namespace ndn
+} // namespace ndn::tests
#endif // NDN_CXX_TESTS_UNIT_IO_KEY_CHAIN_FIXTURE_HPP
diff --git a/tests/unit/key-locator.t.cpp b/tests/unit/key-locator.t.cpp
index 7a8b636..50daa8c 100644
--- a/tests/unit/key-locator.t.cpp
+++ b/tests/unit/key-locator.t.cpp
@@ -26,8 +26,7 @@
#include <boost/lexical_cast.hpp>
-namespace ndn {
-namespace tests {
+namespace ndn::tests {
BOOST_CONCEPT_ASSERT((boost::EqualityComparable<KeyLocator>));
BOOST_CONCEPT_ASSERT((WireEncodable<KeyLocator>));
@@ -200,5 +199,4 @@
BOOST_AUTO_TEST_SUITE_END() // TestKeyLocator
-} // namespace tests
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/link.t.cpp b/tests/unit/link.t.cpp
index 106541a..f1bbd07 100644
--- a/tests/unit/link.t.cpp
+++ b/tests/unit/link.t.cpp
@@ -23,8 +23,7 @@
#include "tests/test-common.hpp"
-namespace ndn {
-namespace tests {
+namespace ndn::tests {
BOOST_CONCEPT_ASSERT((boost::EqualityComparable<Link>));
BOOST_CONCEPT_ASSERT((WireEncodable<Link>));
@@ -175,5 +174,4 @@
BOOST_AUTO_TEST_SUITE_END() // TestLink
-} // namespace tests
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/lp/cache-policy.t.cpp b/tests/unit/lp/cache-policy.t.cpp
index 8b27a6c..08b9d25 100644
--- a/tests/unit/lp/cache-policy.t.cpp
+++ b/tests/unit/lp/cache-policy.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2013-2022 Regents of the University of California.
+ * Copyright (c) 2013-2023 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -25,9 +25,9 @@
#include "tests/boost-test.hpp"
-namespace ndn {
-namespace lp {
-namespace tests {
+namespace ndn::tests {
+
+using namespace ndn::lp;
BOOST_AUTO_TEST_SUITE(Lp)
BOOST_AUTO_TEST_SUITE(TestCachePolicy)
@@ -92,6 +92,4 @@
BOOST_AUTO_TEST_SUITE_END() // TestCachePolicy
BOOST_AUTO_TEST_SUITE_END() // Lp
-} // namespace tests
-} // namespace lp
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/lp/fields.t.cpp b/tests/unit/lp/fields.t.cpp
index e828051..5028b2b 100644
--- a/tests/unit/lp/fields.t.cpp
+++ b/tests/unit/lp/fields.t.cpp
@@ -21,9 +21,9 @@
#include "ndn-cxx/lp/fields.hpp"
-namespace ndn {
-namespace lp {
-namespace tests {
+namespace ndn::tests {
+
+using namespace ndn::lp;
BOOST_CONCEPT_ASSERT((Field<FragmentField>));
BOOST_CONCEPT_ASSERT((Field<SequenceField>));
@@ -40,6 +40,4 @@
BOOST_CONCEPT_ASSERT((Field<NonDiscoveryField>));
BOOST_CONCEPT_ASSERT((Field<PrefixAnnouncementField>));
-} // namespace tests
-} // namespace lp
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/lp/nack-header.t.cpp b/tests/unit/lp/nack-header.t.cpp
index c914eb0..efe31b0 100644
--- a/tests/unit/lp/nack-header.t.cpp
+++ b/tests/unit/lp/nack-header.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2013-2022 Regents of the University of California.
+ * Copyright (c) 2013-2023 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -25,9 +25,9 @@
#include "tests/boost-test.hpp"
-namespace ndn {
-namespace lp {
-namespace tests {
+namespace ndn::tests {
+
+using namespace ndn::lp;
BOOST_AUTO_TEST_SUITE(Lp)
BOOST_AUTO_TEST_SUITE(TestNackHeader)
@@ -112,6 +112,4 @@
BOOST_AUTO_TEST_SUITE_END() // TestNackHeader
BOOST_AUTO_TEST_SUITE_END() // Lp
-} // namespace tests
-} // namespace lp
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/lp/nack.t.cpp b/tests/unit/lp/nack.t.cpp
index ef30de1..64835ef 100644
--- a/tests/unit/lp/nack.t.cpp
+++ b/tests/unit/lp/nack.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2013-2018 Regents of the University of California.
+ * Copyright (c) 2013-2023 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -25,9 +25,9 @@
#include "tests/boost-test.hpp"
-namespace ndn {
-namespace lp {
-namespace tests {
+namespace ndn::tests {
+
+using namespace ndn::lp;
BOOST_AUTO_TEST_SUITE(Lp)
BOOST_AUTO_TEST_SUITE(TestNack)
@@ -60,6 +60,4 @@
BOOST_AUTO_TEST_SUITE_END() // TestNack
BOOST_AUTO_TEST_SUITE_END() // Lp
-} // namespace tests
-} // namespace lp
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/lp/packet.t.cpp b/tests/unit/lp/packet.t.cpp
index 68f55fc..01cc05b 100644
--- a/tests/unit/lp/packet.t.cpp
+++ b/tests/unit/lp/packet.t.cpp
@@ -25,9 +25,9 @@
#include "tests/key-chain-fixture.hpp"
#include "tests/test-common.hpp"
-namespace ndn {
-namespace lp {
-namespace tests {
+namespace ndn::tests {
+
+using namespace ndn::lp;
BOOST_AUTO_TEST_SUITE(Lp)
BOOST_AUTO_TEST_SUITE(TestPacket)
@@ -425,10 +425,10 @@
BOOST_CHECK_THROW(packet.wireDecode(wire), Packet::Error);
}
-BOOST_FIXTURE_TEST_CASE(DecodePrefixAnnouncement, ndn::tests::KeyChainFixture)
+BOOST_FIXTURE_TEST_CASE(DecodePrefixAnnouncement, KeyChainFixture)
{
// Construct Data which prefix announcement is attached to
- auto data0 = ndn::tests::makeData("/edu/ua/cs/news/index.html");
+ auto data0 = makeData("/edu/ua/cs/news/index.html");
Packet packet0;
packet0.wireDecode(data0->wireEncode());
@@ -455,6 +455,4 @@
BOOST_AUTO_TEST_SUITE_END() // TestPacket
BOOST_AUTO_TEST_SUITE_END() // Lp
-} // namespace tests
-} // namespace lp
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/lp/pit-token.t.cpp b/tests/unit/lp/pit-token.t.cpp
index 49d77c1..6f45b32 100644
--- a/tests/unit/lp/pit-token.t.cpp
+++ b/tests/unit/lp/pit-token.t.cpp
@@ -26,9 +26,9 @@
#include <boost/lexical_cast.hpp>
-namespace ndn {
-namespace lp {
-namespace tests {
+namespace ndn::tests {
+
+using namespace ndn::lp;
BOOST_AUTO_TEST_SUITE(Lp)
BOOST_AUTO_TEST_SUITE(TestPitToken)
@@ -76,6 +76,4 @@
BOOST_AUTO_TEST_SUITE_END() // TestPitToken
BOOST_AUTO_TEST_SUITE_END() // Lp
-} // namespace tests
-} // namespace lp
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/lp/prefix-announcement-header.t.cpp b/tests/unit/lp/prefix-announcement-header.t.cpp
index a107eb5..ef4b11f 100644
--- a/tests/unit/lp/prefix-announcement-header.t.cpp
+++ b/tests/unit/lp/prefix-announcement-header.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2013-2020 Regents of the University of California.
+ * Copyright (c) 2013-2023 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -25,12 +25,12 @@
#include "tests/boost-test.hpp"
#include "tests/key-chain-fixture.hpp"
-namespace ndn {
-namespace lp {
-namespace tests {
+namespace ndn::tests {
+
+using namespace ndn::lp;
BOOST_AUTO_TEST_SUITE(Lp)
-BOOST_FIXTURE_TEST_SUITE(TestPrefixAnnouncementHeader, ndn::tests::KeyChainFixture)
+BOOST_FIXTURE_TEST_SUITE(TestPrefixAnnouncementHeader, KeyChainFixture)
BOOST_AUTO_TEST_CASE(EncodeDecode)
{
@@ -45,7 +45,7 @@
const Data& data = pa.toData(m_keyChain, signingWithSha256(), 1);
Block encodedData = data.wireEncode();
- Block expectedBlock(tlv::PrefixAnnouncement);
+ Block expectedBlock(ndn::lp::tlv::PrefixAnnouncement);
expectedBlock.push_back(encodedData);
expectedBlock.encode();
@@ -64,6 +64,4 @@
BOOST_AUTO_TEST_SUITE_END() // TestPrefixAnnouncementHeader
BOOST_AUTO_TEST_SUITE_END() // Lp
-} // namespace tests
-} // namespace lp
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/meta-info.t.cpp b/tests/unit/meta-info.t.cpp
index f909565..2e37ea5 100644
--- a/tests/unit/meta-info.t.cpp
+++ b/tests/unit/meta-info.t.cpp
@@ -23,8 +23,7 @@
#include "tests/boost-test.hpp"
-namespace ndn {
-namespace tests {
+namespace ndn::tests {
BOOST_CONCEPT_ASSERT((WireEncodable<MetaInfo>));
BOOST_CONCEPT_ASSERT((WireEncodableWithEncodingBuffer<MetaInfo>));
@@ -161,5 +160,4 @@
BOOST_AUTO_TEST_SUITE_END() // TestMetaInfo
-} // namespace tests
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/metadata-object.t.cpp b/tests/unit/metadata-object.t.cpp
index 3fd5d09..480f7d4 100644
--- a/tests/unit/metadata-object.t.cpp
+++ b/tests/unit/metadata-object.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2013-2022 Regents of the University of California.
+ * Copyright (c) 2013-2023 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -24,8 +24,7 @@
#include "tests/boost-test.hpp"
#include "tests/key-chain-fixture.hpp"
-namespace ndn {
-namespace tests {
+namespace ndn::tests {
class MetadataObjectFixture : public KeyChainFixture
{
@@ -167,5 +166,4 @@
BOOST_AUTO_TEST_SUITE_END() // TestMetadataObject
-} // namespace tests
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/mgmt/control-response.t.cpp b/tests/unit/mgmt/control-response.t.cpp
index 1dd69b1..7e72c26 100644
--- a/tests/unit/mgmt/control-response.t.cpp
+++ b/tests/unit/mgmt/control-response.t.cpp
@@ -24,9 +24,9 @@
#include "tests/boost-test.hpp"
-namespace ndn {
-namespace mgmt {
-namespace tests {
+namespace ndn::tests {
+
+using namespace ndn::mgmt;
BOOST_CONCEPT_ASSERT((WireEncodable<ControlResponse>));
BOOST_CONCEPT_ASSERT((WireDecodable<ControlResponse>));
@@ -62,6 +62,4 @@
BOOST_AUTO_TEST_SUITE_END() // TestControlResponse
BOOST_AUTO_TEST_SUITE_END() // Mgmt
-} // namespace tests
-} // namespace mgmt
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/mgmt/dispatcher.t.cpp b/tests/unit/mgmt/dispatcher.t.cpp
index 9b01628..1e1c947 100644
--- a/tests/unit/mgmt/dispatcher.t.cpp
+++ b/tests/unit/mgmt/dispatcher.t.cpp
@@ -26,11 +26,9 @@
#include "tests/test-common.hpp"
#include "tests/unit/io-key-chain-fixture.hpp"
-namespace ndn {
-namespace mgmt {
-namespace tests {
+namespace ndn::tests {
-using namespace ndn::tests;
+using namespace ndn::mgmt;
class DispatcherFixture : public IoKeyChainFixture
{
@@ -43,7 +41,7 @@
}
public:
- util::DummyClientFace face;
+ DummyClientFace face;
mgmt::Dispatcher dispatcher;
InMemoryStorageFifo& storage;
};
@@ -473,6 +471,4 @@
BOOST_AUTO_TEST_SUITE_END() // TestDispatcher
BOOST_AUTO_TEST_SUITE_END() // Mgmt
-} // namespace tests
-} // namespace mgmt
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/mgmt/nfd/channel-status.t.cpp b/tests/unit/mgmt/nfd/channel-status.t.cpp
index 8036d0d..b9c6455 100644
--- a/tests/unit/mgmt/nfd/channel-status.t.cpp
+++ b/tests/unit/mgmt/nfd/channel-status.t.cpp
@@ -26,9 +26,9 @@
#include <boost/lexical_cast.hpp>
-namespace ndn {
-namespace nfd {
-namespace tests {
+namespace ndn::tests {
+
+using namespace ndn::nfd;
BOOST_CONCEPT_ASSERT((StatusDatasetItem<ChannelStatus>));
@@ -85,6 +85,4 @@
BOOST_AUTO_TEST_SUITE_END() // Nfd
BOOST_AUTO_TEST_SUITE_END() // Mgmt
-} // namespace tests
-} // namespace nfd
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/mgmt/nfd/command-options.t.cpp b/tests/unit/mgmt/nfd/command-options.t.cpp
index d41c512..f7d74b1 100644
--- a/tests/unit/mgmt/nfd/command-options.t.cpp
+++ b/tests/unit/mgmt/nfd/command-options.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2013-2018 Regents of the University of California.
+ * Copyright (c) 2013-2023 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -24,9 +24,9 @@
#include "tests/boost-test.hpp"
-namespace ndn {
-namespace nfd {
-namespace tests {
+namespace ndn::tests {
+
+using namespace ndn::nfd;
BOOST_AUTO_TEST_SUITE(Mgmt)
BOOST_AUTO_TEST_SUITE(Nfd)
@@ -74,6 +74,4 @@
BOOST_AUTO_TEST_SUITE_END() // Nfd
BOOST_AUTO_TEST_SUITE_END() // Mgmt
-} // namespace tests
-} // namespace nfd
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/mgmt/nfd/control-command.t.cpp b/tests/unit/mgmt/nfd/control-command.t.cpp
index 25371fd..2da5270 100644
--- a/tests/unit/mgmt/nfd/control-command.t.cpp
+++ b/tests/unit/mgmt/nfd/control-command.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2013-2020 Regents of the University of California.
+ * Copyright (c) 2013-2023 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -23,9 +23,9 @@
#include "tests/boost-test.hpp"
-namespace ndn {
-namespace nfd {
-namespace tests {
+namespace ndn::tests {
+
+using namespace ndn::nfd;
BOOST_AUTO_TEST_SUITE(Mgmt)
BOOST_AUTO_TEST_SUITE(Nfd)
@@ -500,6 +500,4 @@
BOOST_AUTO_TEST_SUITE_END() // Nfd
BOOST_AUTO_TEST_SUITE_END() // Mgmt
-} // namespace tests
-} // namespace nfd
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/mgmt/nfd/control-parameters.t.cpp b/tests/unit/mgmt/nfd/control-parameters.t.cpp
index 4866620..e89b4f3 100644
--- a/tests/unit/mgmt/nfd/control-parameters.t.cpp
+++ b/tests/unit/mgmt/nfd/control-parameters.t.cpp
@@ -24,9 +24,9 @@
#include "tests/boost-test.hpp"
-namespace ndn {
-namespace nfd {
-namespace tests {
+namespace ndn::tests {
+
+using namespace ndn::nfd;
BOOST_CONCEPT_ASSERT((WireEncodable<ControlParameters>));
BOOST_CONCEPT_ASSERT((WireDecodable<ControlParameters>));
@@ -248,6 +248,4 @@
BOOST_AUTO_TEST_SUITE_END() // Nfd
BOOST_AUTO_TEST_SUITE_END() // Mgmt
-} // namespace tests
-} // namespace nfd
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/mgmt/nfd/controller-fixture.hpp b/tests/unit/mgmt/nfd/controller-fixture.hpp
index 38b44fd..d1cd401 100644
--- a/tests/unit/mgmt/nfd/controller-fixture.hpp
+++ b/tests/unit/mgmt/nfd/controller-fixture.hpp
@@ -28,11 +28,7 @@
#include "tests/unit/dummy-validator.hpp"
#include "tests/unit/io-key-chain-fixture.hpp"
-namespace ndn {
-namespace nfd {
-namespace tests {
-
-using namespace ndn::tests;
+namespace ndn::tests {
class ControllerFixture : public IoKeyChainFixture
{
@@ -59,16 +55,14 @@
}
protected:
- ndn::util::DummyClientFace face;
+ DummyClientFace face;
DummyValidator m_validator;
- Controller controller;
- CommandFailureCallback commandFailCallback;
- DatasetFailureCallback datasetFailCallback;
+ nfd::Controller controller;
+ nfd::CommandFailureCallback commandFailCallback;
+ nfd::DatasetFailureCallback datasetFailCallback;
std::vector<uint32_t> failCodes;
};
-} // namespace tests
-} // namespace nfd
-} // namespace ndn
+} // namespace ndn::tests
#endif // NDN_CXX_TESTS_UNIT_MGMT_NFD_CONTROLLER_FIXTURE_HPP
diff --git a/tests/unit/mgmt/nfd/controller.t.cpp b/tests/unit/mgmt/nfd/controller.t.cpp
index d68611f..6760d5e 100644
--- a/tests/unit/mgmt/nfd/controller.t.cpp
+++ b/tests/unit/mgmt/nfd/controller.t.cpp
@@ -25,11 +25,9 @@
#include "tests/test-common.hpp"
#include "tests/unit/mgmt/nfd/controller-fixture.hpp"
-namespace ndn {
-namespace nfd {
-namespace tests {
+namespace ndn::tests {
-using namespace ndn::tests;
+using namespace ndn::nfd;
BOOST_AUTO_TEST_SUITE(Mgmt)
BOOST_AUTO_TEST_SUITE(Nfd)
@@ -260,6 +258,4 @@
BOOST_AUTO_TEST_SUITE_END() // Nfd
BOOST_AUTO_TEST_SUITE_END() // Mgmt
-} // namespace tests
-} // namespace nfd
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/mgmt/nfd/cs-info.t.cpp b/tests/unit/mgmt/nfd/cs-info.t.cpp
index 70d8a20..9e4a437 100644
--- a/tests/unit/mgmt/nfd/cs-info.t.cpp
+++ b/tests/unit/mgmt/nfd/cs-info.t.cpp
@@ -26,9 +26,9 @@
#include <boost/lexical_cast.hpp>
-namespace ndn {
-namespace nfd {
-namespace tests {
+namespace ndn::tests {
+
+using namespace ndn::nfd;
BOOST_CONCEPT_ASSERT((StatusDatasetItem<CsInfo>));
@@ -126,6 +126,4 @@
BOOST_AUTO_TEST_SUITE_END() // Nfd
BOOST_AUTO_TEST_SUITE_END() // Mgmt
-} // namespace tests
-} // namespace nfd
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/mgmt/nfd/face-event-notification.t.cpp b/tests/unit/mgmt/nfd/face-event-notification.t.cpp
index 97b3000..3686b17 100644
--- a/tests/unit/mgmt/nfd/face-event-notification.t.cpp
+++ b/tests/unit/mgmt/nfd/face-event-notification.t.cpp
@@ -26,9 +26,9 @@
#include <boost/lexical_cast.hpp>
-namespace ndn {
-namespace nfd {
-namespace tests {
+namespace ndn::tests {
+
+using namespace ndn::nfd;
BOOST_CONCEPT_ASSERT((NotificationStreamItem<FaceEventNotification>));
@@ -268,6 +268,4 @@
BOOST_AUTO_TEST_SUITE_END() // Nfd
BOOST_AUTO_TEST_SUITE_END() // Mgmt
-} // namespace tests
-} // namespace nfd
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/mgmt/nfd/face-query-filter.t.cpp b/tests/unit/mgmt/nfd/face-query-filter.t.cpp
index 1f83f82..1234259 100644
--- a/tests/unit/mgmt/nfd/face-query-filter.t.cpp
+++ b/tests/unit/mgmt/nfd/face-query-filter.t.cpp
@@ -26,9 +26,9 @@
#include <boost/lexical_cast.hpp>
-namespace ndn {
-namespace nfd {
-namespace tests {
+namespace ndn::tests {
+
+using namespace ndn::nfd;
BOOST_CONCEPT_ASSERT((boost::EqualityComparable<FaceQueryFilter>));
BOOST_CONCEPT_ASSERT((WireEncodable<FaceQueryFilter>));
@@ -146,6 +146,4 @@
BOOST_AUTO_TEST_SUITE_END() // Nfd
BOOST_AUTO_TEST_SUITE_END() // Mgmt
-} // namespace tests
-} // namespace nfd
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/mgmt/nfd/face-status.t.cpp b/tests/unit/mgmt/nfd/face-status.t.cpp
index 275acf2..24be329 100644
--- a/tests/unit/mgmt/nfd/face-status.t.cpp
+++ b/tests/unit/mgmt/nfd/face-status.t.cpp
@@ -26,9 +26,9 @@
#include <boost/lexical_cast.hpp>
-namespace ndn {
-namespace nfd {
-namespace tests {
+namespace ndn::tests {
+
+using namespace ndn::nfd;
BOOST_CONCEPT_ASSERT((StatusDatasetItem<FaceStatus>));
@@ -178,6 +178,4 @@
BOOST_AUTO_TEST_SUITE_END() // Nfd
BOOST_AUTO_TEST_SUITE_END() // Mgmt
-} // namespace tests
-} // namespace nfd
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/mgmt/nfd/fib-entry.t.cpp b/tests/unit/mgmt/nfd/fib-entry.t.cpp
index 81f94e5..d802250 100644
--- a/tests/unit/mgmt/nfd/fib-entry.t.cpp
+++ b/tests/unit/mgmt/nfd/fib-entry.t.cpp
@@ -26,9 +26,9 @@
#include <boost/lexical_cast.hpp>
-namespace ndn {
-namespace nfd {
-namespace tests {
+namespace ndn::tests {
+
+using namespace ndn::nfd;
BOOST_CONCEPT_ASSERT((StatusDatasetItem<NextHopRecord>));
BOOST_CONCEPT_ASSERT((StatusDatasetItem<FibEntry>));
@@ -212,6 +212,4 @@
BOOST_AUTO_TEST_SUITE_END() // Nfd
BOOST_AUTO_TEST_SUITE_END() // Mgmt
-} // namespace tests
-} // namespace nfd
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/mgmt/nfd/forwarder-status.t.cpp b/tests/unit/mgmt/nfd/forwarder-status.t.cpp
index 6492e55..056917d 100644
--- a/tests/unit/mgmt/nfd/forwarder-status.t.cpp
+++ b/tests/unit/mgmt/nfd/forwarder-status.t.cpp
@@ -26,9 +26,9 @@
#include <boost/lexical_cast.hpp>
-namespace ndn {
-namespace nfd {
-namespace tests {
+namespace ndn::tests {
+
+using namespace ndn::nfd;
BOOST_CONCEPT_ASSERT((StatusDatasetItem<ForwarderStatus>));
@@ -140,6 +140,4 @@
BOOST_AUTO_TEST_SUITE_END() // Nfd
BOOST_AUTO_TEST_SUITE_END() // Mgmt
-} // namespace tests
-} // namespace nfd
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/mgmt/nfd/rib-entry.t.cpp b/tests/unit/mgmt/nfd/rib-entry.t.cpp
index 3479c01..ae924bf 100644
--- a/tests/unit/mgmt/nfd/rib-entry.t.cpp
+++ b/tests/unit/mgmt/nfd/rib-entry.t.cpp
@@ -26,9 +26,9 @@
#include <boost/lexical_cast.hpp>
-namespace ndn {
-namespace nfd {
-namespace tests {
+namespace ndn::tests {
+
+using namespace ndn::nfd;
BOOST_CONCEPT_ASSERT((StatusDatasetItem<Route>));
BOOST_CONCEPT_ASSERT((StatusDatasetItem<RibEntry>));
@@ -240,6 +240,4 @@
BOOST_AUTO_TEST_SUITE_END() // Nfd
BOOST_AUTO_TEST_SUITE_END() // Mgmt
-} // namespace tests
-} // namespace nfd
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/mgmt/nfd/status-dataset.t.cpp b/tests/unit/mgmt/nfd/status-dataset.t.cpp
index 511498d..bb6acad 100644
--- a/tests/unit/mgmt/nfd/status-dataset.t.cpp
+++ b/tests/unit/mgmt/nfd/status-dataset.t.cpp
@@ -25,11 +25,9 @@
#include "tests/test-common.hpp"
#include "tests/unit/mgmt/nfd/controller-fixture.hpp"
-namespace ndn {
-namespace nfd {
-namespace tests {
+namespace ndn::tests {
-using namespace ndn::tests;
+using namespace ndn::nfd;
BOOST_AUTO_TEST_SUITE(Mgmt)
BOOST_AUTO_TEST_SUITE(Nfd)
@@ -479,6 +477,4 @@
BOOST_AUTO_TEST_SUITE_END() // Nfd
BOOST_AUTO_TEST_SUITE_END() // Mgmt
-} // namespace tests
-} // namespace nfd
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/mgmt/nfd/strategy-choice.t.cpp b/tests/unit/mgmt/nfd/strategy-choice.t.cpp
index 92f271c..63d644b 100644
--- a/tests/unit/mgmt/nfd/strategy-choice.t.cpp
+++ b/tests/unit/mgmt/nfd/strategy-choice.t.cpp
@@ -26,9 +26,9 @@
#include <boost/lexical_cast.hpp>
-namespace ndn {
-namespace nfd {
-namespace tests {
+namespace ndn::tests {
+
+using namespace ndn::nfd;
BOOST_CONCEPT_ASSERT((StatusDatasetItem<StrategyChoice>));
@@ -95,6 +95,4 @@
BOOST_AUTO_TEST_SUITE_END() // Nfd
BOOST_AUTO_TEST_SUITE_END() // Mgmt
-} // namespace tests
-} // namespace nfd
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/mgmt/status-dataset-context.t.cpp b/tests/unit/mgmt/status-dataset-context.t.cpp
index 69b2694..f219729 100644
--- a/tests/unit/mgmt/status-dataset-context.t.cpp
+++ b/tests/unit/mgmt/status-dataset-context.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2013-2022 Regents of the University of California.
+ * Copyright (c) 2013-2023 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -23,11 +23,9 @@
#include "tests/test-common.hpp"
-namespace ndn {
-namespace mgmt {
-namespace tests {
+namespace ndn::tests {
-using namespace ndn::tests;
+using namespace ndn::mgmt;
class StatusDatasetContextFixture
{
@@ -301,6 +299,4 @@
BOOST_AUTO_TEST_SUITE_END() // TestStatusDatasetContext
BOOST_AUTO_TEST_SUITE_END() // Mgmt
-} // namespace tests
-} // namespace mgmt
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/name-component.t.cpp b/tests/unit/name-component.t.cpp
index a35f980..d72de0f 100644
--- a/tests/unit/name-component.t.cpp
+++ b/tests/unit/name-component.t.cpp
@@ -30,9 +30,10 @@
#include <boost/lexical_cast.hpp>
#include <boost/mpl/vector.hpp>
-namespace ndn {
-namespace name {
-namespace tests {
+namespace ndn::tests {
+
+using ndn::name::Component;
+using ndn::name::UriFormat;
BOOST_CONCEPT_ASSERT((boost::EqualityComparable<Component>));
BOOST_CONCEPT_ASSERT((WireEncodable<Component>));
@@ -616,6 +617,4 @@
BOOST_AUTO_TEST_SUITE_END() // TestNameComponent
-} // namespace tests
-} // namespace name
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/name.t.cpp b/tests/unit/name.t.cpp
index 2e107f5..da95aed 100644
--- a/tests/unit/name.t.cpp
+++ b/tests/unit/name.t.cpp
@@ -26,11 +26,9 @@
#include <unordered_map>
#include <boost/range/concepts.hpp>
-namespace ndn {
-namespace tests {
+namespace ndn::tests {
-using Component = name::Component;
-using UriFormat = name::UriFormat;
+using ndn::name::Component;
BOOST_CONCEPT_ASSERT((boost::EqualityComparable<Name>));
BOOST_CONCEPT_ASSERT((WireEncodable<Name>));
@@ -61,7 +59,7 @@
BOOST_CHECK_EQUAL(name[4], Component("\x1C\x9F"));
BOOST_CHECK(name[5].isImplicitSha256Digest());
- BOOST_CHECK_EQUAL(name.toUri(UriFormat::CANONICAL),
+ BOOST_CHECK_EQUAL(name.toUri(name::UriFormat::CANONICAL),
"/8=Emid/25042=P3/8=.../8=..../8=%1C%9F/"
"1=%04%15%E3bJ%15%18P%AChl%84%F1U%F2%98%08%C0%DDs%81%9A%A4%A4%C2%0B%E7%3AM%8A%87L");
@@ -349,7 +347,7 @@
BOOST_TEST(number == 25912);
const auto tp = time::system_clock::now();
- time::system_clock::TimePoint tp2;
+ time::system_clock::time_point tp2;
BOOST_CHECK_NO_THROW(tp2 = name.appendTimestamp(tp).at(-1).toTimestamp());
BOOST_TEST(time::abs(tp2 - tp) <= 1_us);
@@ -561,5 +559,4 @@
BOOST_AUTO_TEST_SUITE_END() // TestName
-} // namespace tests
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/ndebug.t.cpp b/tests/unit/ndebug.t.cpp
index 39dcd8f..4fe1347 100644
--- a/tests/unit/ndebug.t.cpp
+++ b/tests/unit/ndebug.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2013-2018 Regents of the University of California.
+ * Copyright (c) 2013-2023 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -23,8 +23,7 @@
#include "tests/boost-test.hpp"
-namespace ndn {
-namespace tests {
+namespace ndn::tests {
BOOST_AUTO_TEST_SUITE(TestNdebug)
@@ -51,5 +50,4 @@
BOOST_AUTO_TEST_SUITE_END() // TestNdebug
-} // namespace tests
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/net/dns.t.cpp b/tests/unit/net/dns.t.cpp
index b6a24b5..ac734dd 100644
--- a/tests/unit/net/dns.t.cpp
+++ b/tests/unit/net/dns.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2013-2022 Regents of the University of California.
+ * Copyright (c) 2013-2023 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -26,10 +26,9 @@
#include <boost/asio/io_service.hpp>
-namespace ndn {
-namespace dns {
-namespace tests {
+namespace ndn::tests {
+using namespace ndn::dns;
using boost::asio::ip::address_v4;
using boost::asio::ip::address_v6;
@@ -169,6 +168,4 @@
BOOST_AUTO_TEST_SUITE_END() // TestDns
BOOST_AUTO_TEST_SUITE_END() // Net
-} // namespace tests
-} // namespace dns
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/net/ethernet.t.cpp b/tests/unit/net/ethernet.t.cpp
index 162170b..0fc5357 100644
--- a/tests/unit/net/ethernet.t.cpp
+++ b/tests/unit/net/ethernet.t.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-2023 Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -29,8 +29,7 @@
#include "tests/boost-test.hpp"
-namespace ndn {
-namespace tests {
+namespace ndn::tests {
BOOST_AUTO_TEST_SUITE(Net)
BOOST_AUTO_TEST_SUITE(TestEthernet)
@@ -113,5 +112,4 @@
BOOST_AUTO_TEST_SUITE_END() // TestEthernet
BOOST_AUTO_TEST_SUITE_END() // Net
-} // namespace tests
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/net/face-uri.t.cpp b/tests/unit/net/face-uri.t.cpp
index d21d70f..34e050e 100644
--- a/tests/unit/net/face-uri.t.cpp
+++ b/tests/unit/net/face-uri.t.cpp
@@ -34,8 +34,7 @@
#include <boost/concept_check.hpp>
-namespace ndn {
-namespace tests {
+namespace ndn::tests {
BOOST_CONCEPT_ASSERT((boost::EqualityComparable<FaceUri>));
@@ -614,5 +613,4 @@
BOOST_AUTO_TEST_SUITE_END() // TestFaceUri
BOOST_AUTO_TEST_SUITE_END() // Net
-} // namespace tests
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/net/network-configuration-detector.cpp b/tests/unit/net/network-configuration-detector.cpp
index 84e1244..f8a8816 100644
--- a/tests/unit/net/network-configuration-detector.cpp
+++ b/tests/unit/net/network-configuration-detector.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2013-2018 Regents of the University of California.
+ * Copyright (c) 2013-2023 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -27,35 +27,30 @@
#include <boost/asio/ip/udp.hpp>
#include <boost/range/iterator_range_core.hpp>
-namespace ndn {
-namespace tests {
-
-bool NetworkConfigurationDetector::m_isInitialized = false;
-bool NetworkConfigurationDetector::m_hasIpv4 = false;
-bool NetworkConfigurationDetector::m_hasIpv6 = false;
+namespace ndn::tests {
bool
NetworkConfigurationDetector::hasIpv4()
{
- if (!m_isInitialized) {
+ if (!s_isInitialized) {
detect();
}
- return m_hasIpv4;
+ return s_hasIpv4;
}
bool
NetworkConfigurationDetector::hasIpv6()
{
- if (!m_isInitialized) {
+ if (!s_isInitialized) {
detect();
}
- return m_hasIpv6;
+ return s_hasIpv6;
}
void
NetworkConfigurationDetector::detect()
{
- typedef boost::asio::ip::basic_resolver<boost::asio::ip::udp> BoostResolver;
+ using BoostResolver = boost::asio::ip::basic_resolver<boost::asio::ip::udp>;
boost::asio::io_service ioService;
BoostResolver resolver(ioService);
@@ -66,22 +61,21 @@
boost::system::error_code errorCode;
BoostResolver::iterator begin = resolver.resolve(query, errorCode);
if (errorCode) {
- m_isInitialized = true;
+ s_isInitialized = true;
return;
}
BoostResolver::iterator end;
for (const auto& i : boost::make_iterator_range(begin, end)) {
if (i.endpoint().address().is_v4()) {
- m_hasIpv4 = true;
+ s_hasIpv4 = true;
}
else if (i.endpoint().address().is_v6()) {
- m_hasIpv6 = true;
+ s_hasIpv6 = true;
}
}
- m_isInitialized = true;
+ s_isInitialized = true;
}
-} // namespace tests
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/net/network-configuration-detector.hpp b/tests/unit/net/network-configuration-detector.hpp
index 5c0c34b..7264e68 100644
--- a/tests/unit/net/network-configuration-detector.hpp
+++ b/tests/unit/net/network-configuration-detector.hpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2013-2021 Regents of the University of California.
+ * Copyright (c) 2013-2023 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -47,8 +47,7 @@
} \
} while (false)
-namespace ndn {
-namespace tests {
+namespace ndn::tests {
class NetworkConfigurationDetector
{
@@ -64,12 +63,11 @@
detect();
private:
- static bool m_isInitialized;
- static bool m_hasIpv4;
- static bool m_hasIpv6;
+ static inline bool s_isInitialized = false;
+ static inline bool s_hasIpv4 = false;
+ static inline bool s_hasIpv6 = false;
};
-} // namespace tests
-} // namespace ndn
+} // namespace ndn::tests
#endif // NDN_CXX_TESTS_UNIT_NET_NETWORK_CONFIGURATION_DETECTOR_HPP
diff --git a/tests/unit/net/network-monitor-stub.t.cpp b/tests/unit/net/network-monitor-stub.t.cpp
index 453a510..0ef8a9d 100644
--- a/tests/unit/net/network-monitor-stub.t.cpp
+++ b/tests/unit/net/network-monitor-stub.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2013-2018 Regents of the University of California.
+ * Copyright (c) 2013-2023 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -23,9 +23,9 @@
#include "tests/boost-test.hpp"
-namespace ndn {
-namespace net {
-namespace tests {
+namespace ndn::tests {
+
+using namespace ndn::net;
BOOST_AUTO_TEST_SUITE(Net)
BOOST_AUTO_TEST_SUITE(TestNetworkMonitorStub)
@@ -120,6 +120,4 @@
BOOST_AUTO_TEST_SUITE_END() // TestNetworkMonitorStub
BOOST_AUTO_TEST_SUITE_END() // Net
-} // namespace tests
-} // namespace net
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/net/network-monitor.t.cpp b/tests/unit/net/network-monitor.t.cpp
index 132d0db..4515258 100644
--- a/tests/unit/net/network-monitor.t.cpp
+++ b/tests/unit/net/network-monitor.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2013-2018 Regents of the University of California.
+ * Copyright (c) 2013-2023 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -25,9 +25,9 @@
#include <boost/asio/io_service.hpp>
-namespace ndn {
-namespace net {
-namespace tests {
+namespace ndn::tests {
+
+using namespace ndn::net;
BOOST_AUTO_TEST_SUITE(Net)
BOOST_AUTO_TEST_SUITE(TestNetworkMonitor)
@@ -69,6 +69,4 @@
BOOST_AUTO_TEST_SUITE_END() // TestNetworkMonitor
BOOST_AUTO_TEST_SUITE_END() // Net
-} // namespace tests
-} // namespace net
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/prefix-announcement.t.cpp b/tests/unit/prefix-announcement.t.cpp
index 9a3eba9..a13e9f5 100644
--- a/tests/unit/prefix-announcement.t.cpp
+++ b/tests/unit/prefix-announcement.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2013-2021 Regents of the University of California.
+ * Copyright (c) 2013-2023 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -25,8 +25,7 @@
#include "tests/key-chain-fixture.hpp"
#include "tests/test-common.hpp"
-namespace ndn {
-namespace tests {
+namespace ndn::tests {
BOOST_AUTO_TEST_SUITE(TestPrefixAnnouncement)
@@ -265,5 +264,4 @@
BOOST_AUTO_TEST_SUITE_END() // TestPrefixAnnouncement
-} // namespace tests
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/security/additional-description.t.cpp b/tests/unit/security/additional-description.t.cpp
index 82dd606..af71ce4 100644
--- a/tests/unit/security/additional-description.t.cpp
+++ b/tests/unit/security/additional-description.t.cpp
@@ -24,9 +24,9 @@
#include "tests/boost-test.hpp"
-namespace ndn {
-namespace security {
-namespace tests {
+namespace ndn::tests {
+
+using ndn::security::AdditionalDescription;
BOOST_CONCEPT_ASSERT((boost::EqualityComparable<AdditionalDescription>));
BOOST_CONCEPT_ASSERT((WireEncodable<AdditionalDescription>));
@@ -99,6 +99,4 @@
BOOST_AUTO_TEST_SUITE_END() // TestAdditionalDescription
BOOST_AUTO_TEST_SUITE_END() // Security
-} // namespace tests
-} // namespace security
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/security/certificate-bundle-fetcher.t.cpp b/tests/unit/security/certificate-bundle-fetcher.t.cpp
index 0c300b7..1c7b8b8 100644
--- a/tests/unit/security/certificate-bundle-fetcher.t.cpp
+++ b/tests/unit/security/certificate-bundle-fetcher.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2013-2020 Regents of the University of California.
+ * Copyright (c) 2013-2023 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -26,12 +26,9 @@
#include "tests/test-common.hpp"
#include "tests/unit/security/validator-fixture.hpp"
-namespace ndn {
-namespace security {
-inline namespace v2 {
-namespace tests {
+namespace ndn::tests {
-using namespace ndn::tests;
+using namespace ndn::security;
BOOST_AUTO_TEST_SUITE(Security)
BOOST_AUTO_TEST_SUITE(TestCertificateBundleFetcher)
@@ -45,21 +42,10 @@
}
};
-class BundleWithFinalBlockId
-{
-};
-
-class BundleWithoutFinalBlockId
-{
-};
-
-class Timeout
-{
-};
-
-class Nack
-{
-};
+struct BundleWithFinalBlockId {};
+struct BundleWithoutFinalBlockId {};
+struct Timeout {};
+struct Nack {};
template<class Response>
class CertificateBundleFetcherFixture : public HierarchicalValidatorFixture<ValidationPolicySimpleHierarchy,
@@ -198,7 +184,4 @@
BOOST_AUTO_TEST_SUITE_END() // TestCertificateBundleFetcher
BOOST_AUTO_TEST_SUITE_END() // Security
-} // namespace tests
-} // inline namespace v2
-} // namespace security
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/security/certificate-cache.t.cpp b/tests/unit/security/certificate-cache.t.cpp
index 51aa72b..acbdd00 100644
--- a/tests/unit/security/certificate-cache.t.cpp
+++ b/tests/unit/security/certificate-cache.t.cpp
@@ -25,12 +25,7 @@
#include "tests/key-chain-fixture.hpp"
#include "tests/unit/clock-fixture.hpp"
-namespace ndn {
-namespace security {
-inline namespace v2 {
-namespace tests {
-
-using namespace ndn::tests;
+namespace ndn::tests {
class CertificateCacheFixture : public ClockFixture, public KeyChainFixture
{
@@ -60,7 +55,7 @@
}
public:
- CertificateCache certCache;
+ security::CertificateCache certCache;
Identity identity;
Certificate cert;
};
@@ -104,7 +99,4 @@
BOOST_AUTO_TEST_SUITE_END() // TestCertificateCache
BOOST_AUTO_TEST_SUITE_END() // Security
-} // namespace tests
-} // inline namespace v2
-} // namespace security
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/security/certificate-fetcher-direct-fetch.t.cpp b/tests/unit/security/certificate-fetcher-direct-fetch.t.cpp
index 7c9ba90..a843ca6 100644
--- a/tests/unit/security/certificate-fetcher-direct-fetch.t.cpp
+++ b/tests/unit/security/certificate-fetcher-direct-fetch.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2013-2022 Regents of the University of California.
+ * Copyright (c) 2013-2023 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -30,27 +30,16 @@
#include <boost/range/adaptor/sliced.hpp>
#include <boost/range/adaptor/strided.hpp>
-namespace ndn {
-namespace security {
-inline namespace v2 {
-namespace tests {
+namespace ndn::tests {
-using namespace ndn::tests;
+using namespace ndn::security;
BOOST_AUTO_TEST_SUITE(Security)
BOOST_AUTO_TEST_SUITE(TestCertificateFetcherDirectFetch)
-class Cert
-{
-};
-
-class Timeout
-{
-};
-
-class Nack
-{
-};
+struct Cert {};
+struct Timeout {};
+struct Nack {};
template<class Response>
class CertificateFetcherDirectFetchFixture : public HierarchicalValidatorFixture<ValidationPolicySimpleHierarchy,
@@ -260,7 +249,4 @@
BOOST_AUTO_TEST_SUITE_END() // TestCertificateFetcherDirectFetch
BOOST_AUTO_TEST_SUITE_END() // Security
-} // namespace tests
-} // inline namespace v2
-} // namespace security
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/security/certificate-fetcher-from-network.t.cpp b/tests/unit/security/certificate-fetcher-from-network.t.cpp
index cb3e0b5..7ffc276 100644
--- a/tests/unit/security/certificate-fetcher-from-network.t.cpp
+++ b/tests/unit/security/certificate-fetcher-from-network.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2013-2022 Regents of the University of California.
+ * Copyright (c) 2013-2023 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -27,27 +27,16 @@
#include "tests/boost-test.hpp"
#include "tests/unit/security/validator-fixture.hpp"
-namespace ndn {
-namespace security {
-inline namespace v2 {
-namespace tests {
+namespace ndn::tests {
-using namespace ndn::tests;
+using namespace ndn::security;
BOOST_AUTO_TEST_SUITE(Security)
BOOST_AUTO_TEST_SUITE(TestCertificateFetcherFromNetwork)
-class Cert
-{
-};
-
-class Timeout
-{
-};
-
-class Nack
-{
-};
+struct Cert {};
+struct Timeout {};
+struct Nack {};
template<class Response>
class CertificateFetcherFromNetworkFixture : public HierarchicalValidatorFixture<ValidationPolicySimpleHierarchy,
@@ -135,7 +124,4 @@
BOOST_AUTO_TEST_SUITE_END() // TestCertificateFetcherFromNetwork
BOOST_AUTO_TEST_SUITE_END() // Security
-} // namespace tests
-} // inline namespace v2
-} // namespace security
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/security/certificate-fetcher-offline.t.cpp b/tests/unit/security/certificate-fetcher-offline.t.cpp
index f48971f..147701f 100644
--- a/tests/unit/security/certificate-fetcher-offline.t.cpp
+++ b/tests/unit/security/certificate-fetcher-offline.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2013-2022 Regents of the University of California.
+ * Copyright (c) 2013-2023 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -25,10 +25,9 @@
#include "tests/boost-test.hpp"
#include "tests/unit/security/validator-fixture.hpp"
-namespace ndn {
-namespace security {
-inline namespace v2 {
-namespace tests {
+namespace ndn::tests {
+
+using namespace ndn::security;
BOOST_AUTO_TEST_SUITE(Security)
@@ -66,7 +65,4 @@
BOOST_AUTO_TEST_SUITE_END() // TestCertificateFetcherOffline
BOOST_AUTO_TEST_SUITE_END() // Security
-} // namespace tests
-} // inline namespace v2
-} // namespace security
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/security/certificate.t.cpp b/tests/unit/security/certificate.t.cpp
index 44ae731..facb261 100644
--- a/tests/unit/security/certificate.t.cpp
+++ b/tests/unit/security/certificate.t.cpp
@@ -30,12 +30,10 @@
#include <boost/lexical_cast.hpp>
-namespace ndn {
-namespace security {
-inline namespace v2 {
-namespace tests {
+namespace ndn::tests {
-using namespace ndn::tests;
+using ndn::security::Certificate;
+using ndn::security::ValidityPeriod;
BOOST_CONCEPT_ASSERT((WireEncodable<Certificate>));
BOOST_CONCEPT_ASSERT((WireDecodable<Certificate>));
@@ -379,6 +377,9 @@
BOOST_AUTO_TEST_CASE(Helpers)
{
+ using ndn::security::extractIdentityFromCertName;
+ using ndn::security::extractKeyNameFromCertName;
+
BOOST_CHECK_EQUAL(extractIdentityFromCertName("/KEY/hello/world/v=1"), "/");
BOOST_CHECK_EQUAL(extractIdentityFromCertName("/hello/world/KEY/!/self/v=42"), "/hello/world");
@@ -399,7 +400,4 @@
BOOST_AUTO_TEST_SUITE_END() // TestCertificate
BOOST_AUTO_TEST_SUITE_END() // Security
-} // namespace tests
-} // inline namespace v2
-} // namespace security
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/security/detail/certificate-bundle-decoder.t.cpp b/tests/unit/security/detail/certificate-bundle-decoder.t.cpp
index a9fe998..3cb3eb7 100644
--- a/tests/unit/security/detail/certificate-bundle-decoder.t.cpp
+++ b/tests/unit/security/detail/certificate-bundle-decoder.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2013-2022 Regents of the University of California.
+ * Copyright (c) 2013-2023 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -24,12 +24,9 @@
#include "tests/boost-test.hpp"
#include "tests/key-chain-fixture.hpp"
-namespace ndn {
-namespace security {
-namespace detail {
-namespace tests {
+namespace ndn::tests {
-class CertificateBundleDecoderFixture : public ndn::tests::KeyChainFixture
+class CertificateBundleDecoderFixture : public KeyChainFixture
{
protected:
CertificateBundleDecoderFixture()
@@ -51,7 +48,7 @@
}
protected:
- CertificateBundleDecoder cbd;
+ security::detail::CertificateBundleDecoder cbd;
Block certBlock1;
Block certBlock2;
size_t nCertsCompleted = 0;
@@ -213,7 +210,4 @@
BOOST_AUTO_TEST_SUITE_END() // TestCertificateBundleEncoderDecoder
BOOST_AUTO_TEST_SUITE_END() // Security
-} // namespace tests
-} // namespace detail
-} // namespace security
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/security/interest-signer.t.cpp b/tests/unit/security/interest-signer.t.cpp
index b4a3991..b44546b 100644
--- a/tests/unit/security/interest-signer.t.cpp
+++ b/tests/unit/security/interest-signer.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2013-2022 Regents of the University of California.
+ * Copyright (c) 2013-2023 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -25,11 +25,10 @@
#include "tests/key-chain-fixture.hpp"
#include "tests/unit/clock-fixture.hpp"
-namespace ndn {
-namespace security {
-namespace tests {
+namespace ndn::tests {
-using namespace ndn::tests;
+using ndn::security::InterestSigner;
+using ndn::security::SigningInfo;
class InterestSignerFixture : public ClockFixture, public KeyChainFixture
{
@@ -123,6 +122,4 @@
BOOST_AUTO_TEST_SUITE_END() // TestInterestSigner
BOOST_AUTO_TEST_SUITE_END() // Security
-} // namespace tests
-} // namespace security
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/security/key-chain.t.cpp b/tests/unit/security/key-chain.t.cpp
index be544a4..d0b717f 100644
--- a/tests/unit/security/key-chain.t.cpp
+++ b/tests/unit/security/key-chain.t.cpp
@@ -31,12 +31,9 @@
#include <openssl/opensslv.h>
#include <boost/mpl/vector.hpp>
-namespace ndn {
-namespace security {
-inline namespace v2 {
-namespace tests {
+namespace ndn::tests {
-using namespace ndn::tests;
+using namespace ndn::security;
BOOST_AUTO_TEST_SUITE(Security)
BOOST_FIXTURE_TEST_SUITE(TestKeyChain, TestHomeEnvSaver)
@@ -800,7 +797,4 @@
BOOST_AUTO_TEST_SUITE_END() // TestKeyChain
BOOST_AUTO_TEST_SUITE_END() // Security
-} // namespace tests
-} // inline namespace v2
-} // namespace security
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/security/key-params.t.cpp b/tests/unit/security/key-params.t.cpp
index f051b06..27f098a 100644
--- a/tests/unit/security/key-params.t.cpp
+++ b/tests/unit/security/key-params.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2013-2022 Regents of the University of California.
+ * Copyright (c) 2013-2023 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -25,8 +25,7 @@
#include <boost/lexical_cast.hpp>
-namespace ndn {
-namespace tests {
+namespace ndn::tests {
BOOST_AUTO_TEST_SUITE(Security)
BOOST_AUTO_TEST_SUITE(TestKeyParams)
@@ -162,5 +161,4 @@
BOOST_AUTO_TEST_SUITE_END() // TestKeyParams
BOOST_AUTO_TEST_SUITE_END() // Security
-} // namespace tests
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/security/pib/certificate-container.t.cpp b/tests/unit/security/pib/certificate-container.t.cpp
index b1d4343..ecfd0b9 100644
--- a/tests/unit/security/pib/certificate-container.t.cpp
+++ b/tests/unit/security/pib/certificate-container.t.cpp
@@ -26,15 +26,13 @@
#include "tests/boost-test.hpp"
#include "tests/unit/security/pib/pib-data-fixture.hpp"
-namespace ndn {
-namespace security {
-namespace pib {
-namespace tests {
+namespace ndn::tests {
+
+using namespace ndn::security::pib;
NDN_CXX_ASSERT_FORWARD_ITERATOR(CertificateContainer::const_iterator);
BOOST_AUTO_TEST_SUITE(Security)
-BOOST_AUTO_TEST_SUITE(Pib)
BOOST_FIXTURE_TEST_SUITE(TestCertificateContainer, PibDataFixture)
BOOST_AUTO_TEST_CASE(AddGetRemove)
@@ -72,7 +70,7 @@
BOOST_CHECK_EQUAL(cert1, id1Key1Cert1);
BOOST_CHECK_EQUAL(cert2, id1Key1Cert2);
Name id1Key1Cert3Name = Name(id1Key1Name).append("issuer").appendVersion(3);
- BOOST_CHECK_THROW(container.get(id1Key1Cert3Name), pib::Pib::Error);
+ BOOST_CHECK_THROW(container.get(id1Key1Cert3Name), Pib::Error);
}
{
@@ -158,10 +156,6 @@
}
BOOST_AUTO_TEST_SUITE_END() // TestCertificateContainer
-BOOST_AUTO_TEST_SUITE_END() // Pib
BOOST_AUTO_TEST_SUITE_END() // Security
-} // namespace tests
-} // namespace pib
-} // namespace security
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/security/pib/identity-container.t.cpp b/tests/unit/security/pib/identity-container.t.cpp
index ea97da0..81f9ad0 100644
--- a/tests/unit/security/pib/identity-container.t.cpp
+++ b/tests/unit/security/pib/identity-container.t.cpp
@@ -26,15 +26,13 @@
#include "tests/boost-test.hpp"
#include "tests/unit/security/pib/pib-data-fixture.hpp"
-namespace ndn {
-namespace security {
-namespace pib {
-namespace tests {
+namespace ndn::tests {
+
+using namespace ndn::security::pib;
NDN_CXX_ASSERT_FORWARD_ITERATOR(IdentityContainer::const_iterator);
BOOST_AUTO_TEST_SUITE(Security)
-BOOST_AUTO_TEST_SUITE(Pib)
BOOST_FIXTURE_TEST_SUITE(TestIdentityContainer, PibDataFixture)
BOOST_AUTO_TEST_CASE(AddGetRemove)
@@ -74,7 +72,7 @@
Identity identity2 = container.get(id2);
BOOST_CHECK_EQUAL(identity1.getName(), id1);
BOOST_CHECK_EQUAL(identity2.getName(), id2);
- BOOST_CHECK_THROW(container.get(Name("/non-existing")), pib::Pib::Error);
+ BOOST_CHECK_THROW(container.get(Name("/non-existing")), Pib::Error);
}
{
@@ -150,10 +148,6 @@
}
BOOST_AUTO_TEST_SUITE_END() // TestIdentityContainer
-BOOST_AUTO_TEST_SUITE_END() // Pib
BOOST_AUTO_TEST_SUITE_END() // Security
-} // namespace tests
-} // namespace pib
-} // namespace security
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/security/pib/identity.t.cpp b/tests/unit/security/pib/identity.t.cpp
index be2d03b..70252d9 100644
--- a/tests/unit/security/pib/identity.t.cpp
+++ b/tests/unit/security/pib/identity.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2013-2022 Regents of the University of California.
+ * Copyright (c) 2013-2023 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -25,13 +25,11 @@
#include "tests/boost-test.hpp"
#include "tests/unit/security/pib/pib-data-fixture.hpp"
-namespace ndn {
-namespace security {
-namespace pib {
-namespace tests {
+namespace ndn::tests {
+
+using namespace ndn::security::pib;
BOOST_AUTO_TEST_SUITE(Security)
-BOOST_AUTO_TEST_SUITE(Pib)
BOOST_FIXTURE_TEST_SUITE(TestIdentity, PibDataFixture)
BOOST_AUTO_TEST_CASE(ValidityChecking)
@@ -41,7 +39,7 @@
BOOST_TEST(id == Identity());
BOOST_CHECK_THROW(id.getName(), std::domain_error);
- auto impl = std::make_shared<detail::IdentityImpl>(id1, makePibWithIdentity(id1));
+ auto impl = std::make_shared<IdentityImpl>(id1, makePibWithIdentity(id1));
id = Identity(impl);
BOOST_TEST(id);
BOOST_TEST(id != Identity());
@@ -52,12 +50,12 @@
BOOST_CHECK_THROW(id.getName(), std::domain_error);
}
-// pib::Identity is a wrapper of pib::detail::IdentityImpl. Since the functionality
-// of IdentityImpl is already tested in identity-impl.t.cpp, we only test the shared
-// property of pib::Identity in this test case.
+// pib::Identity is a wrapper of pib::IdentityImpl. Since the functionality
+// of IdentityImpl is already tested in identity-impl.t.cpp, we only test
+// the shared property of pib::Identity in this test case.
BOOST_AUTO_TEST_CASE(SharedImpl)
{
- auto impl = std::make_shared<detail::IdentityImpl>(id1, makePibWithIdentity(id1));
+ auto impl = std::make_shared<IdentityImpl>(id1, makePibWithIdentity(id1));
Identity identity1(impl);
Identity identity2(impl);
@@ -66,22 +64,18 @@
BOOST_TEST(Identity() != identity2);
BOOST_TEST(Identity() == Identity());
- BOOST_CHECK_THROW(identity2.getKey(id1Key1Name), pib::Pib::Error);
+ BOOST_CHECK_THROW(identity2.getKey(id1Key1Name), Pib::Error);
identity1.addKey(id1Key1, id1Key1Name);
BOOST_TEST(identity2.getKey(id1Key1Name));
identity2.removeKey(id1Key1Name);
- BOOST_CHECK_THROW(identity1.getKey(id1Key1Name), pib::Pib::Error);
+ BOOST_CHECK_THROW(identity1.getKey(id1Key1Name), Pib::Error);
identity1.setDefaultKey(id1Key1, id1Key1Name);
BOOST_TEST(identity2.getDefaultKey().getName() == id1Key1Name);
}
BOOST_AUTO_TEST_SUITE_END() // TestIdentity
-BOOST_AUTO_TEST_SUITE_END() // Pib
BOOST_AUTO_TEST_SUITE_END() // Security
-} // namespace tests
-} // namespace pib
-} // namespace security
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/security/pib/impl/identity-impl.t.cpp b/tests/unit/security/pib/impl/identity-impl.t.cpp
index 3f38e0e..6b44993 100644
--- a/tests/unit/security/pib/impl/identity-impl.t.cpp
+++ b/tests/unit/security/pib/impl/identity-impl.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2013-2022 Regents of the University of California.
+ * Copyright (c) 2013-2023 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -24,18 +24,13 @@
#include "tests/boost-test.hpp"
#include "tests/unit/security/pib/pib-data-fixture.hpp"
-namespace ndn {
-namespace security {
-namespace pib {
-namespace detail {
-namespace tests {
+namespace ndn::tests {
+
+using namespace ndn::security::pib;
BOOST_AUTO_TEST_SUITE(Security)
-BOOST_AUTO_TEST_SUITE(Pib)
-using pib::Pib;
-
-class IdentityImplFixture : public pib::tests::PibDataFixture
+class IdentityImplFixture : public PibDataFixture
{
protected:
const shared_ptr<PibImpl> pibImpl = makePibWithIdentity(id1);
@@ -136,11 +131,6 @@
}
BOOST_AUTO_TEST_SUITE_END() // TestIdentityImpl
-BOOST_AUTO_TEST_SUITE_END() // Pib
BOOST_AUTO_TEST_SUITE_END() // Security
-} // namespace tests
-} // namespace detail
-} // namespace pib
-} // namespace security
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/security/pib/impl/key-impl.t.cpp b/tests/unit/security/pib/impl/key-impl.t.cpp
index 4cb960a..940974b 100644
--- a/tests/unit/security/pib/impl/key-impl.t.cpp
+++ b/tests/unit/security/pib/impl/key-impl.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2013-2022 Regents of the University of California.
+ * Copyright (c) 2013-2023 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -25,18 +25,13 @@
#include "tests/key-chain-fixture.hpp"
#include "tests/unit/security/pib/pib-data-fixture.hpp"
-namespace ndn {
-namespace security {
-namespace pib {
-namespace detail {
-namespace tests {
+namespace ndn::tests {
+
+using namespace ndn::security::pib;
BOOST_AUTO_TEST_SUITE(Security)
-BOOST_AUTO_TEST_SUITE(Pib)
-using pib::Pib;
-
-class KeyImplFixture : public pib::tests::PibDataFixture
+class KeyImplFixture : public PibDataFixture
{
protected:
const shared_ptr<PibImpl> pibImpl = makePibWithKey(id1Key1Name, id1Key1);
@@ -114,8 +109,7 @@
BOOST_CHECK_THROW(key11.getDefaultCertificate(), Pib::Error);
}
-class ReplaceFixture : public ndn::tests::KeyChainFixture,
- public KeyImplFixture
+class ReplaceFixture : public KeyChainFixture, public KeyImplFixture
{
};
@@ -126,8 +120,8 @@
auto otherCert = id1Key1Cert1;
SignatureInfo info;
- info.setValidityPeriod(ValidityPeriod::makeRelative(-1_s, 10_s));
- m_keyChain.sign(otherCert, SigningInfo().setSignatureInfo(info));
+ info.setValidityPeriod(security::ValidityPeriod::makeRelative(-1_s, 10_s));
+ m_keyChain.sign(otherCert, security::SigningInfo().setSignatureInfo(info));
BOOST_TEST(otherCert.getName() == id1Key1Cert1.getName());
BOOST_TEST(otherCert.getContent() == id1Key1Cert1.getContent());
BOOST_TEST(otherCert != id1Key1Cert1);
@@ -162,11 +156,6 @@
}
BOOST_AUTO_TEST_SUITE_END() // TestKeyImpl
-BOOST_AUTO_TEST_SUITE_END() // Pib
BOOST_AUTO_TEST_SUITE_END() // Security
-} // namespace tests
-} // namespace detail
-} // namespace pib
-} // namespace security
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/security/pib/key-container.t.cpp b/tests/unit/security/pib/key-container.t.cpp
index b126bc2..84a4d3f 100644
--- a/tests/unit/security/pib/key-container.t.cpp
+++ b/tests/unit/security/pib/key-container.t.cpp
@@ -26,15 +26,13 @@
#include "tests/boost-test.hpp"
#include "tests/unit/security/pib/pib-data-fixture.hpp"
-namespace ndn {
-namespace security {
-namespace pib {
-namespace tests {
+namespace ndn::tests {
+
+using namespace ndn::security::pib;
NDN_CXX_ASSERT_FORWARD_ITERATOR(KeyContainer::const_iterator);
BOOST_AUTO_TEST_SUITE(Security)
-BOOST_AUTO_TEST_SUITE(Pib)
BOOST_FIXTURE_TEST_SUITE(TestKeyContainer, PibDataFixture)
BOOST_AUTO_TEST_CASE(AddGetRemove)
@@ -79,8 +77,8 @@
BOOST_TEST(key1.getPublicKey() == id1Key1, boost::test_tools::per_element());
BOOST_CHECK_EQUAL(key2.getName(), id1Key2Name);
BOOST_TEST(key2.getPublicKey() == id1Key2, boost::test_tools::per_element());
- Name id1Key3Name = constructKeyName(id1, name::Component("non-existing-id"));
- BOOST_CHECK_THROW(container.get(id1Key3Name), pib::Pib::Error);
+ Name id1Key3Name = security::constructKeyName(id1, name::Component("non-existing-id"));
+ BOOST_CHECK_THROW(container.get(id1Key3Name), Pib::Error);
}
{
@@ -167,10 +165,6 @@
}
BOOST_AUTO_TEST_SUITE_END() // TestKeyContainer
-BOOST_AUTO_TEST_SUITE_END() // Pib
BOOST_AUTO_TEST_SUITE_END() // Security
-} // namespace tests
-} // namespace pib
-} // namespace security
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/security/pib/key.t.cpp b/tests/unit/security/pib/key.t.cpp
index 4d1da0c..5273436 100644
--- a/tests/unit/security/pib/key.t.cpp
+++ b/tests/unit/security/pib/key.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2013-2022 Regents of the University of California.
+ * Copyright (c) 2013-2023 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -25,13 +25,11 @@
#include "tests/boost-test.hpp"
#include "tests/unit/security/pib/pib-data-fixture.hpp"
-namespace ndn {
-namespace security {
-namespace pib {
-namespace tests {
+namespace ndn::tests {
+
+using namespace ndn::security::pib;
BOOST_AUTO_TEST_SUITE(Security)
-BOOST_AUTO_TEST_SUITE(Pib)
BOOST_FIXTURE_TEST_SUITE(TestKey, PibDataFixture)
BOOST_AUTO_TEST_CASE(ValidityChecking)
@@ -41,8 +39,7 @@
BOOST_TEST(key == Key());
BOOST_CHECK_THROW(key.getName(), std::domain_error);
- auto impl = std::make_shared<detail::KeyImpl>(id1Key1Name, id1Key1,
- makePibWithKey(id1Key1Name, id1Key1));
+ auto impl = std::make_shared<KeyImpl>(id1Key1Name, id1Key1, makePibWithKey(id1Key1Name, id1Key1));
key = Key(impl);
BOOST_TEST(key);
BOOST_TEST(key != Key());
@@ -53,13 +50,12 @@
BOOST_CHECK_THROW(key.getName(), std::domain_error);
}
-// pib::Key is a wrapper of pib::detail::KeyImpl. Since the functionality of KeyImpl is
-// already tested in key-impl.t.cpp, we only test the shared property of pib::Key in
-// this test case.
+// pib::Key is a wrapper of pib::KeyImpl. Since the functionality of KeyImpl is
+// already tested in key-impl.t.cpp, we only test the shared property of pib::Key
+// in this test case.
BOOST_AUTO_TEST_CASE(SharedImpl)
{
- auto keyImpl = std::make_shared<detail::KeyImpl>(id1Key1Name, id1Key1,
- makePibWithKey(id1Key1Name, id1Key1));
+ auto keyImpl = std::make_shared<KeyImpl>(id1Key1Name, id1Key1, makePibWithKey(id1Key1Name, id1Key1));
Key key1(keyImpl);
Key key2(keyImpl);
@@ -68,12 +64,12 @@
BOOST_TEST(Key() != key2);
BOOST_TEST(Key() == Key());
- BOOST_CHECK_THROW(key2.getCertificate(id1Key1Cert1.getName()), pib::Pib::Error);
+ BOOST_CHECK_THROW(key2.getCertificate(id1Key1Cert1.getName()), Pib::Error);
key1.addCertificate(id1Key1Cert1);
BOOST_TEST(key2.getCertificate(id1Key1Cert1.getName()) == id1Key1Cert1);
key2.removeCertificate(id1Key1Cert1.getName());
- BOOST_CHECK_THROW(key1.getCertificate(id1Key1Cert1.getName()), pib::Pib::Error);
+ BOOST_CHECK_THROW(key1.getCertificate(id1Key1Cert1.getName()), Pib::Error);
key1.setDefaultCertificate(id1Key1Cert1);
BOOST_TEST(key2.getDefaultCertificate() == id1Key1Cert1);
@@ -81,6 +77,10 @@
BOOST_AUTO_TEST_CASE(Helpers)
{
+ using ndn::security::constructKeyName;
+ using ndn::security::isValidKeyName;
+ using ndn::security::extractIdentityFromKeyName;
+
BOOST_CHECK_EQUAL(constructKeyName("/hello", name::Component("world")), "/hello/KEY/world");
BOOST_CHECK_EQUAL(isValidKeyName("/hello"), false);
@@ -98,10 +98,6 @@
}
BOOST_AUTO_TEST_SUITE_END() // TestKey
-BOOST_AUTO_TEST_SUITE_END() // Pib
BOOST_AUTO_TEST_SUITE_END() // Security
-} // namespace tests
-} // namespace pib
-} // namespace security
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/security/pib/pib-data-fixture.cpp b/tests/unit/security/pib/pib-data-fixture.cpp
index 488d11e..dde1d8b 100644
--- a/tests/unit/security/pib/pib-data-fixture.cpp
+++ b/tests/unit/security/pib/pib-data-fixture.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2013-2022 Regents of the University of California.
+ * Copyright (c) 2013-2023 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -30,10 +30,10 @@
// #include <iostream>
-namespace ndn {
-namespace security {
-namespace pib {
-namespace tests {
+namespace ndn::tests {
+
+using namespace ndn::security;
+using namespace ndn::security::pib;
// class TestCertDataGenerator
// {
@@ -95,8 +95,8 @@
// }
// private:
-// pib::PibMemory pib;
-// Tpm tpm{"test", "test", make_unique<tpm::BackEndMem>()};
+// PibMemory pib;
+// Tpm tpm{"test:test", make_unique<tpm::BackEndMem>()};
// };
// // The test data can be generated using this test case
@@ -414,7 +414,4 @@
return pib;
}
-} // namespace tests
-} // namespace pib
-} // namespace security
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/security/pib/pib-data-fixture.hpp b/tests/unit/security/pib/pib-data-fixture.hpp
index 64c8652..7fcdebb 100644
--- a/tests/unit/security/pib/pib-data-fixture.hpp
+++ b/tests/unit/security/pib/pib-data-fixture.hpp
@@ -25,20 +25,19 @@
#include "ndn-cxx/security/certificate.hpp"
#include "ndn-cxx/security/pib/pib-impl.hpp"
-namespace ndn {
-namespace security {
-namespace pib {
-namespace tests {
+namespace ndn::tests {
+
+using ndn::security::Certificate;
class PibDataFixture
{
public:
PibDataFixture();
- [[nodiscard]] static shared_ptr<PibImpl>
+ [[nodiscard]] static shared_ptr<security::pib::PibImpl>
makePibWithIdentity(const Name& idName);
- [[nodiscard]] static shared_ptr<PibImpl>
+ [[nodiscard]] static shared_ptr<security::pib::PibImpl>
makePibWithKey(const Name& keyName, span<const uint8_t> key);
public:
@@ -65,9 +64,6 @@
Buffer id2Key2;
};
-} // namespace tests
-} // namespace pib
-} // namespace security
-} // namespace ndn
+} // namespace ndn::tests
#endif // NDN_CXX_TESTS_UNIT_SECURITY_PIB_PIB_DATA_FIXTURE_HPP
diff --git a/tests/unit/security/pib/pib-impl.t.cpp b/tests/unit/security/pib/pib-impl.t.cpp
index d88bad6..b26109d 100644
--- a/tests/unit/security/pib/pib-impl.t.cpp
+++ b/tests/unit/security/pib/pib-impl.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2013-2022 Regents of the University of California.
+ * Copyright (c) 2013-2023 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -29,17 +29,13 @@
#include <boost/filesystem.hpp>
#include <boost/mpl/vector.hpp>
-namespace ndn {
-namespace security {
-namespace pib {
-namespace tests {
+namespace ndn::tests {
+
+using namespace ndn::security::pib;
BOOST_AUTO_TEST_SUITE(Security)
-BOOST_AUTO_TEST_SUITE(Pib)
BOOST_AUTO_TEST_SUITE(TestPibImpl)
-using pib::Pib;
-
class PibMemoryFixture : public PibDataFixture
{
public:
@@ -336,10 +332,6 @@
}
BOOST_AUTO_TEST_SUITE_END() // TestPibImpl
-BOOST_AUTO_TEST_SUITE_END() // Pib
BOOST_AUTO_TEST_SUITE_END() // Security
-} // namespace tests
-} // namespace pib
-} // namespace security
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/security/pib/pib.t.cpp b/tests/unit/security/pib/pib.t.cpp
index 8d668e5..3a665c3 100644
--- a/tests/unit/security/pib/pib.t.cpp
+++ b/tests/unit/security/pib/pib.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2013-2022 Regents of the University of California.
+ * Copyright (c) 2013-2023 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -25,17 +25,13 @@
#include "tests/boost-test.hpp"
#include "tests/unit/security/pib/pib-data-fixture.hpp"
-namespace ndn {
-namespace security {
-namespace pib {
-namespace tests {
+namespace ndn::tests {
+
+using namespace ndn::security::pib;
BOOST_AUTO_TEST_SUITE(Security)
-BOOST_AUTO_TEST_SUITE(Pib)
BOOST_FIXTURE_TEST_SUITE(TestPib, PibDataFixture)
-using pib::Pib;
-
BOOST_AUTO_TEST_CASE(TpmLocator)
{
Pib pib("pib-memory:", make_shared<PibMemory>());
@@ -116,10 +112,6 @@
}
BOOST_AUTO_TEST_SUITE_END() // TestPib
-BOOST_AUTO_TEST_SUITE_END() // Pib
BOOST_AUTO_TEST_SUITE_END() // Security
-} // namespace tests
-} // namespace pib
-} // namespace security
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/security/safe-bag.t.cpp b/tests/unit/security/safe-bag.t.cpp
index ade7f69..9f9b00d 100644
--- a/tests/unit/security/safe-bag.t.cpp
+++ b/tests/unit/security/safe-bag.t.cpp
@@ -25,9 +25,9 @@
#include "tests/boost-test.hpp"
-namespace ndn {
-namespace security {
-namespace tests {
+namespace ndn::tests {
+
+using ndn::security::SafeBag;
BOOST_CONCEPT_ASSERT((WireEncodable<SafeBag>));
BOOST_CONCEPT_ASSERT((WireDecodable<SafeBag>));
@@ -162,6 +162,4 @@
BOOST_AUTO_TEST_SUITE_END() // TestSafeBag
BOOST_AUTO_TEST_SUITE_END() // Security
-} // namespace tests
-} // namespace security
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/security/signing-helpers.t.cpp b/tests/unit/security/signing-helpers.t.cpp
index a515c16..c7065a2 100644
--- a/tests/unit/security/signing-helpers.t.cpp
+++ b/tests/unit/security/signing-helpers.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2013-2020 Regents of the University of California.
+ * Copyright (c) 2013-2023 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -23,9 +23,9 @@
#include "tests/boost-test.hpp"
-namespace ndn {
-namespace security {
-namespace tests {
+namespace ndn::tests {
+
+using ndn::security::SigningInfo;
BOOST_AUTO_TEST_SUITE(Security)
BOOST_AUTO_TEST_SUITE(TestSigningHelpers)
@@ -64,6 +64,4 @@
BOOST_AUTO_TEST_SUITE_END() // TestSigningHelpers
BOOST_AUTO_TEST_SUITE_END() // Security
-} // namespace tests
-} // namespace security
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/security/signing-info.t.cpp b/tests/unit/security/signing-info.t.cpp
index 87c347f..a1aee15 100644
--- a/tests/unit/security/signing-info.t.cpp
+++ b/tests/unit/security/signing-info.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2013-2022 Regents of the University of California.
+ * Copyright (c) 2013-2023 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -27,9 +27,9 @@
#include <boost/lexical_cast.hpp>
#include <sstream>
-namespace ndn {
-namespace security {
-namespace tests {
+namespace ndn::tests {
+
+using namespace ndn::security;
BOOST_AUTO_TEST_SUITE(Security)
BOOST_AUTO_TEST_SUITE(TestSigningInfo)
@@ -288,6 +288,4 @@
BOOST_AUTO_TEST_SUITE_END() // TestSigningInfo
BOOST_AUTO_TEST_SUITE_END() // Security
-} // namespace tests
-} // namespace security
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/security/tpm/back-end-wrapper-file.hpp b/tests/unit/security/tpm/back-end-wrapper-file.hpp
index 2da77aa..6d8a663 100644
--- a/tests/unit/security/tpm/back-end-wrapper-file.hpp
+++ b/tests/unit/security/tpm/back-end-wrapper-file.hpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2013-2021 Regents of the University of California.
+ * Copyright (c) 2013-2023 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -26,10 +26,7 @@
#include <boost/filesystem.hpp>
-namespace ndn {
-namespace security {
-namespace tpm {
-namespace tests {
+namespace ndn::tests {
/**
* @brief A wrapper of tpm::BackEndFile for unit test template.
@@ -39,7 +36,7 @@
public:
BackEndWrapperFile()
: m_tmpPath(boost::filesystem::path(UNIT_TESTS_TMPDIR) / "TpmBackEndFile")
- , m_impl(make_unique<BackEndFile>(m_tmpPath.string()))
+ , m_impl(make_unique<security::tpm::BackEndFile>(m_tmpPath.string()))
{
}
@@ -48,7 +45,7 @@
boost::filesystem::remove_all(m_tmpPath);
}
- BackEnd&
+ security::tpm::BackEnd&
getTpm()
{
return *m_impl;
@@ -62,12 +59,9 @@
private:
const boost::filesystem::path m_tmpPath;
- const unique_ptr<BackEnd> m_impl;
+ const unique_ptr<security::tpm::BackEnd> m_impl;
};
-} // namespace tests
-} // namespace tpm
-} // namespace security
-} // namespace ndn
+} // namespace ndn::tests
#endif // NDN_CXX_TESTS_UNIT_SECURITY_TPM_BACK_END_WRAPPER_FILE_HPP
diff --git a/tests/unit/security/tpm/back-end-wrapper-mem.hpp b/tests/unit/security/tpm/back-end-wrapper-mem.hpp
index 8de2b12..20dae82 100644
--- a/tests/unit/security/tpm/back-end-wrapper-mem.hpp
+++ b/tests/unit/security/tpm/back-end-wrapper-mem.hpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2013-2021 Regents of the University of California.
+ * Copyright (c) 2013-2023 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -24,10 +24,7 @@
#include "ndn-cxx/security/tpm/impl/back-end-mem.hpp"
-namespace ndn {
-namespace security {
-namespace tpm {
-namespace tests {
+namespace ndn::tests {
/**
* @brief A wrapper of tpm::BackEndMem for unit test template.
@@ -36,11 +33,11 @@
{
public:
BackEndWrapperMem()
- : m_impl(make_unique<BackEndMem>())
+ : m_impl(make_unique<security::tpm::BackEndMem>())
{
}
- BackEnd&
+ security::tpm::BackEnd&
getTpm()
{
return *m_impl;
@@ -53,12 +50,9 @@
}
private:
- const unique_ptr<BackEnd> m_impl;
+ const unique_ptr<security::tpm::BackEnd> m_impl;
};
-} // namespace tests
-} // namespace tpm
-} // namespace security
-} // namespace ndn
+} // namespace ndn::tests
#endif // NDN_CXX_TESTS_UNIT_SECURITY_TPM_BACK_END_WRAPPER_MEM_HPP
diff --git a/tests/unit/security/tpm/back-end-wrapper-osx.hpp b/tests/unit/security/tpm/back-end-wrapper-osx.hpp
index c459c47..542c319 100644
--- a/tests/unit/security/tpm/back-end-wrapper-osx.hpp
+++ b/tests/unit/security/tpm/back-end-wrapper-osx.hpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2013-2021 Regents of the University of California.
+ * Copyright (c) 2013-2023 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -27,10 +27,7 @@
#include <cstdlib>
-namespace ndn {
-namespace security {
-namespace tpm {
-namespace tests {
+namespace ndn::tests {
/**
* @brief A wrapper of tpm::BackEndOsx for unit test template.
@@ -52,7 +49,7 @@
else
unsetenv("HOME");
- m_impl = make_unique<BackEndOsx>();
+ m_impl = make_unique<security::tpm::BackEndOsx>();
}
~BackEndWrapperOsx()
@@ -63,7 +60,7 @@
unsetenv("HOME");
}
- BackEnd&
+ security::tpm::BackEnd&
getTpm()
{
return *m_impl;
@@ -77,12 +74,9 @@
private:
std::string m_HOME;
- unique_ptr<BackEnd> m_impl;
+ unique_ptr<security::tpm::BackEnd> m_impl;
};
-} // namespace tests
-} // namespace tpm
-} // namespace security
-} // namespace ndn
+} // namespace ndn::tests
#endif // NDN_CXX_TESTS_UNIT_SECURITY_TPM_BACK_END_WRAPPER_OSX_HPP
diff --git a/tests/unit/security/tpm/back-end.t.cpp b/tests/unit/security/tpm/back-end.t.cpp
index 78f09e3..34d79b4 100644
--- a/tests/unit/security/tpm/back-end.t.cpp
+++ b/tests/unit/security/tpm/back-end.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2013-2022 Regents of the University of California.
+ * Copyright (c) 2013-2023 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -41,16 +41,14 @@
#include <boost/mpl/vector.hpp>
#include <set>
-namespace ndn {
-namespace security {
-namespace tpm {
-namespace tests {
+namespace ndn::tests {
+
+using namespace ndn::security;
+using ndn::security::tpm::BackEnd;
+using ndn::security::tpm::KeyHandle;
BOOST_AUTO_TEST_SUITE(Security)
-BOOST_AUTO_TEST_SUITE(Tpm)
-BOOST_AUTO_TEST_SUITE(TestBackEnd)
-
-using tpm::Tpm;
+BOOST_AUTO_TEST_SUITE(TestTpmBackEnd)
using TestBackEnds = boost::mpl::vector<
#if defined(NDN_CXX_HAVE_OSX_FRAMEWORKS) && defined(NDN_CXX_WITH_OSX_KEYCHAIN)
@@ -354,11 +352,7 @@
}
}
-BOOST_AUTO_TEST_SUITE_END() // TestBackEnd
-BOOST_AUTO_TEST_SUITE_END() // Tpm
+BOOST_AUTO_TEST_SUITE_END() // TestTpmBackEnd
BOOST_AUTO_TEST_SUITE_END() // Security
-} // namespace tests
-} // namespace tpm
-} // namespace security
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/security/transform.t.cpp b/tests/unit/security/transform.t.cpp
deleted file mode 100644
index 901839b..0000000
--- a/tests/unit/security/transform.t.cpp
+++ /dev/null
@@ -1,83 +0,0 @@
-/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/*
- * Copyright (c) 2013-2019 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 "ndn-cxx/security/transform.hpp"
-
-#include "tests/boost-test.hpp"
-
-namespace ndn {
-namespace security {
-namespace tests {
-
-BOOST_AUTO_TEST_SUITE(Security)
-BOOST_AUTO_TEST_SUITE(TestTransform)
-
-BOOST_AUTO_TEST_CASE(SymbolVisibility)
-{
- transform::BufferSource* bufferSource = nullptr;
- BOOST_CHECK(bufferSource == nullptr);
-
- transform::StreamSource* streamSource = nullptr;
- BOOST_CHECK(streamSource == nullptr);
-
- transform::StepSource* stepSource = nullptr;
- BOOST_CHECK(stepSource == nullptr);
-
- transform::BoolSink* boolSink = nullptr;
- BOOST_CHECK(boolSink == nullptr);
-
- transform::StreamSink* streamSink = nullptr;
- BOOST_CHECK(streamSink == nullptr);
-
- transform::HexEncode* hexEncode = nullptr;
- BOOST_CHECK(hexEncode == nullptr);
-
- transform::StripSpace* stripSpace = nullptr;
- BOOST_CHECK(stripSpace == nullptr);
-
- transform::HexDecode* hexDecode = nullptr;
- BOOST_CHECK(hexDecode == nullptr);
-
- transform::Base64Encode* base64Encode = nullptr;
- BOOST_CHECK(base64Encode == nullptr);
-
- transform::Base64Decode* base64Decode = nullptr;
- BOOST_CHECK(base64Decode == nullptr);
-
- transform::DigestFilter* digestFilter = nullptr;
- BOOST_CHECK(digestFilter == nullptr);
-
- transform::BlockCipher* blockCipher = nullptr;
- BOOST_CHECK(blockCipher == nullptr);
-
- transform::SignerFilter* signerFilter = nullptr;
- BOOST_CHECK(signerFilter == nullptr);
-
- transform::VerifierFilter* verifierFilter = nullptr;
- BOOST_CHECK(verifierFilter == nullptr);
-}
-
-BOOST_AUTO_TEST_SUITE_END() // TestTransform
-BOOST_AUTO_TEST_SUITE_END() // Security
-
-} // namespace tests
-} // namespace security
-} // namespace ndn
diff --git a/tests/unit/security/transform/base64-decode.t.cpp b/tests/unit/security/transform/base64-decode.t.cpp
index 5d89fe6..f180624 100644
--- a/tests/unit/security/transform/base64-decode.t.cpp
+++ b/tests/unit/security/transform/base64-decode.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2013-2021 Regents of the University of California.
+ * Copyright (c) 2013-2023 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -27,10 +27,9 @@
#include "tests/boost-test.hpp"
-namespace ndn {
-namespace security {
-namespace transform {
-namespace tests {
+namespace ndn::tests {
+
+using namespace ndn::security::transform;
BOOST_AUTO_TEST_SUITE(Security)
BOOST_AUTO_TEST_SUITE(Transform)
@@ -173,7 +172,4 @@
BOOST_AUTO_TEST_SUITE_END() // Transform
BOOST_AUTO_TEST_SUITE_END() // Security
-} // namespace tests
-} // namespace transform
-} // namespace security
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/security/transform/base64-encode.t.cpp b/tests/unit/security/transform/base64-encode.t.cpp
index 7b4aa47..c25ecba 100644
--- a/tests/unit/security/transform/base64-encode.t.cpp
+++ b/tests/unit/security/transform/base64-encode.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2013-2021 Regents of the University of California.
+ * Copyright (c) 2013-2023 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -28,10 +28,9 @@
#include "tests/boost-test.hpp"
-namespace ndn {
-namespace security {
-namespace transform {
-namespace tests {
+namespace ndn::tests {
+
+using namespace ndn::security::transform;
BOOST_AUTO_TEST_SUITE(Security)
BOOST_AUTO_TEST_SUITE(Transform)
@@ -171,7 +170,4 @@
BOOST_AUTO_TEST_SUITE_END() // Transform
BOOST_AUTO_TEST_SUITE_END() // Security
-} // namespace tests
-} // namespace transform
-} // namespace security
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/security/transform/block-cipher.t.cpp b/tests/unit/security/transform/block-cipher.t.cpp
index d8b3c3b..cd857c1 100644
--- a/tests/unit/security/transform/block-cipher.t.cpp
+++ b/tests/unit/security/transform/block-cipher.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2013-2022 Regents of the University of California.
+ * Copyright (c) 2013-2023 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -27,10 +27,9 @@
#include "tests/boost-test.hpp"
-namespace ndn {
-namespace security {
-namespace transform {
-namespace tests {
+namespace ndn::tests {
+
+using namespace ndn::security::transform;
BOOST_AUTO_TEST_SUITE(Security)
BOOST_AUTO_TEST_SUITE(Transform)
@@ -106,7 +105,4 @@
BOOST_AUTO_TEST_SUITE_END() // Transform
BOOST_AUTO_TEST_SUITE_END() // Security
-} // namespace tests
-} // namespace transform
-} // namespace security
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/security/transform/bool-sink.t.cpp b/tests/unit/security/transform/bool-sink.t.cpp
index a7640c6..be10b13 100644
--- a/tests/unit/security/transform/bool-sink.t.cpp
+++ b/tests/unit/security/transform/bool-sink.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2013-2021 Regents of the University of California.
+ * Copyright (c) 2013-2023 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -23,10 +23,9 @@
#include "tests/boost-test.hpp"
-namespace ndn {
-namespace security {
-namespace transform {
-namespace tests {
+namespace ndn::tests {
+
+using namespace ndn::security::transform;
BOOST_AUTO_TEST_SUITE(Security)
BOOST_AUTO_TEST_SUITE(Transform)
@@ -41,7 +40,7 @@
BOOST_CHECK_EQUAL(sink1.write({in1 + 1, 1}), 1);
sink1.end();
BOOST_CHECK_EQUAL(value1, false);
- BOOST_CHECK_THROW(sink1.write({in1 + 1, 1}), transform::Error);
+ BOOST_CHECK_THROW(sink1.write({in1 + 1, 1}), Error);
const uint8_t in2[] = {0x01, 0x00};
bool value2 = false;
@@ -50,14 +49,11 @@
BOOST_CHECK_EQUAL(sink2.write({in2 + 1, 1}), 1);
sink2.end();
BOOST_CHECK_EQUAL(value2, true);
- BOOST_CHECK_THROW(sink2.write({in2 + 1, 1}), transform::Error);
+ BOOST_CHECK_THROW(sink2.write({in2 + 1, 1}), Error);
}
BOOST_AUTO_TEST_SUITE_END() // TestBoolSink
BOOST_AUTO_TEST_SUITE_END() // Transform
BOOST_AUTO_TEST_SUITE_END() // Security
-} // namespace tests
-} // namespace transform
-} // namespace security
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/security/transform/buffer-source.t.cpp b/tests/unit/security/transform/buffer-source.t.cpp
index f957282..aa27644 100644
--- a/tests/unit/security/transform/buffer-source.t.cpp
+++ b/tests/unit/security/transform/buffer-source.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2013-2022 Regents of the University of California.
+ * Copyright (c) 2013-2023 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -24,10 +24,9 @@
#include "tests/boost-test.hpp"
-namespace ndn {
-namespace security {
-namespace transform {
-namespace tests {
+namespace ndn::tests {
+
+using namespace ndn::security::transform;
BOOST_AUTO_TEST_SUITE(Security)
BOOST_AUTO_TEST_SUITE(Transform)
@@ -91,7 +90,4 @@
BOOST_AUTO_TEST_SUITE_END() // Transform
BOOST_AUTO_TEST_SUITE_END() // Security
-} // namespace tests
-} // namespace transform
-} // namespace security
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/security/transform/digest-filter.t.cpp b/tests/unit/security/transform/digest-filter.t.cpp
index 08f85cf..c414d17 100644
--- a/tests/unit/security/transform/digest-filter.t.cpp
+++ b/tests/unit/security/transform/digest-filter.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2013-2022 Regents of the University of California.
+ * Copyright (c) 2013-2023 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -30,10 +30,9 @@
#include <openssl/evp.h>
-namespace ndn {
-namespace security {
-namespace transform {
-namespace tests {
+namespace ndn::tests {
+
+using namespace ndn::security::transform;
BOOST_AUTO_TEST_SUITE(Security)
BOOST_AUTO_TEST_SUITE(Transform)
@@ -215,7 +214,4 @@
BOOST_AUTO_TEST_SUITE_END() // Transform
BOOST_AUTO_TEST_SUITE_END() // Security
-} // namespace tests
-} // namespace transform
-} // namespace security
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/security/transform/hex-decode.t.cpp b/tests/unit/security/transform/hex-decode.t.cpp
index 23ca9aa..51a2672 100644
--- a/tests/unit/security/transform/hex-decode.t.cpp
+++ b/tests/unit/security/transform/hex-decode.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2013-2021 Regents of the University of California.
+ * Copyright (c) 2013-2023 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -28,10 +28,9 @@
#include "tests/boost-test.hpp"
-namespace ndn {
-namespace security {
-namespace transform {
-namespace tests {
+namespace ndn::tests {
+
+using namespace ndn::security::transform;
BOOST_AUTO_TEST_SUITE(Security)
BOOST_AUTO_TEST_SUITE(Transform)
@@ -262,11 +261,11 @@
{
const std::string in1 = "0001020304050";
OBufferStream os1;
- BOOST_CHECK_THROW(bufferSource(in1) >> hexDecode() >> streamSink(os1), transform::Error);
+ BOOST_CHECK_THROW(bufferSource(in1) >> hexDecode() >> streamSink(os1), Error);
const std::string in2 = "0001020304xy";
OBufferStream os2;
- BOOST_CHECK_THROW(bufferSource(in2) >> hexDecode() >> streamSink(os2), transform::Error);
+ BOOST_CHECK_THROW(bufferSource(in2) >> hexDecode() >> streamSink(os2), Error);
}
BOOST_AUTO_TEST_CASE(EmptyInput)
@@ -283,7 +282,4 @@
BOOST_AUTO_TEST_SUITE_END() // Transform
BOOST_AUTO_TEST_SUITE_END() // Security
-} // namespace tests
-} // namespace transform
-} // namespace security
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/security/transform/hex-encode.t.cpp b/tests/unit/security/transform/hex-encode.t.cpp
index 8025c37..2a81b6a 100644
--- a/tests/unit/security/transform/hex-encode.t.cpp
+++ b/tests/unit/security/transform/hex-encode.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2013-2021 Regents of the University of California.
+ * Copyright (c) 2013-2023 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -27,10 +27,9 @@
#include "tests/boost-test.hpp"
-namespace ndn {
-namespace security {
-namespace transform {
-namespace tests {
+namespace ndn::tests {
+
+using namespace ndn::security::transform;
BOOST_AUTO_TEST_SUITE(Security)
BOOST_AUTO_TEST_SUITE(Transform)
@@ -176,7 +175,4 @@
BOOST_AUTO_TEST_SUITE_END() // Transform
BOOST_AUTO_TEST_SUITE_END() // Security
-} // namespace tests
-} // namespace transform
-} // namespace security
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/security/transform/private-key.t.cpp b/tests/unit/security/transform/private-key.t.cpp
index 077c2e3..f9a511d 100644
--- a/tests/unit/security/transform/private-key.t.cpp
+++ b/tests/unit/security/transform/private-key.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2013-2022 Regents of the University of California.
+ * Copyright (c) 2013-2023 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -38,10 +38,9 @@
#include <boost/mpl/vector.hpp>
#include <sstream>
-namespace ndn {
-namespace security {
-namespace transform {
-namespace tests {
+namespace ndn::tests {
+
+using namespace ndn::security::transform;
BOOST_AUTO_TEST_SUITE(Security)
BOOST_AUTO_TEST_SUITE(Transform)
@@ -716,7 +715,4 @@
BOOST_AUTO_TEST_SUITE_END() // Transform
BOOST_AUTO_TEST_SUITE_END() // Security
-} // namespace tests
-} // namespace transform
-} // namespace security
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/security/transform/public-key.t.cpp b/tests/unit/security/transform/public-key.t.cpp
index 655811c..31970c4 100644
--- a/tests/unit/security/transform/public-key.t.cpp
+++ b/tests/unit/security/transform/public-key.t.cpp
@@ -32,10 +32,9 @@
#include <sstream>
-namespace ndn {
-namespace security {
-namespace transform {
-namespace tests {
+namespace ndn::tests {
+
+using namespace ndn::security::transform;
BOOST_AUTO_TEST_SUITE(Security)
BOOST_AUTO_TEST_SUITE(Transform)
@@ -151,7 +150,4 @@
BOOST_AUTO_TEST_SUITE_END() // Transform
BOOST_AUTO_TEST_SUITE_END() // Security
-} // namespace tests
-} // namespace transform
-} // namespace security
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/security/transform/signer-filter.t.cpp b/tests/unit/security/transform/signer-filter.t.cpp
index cad6f04..ad3b788 100644
--- a/tests/unit/security/transform/signer-filter.t.cpp
+++ b/tests/unit/security/transform/signer-filter.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2013-2022 Regents of the University of California.
+ * Copyright (c) 2013-2023 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -31,10 +31,9 @@
#include "tests/boost-test.hpp"
-namespace ndn {
-namespace security {
-namespace transform {
-namespace tests {
+namespace ndn::tests {
+
+using namespace ndn::security::transform;
BOOST_AUTO_TEST_SUITE(Security)
BOOST_AUTO_TEST_SUITE(Transform)
@@ -92,7 +91,7 @@
bufferSource(data) >> signerFilter(DigestAlgorithm::SHA256, sKey) >> streamSink(os2);
auto sig = os2.buf();
- BOOST_TEST(verifySignature({data}, *sig, *pubKey));
+ BOOST_TEST(security::verifySignature({data}, *sig, *pubKey));
}
BOOST_AUTO_TEST_CASE(Ecdsa)
@@ -130,7 +129,7 @@
bufferSource(data) >> signerFilter(DigestAlgorithm::SHA256, sKey) >> streamSink(os2);
auto sig = os2.buf();
- BOOST_TEST(verifySignature({data}, *sig, *pubKey));
+ BOOST_TEST(security::verifySignature({data}, *sig, *pubKey));
}
BOOST_AUTO_TEST_SUITE(Hmac)
@@ -244,7 +243,4 @@
BOOST_AUTO_TEST_SUITE_END() // Transform
BOOST_AUTO_TEST_SUITE_END() // Security
-} // namespace tests
-} // namespace transform
-} // namespace security
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/security/transform/step-source.t.cpp b/tests/unit/security/transform/step-source.t.cpp
index 0179011..c950716 100644
--- a/tests/unit/security/transform/step-source.t.cpp
+++ b/tests/unit/security/transform/step-source.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2013-2021 Regents of the University of California.
+ * Copyright (c) 2013-2023 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -26,10 +26,9 @@
#include <sstream>
-namespace ndn {
-namespace security {
-namespace transform {
-namespace tests {
+namespace ndn::tests {
+
+using namespace ndn::security::transform;
BOOST_AUTO_TEST_SUITE(Security)
BOOST_AUTO_TEST_SUITE(Transform)
@@ -69,7 +68,7 @@
BOOST_CHECK_EQUAL(ss.write({buf + 960, 320}), 320);
ss.end();
- BOOST_CHECK_THROW(ss.write({buf + 960, 320}), transform::Error);
+ BOOST_CHECK_THROW(ss.write({buf + 960, 320}), Error);
BOOST_CHECK_EQUAL(os.str(), input);
}
@@ -87,7 +86,4 @@
BOOST_AUTO_TEST_SUITE_END() // Transform
BOOST_AUTO_TEST_SUITE_END() // Security
-} // namespace tests
-} // namespace transform
-} // namespace security
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/security/transform/stream-sink.t.cpp b/tests/unit/security/transform/stream-sink.t.cpp
index f58bece..b79012d 100644
--- a/tests/unit/security/transform/stream-sink.t.cpp
+++ b/tests/unit/security/transform/stream-sink.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2013-2021 Regents of the University of California.
+ * Copyright (c) 2013-2023 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -23,10 +23,9 @@
#include "tests/boost-test.hpp"
-namespace ndn {
-namespace security {
-namespace transform {
-namespace tests {
+namespace ndn::tests {
+
+using namespace ndn::security::transform;
BOOST_AUTO_TEST_SUITE(Security)
BOOST_AUTO_TEST_SUITE(Transform)
@@ -48,14 +47,11 @@
std::string out = os.str();
BOOST_CHECK_EQUAL_COLLECTIONS(in, in + sizeof(in), out.begin(), out.end());
- BOOST_CHECK_THROW(sink.write({in + 8, 8}), transform::Error);
+ BOOST_CHECK_THROW(sink.write({in + 8, 8}), Error);
}
BOOST_AUTO_TEST_SUITE_END() // TestStreamSink
BOOST_AUTO_TEST_SUITE_END() // Transform
BOOST_AUTO_TEST_SUITE_END() // Security
-} // namespace tests
-} // namespace transform
-} // namespace security
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/security/transform/stream-source.t.cpp b/tests/unit/security/transform/stream-source.t.cpp
index 1446bc9..e20ff23 100644
--- a/tests/unit/security/transform/stream-source.t.cpp
+++ b/tests/unit/security/transform/stream-source.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2013-2018 Regents of the University of California.
+ * Copyright (c) 2013-2023 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -27,10 +27,9 @@
#include <boost/mpl/integral_c.hpp>
#include <boost/mpl/vector.hpp>
-namespace ndn {
-namespace security {
-namespace transform {
-namespace tests {
+namespace ndn::tests {
+
+using namespace ndn::security::transform;
BOOST_AUTO_TEST_SUITE(Security)
BOOST_AUTO_TEST_SUITE(Transform)
@@ -77,24 +76,21 @@
BOOST_CHECK_EQUAL(os.str(), "");
}
-typedef boost::mpl::vector<
+using BadBits = boost::mpl::vector<
boost::mpl::integral_c<std::ios_base::iostate, std::ios_base::badbit>,
boost::mpl::integral_c<std::ios_base::iostate, std::ios_base::failbit>
-> BadBits;
+>;
BOOST_AUTO_TEST_CASE_TEMPLATE(BadStream, BadBit, BadBits)
{
std::stringstream is;
is.setstate(BadBit::value);
std::stringstream os;
- BOOST_CHECK_THROW(streamSource(is) >> streamSink(os), transform::Error);
+ BOOST_CHECK_THROW(streamSource(is) >> streamSink(os), Error);
}
BOOST_AUTO_TEST_SUITE_END() // TestStreamSource
BOOST_AUTO_TEST_SUITE_END() // Transform
BOOST_AUTO_TEST_SUITE_END() // Security
-} // namespace tests
-} // namespace transform
-} // namespace security
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/security/transform/strip-space.t.cpp b/tests/unit/security/transform/strip-space.t.cpp
index cd73270..cbc406d 100644
--- a/tests/unit/security/transform/strip-space.t.cpp
+++ b/tests/unit/security/transform/strip-space.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2013-2021 Regents of the University of California.
+ * Copyright (c) 2013-2023 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -27,10 +27,9 @@
#include "tests/boost-test.hpp"
-namespace ndn {
-namespace security {
-namespace transform {
-namespace tests {
+namespace ndn::tests {
+
+using namespace ndn::security::transform;
BOOST_AUTO_TEST_SUITE(Security)
BOOST_AUTO_TEST_SUITE(Transform)
@@ -72,7 +71,4 @@
BOOST_AUTO_TEST_SUITE_END() // Transform
BOOST_AUTO_TEST_SUITE_END() // Security
-} // namespace tests
-} // namespace transform
-} // namespace security
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/security/transform/verifier-filter.t.cpp b/tests/unit/security/transform/verifier-filter.t.cpp
index ef986b1..e04415c 100644
--- a/tests/unit/security/transform/verifier-filter.t.cpp
+++ b/tests/unit/security/transform/verifier-filter.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2013-2022 Regents of the University of California.
+ * Copyright (c) 2013-2023 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -35,10 +35,9 @@
#include <openssl/opensslv.h>
-namespace ndn {
-namespace security {
-namespace transform {
-namespace tests {
+namespace ndn::tests {
+
+using namespace ndn::security::transform;
BOOST_AUTO_TEST_SUITE(Security)
BOOST_AUTO_TEST_SUITE(Transform)
@@ -188,7 +187,4 @@
BOOST_AUTO_TEST_SUITE_END() // Transform
BOOST_AUTO_TEST_SUITE_END() // Security
-} // namespace tests
-} // namespace transform
-} // namespace security
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/security/trust-anchor-container.t.cpp b/tests/unit/security/trust-anchor-container.t.cpp
index 09825db..0e76214 100644
--- a/tests/unit/security/trust-anchor-container.t.cpp
+++ b/tests/unit/security/trust-anchor-container.t.cpp
@@ -27,17 +27,12 @@
#include <boost/filesystem/operations.hpp>
-namespace ndn {
-namespace security {
-inline namespace v2 {
-namespace tests {
+namespace ndn::tests {
-using namespace ndn::tests;
+using namespace ndn::security;
-/**
- * This fixture creates a directory and prepares two certificates.
- * cert1 is written to a file under the directory, while cert2 is not.
- */
+// This fixture creates a directory and prepares two certificates.
+// cert1 is written to a file under the directory, while cert2 is not.
class TrustAnchorContainerFixture : public ClockFixture, public KeyChainFixture
{
public:
@@ -196,7 +191,4 @@
BOOST_AUTO_TEST_SUITE_END() // TestTrustAnchorContainer
BOOST_AUTO_TEST_SUITE_END() // Security
-} // namespace tests
-} // inline namespace v2
-} // namespace security
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/security/validation-error.t.cpp b/tests/unit/security/validation-error.t.cpp
index c4a1a08..f59d6e7 100644
--- a/tests/unit/security/validation-error.t.cpp
+++ b/tests/unit/security/validation-error.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2013-2022 Regents of the University of California.
+ * Copyright (c) 2013-2023 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -25,10 +25,9 @@
#include <boost/lexical_cast.hpp>
-namespace ndn {
-namespace security {
-inline namespace v2 {
-namespace tests {
+namespace ndn::tests {
+
+using ndn::security::ValidationError;
BOOST_AUTO_TEST_SUITE(Security)
BOOST_AUTO_TEST_SUITE(TestValidationError)
@@ -59,7 +58,4 @@
BOOST_AUTO_TEST_SUITE_END() // TestValidationError
BOOST_AUTO_TEST_SUITE_END() // Security
-} // namespace tests
-} // inline namespace v2
-} // namespace security
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/security/validation-policy-accept-all.t.cpp b/tests/unit/security/validation-policy-accept-all.t.cpp
index cd94cf7..ca86c86 100644
--- a/tests/unit/security/validation-policy-accept-all.t.cpp
+++ b/tests/unit/security/validation-policy-accept-all.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2013-2020 Regents of the University of California.
+ * Copyright (c) 2013-2023 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -26,16 +26,11 @@
#include <boost/mpl/vector.hpp>
-namespace ndn {
-namespace security {
-inline namespace v2 {
-namespace tests {
-
-using namespace ndn::tests;
+namespace ndn::tests {
BOOST_AUTO_TEST_SUITE(Security)
-class ValidationPolicyAcceptAllFixture : public ValidatorFixture<ValidationPolicyAcceptAll>
+class ValidationPolicyAcceptAllFixture : public ValidatorFixture<security::ValidationPolicyAcceptAll>
{
public:
ValidationPolicyAcceptAllFixture()
@@ -50,7 +45,7 @@
BOOST_FIXTURE_TEST_SUITE(TestValidationPolicyAcceptAll, ValidationPolicyAcceptAllFixture)
-typedef boost::mpl::vector<Interest, Data> Packets;
+using Packets = boost::mpl::vector<Interest, Data>;
BOOST_AUTO_TEST_CASE_TEMPLATE(Validate, Packet, Packets)
{
@@ -71,7 +66,4 @@
BOOST_AUTO_TEST_SUITE_END() // TestValidationPolicyAcceptAll
BOOST_AUTO_TEST_SUITE_END() // Security
-} // namespace tests
-} // inline namespace v2
-} // namespace security
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/security/validation-policy-command-interest.t.cpp b/tests/unit/security/validation-policy-command-interest.t.cpp
index 971b509..ac690e7 100644
--- a/tests/unit/security/validation-policy-command-interest.t.cpp
+++ b/tests/unit/security/validation-policy-command-interest.t.cpp
@@ -30,12 +30,9 @@
#include <boost/mpl/vector.hpp>
-namespace ndn {
-namespace security {
-inline namespace v2 {
-namespace tests {
+namespace ndn::tests {
-using namespace ndn::tests;
+using namespace ndn::security;
BOOST_AUTO_TEST_SUITE(Security)
@@ -535,7 +532,4 @@
BOOST_AUTO_TEST_SUITE_END() // TestValidationPolicyCommandInterest
BOOST_AUTO_TEST_SUITE_END() // Security
-} // namespace tests
-} // inline namespace v2
-} // namespace security
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/security/validation-policy-config.t.cpp b/tests/unit/security/validation-policy-config.t.cpp
index 83c6f52..07b98e9 100644
--- a/tests/unit/security/validation-policy-config.t.cpp
+++ b/tests/unit/security/validation-policy-config.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2013-2022 Regents of the University of California.
+ * Copyright (c) 2013-2023 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -30,14 +30,9 @@
#include "tests/unit/security/validator-config/common.hpp"
#include "tests/unit/security/validator-fixture.hpp"
-namespace ndn {
-namespace security {
-inline namespace v2 {
-namespace validator_config {
-namespace tests {
+namespace ndn::tests {
-using namespace ndn::tests;
-using namespace ndn::security::tests;
+using ndn::security::ValidationPolicyConfig;
BOOST_AUTO_TEST_SUITE(Security)
BOOST_AUTO_TEST_SUITE(TestValidationPolicyConfig)
@@ -760,6 +755,8 @@
BOOST_FIXTURE_TEST_CASE(OrphanedPolicyLoad, HierarchicalValidatorFixture<ValidationPolicyConfig>) // Bug #4758
{
+ using ndn::security::validator_config::Error;
+
ValidationPolicyConfig policy1;
BOOST_CHECK_THROW(policy1.load("trust-anchor { type any }", "test-config"), Error);
@@ -767,8 +764,7 @@
BOOST_CHECK_THROW(policy1.load("trust-anchor { type any }", "test-config"), Error);
ValidationPolicyConfig policy2;
-
- std::string config = R"CONF(
+ const std::string config = R"CONF(
trust-anchor
{
type dir
@@ -776,7 +772,6 @@
refresh 1h
}
)CONF";
-
// Inserting trust anchor would have triggered a segfault
BOOST_CHECK_THROW(policy2.load(config, "test-config"), Error);
}
@@ -784,8 +779,4 @@
BOOST_AUTO_TEST_SUITE_END() // TestValidationPolicyConfig
BOOST_AUTO_TEST_SUITE_END() // Security
-} // namespace tests
-} // namespace validator_config
-} // inline namespace v2
-} // namespace security
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/security/validation-policy-signed-interest.t.cpp b/tests/unit/security/validation-policy-signed-interest.t.cpp
index 58f502e..ded8825 100644
--- a/tests/unit/security/validation-policy-signed-interest.t.cpp
+++ b/tests/unit/security/validation-policy-signed-interest.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2013-2022 Regents of the University of California.
+ * Copyright (c) 2013-2023 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -30,12 +30,9 @@
#include <boost/mpl/vector.hpp>
-namespace ndn {
-namespace security {
-inline namespace v2 {
-namespace tests {
+namespace ndn::tests {
-using namespace ndn::tests;
+using namespace ndn::security;
BOOST_AUTO_TEST_SUITE(Security)
@@ -525,7 +522,4 @@
BOOST_AUTO_TEST_SUITE_END() // TestValidationPolicySignedInterest
BOOST_AUTO_TEST_SUITE_END() // Security
-} // namespace tests
-} // inline namespace v2
-} // namespace security
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/security/validation-policy-simple-hierarchy.t.cpp b/tests/unit/security/validation-policy-simple-hierarchy.t.cpp
index 788a7c9..80fc58a 100644
--- a/tests/unit/security/validation-policy-simple-hierarchy.t.cpp
+++ b/tests/unit/security/validation-policy-simple-hierarchy.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2013-2022 Regents of the University of California.
+ * Copyright (c) 2013-2023 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -26,14 +26,11 @@
#include <boost/mpl/vector.hpp>
-namespace ndn {
-namespace security {
-inline namespace v2 {
-namespace tests {
+namespace ndn::tests {
BOOST_AUTO_TEST_SUITE(Security)
BOOST_FIXTURE_TEST_SUITE(TestValidationPolicySimpleHierarchy,
- HierarchicalValidatorFixture<ValidationPolicySimpleHierarchy>)
+ HierarchicalValidatorFixture<security::ValidationPolicySimpleHierarchy>)
using Packets = boost::mpl::vector<InterestV03Pkt, DataPkt>;
@@ -125,7 +122,4 @@
BOOST_AUTO_TEST_SUITE_END() // TestValidationPolicySimpleHierarchy
BOOST_AUTO_TEST_SUITE_END() // Security
-} // namespace tests
-} // inline namespace v2
-} // namespace security
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/security/validation-policy.t.cpp b/tests/unit/security/validation-policy.t.cpp
index 3d76f62..3ff9fe8 100644
--- a/tests/unit/security/validation-policy.t.cpp
+++ b/tests/unit/security/validation-policy.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2013-2022 Regents of the University of California.
+ * Copyright (c) 2013-2023 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -24,16 +24,15 @@
#include "tests/boost-test.hpp"
#include "tests/key-chain-fixture.hpp"
-namespace ndn {
-namespace security {
-inline namespace v2 {
-namespace tests {
+namespace ndn::tests {
BOOST_AUTO_TEST_SUITE(Security)
-BOOST_FIXTURE_TEST_SUITE(TestValidationPolicy, ndn::tests::KeyChainFixture)
+BOOST_FIXTURE_TEST_SUITE(TestValidationPolicy, KeyChainFixture)
BOOST_AUTO_TEST_CASE(ExtractIdentityNameFromKeyLocator)
{
+ using ndn::security::extractIdentityNameFromKeyLocator;
+
auto id = m_keyChain.createIdentity("/random/identity");
auto keyName = id.getDefaultKey().getName();
auto certName = id.getDefaultKey().getDefaultCertificate().getName();
@@ -55,7 +54,4 @@
BOOST_AUTO_TEST_SUITE_END() // TestValidationPolicy
BOOST_AUTO_TEST_SUITE_END() // Security
-} // namespace tests
-} // inline namespace v2
-} // namespace security
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/security/validator-config.t.cpp b/tests/unit/security/validator-config.t.cpp
index 391879d..7cdfa53 100644
--- a/tests/unit/security/validator-config.t.cpp
+++ b/tests/unit/security/validator-config.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2013-2022 Regents of the University of California.
+ * Copyright (c) 2013-2023 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -29,11 +29,7 @@
#include "tests/key-chain-fixture.hpp"
#include "tests/unit/security/validator-config/common.hpp"
-namespace ndn {
-namespace security {
-namespace tests {
-
-using namespace ndn::tests;
+namespace ndn::tests {
BOOST_AUTO_TEST_SUITE(Security)
BOOST_FIXTURE_TEST_SUITE(TestValidatorConfig, KeyChainFixture)
@@ -42,12 +38,12 @@
BOOST_AUTO_TEST_CASE(Construct)
{
- util::DummyClientFace face;
+ DummyClientFace face;
ValidatorConfig v1(face);
BOOST_CHECK_EQUAL(v1.m_policyConfig.m_isConfigured, false);
- ValidatorConfig v2(make_unique<CertificateFetcherOffline>());
+ ValidatorConfig v2(make_unique<security::CertificateFetcherOffline>());
BOOST_CHECK_EQUAL(v2.m_policyConfig.m_isConfigured, false);
}
@@ -56,7 +52,7 @@
public:
ValidatorConfigFixture()
: path(boost::filesystem::path(UNIT_TESTS_TMPDIR) / "security" / "validator-config")
- , validator(make_unique<CertificateFetcherOffline>())
+ , validator(make_unique<security::CertificateFetcherOffline>())
{
boost::filesystem::create_directories(path);
config = R"CONF(
@@ -118,11 +114,11 @@
BOOST_AUTO_TEST_CASE(FromSection)
{
- validator.load(validator_config::tests::makeSection(config), "config-file-from-section");
+ validator.load(makeSection(config), "config-file-from-section");
BOOST_CHECK_EQUAL(validator.m_policyConfig.m_isConfigured, true);
// should reload policy
- validator.load(validator_config::tests::makeSection(config), "config-file-from-section");
+ validator.load(makeSection(config), "config-file-from-section");
BOOST_CHECK_EQUAL(validator.m_policyConfig.m_isConfigured, true);
}
@@ -133,7 +129,7 @@
{
validator.load(configFile);
- InterestSigner signer(m_keyChain);
+ security::InterestSigner signer(m_keyChain);
auto i = signer.makeCommandInterest("/hello/world/CMD", signingWithSha256());
size_t nValidated = 0, nFailed = 0;
@@ -155,7 +151,7 @@
{
validator.load(configFile);
- InterestSigner signer(m_keyChain);
+ security::InterestSigner signer(m_keyChain);
Interest i1("/hello/world");
signer.makeSignedInterest(i1);
size_t nValidated = 0, nFailed = 0;
@@ -179,7 +175,7 @@
{
validator.load(configFile);
- InterestSigner signer(m_keyChain);
+ security::InterestSigner signer(m_keyChain);
auto i1 = signer.makeCommandInterest("/hello/world");
size_t nValidated = 0, nFailed = 0;
@@ -200,6 +196,4 @@
BOOST_AUTO_TEST_SUITE_END() // TestValidatorConfig
BOOST_AUTO_TEST_SUITE_END() // Security
-} // namespace tests
-} // namespace security
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/security/validator-config/checker.t.cpp b/tests/unit/security/validator-config/checker.t.cpp
index 1170156..6c61085 100644
--- a/tests/unit/security/validator-config/checker.t.cpp
+++ b/tests/unit/security/validator-config/checker.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2013-2021 Regents of the University of California.
+ * Copyright (c) 2013-2023 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -27,14 +27,9 @@
#include "tests/unit/security/validator-fixture.hpp"
#include "tests/unit/security/validator-config/common.hpp"
-namespace ndn {
-namespace security {
-inline namespace v2 {
-namespace validator_config {
-namespace tests {
+namespace ndn::tests {
-using namespace ndn::tests;
-using namespace ndn::security::tests;
+using namespace ndn::security::validator_config;
BOOST_AUTO_TEST_SUITE(Security)
BOOST_AUTO_TEST_SUITE(ValidatorConfig)
@@ -343,8 +338,4 @@
BOOST_AUTO_TEST_SUITE_END() // ValidatorConfig
BOOST_AUTO_TEST_SUITE_END() // Security
-} // namespace tests
-} // namespace validator_config
-} // inline namespace v2
-} // namespace security
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/security/validator-config/common.hpp b/tests/unit/security/validator-config/common.hpp
index c4a4fe3..c984cf5 100644
--- a/tests/unit/security/validator-config/common.hpp
+++ b/tests/unit/security/validator-config/common.hpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2013-2020 Regents of the University of California.
+ * Copyright (c) 2013-2023 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -26,11 +26,9 @@
#include <boost/property_tree/info_parser.hpp>
-namespace ndn {
-namespace security {
-inline namespace v2 {
-namespace validator_config {
-namespace tests {
+namespace ndn::tests {
+
+using ndn::security::validator_config::ConfigSection;
inline ConfigSection
makeSection(const std::string& config)
@@ -41,10 +39,6 @@
return section;
}
-} // namespace tests
-} // namespace validator_config
-} // inline namespace v2
-} // namespace security
-} // namespace ndn
+} // namespace ndn::tests
#endif // NDN_CXX_TESTS_UNIT_SECURITY_VALIDATOR_CONFIG_COMMON_HPP
diff --git a/tests/unit/security/validator-config/filter.t.cpp b/tests/unit/security/validator-config/filter.t.cpp
index 42eeceb..a83217b 100644
--- a/tests/unit/security/validator-config/filter.t.cpp
+++ b/tests/unit/security/validator-config/filter.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2013-2021 Regents of the University of California.
+ * Copyright (c) 2013-2023 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -25,14 +25,9 @@
#include "tests/unit/security/validator-config/common.hpp"
#include "tests/unit/security/validator-fixture.hpp"
-namespace ndn {
-namespace security {
-inline namespace v2 {
-namespace validator_config {
-namespace tests {
+namespace ndn::tests {
-using namespace ndn::tests;
-using namespace ndn::security::tests;
+using namespace ndn::security::validator_config;
BOOST_AUTO_TEST_SUITE(Security)
BOOST_AUTO_TEST_SUITE(ValidatorConfig)
@@ -198,8 +193,4 @@
BOOST_AUTO_TEST_SUITE_END() // ValidatorConfig
BOOST_AUTO_TEST_SUITE_END() // Security
-} // namespace tests
-} // namespace validator_config
-} // inline namespace v2
-} // namespace security
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/security/validator-config/name-relation.t.cpp b/tests/unit/security/validator-config/name-relation.t.cpp
index 8879212..c81a092 100644
--- a/tests/unit/security/validator-config/name-relation.t.cpp
+++ b/tests/unit/security/validator-config/name-relation.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2013-2020 Regents of the University of California.
+ * Copyright (c) 2013-2023 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -25,11 +25,9 @@
#include <boost/lexical_cast.hpp>
-namespace ndn {
-namespace security {
-inline namespace v2 {
-namespace validator_config {
-namespace tests {
+namespace ndn::tests {
+
+using namespace ndn::security::validator_config;
BOOST_AUTO_TEST_SUITE(Security)
BOOST_AUTO_TEST_SUITE(ValidatorConfig)
@@ -49,7 +47,7 @@
BOOST_CHECK_EQUAL(getNameRelationFromString("equal"), NameRelation::EQUAL);
BOOST_CHECK_EQUAL(getNameRelationFromString("is-prefix-of"), NameRelation::IS_PREFIX_OF);
BOOST_CHECK_EQUAL(getNameRelationFromString("is-strict-prefix-of"), NameRelation::IS_STRICT_PREFIX_OF);
- BOOST_CHECK_THROW(getNameRelationFromString("unknown"), validator_config::Error);
+ BOOST_CHECK_THROW(getNameRelationFromString("unknown"), Error);
}
BOOST_AUTO_TEST_CASE(CheckRelation)
@@ -70,8 +68,4 @@
BOOST_AUTO_TEST_SUITE_END() // ValidatorConfig
BOOST_AUTO_TEST_SUITE_END() // Security
-} // namespace tests
-} // namespace validator_config
-} // inline namespace v2
-} // namespace security
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/security/validator-config/rule.t.cpp b/tests/unit/security/validator-config/rule.t.cpp
index 4871521..ea0b4b7 100644
--- a/tests/unit/security/validator-config/rule.t.cpp
+++ b/tests/unit/security/validator-config/rule.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2013-2021 Regents of the University of California.
+ * Copyright (c) 2013-2023 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -27,14 +27,9 @@
#include <boost/mpl/vector_c.hpp>
-namespace ndn {
-namespace security {
-inline namespace v2 {
-namespace validator_config {
-namespace tests {
+namespace ndn::tests {
-using namespace ndn::tests;
-using namespace ndn::security::tests;
+using namespace ndn::security::validator_config;
BOOST_AUTO_TEST_SUITE(Security)
BOOST_AUTO_TEST_SUITE(ValidatorConfig)
@@ -54,7 +49,7 @@
const std::string ruleId = "rule-id";
Rule rule;
Name pktName;
- shared_ptr<ValidationState> state;
+ shared_ptr<security::ValidationState> state;
};
using PktTypes = boost::mpl::vector<DataPkt, InterestV02Pkt, InterestV03Pkt>;
@@ -211,8 +206,4 @@
BOOST_AUTO_TEST_SUITE_END() // ValidatorConfig
BOOST_AUTO_TEST_SUITE_END() // Security
-} // namespace tests
-} // namespace validator_config
-} // inline namespace v2
-} // namespace security
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/security/validator-fixture.cpp b/tests/unit/security/validator-fixture.cpp
index 0e780b4..41497bf 100644
--- a/tests/unit/security/validator-fixture.cpp
+++ b/tests/unit/security/validator-fixture.cpp
@@ -22,11 +22,11 @@
#include "tests/unit/security/validator-fixture.hpp"
#include "ndn-cxx/security/additional-description.hpp"
+#include "ndn-cxx/util/signal/scoped-connection.hpp"
-namespace ndn {
-namespace security {
-inline namespace v2 {
-namespace tests {
+namespace ndn::tests {
+
+using namespace ndn::security;
ValidatorFixtureBase::ValidatorFixtureBase()
{
@@ -45,7 +45,7 @@
void
ValidatorFixtureBase::mockNetworkOperations()
{
- util::signal::ScopedConnection conn = face.onSendInterest.connect([this] (const Interest& interest) {
+ signal::ScopedConnection conn = face.onSendInterest.connect([this] (const Interest& interest) {
if (processInterest) {
m_io.post([=] { processInterest(interest); });
}
@@ -102,7 +102,4 @@
return interest.getName();
}
-} // namespace tests
-} // inline namespace v2
-} // namespace security
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/security/validator-fixture.hpp b/tests/unit/security/validator-fixture.hpp
index 39e4ed3..6d69a1e 100644
--- a/tests/unit/security/validator-fixture.hpp
+++ b/tests/unit/security/validator-fixture.hpp
@@ -31,12 +31,13 @@
#include <boost/lexical_cast.hpp>
-namespace ndn {
-namespace security {
-inline namespace v2 {
-namespace tests {
+namespace ndn::tests {
-class ValidatorFixtureBase : public ndn::tests::IoKeyChainFixture
+using ndn::security::Certificate;
+using ndn::security::Identity;
+using ndn::security::ValidationError;
+
+class ValidatorFixtureBase : public IoKeyChainFixture
{
protected:
ValidatorFixtureBase();
@@ -63,9 +64,9 @@
addSubCertificate(const Name& subIdentityName, const Identity& issuer);
protected:
- util::DummyClientFace face{m_io, {true, true}};
+ DummyClientFace face{m_io, {true, true}};
std::function<void(const Interest&)> processInterest;
- CertificateCache cache{100_days};
+ security::CertificateCache cache{100_days};
ValidationError lastError{ValidationError::NO_ERROR};
private:
@@ -73,7 +74,7 @@
static constexpr int s_mockTimes{200};
};
-template<class ValidationPolicyT, class CertificateFetcherT = CertificateFetcherFromNetwork>
+template<class ValidationPolicyT, class CertificateFetcherT = security::CertificateFetcherFromNetwork>
class ValidatorFixture : public ValidatorFixtureBase
{
protected:
@@ -109,11 +110,11 @@
}
protected:
- Validator validator;
+ security::Validator validator;
ValidationPolicyT& policy;
};
-template<class ValidationPolicyT, class CertificateFetcherT = CertificateFetcherFromNetwork>
+template<class ValidationPolicyT, class CertificateFetcherT = security::CertificateFetcherFromNetwork>
class HierarchicalValidatorFixture : public ValidatorFixture<ValidationPolicyT, CertificateFetcherT>
{
protected:
@@ -142,7 +143,7 @@
#define VALIDATE_SUCCESS(packet, message) this->validate(packet, message, true, __LINE__)
#define VALIDATE_FAILURE(packet, message) this->validate(packet, message, false, __LINE__)
-class DummyValidationState : public ValidationState
+class DummyValidationState : public security::ValidationState
{
public:
~DummyValidationState() override
@@ -190,7 +191,7 @@
return Data(name);
}
- static shared_ptr<ValidationState>
+ static shared_ptr<security::ValidationState>
makeState()
{
return make_shared<DummyValidationState>();
@@ -214,11 +215,11 @@
return Interest(name);
}
- static shared_ptr<ValidationState>
+ static shared_ptr<security::ValidationState>
makeState()
{
auto state = make_shared<DummyValidationState>();
- state->setTag(make_shared<SignedInterestFormatTag>(SignedInterestFormat::V02));
+ state->setTag(make_shared<security::SignedInterestFormatTag>(security::SignedInterestFormat::V02));
return state;
}
};
@@ -240,18 +241,15 @@
return Interest(name);
}
- static shared_ptr<ValidationState>
+ static shared_ptr<security::ValidationState>
makeState()
{
auto state = make_shared<DummyValidationState>();
- state->setTag(make_shared<SignedInterestFormatTag>(SignedInterestFormat::V03));
+ state->setTag(make_shared<security::SignedInterestFormatTag>(security::SignedInterestFormat::V03));
return state;
}
};
-} // namespace tests
-} // inline namespace v2
-} // namespace security
-} // namespace ndn
+} // namespace ndn::tests
#endif // NDN_CXX_TESTS_UNIT_SECURITY_VALIDATOR_FIXTURE_HPP
diff --git a/tests/unit/security/validator-null.t.cpp b/tests/unit/security/validator-null.t.cpp
index 5ad9be5..ebae900 100644
--- a/tests/unit/security/validator-null.t.cpp
+++ b/tests/unit/security/validator-null.t.cpp
@@ -24,12 +24,12 @@
#include "tests/boost-test.hpp"
#include "tests/key-chain-fixture.hpp"
-namespace ndn {
-namespace security {
-namespace tests {
+namespace ndn::tests {
+
+using ndn::security::ValidatorNull;
BOOST_AUTO_TEST_SUITE(Security)
-BOOST_FIXTURE_TEST_SUITE(TestValidatorNull, ndn::tests::KeyChainFixture)
+BOOST_FIXTURE_TEST_SUITE(TestValidatorNull, KeyChainFixture)
BOOST_AUTO_TEST_CASE(ValidateData)
{
@@ -58,6 +58,4 @@
BOOST_AUTO_TEST_SUITE_END() // TestValidatorNull
BOOST_AUTO_TEST_SUITE_END() // Security
-} // namespace tests
-} // namespace security
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/security/validator.t.cpp b/tests/unit/security/validator.t.cpp
index d1b746b..c56db6a 100644
--- a/tests/unit/security/validator.t.cpp
+++ b/tests/unit/security/validator.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2013-2022 Regents of the University of California.
+ * Copyright (c) 2013-2023 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -25,12 +25,9 @@
#include "tests/test-common.hpp"
#include "tests/unit/security/validator-fixture.hpp"
-namespace ndn {
-namespace security {
-inline namespace v2 {
-namespace tests {
+namespace ndn::tests {
-using namespace ndn::tests;
+using namespace ndn::security;
BOOST_AUTO_TEST_SUITE(Security)
BOOST_FIXTURE_TEST_SUITE(TestValidator, HierarchicalValidatorFixture<ValidationPolicySimpleHierarchy>)
@@ -378,7 +375,4 @@
BOOST_AUTO_TEST_SUITE_END() // TestValidator
BOOST_AUTO_TEST_SUITE_END() // Security
-} // namespace tests
-} // inline namespace v2
-} // namespace security
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/security/validity-period.t.cpp b/tests/unit/security/validity-period.t.cpp
index dbcd47f..1fbd6b1 100644
--- a/tests/unit/security/validity-period.t.cpp
+++ b/tests/unit/security/validity-period.t.cpp
@@ -27,11 +27,9 @@
#include <boost/lexical_cast.hpp>
-namespace ndn {
-namespace security {
-namespace tests {
+namespace ndn::tests {
-using namespace ndn::tests;
+using ndn::security::ValidityPeriod;
BOOST_CONCEPT_ASSERT((boost::EqualityComparable<ValidityPeriod>));
BOOST_CONCEPT_ASSERT((WireEncodable<ValidityPeriod>));
@@ -121,8 +119,8 @@
BOOST_AUTO_TEST_CASE(EncodingDecoding)
{
- time::system_clock::TimePoint notBefore = time::getUnixEpoch();
- time::system_clock::TimePoint notAfter = notBefore + 1_day;
+ time::system_clock::time_point notBefore = time::getUnixEpoch();
+ time::system_clock::time_point notAfter = notBefore + 1_day;
ValidityPeriod v1(notBefore, notAfter);
BOOST_CHECK_EQUAL_COLLECTIONS(v1.wireEncode().begin(), v1.wireEncode().end(),
VP1, VP1 + sizeof(VP1));
@@ -206,9 +204,9 @@
BOOST_AUTO_TEST_CASE(Comparison)
{
- time::system_clock::TimePoint notBefore = time::getUnixEpoch();
- time::system_clock::TimePoint notAfter = notBefore + 1_day;
- time::system_clock::TimePoint notAfter2 = notBefore + 2_days;
+ auto notBefore = time::getUnixEpoch();
+ auto notAfter = notBefore + 1_day;
+ auto notAfter2 = notBefore + 2_days;
ValidityPeriod validity1(notBefore, notAfter);
ValidityPeriod validity2(notBefore, notAfter);
@@ -221,6 +219,4 @@
BOOST_AUTO_TEST_SUITE_END() // TestValidityPeriod
BOOST_AUTO_TEST_SUITE_END() // Security
-} // namespace tests
-} // namespace security
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/security/verification-helpers.t.cpp b/tests/unit/security/verification-helpers.t.cpp
index 83d37da..868333d 100644
--- a/tests/unit/security/verification-helpers.t.cpp
+++ b/tests/unit/security/verification-helpers.t.cpp
@@ -29,11 +29,9 @@
#include <openssl/opensslv.h>
#include <boost/mpl/vector.hpp>
-namespace ndn {
-namespace security {
-namespace tests {
+namespace ndn::tests {
-using namespace ndn::tests;
+using namespace ndn::security;
BOOST_AUTO_TEST_SUITE(Security)
BOOST_AUTO_TEST_SUITE(TestVerificationHelpers)
@@ -680,6 +678,4 @@
BOOST_AUTO_TEST_SUITE_END() // TestVerificationHelpers
BOOST_AUTO_TEST_SUITE_END() // Security
-} // namespace tests
-} // namespace security
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/signature-info.t.cpp b/tests/unit/signature-info.t.cpp
index d538217..8fc459c 100644
--- a/tests/unit/signature-info.t.cpp
+++ b/tests/unit/signature-info.t.cpp
@@ -25,8 +25,7 @@
#include <boost/lexical_cast.hpp>
-namespace ndn {
-namespace tests {
+namespace ndn::tests {
BOOST_CONCEPT_ASSERT((boost::EqualityComparable<SignatureInfo>));
BOOST_CONCEPT_ASSERT((WireEncodable<SignatureInfo>));
@@ -550,5 +549,4 @@
BOOST_AUTO_TEST_SUITE_END() // TestSignatureInfo
-} // namespace tests
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/tag.t.cpp b/tests/unit/tag.t.cpp
index 0cbae22..9b4f1a6 100644
--- a/tests/unit/tag.t.cpp
+++ b/tests/unit/tag.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2013-2018 Regents of the University of California.
+ * Copyright (c) 2013-2023 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -23,14 +23,13 @@
#include "tests/boost-test.hpp"
-namespace ndn {
-namespace tests {
+namespace ndn::tests {
BOOST_AUTO_TEST_SUITE(TestTag)
BOOST_AUTO_TEST_CASE(SimpleTag)
{
- typedef ndn::SimpleTag<int, 3> MyTag;
+ using MyTag = ndn::SimpleTag<int, 3>;
BOOST_CHECK_EQUAL(MyTag::getTypeId(), 3);
MyTag tag(23361); // explicitly convertible from value type
@@ -41,5 +40,4 @@
BOOST_AUTO_TEST_SUITE_END() // TestTag
-} // namespace tests
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/test-home-env-saver.hpp b/tests/unit/test-home-env-saver.hpp
index 9a04605..db1c2f2 100644
--- a/tests/unit/test-home-env-saver.hpp
+++ b/tests/unit/test-home-env-saver.hpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2013-2021 Regents of the University of California.
+ * Copyright (c) 2013-2023 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -25,8 +25,7 @@
#include <cstdlib>
#include <string>
-namespace ndn {
-namespace tests {
+namespace ndn::tests {
class TestHomeEnvSaver
{
@@ -50,7 +49,6 @@
std::string m_HOME;
};
-} // namespace tests
-} // namespace ndn
+} // namespace ndn::tests
#endif // NDN_CXX_TESTS_UNIT_TEST_HOME_ENV_SAVER_HPP
diff --git a/tests/unit/transport/tcp-transport.t.cpp b/tests/unit/transport/tcp-transport.t.cpp
index cb577cc..5d86baa 100644
--- a/tests/unit/transport/tcp-transport.t.cpp
+++ b/tests/unit/transport/tcp-transport.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2013-2020 Regents of the University of California.
+ * Copyright (c) 2013-2023 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -23,8 +23,7 @@
#include "tests/boost-test.hpp"
-namespace ndn {
-namespace tests {
+namespace ndn::tests {
BOOST_AUTO_TEST_SUITE(Transport)
BOOST_AUTO_TEST_SUITE(TestTcpTransport)
@@ -85,5 +84,4 @@
BOOST_AUTO_TEST_SUITE_END() // TestTcpTransport
BOOST_AUTO_TEST_SUITE_END() // Transport
-} // namespace tests
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/transport/unix-transport.t.cpp b/tests/unit/transport/unix-transport.t.cpp
index a8946f4..f7c54d6 100644
--- a/tests/unit/transport/unix-transport.t.cpp
+++ b/tests/unit/transport/unix-transport.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2013-2020 Regents of the University of California.
+ * Copyright (c) 2013-2023 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -23,8 +23,7 @@
#include "tests/boost-test.hpp"
-namespace ndn {
-namespace tests {
+namespace ndn::tests {
BOOST_AUTO_TEST_SUITE(Transport)
BOOST_AUTO_TEST_SUITE(TestUnixTransport)
@@ -54,5 +53,4 @@
BOOST_AUTO_TEST_SUITE_END() // TestUnixTransport
BOOST_AUTO_TEST_SUITE_END() // Transport
-} // namespace tests
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/util/concepts.t.cpp b/tests/unit/util/concepts.t.cpp
index 997f86a..74feee7 100644
--- a/tests/unit/util/concepts.t.cpp
+++ b/tests/unit/util/concepts.t.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-2023 Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -27,8 +27,7 @@
#include "ndn-cxx/util/concepts.hpp"
-namespace ndn {
-namespace tests {
+namespace ndn::tests {
class WireEncodableType
{
@@ -57,5 +56,4 @@
};
BOOST_CONCEPT_ASSERT((WireDecodable<WireDecodableType>));
-} // namespace tests
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/util/config-file.t.cpp b/tests/unit/util/config-file.t.cpp
index 9e098c1..ab8f212 100644
--- a/tests/unit/util/config-file.t.cpp
+++ b/tests/unit/util/config-file.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2013-2021 Regents of the University of California.
+ * Copyright (c) 2013-2023 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -27,8 +27,7 @@
#include <boost/filesystem/operations.hpp>
#include <cstdlib>
-namespace ndn {
-namespace tests {
+namespace ndn::tests {
BOOST_AUTO_TEST_SUITE(Util)
BOOST_FIXTURE_TEST_SUITE(TestConfigFile, TestHomeEnvSaver)
@@ -67,5 +66,4 @@
BOOST_AUTO_TEST_SUITE_END() // TestConfigFile
BOOST_AUTO_TEST_SUITE_END() // Util
-} // namespace tests
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/util/dummy-client-face.t.cpp b/tests/unit/util/dummy-client-face.t.cpp
index ad0c3bf..0eea2e6 100644
--- a/tests/unit/util/dummy-client-face.t.cpp
+++ b/tests/unit/util/dummy-client-face.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2013-2022 Regents of the University of California.
+ * Copyright (c) 2013-2023 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -25,11 +25,7 @@
#include "tests/test-common.hpp"
#include "tests/unit/io-key-chain-fixture.hpp"
-namespace ndn {
-namespace util {
-namespace tests {
-
-using namespace ndn::tests;
+namespace ndn::tests {
BOOST_AUTO_TEST_SUITE(Util)
BOOST_FIXTURE_TEST_SUITE(TestDummyClientFace, IoKeyChainFixture)
@@ -107,13 +103,13 @@
[&] (const InterestFilter&, const Interest& interest) {
BOOST_CHECK_EQUAL(interest.getName(), "/face1/data");
nFace1Interest++;
- face1.put(ndn::tests::makeNack(interest, lp::NackReason::NO_ROUTE));
+ face1.put(makeNack(interest, lp::NackReason::NO_ROUTE));
}, nullptr, nullptr);
face2.setInterestFilter("/face2",
[&] (const InterestFilter&, const Interest& interest) {
BOOST_CHECK_EQUAL(interest.getName(), "/face2/data");
nFace2Interest++;
- face2.put(*ndn::tests::makeData("/face2/data"));
+ face2.put(*makeData("/face2/data"));
return;
}, nullptr, nullptr);
@@ -175,6 +171,4 @@
BOOST_AUTO_TEST_SUITE_END() // TestDummyClientFace
BOOST_AUTO_TEST_SUITE_END() // Util
-} // namespace tests
-} // namespace util
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/util/exception.t.cpp b/tests/unit/util/exception.t.cpp
index 49ac2ab..d8184c5 100644
--- a/tests/unit/util/exception.t.cpp
+++ b/tests/unit/util/exception.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2013-2022 Regents of the University of California.
+ * Copyright (c) 2013-2023 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -26,9 +26,7 @@
#include <boost/exception/diagnostic_information.hpp>
#include <boost/exception/get_error_info.hpp>
-namespace ndn {
-namespace exception {
-namespace tests {
+namespace ndn::tests {
BOOST_AUTO_TEST_SUITE(Util)
BOOST_AUTO_TEST_SUITE(TestException)
@@ -50,7 +48,7 @@
BOOST_CHECK(boost::get_error_info<boost::throw_function>(ex) != nullptr);
#ifdef NDN_CXX_HAVE_STACKTRACE
- auto stack = boost::get_error_info<errinfo_stacktrace>(ex);
+ auto stack = boost::get_error_info<ndn::exception::errinfo_stacktrace>(ex);
BOOST_REQUIRE(stack != nullptr);
auto info = boost::diagnostic_information(ex);
BOOST_TEST_MESSAGE(info);
@@ -106,6 +104,4 @@
BOOST_AUTO_TEST_SUITE_END() // TestException
BOOST_AUTO_TEST_SUITE_END() // Util
-} // namespace tests
-} // namespace exception
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/util/indented-stream.t.cpp b/tests/unit/util/indented-stream.t.cpp
index 91da1e3..4994d0d 100644
--- a/tests/unit/util/indented-stream.t.cpp
+++ b/tests/unit/util/indented-stream.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2013-2022 Regents of the University of California.
+ * Copyright (c) 2013-2023 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -25,11 +25,10 @@
#include <boost/test/tools/output_test_stream.hpp>
-namespace ndn {
-namespace util {
-namespace tests {
+namespace ndn::tests {
using boost::test_tools::output_test_stream;
+using ndn::util::IndentedStream;
BOOST_AUTO_TEST_SUITE(Util)
BOOST_AUTO_TEST_SUITE(TestIndentedStream)
@@ -77,6 +76,4 @@
BOOST_AUTO_TEST_SUITE_END() // TestIndentedStream
BOOST_AUTO_TEST_SUITE_END() // Util
-} // namespace tests
-} // namespace util
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/util/io.t.cpp b/tests/unit/util/io.t.cpp
index 9658d04..934648a 100644
--- a/tests/unit/util/io.t.cpp
+++ b/tests/unit/util/io.t.cpp
@@ -27,8 +27,7 @@
#include <boost/filesystem.hpp>
#include <boost/mpl/vector.hpp>
-namespace ndn {
-namespace tests {
+namespace ndn::tests {
BOOST_AUTO_TEST_SUITE(Util)
BOOST_AUTO_TEST_SUITE(TestIo)
@@ -398,5 +397,4 @@
BOOST_AUTO_TEST_SUITE_END() // TestIo
BOOST_AUTO_TEST_SUITE_END() // Util
-} // namespace tests
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/util/log-filter-module.cpp b/tests/unit/util/log-filter-module.cpp
index ab55728..371b7d6 100644
--- a/tests/unit/util/log-filter-module.cpp
+++ b/tests/unit/util/log-filter-module.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2013-2018 Regents of the University of California.
+ * Copyright (c) 2013-2023 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -23,9 +23,7 @@
NDN_LOG_INIT(fm.FilterModule);
-namespace ndn {
-namespace util {
-namespace tests {
+namespace ndn::tests {
void
logFromFilterModule()
@@ -38,7 +36,5 @@
NDN_LOG_FATAL("fatalFM");
}
-} // namespace tests
-} // namespace util
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/util/log-module1.cpp b/tests/unit/util/log-module1.cpp
index 4f71102..2070c58 100644
--- a/tests/unit/util/log-module1.cpp
+++ b/tests/unit/util/log-module1.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2013-2018 Regents of the University of California.
+ * Copyright (c) 2013-2023 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -23,9 +23,7 @@
NDN_LOG_INIT(Module1);
-namespace ndn {
-namespace util {
-namespace tests {
+namespace ndn::tests {
void
logFromModule1()
@@ -38,6 +36,4 @@
NDN_LOG_FATAL("fatal" << 1);
}
-} // namespace tests
-} // namespace util
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/util/log-module2.cpp b/tests/unit/util/log-module2.cpp
index 994e142..6565488 100644
--- a/tests/unit/util/log-module2.cpp
+++ b/tests/unit/util/log-module2.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2013-2018 Regents of the University of California.
+ * Copyright (c) 2013-2023 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -23,9 +23,7 @@
NDN_LOG_INIT(Module2);
-namespace ndn {
-namespace util {
-namespace tests {
+namespace ndn::tests {
void
logFromModule2()
@@ -38,6 +36,4 @@
NDN_LOG_FATAL("fatal" << 2);
}
-} // namespace tests
-} // namespace util
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/util/logger.t.cpp b/tests/unit/util/logger.t.cpp
index ad742bb..70ba72f 100644
--- a/tests/unit/util/logger.t.cpp
+++ b/tests/unit/util/logger.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2013-2018 Regents of the University of California.
+ * Copyright (c) 2013-2023 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -24,9 +24,11 @@
#include "tests/boost-test.hpp"
-namespace ndn {
-namespace util {
-namespace tests {
+namespace ndn::tests {
+
+using ndn::util::Logger;
+using ndn::util::Logging;
+using ndn::util::LogLevel;
BOOST_AUTO_TEST_SUITE(Util)
BOOST_AUTO_TEST_SUITE(TestLogger)
@@ -77,6 +79,4 @@
BOOST_AUTO_TEST_SUITE_END() // TestLogger
BOOST_AUTO_TEST_SUITE_END() // Util
-} // namespace tests
-} // namespace util
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/util/logging.t.cpp b/tests/unit/util/logging.t.cpp
index 02da03a..937b41b 100644
--- a/tests/unit/util/logging.t.cpp
+++ b/tests/unit/util/logging.t.cpp
@@ -27,11 +27,13 @@
#include <boost/test/tools/output_test_stream.hpp>
-namespace ndn {
-namespace util {
-namespace tests {
+namespace ndn::tests {
-NDN_LOG_INIT(ndn.util.tests.Logging);
+using ndn::util::Logger;
+using ndn::util::Logging;
+using ndn::util::LogLevel;
+
+NDN_LOG_INIT(ndn.tests.Logging);
void
logFromModule1();
@@ -60,7 +62,7 @@
namespace ns1 {
-NDN_LOG_INIT(ndn.util.tests.ns1);
+NDN_LOG_INIT(ndn.tests.ns1);
static void
logFromNamespace1()
@@ -72,7 +74,7 @@
namespace ns2 {
-NDN_LOG_INIT(ndn.util.tests.ns2);
+NDN_LOG_INIT(ndn.tests.ns2);
static void
logFromNamespace2()
@@ -101,7 +103,7 @@
NDN_LOG_MEMBER_DECL();
};
-NDN_LOG_MEMBER_INIT(ClassWithLogger, ndn.util.tests.ClassWithLogger);
+NDN_LOG_MEMBER_INIT(ClassWithLogger, ndn.tests.ClassWithLogger);
class AbstractClassWithLogger
{
@@ -123,7 +125,7 @@
};
// Check that the macro can cope with abstract types
-NDN_LOG_MEMBER_INIT(AbstractClassWithLogger, ndn.util.tests.AbstractClassWithLogger);
+NDN_LOG_MEMBER_INIT(AbstractClassWithLogger, ndn.tests.AbstractClassWithLogger);
class DerivedClass : public AbstractClassWithLogger
{
@@ -159,13 +161,13 @@
// but we want to test that the macro expands to well-formed code
NDN_LOG_MEMBER_DECL_SPECIALIZED((ClassTemplateWithLogger<int, double>));
-NDN_LOG_MEMBER_INIT_SPECIALIZED((ClassTemplateWithLogger<int, double>), ndn.util.tests.Specialized1);
-NDN_LOG_MEMBER_INIT_SPECIALIZED((ClassTemplateWithLogger<int, std::string>), ndn.util.tests.Specialized2);
+NDN_LOG_MEMBER_INIT_SPECIALIZED((ClassTemplateWithLogger<int, double>), ndn.tests.Specialized1);
+NDN_LOG_MEMBER_INIT_SPECIALIZED((ClassTemplateWithLogger<int, std::string>), ndn.tests.Specialized2);
constexpr time::microseconds LOG_SYSTIME{1468108800311239LL};
const std::string LOG_SYSTIME_STR("1468108800.311239");
-class LoggingFixture : public ndn::tests::ClockFixture
+class LoggingFixture : public ClockFixture
{
protected:
LoggingFixture()
@@ -202,7 +204,7 @@
NDN_LOG_TRACE("GetLoggerNames");
auto names = Logging::getLoggerNames();
BOOST_CHECK_EQUAL(names.size(), n);
- BOOST_CHECK_EQUAL(names.count("ndn.util.tests.Logging"), 1);
+ BOOST_CHECK_EQUAL(names.count("ndn.tests.Logging"), 1);
}
BOOST_AUTO_TEST_SUITE(Severity)
@@ -308,48 +310,48 @@
BOOST_AUTO_TEST_CASE(NamespaceLogger)
{
- Logging::setLevel("ndn.util.tests.ns1", LogLevel::INFO);
- Logging::setLevel("ndn.util.tests.ns2", LogLevel::DEBUG);
+ Logging::setLevel("ndn.tests.ns1", LogLevel::INFO);
+ Logging::setLevel("ndn.tests.ns2", LogLevel::DEBUG);
const auto& levels = Logging::get().getLevels();
BOOST_CHECK_EQUAL(levels.size(), 2);
- BOOST_CHECK_EQUAL(levels.at("ndn.util.tests.ns1"), LogLevel::INFO);
- BOOST_CHECK_EQUAL(levels.at("ndn.util.tests.ns2"), LogLevel::DEBUG);
+ BOOST_CHECK_EQUAL(levels.at("ndn.tests.ns1"), LogLevel::INFO);
+ BOOST_CHECK_EQUAL(levels.at("ndn.tests.ns2"), LogLevel::DEBUG);
const auto& names = Logging::getLoggerNames();
- BOOST_CHECK_EQUAL(names.count("ndn.util.tests.ns1"), 1);
- BOOST_CHECK_EQUAL(names.count("ndn.util.tests.ns2"), 1);
+ BOOST_CHECK_EQUAL(names.count("ndn.tests.ns1"), 1);
+ BOOST_CHECK_EQUAL(names.count("ndn.tests.ns2"), 1);
ns1::logFromNamespace1();
ns2::logFromNamespace2();
Logging::flush();
BOOST_CHECK(os.is_equal(
- LOG_SYSTIME_STR + " INFO: [ndn.util.tests.ns1] hello world from ns1\n" +
- LOG_SYSTIME_STR + " INFO: [ndn.util.tests.ns2] hi there from ns2\n"
+ LOG_SYSTIME_STR + " INFO: [ndn.tests.ns1] hello world from ns1\n" +
+ LOG_SYSTIME_STR + " INFO: [ndn.tests.ns2] hi there from ns2\n"
));
}
BOOST_AUTO_TEST_CASE(MemberLogger)
{
- Logging::setLevel("ndn.util.tests.ClassWithLogger", LogLevel::INFO);
- Logging::setLevel("ndn.util.tests.AbstractClassWithLogger", LogLevel::INFO);
- Logging::setLevel("ndn.util.tests.Specialized1", LogLevel::INFO);
- // ndn.util.tests.Specialized2 is not enabled
+ Logging::setLevel("ndn.tests.ClassWithLogger", LogLevel::INFO);
+ Logging::setLevel("ndn.tests.AbstractClassWithLogger", LogLevel::INFO);
+ Logging::setLevel("ndn.tests.Specialized1", LogLevel::INFO);
+ // ndn.tests.Specialized2 is not enabled
const auto& names = Logging::getLoggerNames();
- BOOST_CHECK_EQUAL(names.count("ndn.util.tests.ClassWithLogger"), 1);
- BOOST_CHECK_EQUAL(names.count("ndn.util.tests.AbstractClassWithLogger"), 1);
- BOOST_CHECK_EQUAL(names.count("ndn.util.tests.Specialized1"), 1);
- BOOST_CHECK_EQUAL(names.count("ndn.util.tests.Specialized2"), 1);
+ BOOST_CHECK_EQUAL(names.count("ndn.tests.ClassWithLogger"), 1);
+ BOOST_CHECK_EQUAL(names.count("ndn.tests.AbstractClassWithLogger"), 1);
+ BOOST_CHECK_EQUAL(names.count("ndn.tests.Specialized1"), 1);
+ BOOST_CHECK_EQUAL(names.count("ndn.tests.Specialized2"), 1);
ClassWithLogger::logFromStaticMemberFunction();
ClassWithLogger{}.logFromConstMemberFunction();
Logging::flush();
BOOST_CHECK(os.is_equal(
- LOG_SYSTIME_STR + " INFO: [ndn.util.tests.ClassWithLogger] static member function\n" +
- LOG_SYSTIME_STR + " INFO: [ndn.util.tests.ClassWithLogger] const member function\n"
+ LOG_SYSTIME_STR + " INFO: [ndn.tests.ClassWithLogger] static member function\n" +
+ LOG_SYSTIME_STR + " INFO: [ndn.tests.ClassWithLogger] const member function\n"
));
DerivedClass{}.logFromConstMemberFunction();
@@ -357,8 +359,8 @@
Logging::flush();
BOOST_CHECK(os.is_equal(
- LOG_SYSTIME_STR + " INFO: [ndn.util.tests.AbstractClassWithLogger] const member function\n" +
- LOG_SYSTIME_STR + " INFO: [ndn.util.tests.AbstractClassWithLogger] overridden virtual function\n"
+ LOG_SYSTIME_STR + " INFO: [ndn.tests.AbstractClassWithLogger] const member function\n" +
+ LOG_SYSTIME_STR + " INFO: [ndn.tests.AbstractClassWithLogger] overridden virtual function\n"
));
ClassTemplateWithLogger<int, double>::logFromStaticMemberFunction();
@@ -368,8 +370,8 @@
Logging::flush();
BOOST_CHECK(os.is_equal(
- LOG_SYSTIME_STR + " INFO: [ndn.util.tests.Specialized1] class template static member function\n" +
- LOG_SYSTIME_STR + " INFO: [ndn.util.tests.Specialized1] class template non-static member function\n"
+ LOG_SYSTIME_STR + " INFO: [ndn.tests.Specialized1] class template static member function\n" +
+ LOG_SYSTIME_STR + " INFO: [ndn.tests.Specialized1] class template non-static member function\n"
));
}
@@ -702,6 +704,4 @@
BOOST_AUTO_TEST_SUITE_END() // TestLogging
BOOST_AUTO_TEST_SUITE_END() // Util
-} // namespace tests
-} // namespace util
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/util/notification-stream.t.cpp b/tests/unit/util/notification-stream.t.cpp
index 3ff6ed9..36b9004 100644
--- a/tests/unit/util/notification-stream.t.cpp
+++ b/tests/unit/util/notification-stream.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-2023 Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -32,12 +32,12 @@
#include "tests/unit/io-key-chain-fixture.hpp"
#include "tests/unit/util/simple-notification.hpp"
-namespace ndn {
-namespace util {
-namespace tests {
+namespace ndn::tests {
+
+using ndn::util::NotificationStream;
BOOST_AUTO_TEST_SUITE(Util)
-BOOST_FIXTURE_TEST_SUITE(TestNotificationStream, ndn::tests::IoKeyChainFixture)
+BOOST_FIXTURE_TEST_SUITE(TestNotificationStream, IoKeyChainFixture)
BOOST_AUTO_TEST_CASE(Post)
{
@@ -72,6 +72,4 @@
BOOST_AUTO_TEST_SUITE_END() // TestNotificationStream
BOOST_AUTO_TEST_SUITE_END() // Util
-} // namespace tests
-} // namespace util
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/util/notification-subscriber.t.cpp b/tests/unit/util/notification-subscriber.t.cpp
index 896f632..107784a 100644
--- a/tests/unit/util/notification-subscriber.t.cpp
+++ b/tests/unit/util/notification-subscriber.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2022 Regents of the University of California,
+ * Copyright (c) 2014-2023 Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -32,11 +32,7 @@
#include "tests/unit/io-key-chain-fixture.hpp"
#include "tests/unit/util/simple-notification.hpp"
-namespace ndn {
-namespace util {
-namespace tests {
-
-using namespace ndn::tests;
+namespace ndn::tests {
class NotificationSubscriberFixture : public IoKeyChainFixture
{
@@ -131,8 +127,8 @@
Name streamPrefix;
DummyClientFace subscriberFace;
util::NotificationSubscriber<SimpleNotification> subscriber;
- util::signal::Connection notificationConn;
- util::signal::Connection nackConn;
+ signal::Connection notificationConn;
+ signal::Connection nackConn;
uint64_t nextSendNotificationNo;
uint64_t lastDeliveredSeqNum;
SimpleNotification lastNotification;
@@ -285,6 +281,4 @@
BOOST_AUTO_TEST_SUITE_END() // TestNotificationSubscriber
BOOST_AUTO_TEST_SUITE_END() // Util
-} // namespace tests
-} // namespace util
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/util/ostream-joiner.t.cpp b/tests/unit/util/ostream-joiner.t.cpp
index 7e8e63f..2e7ac8f 100644
--- a/tests/unit/util/ostream-joiner.t.cpp
+++ b/tests/unit/util/ostream-joiner.t.cpp
@@ -26,8 +26,7 @@
#include <numeric>
#include <boost/test/tools/output_test_stream.hpp>
-namespace ndn {
-namespace tests {
+namespace ndn::tests {
BOOST_AUTO_TEST_SUITE(Util)
BOOST_AUTO_TEST_SUITE(TestOstreamJoiner)
@@ -69,5 +68,4 @@
BOOST_AUTO_TEST_SUITE_END() // TestOstreamJoiner
BOOST_AUTO_TEST_SUITE_END() // Util
-} // namespace tests
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/util/random.t.cpp b/tests/unit/util/random.t.cpp
index 388bb98..b72e754 100644
--- a/tests/unit/util/random.t.cpp
+++ b/tests/unit/util/random.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2013-2022 Regents of the University of California.
+ * Copyright (c) 2013-2023 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -28,8 +28,7 @@
#include <array>
#include <thread>
-namespace ndn {
-namespace tests {
+namespace ndn::tests {
BOOST_AUTO_TEST_SUITE(Util)
BOOST_AUTO_TEST_SUITE(TestRandom)
@@ -125,5 +124,4 @@
BOOST_AUTO_TEST_SUITE_END() // TestRandom
BOOST_AUTO_TEST_SUITE_END() // Util
-} // namespace tests
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/util/regex.t.cpp b/tests/unit/util/regex.t.cpp
index ca15b66..d09688e 100644
--- a/tests/unit/util/regex.t.cpp
+++ b/tests/unit/util/regex.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2013-2021 Regents of the University of California.
+ * Copyright (c) 2013-2023 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -32,8 +32,7 @@
#include "tests/boost-test.hpp"
-namespace ndn {
-namespace tests {
+namespace ndn::tests {
using std::string;
@@ -490,5 +489,4 @@
BOOST_AUTO_TEST_SUITE_END() // TestRegex
BOOST_AUTO_TEST_SUITE_END() // Util
-} // namespace tests
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/util/rtt-estimator.t.cpp b/tests/unit/util/rtt-estimator.t.cpp
index b819c9b..7070fb0 100644
--- a/tests/unit/util/rtt-estimator.t.cpp
+++ b/tests/unit/util/rtt-estimator.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2016-2019, Regents of the University of California,
+ * Copyright (c) 2016-2023, Regents of the University of California,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University.
*
@@ -27,9 +27,10 @@
#include <cmath>
-namespace ndn {
-namespace util {
-namespace tests {
+namespace ndn::tests {
+
+using ndn::util::RttEstimator;
+using ndn::util::RttEstimatorWithStats;
BOOST_AUTO_TEST_SUITE(Util)
BOOST_AUTO_TEST_SUITE(TestRttEstimator)
@@ -168,6 +169,4 @@
BOOST_AUTO_TEST_SUITE_END() // TestRttEstimator
BOOST_AUTO_TEST_SUITE_END() // Util
-} // namespace tests
-} // namespace util
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/util/scheduler.t.cpp b/tests/unit/util/scheduler.t.cpp
index 1040b92..e5c99e5 100644
--- a/tests/unit/util/scheduler.t.cpp
+++ b/tests/unit/util/scheduler.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2013-2021 Regents of the University of California.
+ * Copyright (c) 2013-2023 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -26,11 +26,11 @@
#include <boost/lexical_cast.hpp>
-namespace ndn {
-namespace scheduler {
-namespace tests {
+namespace ndn::tests {
-class SchedulerFixture : public ndn::tests::IoFixture
+using namespace ndn::scheduler;
+
+class SchedulerFixture : public IoFixture
{
protected:
Scheduler scheduler{m_io};
@@ -383,6 +383,4 @@
BOOST_AUTO_TEST_SUITE_END() // TestScheduler
BOOST_AUTO_TEST_SUITE_END() // Util
-} // namespace tests
-} // namespace scheduler
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/util/segment-fetcher.t.cpp b/tests/unit/util/segment-fetcher.t.cpp
index 4abe243..1166110 100644
--- a/tests/unit/util/segment-fetcher.t.cpp
+++ b/tests/unit/util/segment-fetcher.t.cpp
@@ -31,11 +31,7 @@
#include <set>
-namespace ndn {
-namespace util {
-namespace tests {
-
-using namespace ndn::tests;
+namespace ndn::tests {
class SegmentFetcherFixture : public IoKeyChainFixture
{
@@ -853,6 +849,4 @@
BOOST_AUTO_TEST_SUITE_END() // TestSegmentFetcher
BOOST_AUTO_TEST_SUITE_END() // Util
-} // namespace tests
-} // namespace util
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/util/segmenter.t.cpp b/tests/unit/util/segmenter.t.cpp
index d7ab98a..f6eb2a8 100644
--- a/tests/unit/util/segmenter.t.cpp
+++ b/tests/unit/util/segmenter.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2013-2022 Regents of the University of California.
+ * Copyright (c) 2013-2023 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -24,11 +24,7 @@
#include "tests/boost-test.hpp"
#include "tests/key-chain-fixture.hpp"
-namespace ndn {
-namespace util {
-namespace tests {
-
-using namespace ndn::tests;
+namespace ndn::tests {
BOOST_AUTO_TEST_SUITE(Util)
BOOST_FIXTURE_TEST_SUITE(TestSegmenter, KeyChainFixture)
@@ -144,6 +140,4 @@
BOOST_AUTO_TEST_SUITE_END() // TestSegmenter
BOOST_AUTO_TEST_SUITE_END() // Util
-} // namespace tests
-} // namespace util
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/util/sha256.t.cpp b/tests/unit/util/sha256.t.cpp
index c5fd1fd..4a31ac7 100644
--- a/tests/unit/util/sha256.t.cpp
+++ b/tests/unit/util/sha256.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2013-2022 Regents of the University of California.
+ * Copyright (c) 2013-2023 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -27,9 +27,9 @@
#include <boost/endian/conversion.hpp>
#include <sstream>
-namespace ndn {
-namespace util {
-namespace tests {
+namespace ndn::tests {
+
+using ndn::util::Sha256;
BOOST_AUTO_TEST_SUITE(Util)
BOOST_AUTO_TEST_SUITE(TestSha256)
@@ -201,6 +201,4 @@
BOOST_AUTO_TEST_SUITE_END() // TestSha256
BOOST_AUTO_TEST_SUITE_END() // Util
-} // namespace tests
-} // namespace util
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/util/signal.t.cpp b/tests/unit/util/signal.t.cpp
index b3640f9..001d02a 100644
--- a/tests/unit/util/signal.t.cpp
+++ b/tests/unit/util/signal.t.cpp
@@ -25,10 +25,9 @@
#include <boost/concept_check.hpp>
-namespace ndn {
-namespace util {
-namespace signal {
-namespace tests {
+namespace ndn::tests {
+
+using namespace ndn::signal;
BOOST_AUTO_TEST_SUITE(Util)
BOOST_AUTO_TEST_SUITE(TestSignal)
@@ -477,7 +476,4 @@
BOOST_AUTO_TEST_SUITE_END() // TestSignal
BOOST_AUTO_TEST_SUITE_END() // Util
-} // namespace tests
-} // namespace signal
-} // namespace util
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/util/simple-notification.hpp b/tests/unit/util/simple-notification.hpp
index ece2c48..239574b 100644
--- a/tests/unit/util/simple-notification.hpp
+++ b/tests/unit/util/simple-notification.hpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2022 Regents of the University of California,
+ * Copyright (c) 2014-2023 Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -30,9 +30,7 @@
#include "ndn-cxx/encoding/block-helpers.hpp"
-namespace ndn {
-namespace util {
-namespace tests {
+namespace ndn::tests {
class SimpleNotification
{
@@ -82,8 +80,6 @@
std::string m_message;
};
-} // namespace tests
-} // namespace util
-} // namespace ndn
+} // namespace ndn::tests
#endif // NDN_CXX_TESTS_UNIT_UTIL_SIMPLE_NOTIFICATION_HPP
diff --git a/tests/unit/util/sqlite3-statement.t.cpp b/tests/unit/util/sqlite3-statement.t.cpp
index 99ea89f..b3d32d5 100644
--- a/tests/unit/util/sqlite3-statement.t.cpp
+++ b/tests/unit/util/sqlite3-statement.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2013-2022 Regents of the University of California.
+ * Copyright (c) 2013-2023 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -27,9 +27,9 @@
#include <cstring>
#include <sqlite3.h>
-namespace ndn {
-namespace util {
-namespace tests {
+namespace ndn::tests {
+
+using ndn::util::Sqlite3Statement;
class Sqlite3DbFixture
{
@@ -153,6 +153,4 @@
BOOST_AUTO_TEST_SUITE_END() // TestSqlite3Statement
BOOST_AUTO_TEST_SUITE_END() // Util
-} // namespace tests
-} // namespace util
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/util/string-helper.t.cpp b/tests/unit/util/string-helper.t.cpp
index 3816fab..9361ed6 100644
--- a/tests/unit/util/string-helper.t.cpp
+++ b/tests/unit/util/string-helper.t.cpp
@@ -28,9 +28,7 @@
#include <cstring>
#include <boost/test/tools/output_test_stream.hpp>
-namespace ndn {
-namespace util {
-namespace tests {
+namespace ndn::tests {
using boost::test_tools::output_test_stream;
@@ -202,6 +200,4 @@
BOOST_AUTO_TEST_SUITE_END() // TestStringHelper
BOOST_AUTO_TEST_SUITE_END() // Util
-} // namespace tests
-} // namespace util
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/util/time-unit-test-clock.t.cpp b/tests/unit/util/time-unit-test-clock.t.cpp
index f1be623..6b34ff8 100644
--- a/tests/unit/util/time-unit-test-clock.t.cpp
+++ b/tests/unit/util/time-unit-test-clock.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2013-2020 Regents of the University of California.
+ * Copyright (c) 2013-2023 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -28,8 +28,7 @@
#include <boost/lexical_cast.hpp>
#include <thread>
-namespace ndn {
-namespace tests {
+namespace ndn::tests {
BOOST_AUTO_TEST_SUITE(Util)
BOOST_FIXTURE_TEST_SUITE(TestTimeUnitTestClock, ClockFixture)
@@ -51,8 +50,7 @@
BOOST_CHECK_GT(time::system_clock::now().time_since_epoch(),
time::UnitTestClockTraits<time::system_clock>::getDefaultStartTime());
- time::system_clock::TimePoint referenceTime =
- time::fromUnixTimestamp(time::milliseconds(1390966967032LL));
+ auto referenceTime = time::fromUnixTimestamp(time::milliseconds(1390966967032LL));
BOOST_CHECK_GT(time::system_clock::now(), referenceTime);
m_systemClock->setNow(referenceTime.time_since_epoch());
@@ -134,5 +132,4 @@
BOOST_AUTO_TEST_SUITE_END() // TestTimeUnitTestClock
BOOST_AUTO_TEST_SUITE_END() // Util
-} // namespace tests
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/util/time.t.cpp b/tests/unit/util/time.t.cpp
index 2232e12..9004700 100644
--- a/tests/unit/util/time.t.cpp
+++ b/tests/unit/util/time.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2013-2021 Regents of the University of California.
+ * Copyright (c) 2013-2023 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -26,9 +26,9 @@
#include <boost/lexical_cast.hpp>
#include <thread>
-namespace ndn {
-namespace time {
-namespace tests {
+namespace ndn::tests {
+
+using namespace ndn::time;
BOOST_AUTO_TEST_SUITE(Util)
BOOST_AUTO_TEST_SUITE(TestTime)
@@ -170,6 +170,4 @@
BOOST_AUTO_TEST_SUITE_END() // TestTime
BOOST_AUTO_TEST_SUITE_END() // Util
-} // namespace tests
-} // namespace time
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/version.t.cpp b/tests/unit/version.t.cpp
index ff3e32a..527bc95 100644
--- a/tests/unit/version.t.cpp
+++ b/tests/unit/version.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2013-2022 Regents of the University of California.
+ * Copyright (c) 2013-2023 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -25,8 +25,7 @@
#include <cstdio>
-namespace ndn {
-namespace tests {
+namespace ndn::tests {
BOOST_AUTO_TEST_SUITE(TestVersion)
@@ -58,5 +57,4 @@
BOOST_AUTO_TEST_SUITE_END() // TestVersion
-} // namespace tests
-} // namespace ndn
+} // namespace ndn::tests