fix test errors
Change-Id: Idbc6c979b675231360dd70870cafc205c9f1e646
diff --git a/tests/unit-tests/bench.t.cpp b/tests/unit-tests/bench.t.cpp
index 1766a18..709a0bc 100644
--- a/tests/unit-tests/bench.t.cpp
+++ b/tests/unit-tests/bench.t.cpp
@@ -38,8 +38,8 @@
util::DummyClientFace face(io, m_keyChain, {true, true});
CaModule ca(face, m_keyChain, "tests/unit-tests/config-files/config-ca-1", "ca-storage-memory");
- auto profileData = ca.getCaProfileData();
advanceClocks(time::milliseconds(20), 60);
+ auto profileData = ca.getCaProfileData();
Interest interest = MetadataObject::makeDiscoveryInterest(Name("/ndn/CA/INFO"));
std::cout << "CA Config discovery Interest Size: " << interest.wireEncode().size() << std::endl;
@@ -48,8 +48,10 @@
face.setInterestFilter(
InterestFilter("/ndn/CA/INFO"),
[&](const auto&, const Interest& interest) {
- BOOST_CHECK(interest.matchesData(profileData));
- face.put(profileData);
+ std::cout << interest.getName() << std::endl;
+ if (interest.getName() == profileData.getName()) {
+ face.put(profileData);
+ }
},
nullptr, nullptr);
advanceClocks(time::milliseconds(20), 60);
@@ -61,9 +63,8 @@
std::cout << "CA Config MetaData Size: " << response.wireEncode().size() << std::endl;
auto block = response.getContent();
block.parse();
- Interest interest(Name(block.get(tlv::Name)));
- interest.setCanBePrefix(true);
- infoInterest = make_shared<Interest>(interest);
+ infoInterest = make_shared<Interest>(Name(block.get(tlv::Name)).appendSegment(0));
+ infoInterest->setCanBePrefix(false);
std::cout << "CA Config fetch Interest Size: " << infoInterest->wireEncode().size() << std::endl;
}
else {
diff --git a/tests/unit-tests/ca-module.t.cpp b/tests/unit-tests/ca-module.t.cpp
index 9f7d53a..e848aca 100644
--- a/tests/unit-tests/ca-module.t.cpp
+++ b/tests/unit-tests/ca-module.t.cpp
@@ -51,8 +51,8 @@
util::DummyClientFace face(io, m_keyChain, {true, true});
CaModule ca(face, m_keyChain, "tests/unit-tests/config-files/config-ca-1", "ca-storage-memory");
- auto profileData = ca.getCaProfileData();
advanceClocks(time::milliseconds(20), 60);
+ auto profileData = ca.getCaProfileData();
Interest interest = MetadataObject::makeDiscoveryInterest(Name("/ndn/CA/INFO"));
shared_ptr<Interest> infoInterest = nullptr;
@@ -60,9 +60,11 @@
face.setInterestFilter(
InterestFilter("/ndn/CA/INFO"),
[&](const auto&, const Interest& interest) {
- BOOST_CHECK(interest.matchesData(profileData));
- face.put(profileData);
- }, nullptr, nullptr);
+ if (interest.getName() == profileData.getName()) {
+ face.put(profileData);
+ }
+ },
+ nullptr, nullptr);
advanceClocks(time::milliseconds(20), 60);
int count = 0;
@@ -71,9 +73,8 @@
count++;
auto block = response.getContent();
block.parse();
- Interest interest(Name(block.get(tlv::Name)));
- interest.setCanBePrefix(true);
- infoInterest = make_shared<Interest>(interest);
+ infoInterest = make_shared<Interest>(Name(block.get(tlv::Name)).appendSegment(0));
+ infoInterest->setCanBePrefix(false);
}
else {
count++;
@@ -92,6 +93,7 @@
advanceClocks(time::milliseconds(20), 60);
face.receive(*infoInterest);
advanceClocks(time::milliseconds(20), 60);
+
BOOST_CHECK_EQUAL(count, 2);
}