tests: sync common testing infrastructure with ndn-cxx and NFD
And upgrade waf to version 2.0.21
Change-Id: Id713e0f3035badd97ca7fc03f76e50085b9a266c
diff --git a/tests/test-common.cpp b/tests/test-common.cpp
index e1b2431..98fa188 100644
--- a/tests/test-common.cpp
+++ b/tests/test-common.cpp
@@ -23,64 +23,20 @@
* ndn-tools, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "test-common.hpp"
-
-#include <ndn-cxx/security/signature-sha256-with-rsa.hpp>
+#include "tests/test-common.hpp"
namespace ndn {
namespace tests {
-UnitTestTimeFixture::UnitTestTimeFixture()
- : steadyClock(make_shared<time::UnitTestSteadyClock>())
- , systemClock(make_shared<time::UnitTestSystemClock>())
-{
- time::setCustomClocks(steadyClock, systemClock);
-}
-
-UnitTestTimeFixture::~UnitTestTimeFixture()
-{
- time::setCustomClocks(nullptr, nullptr);
-}
-
-void
-UnitTestTimeFixture::advanceClocks(boost::asio::io_service& io,
- time::nanoseconds tick, size_t nTicks)
-{
- this->advanceClocks(io, tick, tick * nTicks);
-}
-
-void
-UnitTestTimeFixture::advanceClocks(boost::asio::io_service& io,
- time::nanoseconds tick, time::nanoseconds total)
-{
- BOOST_ASSERT(tick > time::nanoseconds::zero());
- BOOST_ASSERT(total >= time::nanoseconds::zero());
-
- time::nanoseconds remaining = total;
- while (remaining > time::nanoseconds::zero()) {
- if (remaining >= tick) {
- steadyClock->advance(tick);
- systemClock->advance(tick);
- remaining -= tick;
- }
- else {
- steadyClock->advance(remaining);
- systemClock->advance(remaining);
- remaining = time::nanoseconds::zero();
- }
-
- if (io.stopped())
- io.reset();
- io.poll();
- }
-}
-
shared_ptr<Interest>
-makeInterest(const Name& name, bool canBePrefix, time::milliseconds lifetime,
+makeInterest(const Name& name, bool canBePrefix, optional<time::milliseconds> lifetime,
optional<Interest::Nonce> nonce)
{
- auto interest = make_shared<Interest>(name, lifetime);
+ auto interest = std::make_shared<Interest>(name);
interest->setCanBePrefix(canBePrefix);
+ if (lifetime) {
+ interest->setInterestLifetime(*lifetime);
+ }
interest->setNonce(nonce);
return interest;
}
@@ -88,16 +44,15 @@
shared_ptr<Data>
makeData(const Name& name)
{
- auto data = make_shared<Data>(name);
+ auto data = std::make_shared<Data>(name);
return signData(data);
}
Data&
signData(Data& data)
{
- ndn::SignatureSha256WithRsa fakeSignature;
- fakeSignature.setValue(ndn::encoding::makeEmptyBlock(tlv::SignatureValue));
- data.setSignature(fakeSignature);
+ data.setSignatureInfo(SignatureInfo(tlv::NullSignature));
+ data.setSignatureValue(std::make_shared<Buffer>());
data.wireEncode();
return data;
}