tests: use std::nullopt

Change-Id: I7efdc8076c1bc4ced11dd3bdab7f199609009545
diff --git a/tests/daemon/mgmt/command-authenticator.t.cpp b/tests/daemon/mgmt/command-authenticator.t.cpp
index 6ef3ce8..2dd3da6 100644
--- a/tests/daemon/mgmt/command-authenticator.t.cpp
+++ b/tests/daemon/mgmt/command-authenticator.t.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2014-2022,  Regents of the University of California,
+ * Copyright (c) 2014-2023,  Regents of the University of California,
  *                           Arizona Board of Regents,
  *                           Colorado State University,
  *                           University Pierre & Marie Curie, Sorbonne University,
@@ -303,7 +303,7 @@
   BOOST_CHECK_EQUAL(authorize1_V02(
     [] (Interest& interest) {
       ndn::SignatureInfo sigInfo(interest.getName().at(ndn::command_interest::POS_SIG_INFO).blockFromValue());
-      sigInfo.setKeyLocator(ndn::nullopt);
+      sigInfo.setKeyLocator(std::nullopt);
       setNameComponent(interest, ndn::command_interest::POS_SIG_INFO, span(sigInfo.wireEncode()));
     }
   ), false);
@@ -312,7 +312,7 @@
   BOOST_CHECK_EQUAL(authorize1_V03(
     [] (Interest& interest) {
       auto sigInfo = interest.getSignatureInfo().value();
-      sigInfo.setKeyLocator(ndn::nullopt);
+      sigInfo.setKeyLocator(std::nullopt);
       interest.setSignatureInfo(sigInfo);
     }
   ), false);
@@ -371,7 +371,7 @@
   BOOST_CHECK_EQUAL(authorize1_V03(
     [] (Interest& interest) {
       auto sigInfo = interest.getSignatureInfo().value();
-      sigInfo.setTime(ndn::nullopt);
+      sigInfo.setTime(std::nullopt);
       interest.setSignatureInfo(sigInfo);
     }
   ), false);
diff --git a/tests/daemon/mgmt/rib-manager-sl-announce.t.cpp b/tests/daemon/mgmt/rib-manager-sl-announce.t.cpp
index b085657..1108a06 100644
--- a/tests/daemon/mgmt/rib-manager-sl-announce.t.cpp
+++ b/tests/daemon/mgmt/rib-manager-sl-announce.t.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2014-2022,  Regents of the University of California,
+ * Copyright (c) 2014-2023,  Regents of the University of California,
  *                           Arizona Board of Regents,
  *                           Colorado State University,
  *                           University Pierre & Marie Curie, Sorbonne University,
@@ -273,7 +273,7 @@
 
 BOOST_AUTO_TEST_CASE(AnnounceExpired)
 {
-  auto pa = makeTrustedAnn("/awrVv6V7", 1_h, std::pair(-3_h, -1_h));
+  auto pa = makeTrustedAnn("/awrVv6V7", 1_h, ndn::security::ValidityPeriod::makeRelative(-3_h, -1_h));
   BOOST_CHECK_EQUAL(slAnnounceSync(pa, 9087, 1_h), SlAnnounceResult::EXPIRED);
 
   BOOST_CHECK(findAnnRoute("/awrVv6V7", 9087) == nullptr);
diff --git a/tests/daemon/rib/route.t.cpp b/tests/daemon/rib/route.t.cpp
index dc999b7..c51e964 100644
--- a/tests/daemon/rib/route.t.cpp
+++ b/tests/daemon/rib/route.t.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2014-2022,  Regents of the University of California,
+ * Copyright (c) 2014-2023,  Regents of the University of California,
  *                           Arizona Board of Regents,
  *                           Colorado State University,
  *                           University Pierre & Marie Curie, Sorbonne University,
@@ -53,7 +53,7 @@
 
 BOOST_AUTO_TEST_CASE(BeforeNotBefore)
 {
-  auto pa = makePrefixAnn("/A", 212_s, {10_s, 80_s});
+  auto pa = makePrefixAnn("/A", 212_s, ndn::security::ValidityPeriod::makeRelative(10_s, 80_s));
   Route route(pa, 1053);
   BOOST_CHECK_LE(route.annExpires, time::steady_clock::now());
   BOOST_REQUIRE(route.expires);
@@ -62,7 +62,7 @@
 
 BOOST_AUTO_TEST_CASE(AfterNotAfter)
 {
-  auto pa = makePrefixAnn("/A", 212_s, {-80_s, -10_s});
+  auto pa = makePrefixAnn("/A", 212_s, ndn::security::ValidityPeriod::makeRelative(-80_s, -10_s));
   Route route(pa, 2972);
   BOOST_CHECK_LE(route.annExpires, time::steady_clock::now());
   BOOST_REQUIRE(route.expires);
@@ -71,7 +71,7 @@
 
 BOOST_AUTO_TEST_CASE(ExpirationLtValidity)
 {
-  auto pa = makePrefixAnn("/A", 212_s, {-100_s, 300_s});
+  auto pa = makePrefixAnn("/A", 212_s, ndn::security::ValidityPeriod::makeRelative(-100_s, 300_s));
   Route route(pa, 7804);
   BOOST_CHECK_EQUAL(route.annExpires, time::steady_clock::now() + 212_s);
   BOOST_REQUIRE(route.expires);
@@ -80,7 +80,7 @@
 
 BOOST_AUTO_TEST_CASE(ValidityLtExpiration)
 {
-  auto pa = makePrefixAnn("/A", 212_s, {-100_s, 200_s});
+  auto pa = makePrefixAnn("/A", 212_s, ndn::security::ValidityPeriod::makeRelative(-100_s, 200_s));
   Route route(pa, 7804);
   BOOST_CHECK_EQUAL(route.annExpires, time::steady_clock::now() + 200_s);
   BOOST_REQUIRE(route.expires);
diff --git a/tests/test-common.cpp b/tests/test-common.cpp
index 0a7c7f6..ef2ada0 100644
--- a/tests/test-common.cpp
+++ b/tests/test-common.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2014-2022,  Regents of the University of California,
+ * Copyright (c) 2014-2023,  Regents of the University of California,
  *                           Arizona Board of Regents,
  *                           Colorado State University,
  *                           University Pierre & Marie Curie, Sorbonne University,
@@ -36,7 +36,7 @@
   if (lifetime) {
     interest->setInterestLifetime(*lifetime);
   }
-  interest->setNonce(nonce ? ndn::make_optional(*nonce) : ndn::nullopt);
+  interest->setNonce(nonce);
   return interest;
 }
 
@@ -71,24 +71,15 @@
   ndn::PrefixAnnouncement pa;
   pa.setAnnouncedName(announcedName);
   pa.setExpiration(expiration);
-  pa.setValidityPeriod(validity ? ndn::make_optional(*validity) : ndn::nullopt);
+  pa.setValidityPeriod(validity);
   return pa;
 }
 
 ndn::PrefixAnnouncement
-makePrefixAnn(const Name& announcedName, time::milliseconds expiration,
-              std::pair<time::seconds, time::seconds> validityFromNow)
-{
-  auto now = time::system_clock::now();
-  return makePrefixAnn(announcedName, expiration,
-    ndn::security::ValidityPeriod(now + validityFromNow.first, now + validityFromNow.second));
-}
-
-ndn::PrefixAnnouncement
 signPrefixAnn(ndn::PrefixAnnouncement&& pa, ndn::KeyChain& keyChain,
               const ndn::security::SigningInfo& si, std::optional<uint64_t> version)
 {
-  pa.toData(keyChain, si, version ? ndn::make_optional(*version) : ndn::nullopt);
+  pa.toData(keyChain, si, version);
   return std::move(pa);
 }
 
diff --git a/tests/test-common.hpp b/tests/test-common.hpp
index 0986f11..a8b2f36 100644
--- a/tests/test-common.hpp
+++ b/tests/test-common.hpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2014-2022,  Regents of the University of California,
+ * Copyright (c) 2014-2023,  Regents of the University of California,
  *                           Arizona Board of Regents,
  *                           Colorado State University,
  *                           University Pierre & Marie Curie, Sorbonne University,
@@ -86,7 +86,7 @@
 
 /**
  * \brief Replace a name component in a packet
- * \param[inout] pkt the packet
+ * \param[in,out] pkt the packet
  * \param index the index of the name component to replace
  * \param args arguments to name::Component constructor
  */
@@ -107,16 +107,6 @@
               std::optional<ndn::security::ValidityPeriod> validity = std::nullopt);
 
 /**
- * \brief Create a prefix announcement without signing
- * \param announcedName announced name
- * \param expiration expiration period
- * \param validityFromNow validity period, relative from now
- */
-ndn::PrefixAnnouncement
-makePrefixAnn(const Name& announcedName, time::milliseconds expiration,
-              std::pair<time::seconds, time::seconds> validityFromNow);
-
-/**
  * \brief Sign a prefix announcement
  */
 ndn::PrefixAnnouncement
diff --git a/tools/nfdc/face-helpers.hpp b/tools/nfdc/face-helpers.hpp
index 1ceb976..fbd5faa 100644
--- a/tools/nfdc/face-helpers.hpp
+++ b/tools/nfdc/face-helpers.hpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2014-2022,  Regents of the University of California,
+ * Copyright (c) 2014-2023,  Regents of the University of California,
  *                           Arizona Board of Regents,
  *                           Colorado State University,
  *                           University Pierre & Marie Curie, Sorbonne University,
@@ -72,7 +72,7 @@
   /** \brief Find face by FaceId or FaceUri.
    *  \param faceIdOrUri either a FaceId (uint64_t) or a FaceUri
    *  \param allowMulti effective only if \p faceIdOrUri contains a FaceUri
-   *  \throw ndn::bad_any_cast faceIdOrUri is neither uint64_t nor FaceUri
+   *  \throw std::bad_any_cast faceIdOrUri is neither uint64_t nor FaceUri
    */
   Code
   execute(const std::any& faceIdOrUri, bool allowMulti = false);