pingserver: code cleanup
Change-Id: Ifdb75174f54aa26619594d4f1b919396a1012998
diff --git a/tests/ping/integrated.t.cpp b/tests/ping/integrated.t.cpp
index 9e929aa..84c13e5 100644
--- a/tests/ping/integrated.t.cpp
+++ b/tests/ping/integrated.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
- * Copyright (c) 2014-2016, Arizona Board of Regents.
+/*
+ * Copyright (c) 2015-2018, Arizona Board of Regents.
*
* This file is part of ndn-tools (Named Data Networking Essential Tools).
* See AUTHORS.md for complete list of ndn-tools authors and contributors.
@@ -74,11 +74,11 @@
{
server::Options serverOpts;
serverOpts.prefix = "ndn:/test-prefix";
- serverOpts.freshnessPeriod = time::milliseconds(5000);
+ serverOpts.freshnessPeriod = 5_s;
serverOpts.nMaxPings = 4;
- serverOpts.shouldPrintTimestamp = false;
+ serverOpts.wantTimestamp = false;
serverOpts.payloadSize = 0;
- server.reset(new server::PingServer(serverFace, m_keyChain, serverOpts));
+ server = make_unique<server::PingServer>(serverFace, m_keyChain, serverOpts);
BOOST_REQUIRE_EQUAL(0, server->getNPings());
server->start();
@@ -88,17 +88,17 @@
clientOpts.shouldGenerateRandomSeq = false;
clientOpts.shouldPrintTimestamp = false;
clientOpts.nPings = 4;
- clientOpts.interval = time::milliseconds(100);
- clientOpts.timeout = time::milliseconds(2000);
+ clientOpts.interval = 100_ms;
+ clientOpts.timeout = 2_s;
clientOpts.startSeq = 1000;
- client.reset(new client::Ping(clientFace, clientOpts));
+ client = make_unique<client::Ping>(clientFace, clientOpts);
client->afterFinish.connect(bind(&PingIntegratedFixture::onFinish, this));
client->start();
- this->advanceClocks(io, time::milliseconds(1), 400);
+ advanceClocks(io, 1_ms, 400);
io.run();
- BOOST_REQUIRE_EQUAL(4, server->getNPings());
+ BOOST_CHECK_EQUAL(4, server->getNPings());
}
BOOST_FIXTURE_TEST_CASE(Timeout, PingIntegratedFixture)
@@ -107,11 +107,11 @@
server::Options serverOpts;
serverOpts.prefix = "ndn:/test-prefix";
- serverOpts.freshnessPeriod = time::milliseconds(5000);
+ serverOpts.freshnessPeriod = 5_s;
serverOpts.nMaxPings = 4;
- serverOpts.shouldPrintTimestamp = false;
+ serverOpts.wantTimestamp = false;
serverOpts.payloadSize = 0;
- server.reset(new server::PingServer(serverFace, m_keyChain, serverOpts));
+ server = make_unique<server::PingServer>(serverFace, m_keyChain, serverOpts);
BOOST_REQUIRE_EQUAL(0, server->getNPings());
server->start();
@@ -121,17 +121,17 @@
clientOpts.shouldGenerateRandomSeq = false;
clientOpts.shouldPrintTimestamp = false;
clientOpts.nPings = 4;
- clientOpts.interval = time::milliseconds(100);
- clientOpts.timeout = time::milliseconds(500);
+ clientOpts.interval = 100_ms;
+ clientOpts.timeout = 500_ms;
clientOpts.startSeq = 1000;
- client.reset(new client::Ping(clientFace, clientOpts));
+ client = make_unique<client::Ping>(clientFace, clientOpts);
client->afterFinish.connect(bind(&PingIntegratedFixture::onFinish, this));
client->start();
- this->advanceClocks(io, time::milliseconds(1), 1000);
+ advanceClocks(io, 1_ms, 1000);
io.run();
- BOOST_REQUIRE_EQUAL(0, server->getNPings());
+ BOOST_CHECK_EQUAL(0, server->getNPings());
}
BOOST_AUTO_TEST_SUITE_END() // TestIntegrated
diff --git a/tests/ping/server/ping-server.t.cpp b/tests/ping/server/ping-server.t.cpp
index 0192008..497d4d6 100644
--- a/tests/ping/server/ping-server.t.cpp
+++ b/tests/ping/server/ping-server.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
- * Copyright (c) 2014-2016, Arizona Board of Regents.
+/*
+ * Copyright (c) 2014-2018, Arizona Board of Regents.
*
* This file is part of ndn-tools (Named Data Networking Essential Tools).
* See AUTHORS.md for complete list of ndn-tools authors and contributors.
@@ -18,11 +18,12 @@
*/
#include "tools/ping/server/ping-server.hpp"
-#include <ndn-cxx/util/dummy-client-face.hpp>
#include "tests/test-common.hpp"
#include "../../identity-management-fixture.hpp"
+#include <ndn-cxx/util/dummy-client-face.hpp>
+
namespace ndn {
namespace ping {
namespace server {
@@ -63,7 +64,7 @@
opt.prefix = "ndn:/test-prefix";
opt.freshnessPeriod = time::milliseconds(5000);
opt.nMaxPings = 2;
- opt.shouldPrintTimestamp = false;
+ opt.wantTimestamp = false;
opt.payloadSize = 0;
return opt;
}
@@ -80,14 +81,14 @@
BOOST_REQUIRE_EQUAL(0, pingServer.getNPings());
pingServer.start();
- this->advanceClocks(io, time::milliseconds(1), 200);
+ advanceClocks(io, 1_ms, 200);
face.receive(makePingInterest(1000));
face.receive(makePingInterest(1001));
io.run();
- BOOST_REQUIRE_EQUAL(2, pingServer.getNPings());
+ BOOST_CHECK_EQUAL(2, pingServer.getNPings());
}
BOOST_AUTO_TEST_SUITE_END() // TestPingServer