From 49e1e87b24da0bfdf61c0cd965bfc11164026192 Mon Sep 17 00:00:00 2001 From: Davide Pesavento Date: Sat, 11 Nov 2023 00:45:23 -0500 Subject: [PATCH] Replace Boost.MPL with Mp11 Change-Id: I9e0f3cd0169a733f602ff5fc1457f63d6499387d --- ndn-cxx/impl/face-impl.hpp | 1 + ndn-cxx/lp/fields.hpp | 6 ++- ndn-cxx/lp/packet.cpp | 32 ++++--------- ndn-cxx/lp/packet.hpp | 4 +- ndn-cxx/net/face-uri.cpp | 45 ++++++++--------- ndn-cxx/util/dummy-client-face.cpp | 1 + tests/benchmarks/encoding-bench.cpp | 5 +- tests/integration/face.cpp | 4 +- tests/unit/detail/tag-host.t.cpp | 4 +- tests/unit/face.t.cpp | 3 +- tests/unit/ims/in-memory-storage.t.cpp | 16 +++---- tests/unit/lp/packet.t.cpp | 1 + tests/unit/lp/pit-token.t.cpp | 1 + tests/unit/name-component.t.cpp | 14 +++--- .../security/certificate-bundle-fetcher.t.cpp | 6 ++- .../certificate-fetcher-direct-fetch.t.cpp | 3 +- .../certificate-fetcher-from-network.t.cpp | 4 +- .../certificate-fetcher-offline.t.cpp | 4 +- tests/unit/security/key-chain.t.cpp | 5 +- tests/unit/security/pib/pib-impl.t.cpp | 5 +- tests/unit/security/signing-info.t.cpp | 1 - tests/unit/security/tpm/back-end.t.cpp | 5 +- .../unit/security/transform/private-key.t.cpp | 6 +-- .../unit/security/transform/public-key.t.cpp | 4 +- .../security/transform/stream-source.t.cpp | 9 ++-- .../security/transform/verifier-filter.t.cpp | 2 - .../validation-policy-accept-all.t.cpp | 4 +- .../validation-policy-command-interest.t.cpp | 7 +-- .../security/validation-policy-config.t.cpp | 48 ++++++++++--------- .../validation-policy-signed-interest.t.cpp | 7 +-- .../validation-policy-simple-hierarchy.t.cpp | 4 +- .../security/validator-config/checker.t.cpp | 26 +++++----- .../unit/security/validator-config/rule.t.cpp | 4 +- .../unit/security/verification-helpers.t.cpp | 7 ++- tests/unit/util/io.t.cpp | 4 +- 35 files changed, 144 insertions(+), 158 deletions(-) diff --git a/ndn-cxx/impl/face-impl.hpp b/ndn-cxx/impl/face-impl.hpp index df1fabd6..2b08d5e4 100644 --- a/ndn-cxx/impl/face-impl.hpp +++ b/ndn-cxx/impl/face-impl.hpp @@ -27,6 +27,7 @@ #include "ndn-cxx/impl/lp-field-tag.hpp" #include "ndn-cxx/impl/pending-interest.hpp" #include "ndn-cxx/impl/registered-prefix.hpp" +#include "ndn-cxx/lp/fields.hpp" #include "ndn-cxx/lp/packet.hpp" #include "ndn-cxx/lp/tags.hpp" #include "ndn-cxx/mgmt/nfd/command-options.hpp" diff --git a/ndn-cxx/lp/fields.hpp b/ndn-cxx/lp/fields.hpp index d30ba1f7..37cbec42 100644 --- a/ndn-cxx/lp/fields.hpp +++ b/ndn-cxx/lp/fields.hpp @@ -31,7 +31,8 @@ #include "ndn-cxx/lp/sequence.hpp" #include "ndn-cxx/lp/tlv.hpp" -#include +#include +#include namespace ndn::lp { @@ -116,7 +117,7 @@ typedef FieldDecl; +static_assert(boost::mp11::mp_is_set
()); } // namespace ndn::lp diff --git a/ndn-cxx/lp/packet.cpp b/ndn-cxx/lp/packet.cpp index be115f9b..3b879686 100644 --- a/ndn-cxx/lp/packet.cpp +++ b/ndn-cxx/lp/packet.cpp @@ -20,10 +20,9 @@ */ #include "ndn-cxx/lp/packet.hpp" +#include "ndn-cxx/lp/fields.hpp" -#include -#include -#include +#include namespace ndn::lp { @@ -54,28 +53,17 @@ struct FieldInfo int8_t locationSortOrder = getLocationSortOrder(); ///< sort order of field_location_tag }; -struct ExtractFieldInfo -{ - using result_type = void; - - template - constexpr void - operator()(FieldInfo* info, const T&) const noexcept - { - if (T::TlvType::value != info->tlvType) { - return; - } - info->isRecognized = true; - info->canIgnore = false; - info->isRepeatable = T::IsRepeatable::value; - info->locationSortOrder = getLocationSortOrder(); - } -}; - FieldInfo::FieldInfo(uint32_t type) noexcept : tlvType(type) { - boost::mpl::for_each
(boost::bind(ExtractFieldInfo(), this, _1)); + boost::mp11::mp_for_each
([this] (auto fieldDecl) { + if (tlvType == decltype(fieldDecl)::TlvType::value) { + isRecognized = true; + isRepeatable = decltype(fieldDecl)::IsRepeatable::value; + locationSortOrder = getLocationSortOrder(); + } + }); + if (!isRecognized) { canIgnore = tlv::HEADER3_MIN <= tlvType && tlvType <= tlv::HEADER3_MAX && diff --git a/ndn-cxx/lp/packet.hpp b/ndn-cxx/lp/packet.hpp index 9f065551..a42780bf 100644 --- a/ndn-cxx/lp/packet.hpp +++ b/ndn-cxx/lp/packet.hpp @@ -22,7 +22,9 @@ #ifndef NDN_CXX_LP_PACKET_HPP #define NDN_CXX_LP_PACKET_HPP -#include "ndn-cxx/lp/fields.hpp" +#include "ndn-cxx/encoding/block.hpp" +#include "ndn-cxx/encoding/encoding-buffer.hpp" +#include "ndn-cxx/lp/tlv.hpp" /** * @brief Contains classes and functions related to NDNLPv2. diff --git a/ndn-cxx/net/face-uri.cpp b/ndn-cxx/net/face-uri.cpp index 93cbec46..b25f1784 100644 --- a/ndn-cxx/net/face-uri.cpp +++ b/ndn-cxx/net/face-uri.cpp @@ -32,8 +32,9 @@ #include #include #include -#include -#include +#include +#include +#include #include #include @@ -550,25 +551,20 @@ public: } }; -using CanonizeProviders = boost::mpl::vector; +using CanonizeProviders = boost::mp11::mp_list; +static_assert(boost::mp11::mp_is_set()); + using CanonizeProviderTable = std::map>; -class CanonizeProviderTableInitializer +struct CanonizeProviderTableInitializer { -public: - explicit - CanonizeProviderTableInitializer(CanonizeProviderTable& providerTable) - : m_providerTable(providerTable) - { - } - template void - operator()(CP*) + operator()(boost::mp11::mp_identity) { shared_ptr cp = make_shared(); auto schemes = cp->getSchemes(); @@ -580,24 +576,23 @@ public: } } -private: CanonizeProviderTable& m_providerTable; }; static const CanonizeProvider* getCanonizeProvider(const std::string& scheme) { - static CanonizeProviderTable providerTable; - if (providerTable.empty()) { - boost::mpl::for_each(CanonizeProviderTableInitializer(providerTable)); - BOOST_ASSERT(!providerTable.empty()); - } + static const auto providerTable = [] { + using namespace boost::mp11; + CanonizeProviderTable table; + mp_for_each>(CanonizeProviderTableInitializer{table}); + return table; + }(); auto it = providerTable.find(scheme); return it == providerTable.end() ? nullptr : it->second.get(); } - bool FaceUri::canCanonize(const std::string& scheme) { @@ -607,7 +602,7 @@ FaceUri::canCanonize(const std::string& scheme) bool FaceUri::isCanonical() const { - const CanonizeProvider* cp = getCanonizeProvider(this->getScheme()); + const auto* cp = getCanonizeProvider(getScheme()); if (cp == nullptr) { return false; } @@ -620,7 +615,7 @@ FaceUri::canonize(const CanonizeSuccessCallback& onSuccess, const CanonizeFailureCallback& onFailure, boost::asio::io_context& io, time::nanoseconds timeout) const { - const CanonizeProvider* cp = getCanonizeProvider(this->getScheme()); + const auto* cp = getCanonizeProvider(getScheme()); if (cp == nullptr) { if (onFailure) { onFailure("scheme not supported"); diff --git a/ndn-cxx/util/dummy-client-face.cpp b/ndn-cxx/util/dummy-client-face.cpp index 06981b9e..b4dc3416 100644 --- a/ndn-cxx/util/dummy-client-face.cpp +++ b/ndn-cxx/util/dummy-client-face.cpp @@ -22,6 +22,7 @@ #include "ndn-cxx/util/dummy-client-face.hpp" #include "ndn-cxx/impl/lp-field-tag.hpp" +#include "ndn-cxx/lp/fields.hpp" #include "ndn-cxx/lp/packet.hpp" #include "ndn-cxx/lp/tags.hpp" #include "ndn-cxx/mgmt/nfd/control-parameters.hpp" diff --git a/tests/benchmarks/encoding-bench.cpp b/tests/benchmarks/encoding-bench.cpp index 7694d894..4d7c96bc 100644 --- a/tests/benchmarks/encoding-bench.cpp +++ b/tests/benchmarks/encoding-bench.cpp @@ -25,8 +25,7 @@ #include "ndn-cxx/encoding/tlv.hpp" #include "tests/benchmarks/timed-execute.hpp" -#include -#include +#include #include @@ -71,7 +70,7 @@ struct ReadVarNumberAlignTest : public ReadVarNumberTest static_assert(sizeof(ReadVarNumberTest::WIRE) == WIRE_SIZE); }; -using ReadVarNumberTests = boost::mpl::vector< +using ReadVarNumberTests = boost::mp11::mp_list< ReadVarNumberAlignTest<1, 0>, ReadVarNumberAlignTest<3, 0>, ReadVarNumberAlignTest<3, 1>, diff --git a/tests/integration/face.cpp b/tests/integration/face.cpp index a759e35f..9393d0d3 100644 --- a/tests/integration/face.cpp +++ b/tests/integration/face.cpp @@ -35,7 +35,7 @@ #include #include -#include +#include namespace ndn::tests { @@ -116,7 +116,7 @@ protected: Scheduler sched; }; -using Transports = boost::mpl::vector; +using Transports = boost::mp11::mp_list; BOOST_AUTO_TEST_SUITE(Consumer) diff --git a/tests/unit/detail/tag-host.t.cpp b/tests/unit/detail/tag-host.t.cpp index c5972030..15c43f5a 100644 --- a/tests/unit/detail/tag-host.t.cpp +++ b/tests/unit/detail/tag-host.t.cpp @@ -25,7 +25,7 @@ #include "tests/boost-test.hpp" -#include +#include namespace ndn::tests { @@ -52,7 +52,7 @@ public: } }; -using Fixtures = boost::mpl::vector; +using Fixtures = boost::mp11::mp_list; BOOST_FIXTURE_TEST_CASE_TEMPLATE(Basic, T, Fixtures, T) { diff --git a/tests/unit/face.t.cpp b/tests/unit/face.t.cpp index 78d7c679..55d82453 100644 --- a/tests/unit/face.t.cpp +++ b/tests/unit/face.t.cpp @@ -30,6 +30,7 @@ #include "tests/unit/io-key-chain-fixture.hpp" #include +#include namespace ndn::tests { @@ -911,7 +912,7 @@ class WithEnvAndConfig : public WithEnv, public WithConfig { }; -using ConfigOptions = boost::mpl::vector; +using ConfigOptions = boost::mp11::mp_list; BOOST_FIXTURE_TEST_CASE(NoConfig, WithEnvAndConfig) // fixture configures test HOME and PIB/TPM path { diff --git a/tests/unit/ims/in-memory-storage.t.cpp b/tests/unit/ims/in-memory-storage.t.cpp index 31532ed9..2d18ec1e 100644 --- a/tests/unit/ims/in-memory-storage.t.cpp +++ b/tests/unit/ims/in-memory-storage.t.cpp @@ -29,17 +29,17 @@ #include "tests/test-common.hpp" #include "tests/unit/io-fixture.hpp" -#include +#include namespace ndn::tests { BOOST_AUTO_TEST_SUITE(Ims) BOOST_AUTO_TEST_SUITE(TestInMemoryStorage) -using InMemoryStorages = boost::mpl::vector; +using InMemoryStorages = boost::mp11::mp_list; BOOST_AUTO_TEST_CASE_TEMPLATE(Insertion, T, InMemoryStorages) { @@ -371,9 +371,9 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(EraseCanonical, T, InMemoryStorages) BOOST_CHECK_EQUAL(ims.size(), 6); } -using InMemoryStoragesLimited = boost::mpl::vector; +using InMemoryStoragesLimited = boost::mp11::mp_list; BOOST_AUTO_TEST_CASE_TEMPLATE(SetCapacity, T, InMemoryStoragesLimited) { diff --git a/tests/unit/lp/packet.t.cpp b/tests/unit/lp/packet.t.cpp index 01cc05b7..50cc681e 100644 --- a/tests/unit/lp/packet.t.cpp +++ b/tests/unit/lp/packet.t.cpp @@ -20,6 +20,7 @@ */ #include "ndn-cxx/lp/packet.hpp" +#include "ndn-cxx/lp/fields.hpp" #include "ndn-cxx/prefix-announcement.hpp" #include "tests/key-chain-fixture.hpp" diff --git a/tests/unit/lp/pit-token.t.cpp b/tests/unit/lp/pit-token.t.cpp index 6f45b324..9496070a 100644 --- a/tests/unit/lp/pit-token.t.cpp +++ b/tests/unit/lp/pit-token.t.cpp @@ -20,6 +20,7 @@ */ #include "ndn-cxx/lp/pit-token.hpp" +#include "ndn-cxx/lp/fields.hpp" #include "ndn-cxx/lp/packet.hpp" #include "tests/boost-test.hpp" diff --git a/tests/unit/name-component.t.cpp b/tests/unit/name-component.t.cpp index d4b674d8..73a423bb 100644 --- a/tests/unit/name-component.t.cpp +++ b/tests/unit/name-component.t.cpp @@ -28,7 +28,7 @@ #include #include #include -#include +#include namespace ndn::tests { @@ -305,10 +305,12 @@ BOOST_AUTO_TEST_CASE(ConstructFromSpan) BOOST_AUTO_TEST_SUITE(ConstructFromIterators) // Bug 2490 -using ContainerTypes = boost::mpl::vector, - std::list, - std::vector, - std::list>; +using ContainerTypes = boost::mp11::mp_list< + std::vector, + std::list, + std::vector, + std::list +>; BOOST_AUTO_TEST_CASE_TEMPLATE(ZeroOctets, T, ContainerTypes) { @@ -540,7 +542,7 @@ public: } }; -using ConventionTests = boost::mpl::vector< +using ConventionTests = boost::mp11::mp_list< NumberWithMarker, SegmentMarker, SegmentTyped, diff --git a/tests/unit/security/certificate-bundle-fetcher.t.cpp b/tests/unit/security/certificate-bundle-fetcher.t.cpp index 1c7b8b8f..5600257c 100644 --- a/tests/unit/security/certificate-bundle-fetcher.t.cpp +++ b/tests/unit/security/certificate-bundle-fetcher.t.cpp @@ -26,6 +26,8 @@ #include "tests/test-common.hpp" #include "tests/unit/security/validator-fixture.hpp" +#include + namespace ndn::tests { using namespace ndn::security; @@ -147,7 +149,7 @@ CertificateBundleFetcherFixture::makeResponse(const Interest& interest) face.receive(makeNack(interest, lp::NackReason::NO_ROUTE)); } -using SuccessWithBundle = boost::mpl::vector; +using SuccessWithBundle = boost::mp11::mp_list; BOOST_FIXTURE_TEST_CASE_TEMPLATE(ValidateSuccessWithBundle, T, SuccessWithBundle, CertificateBundleFetcherFixture) @@ -160,7 +162,7 @@ BOOST_FIXTURE_TEST_CASE_TEMPLATE(ValidateSuccessWithBundle, T, SuccessWithBundle } } -using SuccessWithoutBundle = boost::mpl::vector; +using SuccessWithoutBundle = boost::mp11::mp_list; BOOST_FIXTURE_TEST_CASE_TEMPLATE(ValidateSuccessWithoutBundle, T, SuccessWithoutBundle, CertificateBundleFetcherFixture) diff --git a/tests/unit/security/certificate-fetcher-direct-fetch.t.cpp b/tests/unit/security/certificate-fetcher-direct-fetch.t.cpp index a843ca6d..ca185c60 100644 --- a/tests/unit/security/certificate-fetcher-direct-fetch.t.cpp +++ b/tests/unit/security/certificate-fetcher-direct-fetch.t.cpp @@ -27,6 +27,7 @@ #include "tests/test-common.hpp" #include "tests/unit/security/validator-fixture.hpp" +#include #include #include @@ -124,7 +125,7 @@ CertificateFetcherDirectFetchFixture::makeResponse(const Interest& interes face.receive(makeNack(interest, lp::NackReason::NO_ROUTE)); } -using Failures = boost::mpl::vector; +using Failures = boost::mp11::mp_list; BOOST_FIXTURE_TEST_CASE(ValidateSuccessData, CertificateFetcherDirectFetchFixture) { diff --git a/tests/unit/security/certificate-fetcher-from-network.t.cpp b/tests/unit/security/certificate-fetcher-from-network.t.cpp index 7ffc2766..ee66ad5f 100644 --- a/tests/unit/security/certificate-fetcher-from-network.t.cpp +++ b/tests/unit/security/certificate-fetcher-from-network.t.cpp @@ -27,6 +27,8 @@ #include "tests/boost-test.hpp" #include "tests/unit/security/validator-fixture.hpp" +#include + namespace ndn::tests { using namespace ndn::security; @@ -91,7 +93,7 @@ CertificateFetcherFromNetworkFixture::makeResponse(const Interest& interes face.receive(nack); } -using Failures = boost::mpl::vector; +using Failures = boost::mp11::mp_list; BOOST_FIXTURE_TEST_CASE(ValidateSuccess, CertificateFetcherFromNetworkFixture) { diff --git a/tests/unit/security/certificate-fetcher-offline.t.cpp b/tests/unit/security/certificate-fetcher-offline.t.cpp index 147701f8..978bc12b 100644 --- a/tests/unit/security/certificate-fetcher-offline.t.cpp +++ b/tests/unit/security/certificate-fetcher-offline.t.cpp @@ -25,6 +25,8 @@ #include "tests/boost-test.hpp" #include "tests/unit/security/validator-fixture.hpp" +#include + namespace ndn::tests { using namespace ndn::security; @@ -44,7 +46,7 @@ using CertificateFetcherOfflineFixture = HierarchicalValidatorFixture; +using Packets = boost::mp11::mp_list; BOOST_AUTO_TEST_CASE_TEMPLATE(Validate, Packet, Packets) { diff --git a/tests/unit/security/key-chain.t.cpp b/tests/unit/security/key-chain.t.cpp index 15bf4cd8..ac45ee74 100644 --- a/tests/unit/security/key-chain.t.cpp +++ b/tests/unit/security/key-chain.t.cpp @@ -28,8 +28,7 @@ #include "tests/unit/clock-fixture.hpp" #include "tests/unit/test-home-env-saver.hpp" -#include -#include +#include namespace ndn::tests { @@ -530,7 +529,7 @@ struct Sha256Signing : protected KeyChainFixture, protected PacketType } }; -using SigningTests = boost::mpl::vector< +using SigningTests = boost::mp11::mp_list< RsaSigning, RsaSigning, RsaSigning, diff --git a/tests/unit/security/pib/pib-impl.t.cpp b/tests/unit/security/pib/pib-impl.t.cpp index b26109d4..d3d73de8 100644 --- a/tests/unit/security/pib/pib-impl.t.cpp +++ b/tests/unit/security/pib/pib-impl.t.cpp @@ -21,13 +21,12 @@ #include "ndn-cxx/security/pib/impl/pib-memory.hpp" #include "ndn-cxx/security/pib/impl/pib-sqlite3.hpp" -#include "ndn-cxx/security/security-common.hpp" #include "tests/boost-test.hpp" #include "tests/unit/security/pib/pib-data-fixture.hpp" #include -#include +#include namespace ndn::tests { @@ -57,7 +56,7 @@ public: PibSqlite3 pib{m_path.string()}; }; -using PibImpls = boost::mpl::vector; +using PibImpls = boost::mp11::mp_list; BOOST_FIXTURE_TEST_CASE_TEMPLATE(TpmLocator, T, PibImpls, T) { diff --git a/tests/unit/security/signing-info.t.cpp b/tests/unit/security/signing-info.t.cpp index 29fd8ad4..cdcc0c0e 100644 --- a/tests/unit/security/signing-info.t.cpp +++ b/tests/unit/security/signing-info.t.cpp @@ -23,7 +23,6 @@ #include "tests/boost-test.hpp" -#include #include #include diff --git a/tests/unit/security/tpm/back-end.t.cpp b/tests/unit/security/tpm/back-end.t.cpp index da220296..d432d735 100644 --- a/tests/unit/security/tpm/back-end.t.cpp +++ b/tests/unit/security/tpm/back-end.t.cpp @@ -37,9 +37,8 @@ #include "tests/boost-test.hpp" -#include -#include #include +#include namespace ndn::tests { @@ -50,7 +49,7 @@ using ndn::security::tpm::KeyHandle; BOOST_AUTO_TEST_SUITE(Security) BOOST_AUTO_TEST_SUITE(TestTpmBackEnd) -using TestBackEnds = boost::mpl::vector< +using TestBackEnds = boost::mp11::mp_list< #if defined(NDN_CXX_HAVE_OSX_FRAMEWORKS) && defined(NDN_CXX_WITH_OSX_KEYCHAIN) BackEndWrapperOsx, #endif diff --git a/tests/unit/security/transform/private-key.t.cpp b/tests/unit/security/transform/private-key.t.cpp index 3d77d6c2..cf8dddd1 100644 --- a/tests/unit/security/transform/private-key.t.cpp +++ b/tests/unit/security/transform/private-key.t.cpp @@ -35,7 +35,7 @@ #include "tests/boost-test.hpp" #include -#include +#include #include namespace ndn::tests { @@ -364,7 +364,7 @@ kAegdE+db4ojchAbcDLRcnzY+TUx5pTBqdBg+STMK7h36ZUn+KcMeizMRA== )PEM"; }; -using KeyTestDataSets = boost::mpl::vector< +using KeyTestDataSets = boost::mp11::mp_list< #if OPENSSL_VERSION_NUMBER < 0x30000000L // DES-encrypted keys // .privateKeyPkcs8 uses either the PBES1 or PBES2 encryption scheme with DES-CBC-Pad (see RFC 8018) @@ -645,7 +645,7 @@ public: } }; -using KeyGenParams = boost::mpl::vector< +using KeyGenParams = boost::mp11::mp_list< HmacKeyGenParams, RsaKeyGenParams, EcKeyGenParams diff --git a/tests/unit/security/transform/public-key.t.cpp b/tests/unit/security/transform/public-key.t.cpp index 31970c4f..473ead6d 100644 --- a/tests/unit/security/transform/public-key.t.cpp +++ b/tests/unit/security/transform/public-key.t.cpp @@ -28,7 +28,7 @@ #include "tests/boost-test.hpp" -#include +#include #include @@ -68,7 +68,7 @@ struct EcKeyTestData "5EJTDxq6ls5FoYLfThp8HOjuwGSz0qw8ocMqyku1y0V5peQ4rEPd0bwcpZd9svA=\n"; }; -using KeyTestDataSets = boost::mpl::vector; +using KeyTestDataSets = boost::mp11::mp_list; BOOST_AUTO_TEST_CASE_TEMPLATE(LoadAndSave, T, KeyTestDataSets) { diff --git a/tests/unit/security/transform/stream-source.t.cpp b/tests/unit/security/transform/stream-source.t.cpp index e20ff23f..1500226e 100644 --- a/tests/unit/security/transform/stream-source.t.cpp +++ b/tests/unit/security/transform/stream-source.t.cpp @@ -24,8 +24,7 @@ #include "tests/boost-test.hpp" -#include -#include +#include namespace ndn::tests { @@ -76,9 +75,9 @@ BOOST_AUTO_TEST_CASE(EmptyStream) BOOST_CHECK_EQUAL(os.str(), ""); } -using BadBits = boost::mpl::vector< - boost::mpl::integral_c, - boost::mpl::integral_c +using BadBits = boost::mp11::mp_list_c; BOOST_AUTO_TEST_CASE_TEMPLATE(BadStream, BadBit, BadBits) diff --git a/tests/unit/security/transform/verifier-filter.t.cpp b/tests/unit/security/transform/verifier-filter.t.cpp index 4f659bee..cda900e6 100644 --- a/tests/unit/security/transform/verifier-filter.t.cpp +++ b/tests/unit/security/transform/verifier-filter.t.cpp @@ -33,8 +33,6 @@ #include "tests/boost-test.hpp" -#include - namespace ndn::tests { using namespace ndn::security::transform; diff --git a/tests/unit/security/validation-policy-accept-all.t.cpp b/tests/unit/security/validation-policy-accept-all.t.cpp index ca86c86c..9fe1ba32 100644 --- a/tests/unit/security/validation-policy-accept-all.t.cpp +++ b/tests/unit/security/validation-policy-accept-all.t.cpp @@ -24,7 +24,7 @@ #include "tests/boost-test.hpp" #include "tests/unit/security/validator-fixture.hpp" -#include +#include namespace ndn::tests { @@ -45,7 +45,7 @@ public: BOOST_FIXTURE_TEST_SUITE(TestValidationPolicyAcceptAll, ValidationPolicyAcceptAllFixture) -using Packets = boost::mpl::vector; +using Packets = boost::mp11::mp_list; BOOST_AUTO_TEST_CASE_TEMPLATE(Validate, Packet, Packets) { diff --git a/tests/unit/security/validation-policy-command-interest.t.cpp b/tests/unit/security/validation-policy-command-interest.t.cpp index ac690e7a..657b830c 100644 --- a/tests/unit/security/validation-policy-command-interest.t.cpp +++ b/tests/unit/security/validation-policy-command-interest.t.cpp @@ -28,7 +28,7 @@ #include "tests/test-common.hpp" #include "tests/unit/security/validator-fixture.hpp" -#include +#include namespace ndn::tests { @@ -339,10 +339,7 @@ BOOST_AUTO_TEST_SUITE_END() // Rejects BOOST_AUTO_TEST_SUITE(Options) -using NonPositiveGracePeriods = boost::mpl::vector< - GracePeriodSeconds<0>, - GracePeriodSeconds<-1> ->; +using NonPositiveGracePeriods = boost::mp11::mp_list, GracePeriodSeconds<-1>>; BOOST_FIXTURE_TEST_CASE_TEMPLATE(GraceNonPositive, GracePeriod, NonPositiveGracePeriods, ValidationPolicyCommandInterestFixture) diff --git a/tests/unit/security/validation-policy-config.t.cpp b/tests/unit/security/validation-policy-config.t.cpp index 07b98e90..031eff03 100644 --- a/tests/unit/security/validation-policy-config.t.cpp +++ b/tests/unit/security/validation-policy-config.t.cpp @@ -30,6 +30,8 @@ #include "tests/unit/security/validator-config/common.hpp" #include "tests/unit/security/validator-fixture.hpp" +#include + namespace ndn::tests { using ndn::security::ValidationPolicyConfig; @@ -341,27 +343,29 @@ public: } }; -using DataPolicies = boost::mpl::vector, - LoadFileWithFileAnchor, - LoadFileWithMultipleFileAnchors, - LoadSectionWithFileAnchor, - LoadStringWithBase64Anchor, - LoadStringWithDirAnchor, - LoadStringWithDirAnchor, - LoadStringWithDirAnchor, - LoadStringWithDirAnchor - >; +using DataPolicies = boost::mp11::mp_list< + LoadStringWithFileAnchor, + LoadFileWithFileAnchor, + LoadFileWithMultipleFileAnchors, + LoadSectionWithFileAnchor, + LoadStringWithBase64Anchor, + LoadStringWithDirAnchor, + LoadStringWithDirAnchor, + LoadStringWithDirAnchor, + LoadStringWithDirAnchor +>; -using InterestPolicies = boost::mpl::vector, - LoadFileWithFileAnchor, - LoadFileWithMultipleFileAnchors, - LoadSectionWithFileAnchor, - LoadStringWithBase64Anchor, - LoadStringWithDirAnchor, - LoadStringWithDirAnchor, - LoadStringWithDirAnchor, - LoadStringWithDirAnchor - >; +using InterestPolicies = boost::mp11::mp_list< + LoadStringWithFileAnchor, + LoadFileWithFileAnchor, + LoadFileWithMultipleFileAnchors, + LoadSectionWithFileAnchor, + LoadStringWithBase64Anchor, + LoadStringWithDirAnchor, + LoadStringWithDirAnchor, + LoadStringWithDirAnchor, + LoadStringWithDirAnchor +>; BOOST_FIXTURE_TEST_CASE_TEMPLATE(ValidateData, Policy, DataPolicies, Policy) { @@ -687,7 +691,7 @@ BOOST_FIXTURE_TEST_CASE(Reload, HierarchicalValidatorFixturepolicy.m_interestRules.size(), 0); } -using Packets = boost::mpl::vector; +using Packets = boost::mp11::mp_list; BOOST_FIXTURE_TEST_CASE_TEMPLATE(TrustAnchorWildcard, Packet, Packets, ValidationPolicyConfigFixture) { @@ -729,7 +733,7 @@ BOOST_FIXTURE_TEST_CASE_TEMPLATE(TrustAnchorWildcard, Packet, Packets, Validatio VALIDATE_SUCCESS(packet, "Policy should accept everything"); } -using RefreshPolicies = boost::mpl::vector; +using RefreshPolicies = boost::mp11::mp_list; template class RefreshPolicyFixture : public LoadStringWithDirAnchor diff --git a/tests/unit/security/validation-policy-signed-interest.t.cpp b/tests/unit/security/validation-policy-signed-interest.t.cpp index ded88258..2cd91a7b 100644 --- a/tests/unit/security/validation-policy-signed-interest.t.cpp +++ b/tests/unit/security/validation-policy-signed-interest.t.cpp @@ -28,7 +28,7 @@ #include "tests/test-common.hpp" #include "tests/unit/security/validator-fixture.hpp" -#include +#include namespace ndn::tests { @@ -322,10 +322,7 @@ BOOST_AUTO_TEST_CASE(TimestampReorderNegative) VALIDATE_SUCCESS(i4, "Should succeed"); } -using NonPositiveGracePeriods = boost::mpl::vector< - GracePeriodSeconds<0>, - GracePeriodSeconds<-1> ->; +using NonPositiveGracePeriods = boost::mp11::mp_list, GracePeriodSeconds<-1>>; BOOST_FIXTURE_TEST_CASE_TEMPLATE(GraceNonPositive, GracePeriod, NonPositiveGracePeriods, ValidationPolicySignedInterestFixture) diff --git a/tests/unit/security/validation-policy-simple-hierarchy.t.cpp b/tests/unit/security/validation-policy-simple-hierarchy.t.cpp index 80fc58a3..11e7ee11 100644 --- a/tests/unit/security/validation-policy-simple-hierarchy.t.cpp +++ b/tests/unit/security/validation-policy-simple-hierarchy.t.cpp @@ -24,7 +24,7 @@ #include "tests/boost-test.hpp" #include "tests/unit/security/validator-fixture.hpp" -#include +#include namespace ndn::tests { @@ -32,7 +32,7 @@ BOOST_AUTO_TEST_SUITE(Security) BOOST_FIXTURE_TEST_SUITE(TestValidationPolicySimpleHierarchy, HierarchicalValidatorFixture) -using Packets = boost::mpl::vector; +using Packets = boost::mp11::mp_list; BOOST_AUTO_TEST_CASE_TEMPLATE(Validate, Packet, Packets) { diff --git a/tests/unit/security/validator-config/checker.t.cpp b/tests/unit/security/validator-config/checker.t.cpp index 6c610857..d7e2fb92 100644 --- a/tests/unit/security/validator-config/checker.t.cpp +++ b/tests/unit/security/validator-config/checker.t.cpp @@ -20,13 +20,13 @@ */ #include "ndn-cxx/security/validator-config/checker.hpp" -#include "ndn-cxx/security/validation-policy.hpp" -#include "ndn-cxx/security/validation-state.hpp" #include "tests/boost-test.hpp" #include "tests/unit/security/validator-fixture.hpp" #include "tests/unit/security/validator-config/common.hpp" +#include + namespace ndn::tests { using namespace ndn::security::validator_config; @@ -283,7 +283,7 @@ public: {false, false, false, true}}; }; -using CheckerFixtures = boost::mpl::vector< +using CheckerFixtures = boost::mp11::mp_list< NameRelationEqual, NameRelationIsPrefixOf, NameRelationIsStrictPrefixOf, @@ -300,19 +300,16 @@ using CheckerFixtures = boost::mpl::vector< >; // Cartesian product of [DataPkt, InterestV02Pkt, InterestV03Pkt] and CheckerFixtures. -// Each element is a boost::mpl::pair. -using Tests = boost::mpl::fold< - CheckerFixtures, - boost::mpl::vector<>, - boost::mpl::push_back>, - boost::mpl::pair>, - boost::mpl::pair> ->::type; +// Each element is an mp_list. +using Tests = boost::mp11::mp_product< + boost::mp11::mp_list, + boost::mp11::mp_list, + CheckerFixtures +>; -BOOST_FIXTURE_TEST_CASE_TEMPLATE(Checks, T, Tests, T::second) +BOOST_FIXTURE_TEST_CASE_TEMPLATE(Checks, T, Tests, boost::mp11::mp_second) { - using PktType = typename T::first; + using PktType = boost::mp11::mp_first; BOOST_REQUIRE_EQUAL(this->outcomes.size(), this->names.size()); for (size_t i = 0; i < this->names.size(); ++i) { @@ -326,7 +323,6 @@ BOOST_FIXTURE_TEST_CASE_TEMPLATE(Checks, T, Tests, T::second) this->template testChecker(this->checker, tlv::SignatureSha256WithRsa, pktName, klName, expectedOutcome); this->template testChecker(this->checker, tlv::SignatureSha256WithEcdsa, pktName, klName, false); - klName = this->makeKeyLocatorCertName(this->names[j]); this->template testChecker(this->checker, tlv::SignatureSha256WithRsa, pktName, klName, expectedOutcome); this->template testChecker(this->checker, tlv::SignatureSha256WithEcdsa, pktName, klName, false); diff --git a/tests/unit/security/validator-config/rule.t.cpp b/tests/unit/security/validator-config/rule.t.cpp index ea0b4b7e..434a0c94 100644 --- a/tests/unit/security/validator-config/rule.t.cpp +++ b/tests/unit/security/validator-config/rule.t.cpp @@ -25,7 +25,7 @@ #include "tests/unit/security/validator-fixture.hpp" #include "tests/unit/security/validator-config/common.hpp" -#include +#include namespace ndn::tests { @@ -52,7 +52,7 @@ public: shared_ptr state; }; -using PktTypes = boost::mpl::vector; +using PktTypes = boost::mp11::mp_list; BOOST_AUTO_TEST_SUITE(TestRule) diff --git a/tests/unit/security/verification-helpers.t.cpp b/tests/unit/security/verification-helpers.t.cpp index 540a1337..0e34bcdd 100644 --- a/tests/unit/security/verification-helpers.t.cpp +++ b/tests/unit/security/verification-helpers.t.cpp @@ -26,8 +26,7 @@ #include "tests/key-chain-fixture.hpp" #include "tests/test-common.hpp" -#include -#include +#include namespace ndn::tests { @@ -536,7 +535,7 @@ struct Sha256Dataset // - .badSigInterestOldFormat is a valid and signed Interest packet that cannot be verified against // .cert (signed using a different private key and in the old signed Interest format) -using SignatureDatasets = boost::mpl::vector; +using SignatureDatasets = boost::mp11::mp_list; BOOST_AUTO_TEST_CASE_TEMPLATE(VerifySignature, Dataset, SignatureDatasets) { @@ -616,7 +615,7 @@ BOOST_FIXTURE_TEST_CASE(VerifyHmac, KeyChainFixture) BOOST_CHECK(verifySignature(interestOldFormat, tpm, signingInfo.getSignerName(), DigestAlgorithm::SHA256)); } -using DigestDatasets = boost::mpl::vector; +using DigestDatasets = boost::mp11::mp_list; BOOST_AUTO_TEST_CASE_TEMPLATE(VerifyDigest, Dataset, DigestDatasets) { diff --git a/tests/unit/util/io.t.cpp b/tests/unit/util/io.t.cpp index 934648aa..3492fa14 100644 --- a/tests/unit/util/io.t.cpp +++ b/tests/unit/util/io.t.cpp @@ -25,7 +25,7 @@ #include "tests/key-chain-fixture.hpp" #include -#include +#include namespace ndn::tests { @@ -53,7 +53,7 @@ struct HexEncoding std::istringstream stream{"486578456E63", std::ios_base::binary}; }; -using Encodings = boost::mpl::vector; +using Encodings = boost::mp11::mp_list; BOOST_AUTO_TEST_CASE_TEMPLATE(LoadBuffer, T, Encodings) {