tests+tools: minor code cleanup

Change-Id: Ic3356d4a18a8e5eeb45fc076fc0563c3d1549c8a
diff --git a/tests/daemon/fw/asf-strategy.t.cpp b/tests/daemon/fw/asf-strategy.t.cpp
index d363880..27ed2aa 100644
--- a/tests/daemon/fw/asf-strategy.t.cpp
+++ b/tests/daemon/fw/asf-strategy.t.cpp
@@ -36,7 +36,7 @@
 using namespace nfd::fw::tests;
 
 // The tester is unused in this file, but it's used in various templated test suites.
-typedef StrategyTester<AsfStrategy> AsfStrategyTester;
+using AsfStrategyTester = StrategyTester<AsfStrategy>;
 NFD_REGISTER_STRATEGY(AsfStrategyTester);
 
 BOOST_AUTO_TEST_SUITE(Fw)
@@ -45,8 +45,9 @@
 class AsfGridFixture : public GlobalIoTimeFixture
 {
 protected:
-  AsfGridFixture(Name parameters = AsfStrategy::getStrategyName())
-    : parameters(parameters)
+  explicit
+  AsfGridFixture(const Name& params = AsfStrategy::getStrategyName())
+    : parameters(params)
   {
     /*
      *                  +---------+
@@ -74,10 +75,10 @@
     topo.setStrategy<AsfStrategy>(nodeC, Name("ndn:/"), parameters);
     topo.setStrategy<AsfStrategy>(nodeD, Name("ndn:/"), parameters);
 
-    linkAB = topo.addLink("AB", time::milliseconds(10), {nodeA, nodeB});
-    linkAD = topo.addLink("AD", time::milliseconds(100), {nodeA, nodeD});
-    linkBC = topo.addLink("BC", time::milliseconds(10), {nodeB, nodeC});
-    linkCD = topo.addLink("CD", time::milliseconds(100), {nodeC, nodeD});
+    linkAB = topo.addLink("AB", 10_ms, {nodeA, nodeB});
+    linkAD = topo.addLink("AD", 100_ms, {nodeA, nodeD});
+    linkBC = topo.addLink("BC", 10_ms, {nodeB, nodeC});
+    linkCD = topo.addLink("CD", 100_ms, {nodeC, nodeD});
 
     consumer = topo.addAppFace("c", nodeA);
     producer = topo.addAppFace("p", nodeC, PRODUCER_PREFIX);
@@ -91,8 +92,8 @@
   void
   runConsumer(int numInterests = 30)
   {
-    topo.addIntervalConsumer(consumer->getClientFace(), PRODUCER_PREFIX, time::seconds(1), numInterests);
-    this->advanceClocks(time::milliseconds(10), time::seconds(numInterests));
+    topo.addIntervalConsumer(consumer->getClientFace(), PRODUCER_PREFIX, 1_s, numInterests);
+    this->advanceClocks(10_ms, time::seconds(numInterests));
   }
 
 protected:
@@ -160,7 +161,7 @@
   linkAB->recover();
 
   // Advance time to ensure probing is due
-  this->advanceClocks(time::milliseconds(10), time::seconds(10));
+  this->advanceClocks(10_ms, 10_s);
 
   runConsumer();
 
@@ -229,10 +230,10 @@
     topo.setStrategy<AsfStrategy>(node);
   }
 
-  shared_ptr<TopologyLink> linkAB = topo.addLink("AB", time::milliseconds(15), {nodeA, nodeB}),
-                           linkAC = topo.addLink("AC", time::milliseconds(14), {nodeA, nodeC}),
-                           linkBC = topo.addLink("BC", time::milliseconds(16), {nodeB, nodeC}),
-                           linkBD = topo.addLink("BD", time::milliseconds(80), {nodeB, nodeD});
+  shared_ptr<TopologyLink> linkAB = topo.addLink("AB", 15_ms, {nodeA, nodeB}),
+                           linkAC = topo.addLink("AC", 14_ms, {nodeA, nodeC}),
+                           linkBC = topo.addLink("BC", 16_ms, {nodeB, nodeC}),
+                           linkBD = topo.addLink("BD", 80_ms, {nodeB, nodeD});
 
   shared_ptr<TopologyAppLink> ping = topo.addAppFace("c", nodeA),
                         pingServer = topo.addAppFace("p", nodeD, PRODUCER_PREFIX);
@@ -257,14 +258,8 @@
 
     // Don't know when the probe will be triggered since it is random between 0-5 seconds
     // or whether it will be triggered for this interest
-    int j = 1;
-    while (linkAB->getFace(nodeA).getCounters().nOutInterests != 1) {
-      this->advanceClocks(time::milliseconds(1));
-      ++j;
-      // Probe was not scheduled with this ping interest
-      if (j > 1000) {
-        break;
-      }
+    for (int j = 1; j <= 1000 && linkAB->getFace(nodeA).getCounters().nOutInterests != 1; ++j) {
+      this->advanceClocks(1_ms);
     }
 
     // Check if probe is sent to B else send another ping
@@ -286,7 +281,7 @@
       BOOST_CHECK_EQUAL(linkBD->getFace(nodeB).getCounters().nOutInterests, i - 1);
 
       // After 15ms, B should get the probe interest
-      this->advanceClocks(time::milliseconds(1), time::milliseconds(15));
+      this->advanceClocks(1_ms, 15_ms);
       BOOST_CHECK_EQUAL(linkAB->getFace(nodeB).getCounters().nInInterests, 1);
       BOOST_CHECK_EQUAL(linkBD->getFace(nodeB).getCounters().nOutInterests, i);
 
@@ -298,7 +293,7 @@
       BOOST_CHECK(outRecord != pitEntry->out_end());
 
       // RTT between B and D
-      this->advanceClocks(time::milliseconds(5), time::milliseconds(160));
+      this->advanceClocks(5_ms, 160_ms);
       outRecord = pitEntry->getOutRecord(linkBD->getFace(nodeB), 0);
 
       BOOST_CHECK_EQUAL(linkBD->getFace(nodeB).getCounters().nInData, i);
@@ -308,7 +303,7 @@
       // Data is returned for the ping after 15 ms - will result in false measurement
       // 14+16-15 = 15ms
       // Since outRecord == pitEntry->out_end()
-      this->advanceClocks(time::milliseconds(1), time::milliseconds(15));
+      this->advanceClocks(1_ms, 15_ms);
       BOOST_CHECK_EQUAL(linkBD->getFace(nodeB).getCounters().nInData, i+1);
 
       break;
@@ -352,7 +347,7 @@
   // Send 6 interests let it change to use the 10 ms link
   runConsumer(6);
 
-  shared_ptr<TopologyLink> linkAC = topo.addLink("AC", time::milliseconds(5), {nodeA, nodeD});
+  shared_ptr<TopologyLink> linkAC = topo.addLink("AC", 5_ms, {nodeA, nodeD});
   topo.registerPrefix(nodeA, linkAC->getFace(nodeA), PRODUCER_PREFIX, 1);
 
   BOOST_CHECK_EQUAL(linkAC->getFace(nodeA).getCounters().nOutInterests, 0);