tools/tests: fix compilation errors caused by bind and placeholders
refs #2175
Change-Id: I65eadb0d0ccf468c3d478236335dbf09aa4dcc71
diff --git a/tests/daemon/mgmt/face-manager.cpp b/tests/daemon/mgmt/face-manager.cpp
index ad798af..aa1bf32 100644
--- a/tests/daemon/mgmt/face-manager.cpp
+++ b/tests/daemon/mgmt/face-manager.cpp
@@ -813,9 +813,9 @@
{
shared_ptr<Interest> command(make_shared<Interest>("/localhost/nfd/faces"));
- getFace()->onReceiveData +=
- bind(&FaceManagerFixture::validateControlResponse, this, _1,
- command->getName(), 400, "Malformed command");
+ getFace()->onReceiveData += [this, command] (const Data& response) {
+ this->validateControlResponse(response, command->getName(), 400, "Malformed command");
+ };
getFace()->sendInterest(*command);
g_io.run_one();
@@ -827,9 +827,9 @@
{
shared_ptr<Interest> command(make_shared<Interest>("/localhost/nfd/faces"));
- getFace()->onReceiveData +=
- bind(&FaceManagerFixture::validateControlResponse, this, _1,
- command->getName(), 400, "Malformed command");
+ getFace()->onReceiveData += [this, command] (const Data& response) {
+ this->validateControlResponse(response, command->getName(), 400, "Malformed command");
+ };
getManager().onFaceRequest(*command);
@@ -849,9 +849,9 @@
shared_ptr<Interest> command(make_shared<Interest>(commandName));
- getFace()->onReceiveData +=
- bind(&FaceManagerFixture::validateControlResponse, this, _1,
- command->getName(), 401, "Signature required");
+ getFace()->onReceiveData += [this, command] (const Data& response) {
+ this->validateControlResponse(response, command->getName(), 401, "Signature required");
+ };
getManager().onFaceRequest(*command);
@@ -872,9 +872,9 @@
shared_ptr<Interest> command(make_shared<Interest>(commandName));
generateCommand(*command);
- getFace()->onReceiveData +=
- bind(&FaceManagerFixture::validateControlResponse, this, _1,
- command->getName(), 403, "Unauthorized command");
+ getFace()->onReceiveData += [this, command] (const Data& response) {
+ this->validateControlResponse(response, command->getName(), 403, "Unauthorized command");
+ };
getManager().onFaceRequest(*command);
@@ -910,9 +910,9 @@
shared_ptr<Interest> command(make_shared<Interest>(commandName));
generateCommand(*command);
- getFace()->onReceiveData +=
- bind(&FaceManagerFixture::validateControlResponse, this, _1,
- command->getName(), 501, "Unsupported command");
+ getFace()->onReceiveData += [this, command] (const Data& response) {
+ this->validateControlResponse(response, command->getName(), 501, "Unsupported command");
+ };
getManager().onFaceRequest(*command);
@@ -980,9 +980,9 @@
shared_ptr<Interest> command(make_shared<Interest>(commandName));
generateCommand(*command);
- getFace()->onReceiveData +=
- bind(&ValidatedFaceRequestFixture::validateControlResponse, this, _1,
- command->getName(), 400, "Malformed command");
+ getFace()->onReceiveData += [this, command] (const Data& response) {
+ this->validateControlResponse(response, command->getName(), 400, "Malformed command");
+ };
onValidatedFaceRequest(command);
@@ -1077,8 +1077,10 @@
generateCommand(*enableCommand);
TestFaceManagerCommon::m_face->onReceiveData +=
- bind(&LocalControlFixture::validateControlResponse, this, _1,
- enableCommand->getName(), 200, "Success", encodedParameters);
+ [this, enableCommand, encodedParameters] (const Data& response) {
+ this->validateControlResponse(response, enableCommand->getName(),
+ 200, "Success", encodedParameters);
+ };
onValidatedFaceRequest(enableCommand);
@@ -1098,8 +1100,10 @@
generateCommand(*disableCommand);
TestFaceManagerCommon::m_face->onReceiveData +=
- bind(&LocalControlFixture::validateControlResponse, this, _1,
- disableCommand->getName(), 200, "Success", encodedParameters);
+ [this, disableCommand, encodedParameters] (const Data& response) {
+ this->validateControlResponse(response, disableCommand->getName(),
+ 200, "Success", encodedParameters);
+ };
onValidatedFaceRequest(disableCommand);
@@ -1128,9 +1132,9 @@
generateCommand(*enableCommand);
- TestFaceManagerCommon::m_face->onReceiveData +=
- bind(&LocalControlFixture::validateControlResponse, this, _1,
- enableCommand->getName(), 410, "Face not found");
+ TestFaceManagerCommon::m_face->onReceiveData += [this, enableCommand] (const Data& response) {
+ this->validateControlResponse(response, enableCommand->getName(), 410, "Face not found");
+ };
onValidatedFaceRequest(enableCommand);
@@ -1149,9 +1153,9 @@
generateCommand(*disableCommand);
- TestFaceManagerCommon::m_face->onReceiveData +=
- bind(&LocalControlFixture::validateControlResponse, this, _1,
- disableCommand->getName(), 410, "Face not found");
+ TestFaceManagerCommon::m_face->onReceiveData += [this, disableCommand] (const Data& response) {
+ this->validateControlResponse(response, disableCommand->getName(), 410, "Face not found");
+ };
onValidatedFaceRequest(disableCommand);
@@ -1179,9 +1183,9 @@
generateCommand(*enableCommand);
- TestFaceManagerCommon::m_face->onReceiveData +=
- bind(&LocalControlFixture::validateControlResponse, this, _1,
- enableCommand->getName(), 400, "Malformed command");
+ TestFaceManagerCommon::m_face->onReceiveData += [this, enableCommand] (const Data& response) {
+ this->validateControlResponse(response, enableCommand->getName(), 400, "Malformed command");
+ };
onValidatedFaceRequest(enableCommand);
@@ -1200,9 +1204,9 @@
generateCommand(*disableCommand);
- TestFaceManagerCommon::m_face->onReceiveData +=
- bind(&LocalControlFixture::validateControlResponse, this, _1,
- disableCommand->getName(), 400, "Malformed command");
+ TestFaceManagerCommon::m_face->onReceiveData += [this, disableCommand] (const Data& response) {
+ this->validateControlResponse(response, disableCommand->getName(), 400, "Malformed command");
+ };
onValidatedFaceRequest(disableCommand);
@@ -1231,9 +1235,9 @@
generateCommand(*enableCommand);
- TestFaceManagerCommon::m_face->onReceiveData +=
- bind(&LocalControlFixture::validateControlResponse, this, _1,
- enableCommand->getName(), 412, "Face is non-local");
+ TestFaceManagerCommon::m_face->onReceiveData += [this, enableCommand] (const Data& response) {
+ this->validateControlResponse(response, enableCommand->getName(), 412, "Face is non-local");
+ };
onValidatedFaceRequest(enableCommand);
@@ -1250,9 +1254,9 @@
generateCommand(*disableCommand);
- TestFaceManagerCommon::m_face->onReceiveData +=
- bind(&LocalControlFixture::validateControlResponse, this, _1,
- disableCommand->getName(), 412, "Face is non-local");
+ TestFaceManagerCommon::m_face->onReceiveData += [this, disableCommand] (const Data& response) {
+ this->validateControlResponse(response, disableCommand->getName(), 412, "Face is non-local");
+ };
onValidatedFaceRequest(disableCommand);
@@ -1280,8 +1284,10 @@
generateCommand(*enableCommand);
TestFaceManagerCommon::m_face->onReceiveData +=
- bind(&LocalControlFixture::validateControlResponse, this, _1,
- enableCommand->getName(), 200, "Success", encodedParameters);
+ [this, enableCommand, encodedParameters] (const Data& response) {
+ this->validateControlResponse(response, enableCommand->getName(),
+ 200, "Success", encodedParameters);
+ };
onValidatedFaceRequest(enableCommand);
@@ -1302,8 +1308,10 @@
generateCommand(*disableCommand);
TestFaceManagerCommon::m_face->onReceiveData +=
- bind(&LocalControlFixture::validateControlResponse, this, _1,
- disableCommand->getName(), 200, "Success", encodedParameters);
+ [this, disableCommand, encodedParameters] (const Data& response) {
+ this->validateControlResponse(response, disableCommand->getName(),
+ 200, "Success", encodedParameters);
+ };
onValidatedFaceRequest(disableCommand);
@@ -1332,9 +1340,9 @@
generateCommand(*enableCommand);
- TestFaceManagerCommon::m_face->onReceiveData +=
- bind(&LocalControlFixture::validateControlResponse, this, _1,
- enableCommand->getName(), 410, "Face not found");
+ TestFaceManagerCommon::m_face->onReceiveData += [this, enableCommand] (const Data& response) {
+ this->validateControlResponse(response, enableCommand->getName(), 410, "Face not found");
+ };
onValidatedFaceRequest(enableCommand);
@@ -1354,9 +1362,9 @@
generateCommand(*disableCommand);
- TestFaceManagerCommon::m_face->onReceiveData +=
- bind(&LocalControlFixture::validateControlResponse, this, _1,
- disableCommand->getName(), 410, "Face not found");
+ TestFaceManagerCommon::m_face->onReceiveData += [this, disableCommand] (const Data& response) {
+ this->validateControlResponse(response, disableCommand->getName(), 410, "Face not found");
+ };
onValidatedFaceRequest(disableCommand);
@@ -1385,9 +1393,9 @@
generateCommand(*enableCommand);
- TestFaceManagerCommon::m_face->onReceiveData +=
- bind(&LocalControlFixture::validateControlResponse, this, _1,
- enableCommand->getName(), 412, "Face is non-local");
+ TestFaceManagerCommon::m_face->onReceiveData += [this, enableCommand] (const Data& response) {
+ this->validateControlResponse(response, enableCommand->getName(), 412, "Face is non-local");
+ };
onValidatedFaceRequest(enableCommand);
@@ -1404,9 +1412,9 @@
generateCommand(*disableCommand);
- TestFaceManagerCommon::m_face->onReceiveData +=
- bind(&LocalControlFixture::validateControlResponse, this, _1,
- disableCommand->getName(), 412, "Face is non-local");
+ TestFaceManagerCommon::m_face->onReceiveData += [this, disableCommand] (const Data& response) {
+ this->validateControlResponse(response, disableCommand->getName(), 412, "Face is non-local");
+ };
onValidatedFaceRequest(disableCommand);
@@ -1522,9 +1530,9 @@
shared_ptr<Interest> command(make_shared<Interest>(commandName));
generateCommand(*command);
- getFace()->onReceiveData +=
- bind(&FaceFixture::validateControlResponse, this, _1,
- command->getName(), 400, "Malformed command");
+ getFace()->onReceiveData += [this, command] (const Data& response) {
+ this->validateControlResponse(response, command->getName(), 400, "Malformed command");
+ };
createFace(*command, parameters);
@@ -1544,9 +1552,9 @@
shared_ptr<Interest> command(make_shared<Interest>(commandName));
generateCommand(*command);
- getFace()->onReceiveData +=
- bind(&FaceFixture::validateControlResponse, this, _1,
- command->getName(), 400, "Malformed command");
+ getFace()->onReceiveData += [this, command] (const Data& response) {
+ this->validateControlResponse(response, command->getName(), 400, "Malformed command");
+ };
createFace(*command, parameters);
@@ -1569,9 +1577,9 @@
shared_ptr<Interest> command(make_shared<Interest>(commandName));
generateCommand(*command);
- getFace()->onReceiveData +=
- bind(&FaceFixture::validateControlResponse, this, _1,
- command->getName(), 501, "Unsupported protocol");
+ getFace()->onReceiveData += [this, command] (const Data& response) {
+ this->validateControlResponse(response, command->getName(), 501, "Unsupported protocol");
+ };
createFace(*command, parameters);
@@ -1609,9 +1617,10 @@
Block encodedResultParameters(resultParameters.wireEncode());
getFace()->onReceiveData +=
- bind(&FaceFixture::callbackDispatch, this, _1,
- command->getName(), 200, "Success",
- encodedResultParameters, expectedFaceEvent);
+ [this, command, encodedResultParameters, expectedFaceEvent] (const Data& response) {
+ this->callbackDispatch(response,command->getName(), 200, "Success",
+ encodedResultParameters, expectedFaceEvent);
+ };
onCreated(command->getName(), parameters, dummy);
@@ -1633,9 +1642,9 @@
shared_ptr<Interest> command(make_shared<Interest>(commandName));
generateCommand(*command);
- getFace()->onReceiveData +=
- bind(&FaceFixture::validateControlResponse, this, _1,
- command->getName(), 408, "unit-test-reason");
+ getFace()->onReceiveData += [this, command] (const Data& response) {
+ this->validateControlResponse(response, command->getName(), 408, "unit-test-reason");
+ };
onConnectFailed(command->getName(), "unit-test-reason");
@@ -1670,8 +1679,10 @@
.setFacePersistency(ndn::nfd::FACE_PERSISTENCY_PERSISTENT);
getFace()->onReceiveData +=
- bind(&FaceFixture::callbackDispatch, this, _1, command->getName(),
- 200, "Success", ref(encodedParameters), expectedFaceEvent);
+ [this, command, encodedParameters, expectedFaceEvent] (const Data& response) {
+ this->callbackDispatch(response,command->getName(), 200, "Success",
+ encodedParameters, expectedFaceEvent);
+ };
destroyFace(*command, parameters);