tests: replace Boost.MPL with Mp11
Change-Id: I2e8410f4acb7f25b5cb9d7846f05163414095cc7
diff --git a/tests/daemon/fw/multicast-strategy.t.cpp b/tests/daemon/fw/multicast-strategy.t.cpp
index aa18cdf..55254da 100644
--- a/tests/daemon/fw/multicast-strategy.t.cpp
+++ b/tests/daemon/fw/multicast-strategy.t.cpp
@@ -32,6 +32,8 @@
#include "strategy-tester.hpp"
#include "topology-tester.hpp"
+#include <boost/mp11/list.hpp>
+
namespace nfd::tests {
using MulticastStrategyTester = StrategyTester<fw::MulticastStrategy>;
@@ -470,7 +472,7 @@
}
};
-using Tests = boost::mpl::vector<
+using Tests = boost::mp11::mp_list<
BasicNonLocal,
NewFibLocal,
InFaceLocal,
diff --git a/tests/daemon/fw/strategy-ad-hoc-face.t.cpp b/tests/daemon/fw/strategy-ad-hoc-face.t.cpp
index cd46054..ebd2623 100644
--- a/tests/daemon/fw/strategy-ad-hoc-face.t.cpp
+++ b/tests/daemon/fw/strategy-ad-hoc-face.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-2024, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -37,7 +37,7 @@
#include "tests/daemon/global-io-fixture.hpp"
#include "topology-tester.hpp"
-#include <boost/mpl/vector.hpp>
+#include <boost/mp11/list.hpp>
namespace nfd::tests {
@@ -86,7 +86,7 @@
BOOST_AUTO_TEST_SUITE(Fw)
BOOST_AUTO_TEST_SUITE(TestStrategyAdHocFace)
-using Strategies = boost::mpl::vector<
+using Strategies = boost::mp11::mp_list<
AsfStrategy,
BestRouteStrategy,
MulticastStrategy,
diff --git a/tests/daemon/fw/strategy-broadcast-medium.t.cpp b/tests/daemon/fw/strategy-broadcast-medium.t.cpp
index 113faf5..e8e5acb 100644
--- a/tests/daemon/fw/strategy-broadcast-medium.t.cpp
+++ b/tests/daemon/fw/strategy-broadcast-medium.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-2024, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -38,7 +38,7 @@
#include "tests/daemon/global-io-fixture.hpp"
#include "topology-tester.hpp"
-#include <boost/mpl/vector.hpp>
+#include <boost/mp11/list.hpp>
namespace nfd::tests {
@@ -89,7 +89,7 @@
BOOST_AUTO_TEST_SUITE(Fw)
BOOST_AUTO_TEST_SUITE(TestStrategyBroadcastMedium)
-using Strategies = boost::mpl::vector<
+using Strategies = boost::mp11::mp_list<
AsfStrategy,
BestRouteStrategy,
MulticastStrategy,
diff --git a/tests/daemon/fw/strategy-instantiation.t.cpp b/tests/daemon/fw/strategy-instantiation.t.cpp
index 0ac730c..ca59f3e 100644
--- a/tests/daemon/fw/strategy-instantiation.t.cpp
+++ b/tests/daemon/fw/strategy-instantiation.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2023, Regents of the University of California,
+ * Copyright (c) 2014-2024, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -37,7 +37,7 @@
#include "tests/test-common.hpp"
-#include <boost/mpl/vector.hpp>
+#include <boost/mp11/list.hpp>
namespace nfd::tests {
@@ -46,23 +46,12 @@
BOOST_AUTO_TEST_SUITE(Fw)
BOOST_AUTO_TEST_SUITE(TestStrategyInstantiation)
-template<typename S, bool CanAcceptParameters, uint64_t MinVersion>
-class Test
+template<typename S, bool CanAcceptParams, uint64_t MinVer>
+struct Test
{
-public:
using Strategy = S;
-
- static bool
- canAcceptParameters()
- {
- return CanAcceptParameters;
- }
-
- static uint64_t
- getMinVersion()
- {
- return MinVersion;
- }
+ static constexpr bool canAcceptParameters = CanAcceptParams;
+ static constexpr uint64_t minVersion = MinVer;
static Name
getVersionedStrategyName(uint64_t version)
@@ -71,7 +60,7 @@
}
};
-using Tests = boost::mpl::vector<
+using Tests = boost::mp11::mp_list<
Test<AccessStrategy, false, 1>,
Test<AsfStrategy, true, 4>,
Test<BestRouteStrategy, true, 5>,
@@ -89,26 +78,25 @@
{
BOOST_REQUIRE(T::Strategy::getStrategyName().at(-1).isVersion());
uint64_t maxVersion = T::Strategy::getStrategyName().at(-1).toVersion();
- BOOST_REQUIRE_LE(T::getMinVersion(), maxVersion);
+ BOOST_REQUIRE_LE(T::minVersion, maxVersion);
FaceTable faceTable;
Forwarder forwarder(faceTable);
- for (uint64_t version = T::getMinVersion(); version <= maxVersion; ++version) {
+ for (auto version = T::minVersion; version <= maxVersion; ++version) {
Name versionedName = T::getVersionedStrategyName(version);
- unique_ptr<typename T::Strategy> instance;
- BOOST_CHECK_NO_THROW(instance = make_unique<typename T::Strategy>(forwarder, versionedName));
+ auto instance = make_unique<typename T::Strategy>(forwarder, versionedName);
BOOST_CHECK_EQUAL(instance->getInstanceName(), versionedName);
- if (!T::canAcceptParameters()) {
+ if (!T::canAcceptParameters) {
Name nameWithParameters = Name(versionedName).append("param");
BOOST_CHECK_THROW(typename T::Strategy(forwarder, nameWithParameters), std::invalid_argument);
}
}
- if (T::getMinVersion() > 0) {
+ if (T::minVersion > 0) {
Name version0Name = T::getVersionedStrategyName(0);
BOOST_CHECK_THROW(typename T::Strategy(forwarder, version0Name), std::invalid_argument);
- Name earlyVersionName = T::getVersionedStrategyName(T::getMinVersion() - 1);
+ Name earlyVersionName = T::getVersionedStrategyName(T::minVersion - 1);
BOOST_CHECK_THROW(typename T::Strategy(forwarder, earlyVersionName), std::invalid_argument);
}
@@ -145,7 +133,7 @@
Forwarder m_forwarder{m_faceTable};
};
-using StrategiesWithRetxSuppressionExponential = boost::mpl::vector<
+using StrategiesWithRetxSuppressionExponential = boost::mp11::mp_list<
AsfStrategy,
BestRouteStrategy,
MulticastStrategy
diff --git a/tests/daemon/fw/strategy-nack-return.t.cpp b/tests/daemon/fw/strategy-nack-return.t.cpp
index 4b6961d..e7ed117 100644
--- a/tests/daemon/fw/strategy-nack-return.t.cpp
+++ b/tests/daemon/fw/strategy-nack-return.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-2024, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -35,7 +35,7 @@
#include "topology-tester.hpp"
#include "tests/daemon/face/dummy-face.hpp"
-#include <boost/mpl/vector.hpp>
+#include <boost/mp11/list.hpp>
namespace nfd::tests {
@@ -83,7 +83,7 @@
BOOST_AUTO_TEST_SUITE(Fw)
BOOST_AUTO_TEST_SUITE(TestStrategyNackReturn)
-using Strategies = boost::mpl::vector<
+using Strategies = boost::mp11::mp_list<
BestRouteStrategy,
RandomStrategy
>;
@@ -282,7 +282,7 @@
static constexpr lp::NackReason expectedResult{R};
};
-using NackReasonCombinations = boost::mpl::vector<
+using NackReasonCombinations = boost::mp11::mp_list<
NackReasonCombination<lp::NackReason::CONGESTION, lp::NackReason::CONGESTION, lp::NackReason::CONGESTION>,
NackReasonCombination<lp::NackReason::CONGESTION, lp::NackReason::DUPLICATE, lp::NackReason::CONGESTION>,
NackReasonCombination<lp::NackReason::CONGESTION, lp::NackReason::NO_ROUTE, lp::NackReason::CONGESTION>,
diff --git a/tests/daemon/fw/strategy-no-route.t.cpp b/tests/daemon/fw/strategy-no-route.t.cpp
index 3dfce2c..2e70e0e 100644
--- a/tests/daemon/fw/strategy-no-route.t.cpp
+++ b/tests/daemon/fw/strategy-no-route.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-2024, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -39,7 +39,7 @@
#include "choose-strategy.hpp"
#include "strategy-tester.hpp"
-#include <boost/mpl/vector.hpp>
+#include <boost/mp11/list.hpp>
namespace nfd::tests {
@@ -78,25 +78,16 @@
BOOST_AUTO_TEST_SUITE(Fw)
BOOST_AUTO_TEST_SUITE(TestStrategyNoRoute)
-template<typename S, typename C>
-class Test
-{
-public:
- using Strategy = S;
- using Case = C;
-};
-
template<typename S>
-class EmptyNextHopList
+struct EmptyNextHopList
{
-public:
- Name
+ static Name
getInterestName()
{
return "/P";
}
- void
+ static void
insertFibEntry(StrategyNoRouteFixture<S>* fixture)
{
fixture->fib.insert(Name());
@@ -104,16 +95,15 @@
};
template<typename S>
-class NextHopIsDownstream
+struct NextHopIsDownstream
{
-public:
- Name
+ static Name
getInterestName()
{
return "/P";
}
- void
+ static void
insertFibEntry(StrategyNoRouteFixture<S>* fixture)
{
fib::Entry* entry = fixture->fib.insert(Name()).first;
@@ -122,16 +112,15 @@
};
template<typename S>
-class NextHopViolatesScope
+struct NextHopViolatesScope
{
-public:
- Name
+ static Name
getInterestName()
{
return "/localhop/P";
}
- void
+ static void
insertFibEntry(StrategyNoRouteFixture<S>* fixture)
{
fib::Entry* entry = fixture->fib.insert("/localhop").first;
@@ -140,27 +129,27 @@
}
};
-using Tests = boost::mpl::vector<
- Test<AsfStrategy, EmptyNextHopList<AsfStrategy>>,
- Test<AsfStrategy, NextHopIsDownstream<AsfStrategy>>,
- Test<AsfStrategy, NextHopViolatesScope<AsfStrategy>>,
+using Tests = boost::mp11::mp_list<
+ boost::mp11::mp_list<AsfStrategy, EmptyNextHopList<AsfStrategy>>,
+ boost::mp11::mp_list<AsfStrategy, NextHopIsDownstream<AsfStrategy>>,
+ boost::mp11::mp_list<AsfStrategy, NextHopViolatesScope<AsfStrategy>>,
- Test<BestRouteStrategy, EmptyNextHopList<BestRouteStrategy>>,
- Test<BestRouteStrategy, NextHopIsDownstream<BestRouteStrategy>>,
- Test<BestRouteStrategy, NextHopViolatesScope<BestRouteStrategy>>,
+ boost::mp11::mp_list<BestRouteStrategy, EmptyNextHopList<BestRouteStrategy>>,
+ boost::mp11::mp_list<BestRouteStrategy, NextHopIsDownstream<BestRouteStrategy>>,
+ boost::mp11::mp_list<BestRouteStrategy, NextHopViolatesScope<BestRouteStrategy>>,
- Test<RandomStrategy, EmptyNextHopList<RandomStrategy>>,
- Test<RandomStrategy, NextHopIsDownstream<RandomStrategy>>,
- Test<RandomStrategy, NextHopViolatesScope<RandomStrategy>>
+ boost::mp11::mp_list<RandomStrategy, EmptyNextHopList<RandomStrategy>>,
+ boost::mp11::mp_list<RandomStrategy, NextHopIsDownstream<RandomStrategy>>,
+ boost::mp11::mp_list<RandomStrategy, NextHopViolatesScope<RandomStrategy>>
>;
BOOST_FIXTURE_TEST_CASE_TEMPLATE(IncomingInterest,
- T, Tests, StrategyNoRouteFixture<typename T::Strategy>)
+ T, Tests, StrategyNoRouteFixture<boost::mp11::mp_first<T>>)
{
- typename T::Case scenario;
- scenario.insertFibEntry(this);
+ using Scenario = boost::mp11::mp_second<T>;
+ Scenario::insertFibEntry(this);
- auto interest = makeInterest(scenario.getInterestName());
+ auto interest = makeInterest(Scenario::getInterestName());
auto pitEntry = this->pit.insert(*interest).first;
pitEntry->insertOrUpdateInRecord(*this->face1, *interest);
diff --git a/tests/daemon/fw/strategy-scope-control.t.cpp b/tests/daemon/fw/strategy-scope-control.t.cpp
index 392becb..8bd96d1 100644
--- a/tests/daemon/fw/strategy-scope-control.t.cpp
+++ b/tests/daemon/fw/strategy-scope-control.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-2024, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -39,7 +39,7 @@
#include "choose-strategy.hpp"
#include "strategy-tester.hpp"
-#include <boost/mpl/vector.hpp>
+#include <boost/mp11/list.hpp>
namespace nfd::tests {
@@ -85,31 +85,15 @@
BOOST_AUTO_TEST_SUITE(TestStrategyScopeControl)
template<typename S, bool WillSendNackNoRoute, bool CanProcessNack, bool WillRejectPitEntry>
-class Test
+struct Test
{
-public:
using Strategy = S;
-
- static bool
- willRejectPitEntry()
- {
- return WillRejectPitEntry;
- }
-
- static bool
- willSendNackNoRoute()
- {
- return WillSendNackNoRoute;
- }
-
- static bool
- canProcessNack()
- {
- return CanProcessNack;
- }
+ static constexpr bool canProcessNack = CanProcessNack;
+ static constexpr bool willRejectPitEntry = WillRejectPitEntry;
+ static constexpr bool willSendNackNoRoute = WillSendNackNoRoute;
};
-using Tests = boost::mpl::vector<
+using Tests = boost::mp11::mp_list<
Test<AccessStrategy, false, false, true>,
Test<AsfStrategy, true, false, true>,
Test<BestRouteStrategy, true, true, true>,
@@ -148,11 +132,11 @@
BOOST_REQUIRE(this->strategy.waitForAction(
[&] { this->strategy.afterReceiveInterest(*interest, FaceEndpoint(*this->localFace3), pitEntry); },
- this->limitedIo, T::willRejectPitEntry() + T::willSendNackNoRoute()));
+ this->limitedIo, T::willRejectPitEntry + T::willSendNackNoRoute));
BOOST_CHECK_EQUAL(this->strategy.sendInterestHistory.size(), 0);
- BOOST_CHECK_EQUAL(this->strategy.rejectPendingInterestHistory.size(), T::willRejectPitEntry());
- if (T::willSendNackNoRoute()) {
+ BOOST_CHECK_EQUAL(this->strategy.rejectPendingInterestHistory.size(), T::willRejectPitEntry);
+ if (T::willSendNackNoRoute) {
BOOST_REQUIRE_EQUAL(this->strategy.sendNackHistory.size(), 1);
BOOST_CHECK_EQUAL(this->strategy.sendNackHistory.back().header.getReason(), lp::NackReason::NO_ROUTE);
}
@@ -191,11 +175,11 @@
BOOST_REQUIRE(this->strategy.waitForAction(
[&] { this->strategy.afterReceiveInterest(*interest, FaceEndpoint(*this->nonLocalFace1), pitEntry); },
- this->limitedIo, T::willRejectPitEntry() + T::willSendNackNoRoute()));
+ this->limitedIo, T::willRejectPitEntry + T::willSendNackNoRoute));
BOOST_CHECK_EQUAL(this->strategy.sendInterestHistory.size(), 0);
- BOOST_CHECK_EQUAL(this->strategy.rejectPendingInterestHistory.size(), T::willRejectPitEntry());
- if (T::willSendNackNoRoute()) {
+ BOOST_CHECK_EQUAL(this->strategy.rejectPendingInterestHistory.size(), T::willRejectPitEntry);
+ if (T::willSendNackNoRoute) {
BOOST_REQUIRE_EQUAL(this->strategy.sendNackHistory.size(), 1);
BOOST_CHECK_EQUAL(this->strategy.sendNackHistory.back().header.getReason(), lp::NackReason::NO_ROUTE);
}
@@ -237,11 +221,11 @@
BOOST_REQUIRE(this->strategy.waitForAction(
[&] { this->strategy.afterReceiveNack(nack, FaceEndpoint(*this->localFace4), pitEntry); },
- this->limitedIo, T::canProcessNack()));
+ this->limitedIo, T::canProcessNack));
BOOST_CHECK_EQUAL(this->strategy.sendInterestHistory.size(), 0);
BOOST_CHECK_EQUAL(this->strategy.rejectPendingInterestHistory.size(), 0);
- if (T::canProcessNack()) {
+ if (T::canProcessNack) {
BOOST_REQUIRE_EQUAL(this->strategy.sendNackHistory.size(), 1);
BOOST_CHECK_EQUAL(this->strategy.sendNackHistory.back().header.getReason(), lp::NackReason::NO_ROUTE);
}
@@ -262,11 +246,11 @@
BOOST_REQUIRE(this->strategy.waitForAction(
[&] { this->strategy.afterReceiveNack(nack, FaceEndpoint(*this->localFace4), pitEntry); },
- this->limitedIo, T::canProcessNack()));
+ this->limitedIo, T::canProcessNack));
BOOST_CHECK_EQUAL(this->strategy.sendInterestHistory.size(), 0);
BOOST_CHECK_EQUAL(this->strategy.rejectPendingInterestHistory.size(), 0);
- if (T::canProcessNack()) {
+ if (T::canProcessNack) {
BOOST_REQUIRE_EQUAL(this->strategy.sendNackHistory.size(), 1);
BOOST_CHECK_EQUAL(this->strategy.sendNackHistory.back().header.getReason(), lp::NackReason::NO_ROUTE);
}
diff --git a/tests/daemon/fw/unsolicited-data-policy.t.cpp b/tests/daemon/fw/unsolicited-data-policy.t.cpp
index 67be5b2..c4a7097 100644
--- a/tests/daemon/fw/unsolicited-data-policy.t.cpp
+++ b/tests/daemon/fw/unsolicited-data-policy.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-2024, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -31,7 +31,7 @@
#include "tests/daemon/face/dummy-face.hpp"
#include <boost/logic/tribool.hpp>
-#include <boost/mpl/vector.hpp>
+#include <boost/mp11/list.hpp>
namespace nfd::tests {
@@ -40,7 +40,8 @@
class UnsolicitedDataPolicyFixture : public GlobalIoTimeFixture
{
protected:
- /** \tparam Policy policy type, or void to keep default policy
+ /**
+ * \tparam Policy The policy type, or `void` to keep the default policy.
*/
template<typename Policy>
void
@@ -89,15 +90,15 @@
BOOST_CHECK_EQUAL(policyNames.count("admit-all"), 1);
}
-template<typename Policy, bool shouldAdmitLocal, bool shouldAdmitNonLocal>
+template<typename P, bool Local, bool NonLocal>
struct FaceScopePolicyTest
{
- using PolicyType = Policy;
- using ShouldAdmitLocal = std::bool_constant<shouldAdmitLocal>;
- using ShouldAdmitNonLocal = std::bool_constant<shouldAdmitNonLocal>;
+ using PolicyType = P;
+ static constexpr bool shouldAdmitLocal = Local;
+ static constexpr bool shouldAdmitNonLocal = NonLocal;
};
-using FaceScopePolicyTests = boost::mpl::vector<
+using FaceScopePolicyTests = boost::mp11::mp_list<
FaceScopePolicyTest<void, false, false>, // default policy
FaceScopePolicyTest<DropAllUnsolicitedDataPolicy, false, false>,
FaceScopePolicyTest<AdmitLocalUnsolicitedDataPolicy, true, false>,
@@ -115,7 +116,7 @@
auto data1 = makeData("/unsolicited-from-local");
forwarder.onIncomingData(*data1, FaceEndpoint(*face1));
- BOOST_CHECK_EQUAL(isInCs(*data1), T::ShouldAdmitLocal::value);
+ BOOST_CHECK_EQUAL(isInCs(*data1), T::shouldAdmitLocal);
auto face2 = make_shared<DummyFace>("dummy://", "dummy://",
ndn::nfd::FACE_SCOPE_NON_LOCAL);
@@ -123,7 +124,7 @@
auto data2 = makeData("/unsolicited-from-non-local");
forwarder.onIncomingData(*data2, FaceEndpoint(*face2));
- BOOST_CHECK_EQUAL(isInCs(*data2), T::ShouldAdmitNonLocal::value);
+ BOOST_CHECK_EQUAL(isInCs(*data2), T::shouldAdmitNonLocal);
}
BOOST_AUTO_TEST_SUITE_END() // TestUnsolicitedDataPolicy