CR fix 3
Change-Id: If6802a52f48870a1fe3c42d57d7797a5f5248b26
diff --git a/tests/unit-tests/bench.t.cpp b/tests/unit-tests/bench.t.cpp
index 9fba0e8..0927e9c 100644
--- a/tests/unit-tests/bench.t.cpp
+++ b/tests/unit-tests/bench.t.cpp
@@ -144,7 +144,7 @@
auto paramList = requester::Requester::selectOrContinueChallenge(state, "pin");
auto request = ca.getCertificateRequest(*challengeInterest2);
auto secret = request->m_challengeState->m_secrets.get(ChallengePin::PARAMETER_KEY_CODE, "");
- std::get<1>(paramList[0]) = secret;
+ paramList.begin()->second = secret;
challengeInterest3 = requester::Requester::genChallengeInterest(state, std::move(paramList));
// std::cout << "CHALLENGE Interest Size: " << challengeInterest3->wireEncode().size() << std::endl;
}
diff --git a/tests/unit-tests/ca-module.t.cpp b/tests/unit-tests/ca-module.t.cpp
index 15c7532..4c295db 100644
--- a/tests/unit-tests/ca-module.t.cpp
+++ b/tests/unit-tests/ca-module.t.cpp
@@ -423,7 +423,7 @@
auto paramList = requester::Requester::selectOrContinueChallenge(state, "pin");
auto request = ca.getCertificateRequest(*challengeInterest2);
auto secret = request->m_challengeState->m_secrets.get(ChallengePin::PARAMETER_KEY_CODE, "");
- std::get<1>(paramList[0]) = secret;
+ paramList.begin()->second = secret;
challengeInterest3 = requester::Requester::genChallengeInterest(state, std::move(paramList));
}
else if (Name("/ndn/CA/CHALLENGE").isPrefixOf(response.getName()) && count == 2) {
diff --git a/tests/unit-tests/configuration.t.cpp b/tests/unit-tests/configuration.t.cpp
index 3ba4567..317d01b 100644
--- a/tests/unit-tests/configuration.t.cpp
+++ b/tests/unit-tests/configuration.t.cpp
@@ -55,15 +55,12 @@
BOOST_CHECK_EQUAL(config.m_redirection->at(0)->getName(),
"/ndn/site1/KEY/%11%BC%22%F4c%15%FF%17/self/%FD%00%00%01Y%C8%14%D9%A5");
BOOST_CHECK_EQUAL(config.m_nameAssignmentFuncs.size(), 3);
- BOOST_CHECK_EQUAL(config.m_nameAssignmentFuncs[0]->FACTORY_TYPE, "param");
- BOOST_CHECK_EQUAL(config.m_nameAssignmentFuncs[1]->FACTORY_TYPE, "param");
- BOOST_CHECK_EQUAL(config.m_nameAssignmentFuncs[2]->FACTORY_TYPE, "random");
BOOST_CHECK_EQUAL(config.m_nameAssignmentFuncs[0]->m_nameFormat[0], "group");
BOOST_CHECK_EQUAL(config.m_nameAssignmentFuncs[0]->m_nameFormat[1], "email");
- std::vector<std::tuple<std::string, std::string>> params;
- params.emplace_back("email", "1@1.edu");
- params.emplace_back("group", "irl");
- params.emplace_back("name", "ndncert");
+ std::multimap<std::string, std::string> params;
+ params.emplace("email", "1@1.edu");
+ params.emplace("group", "irl");
+ params.emplace("name", "ndncert");
std::vector<Name> names;
for (auto& assignment : config.m_nameAssignmentFuncs) {
auto results = assignment->assignName(params);
diff --git a/tests/unit-tests/name-assignment.t.cpp b/tests/unit-tests/name-assignment.t.cpp
index 154779a..425e513 100644
--- a/tests/unit-tests/name-assignment.t.cpp
+++ b/tests/unit-tests/name-assignment.t.cpp
@@ -31,39 +31,39 @@
BOOST_AUTO_TEST_CASE(NameAssignmentRandom)
{
AssignmentRandom assignment;
- BOOST_CHECK_EQUAL(assignment.assignName(std::vector<std::tuple<std::string, std::string>>()).size(), 1);
- BOOST_CHECK_EQUAL(assignment.assignName(std::vector<std::tuple<std::string, std::string>>()).begin()->size(), 1);
+ BOOST_CHECK_EQUAL(assignment.assignName(std::multimap<std::string, std::string>()).size(), 1);
+ BOOST_CHECK_EQUAL(assignment.assignName(std::multimap<std::string, std::string>()).begin()->size(), 1);
}
BOOST_AUTO_TEST_CASE(NameAssignmentParam)
{
AssignmentParam assignment("/abc/xyz");
- std::vector<std::tuple<std::string, std::string>> params;
- params.emplace_back("abc", "123");
+ std::multimap<std::string, std::string> params;
+ params.emplace("abc", "123");
BOOST_CHECK_EQUAL(assignment.assignName(params).size(), 0);
- params.emplace_back("xyz", "789");
+ params.emplace("xyz", "789");
BOOST_CHECK_EQUAL(assignment.assignName(params).size(), 1);
BOOST_CHECK_EQUAL(*assignment.assignName(params).begin(), Name("/123/789"));
- params.emplace_back("fake", "456");
+ params.emplace("fake", "456");
BOOST_CHECK_EQUAL(assignment.assignName(params).size(), 1);
BOOST_CHECK_EQUAL(*assignment.assignName(params).begin(), Name("/123/789"));
- params[1] = std::tuple<std::string, std::string>("xyz", "");
+ params.find("xyz")->second = "";
BOOST_CHECK_EQUAL(assignment.assignName(params).size(), 0);
}
BOOST_AUTO_TEST_CASE(NameAssignmentHash)
{
AssignmentHash assignment("/abc/xyz");
- std::vector<std::tuple<std::string, std::string>> params;
- params.emplace_back("abc", "123");
+ std::multimap<std::string, std::string> params;
+ params.emplace("abc", "123");
BOOST_CHECK_EQUAL(assignment.assignName(params).size(), 0);
- params.emplace_back("xyz", "789");
+ params.emplace("xyz", "789");
BOOST_CHECK_EQUAL(assignment.assignName(params).size(), 1);
BOOST_CHECK_EQUAL(assignment.assignName(params).begin()->size(), 2);
- params.emplace_back("fake", "456");
+ params.emplace("fake", "456");
BOOST_CHECK_EQUAL(assignment.assignName(params).size(), 1);
BOOST_CHECK_EQUAL(assignment.assignName(params).begin()->size(), 2);
- params[1] = std::tuple<std::string, std::string>("xyz", "");
+ params.find("xyz")->second = "";
BOOST_CHECK_EQUAL(assignment.assignName(params).size(), 1);
BOOST_CHECK_EQUAL(assignment.assignName(params).begin()->size(), 2);
}
diff --git a/tests/unit-tests/protocol-encoders.t.cpp b/tests/unit-tests/protocol-encoders.t.cpp
index 532049b..47e65f5 100644
--- a/tests/unit-tests/protocol-encoders.t.cpp
+++ b/tests/unit-tests/protocol-encoders.t.cpp
@@ -64,16 +64,14 @@
BOOST_AUTO_TEST_CASE(ProbeEncodingAppParam)
{
- std::vector<std::tuple<std::string, std::string>> parameters;
- parameters.emplace_back("key1", "value1");
- parameters.emplace_back("key2", "value2");
+ std::multimap<std::string, std::string> parameters;
+ parameters.emplace("key1", "value1");
+ parameters.emplace("key2", "value2");
auto appParam = probeEncoder::encodeApplicationParameters(std::move(parameters));
auto param1 = probeEncoder::decodeApplicationParameters(appParam);
- BOOST_CHECK_EQUAL(parameters.size(), param1.size());
- BOOST_CHECK_EQUAL(std::get<0>(parameters[0]), std::get<0>(param1[0]));
- BOOST_CHECK_EQUAL(std::get<1>(parameters[0]), std::get<1>(param1[0]));
- BOOST_CHECK_EQUAL(std::get<0>(parameters[1]), std::get<0>(param1[1]));
- BOOST_CHECK_EQUAL(std::get<1>(parameters[1]), std::get<1>(param1[1]));
+ BOOST_CHECK_EQUAL(param1.size(), 2);
+ BOOST_CHECK_EQUAL(param1.find("key1")->second, "value1");
+ BOOST_CHECK_EQUAL(param1.find("key2")->second, "value2");
}
BOOST_AUTO_TEST_CASE(ProbeEncodingData)
diff --git a/tests/unit-tests/requester.t.cpp b/tests/unit-tests/requester.t.cpp
index e51658d..c9a1d1d 100644
--- a/tests/unit-tests/requester.t.cpp
+++ b/tests/unit-tests/requester.t.cpp
@@ -47,10 +47,10 @@
ca_profile.m_caPrefix = Name("/site");
ca_profile.m_cert = std::make_shared<security::Certificate>(cert);
- std::vector<std::tuple<std::string, std::string>> probeParams;
- probeParams.push_back(std::make_tuple("email", "zhiyi@cs.ucla.edu"));
- probeParams.push_back(std::make_tuple("uid", "987654321"));
- probeParams.push_back(std::make_tuple("name", "Zhiyi Zhang"));
+ std::multimap<std::string, std::string> probeParams;
+ probeParams.emplace("email", "zhiyi@cs.ucla.edu");
+ probeParams.emplace("uid", "987654321");
+ probeParams.emplace("name", "Zhiyi Zhang");
auto firstInterest = Requester::genProbeInterest(ca_profile, std::move(probeParams));
BOOST_CHECK(firstInterest->getName().at(-1).isParametersSha256Digest());