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/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