Use std::string_view in several APIs
Change-Id: I2c13b229162b247738cbf46d6bf71fc69d45816f
diff --git a/tests/unit/util/logging.t.cpp b/tests/unit/util/logging.t.cpp
index 821e11e..02da03a 100644
--- a/tests/unit/util/logging.t.cpp
+++ b/tests/unit/util/logging.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2013-2022 Regents of the University of California.
+ * Copyright (c) 2013-2023 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -162,7 +162,7 @@
NDN_LOG_MEMBER_INIT_SPECIALIZED((ClassTemplateWithLogger<int, double>), ndn.util.tests.Specialized1);
NDN_LOG_MEMBER_INIT_SPECIALIZED((ClassTemplateWithLogger<int, std::string>), ndn.util.tests.Specialized2);
-const time::microseconds LOG_SYSTIME(1468108800311239LL);
+constexpr time::microseconds LOG_SYSTIME{1468108800311239LL};
const std::string LOG_SYSTIME_STR("1468108800.311239");
class LoggingFixture : public ndn::tests::ClockFixture
@@ -177,7 +177,7 @@
Logging::setDestination(os, true);
}
- ~LoggingFixture()
+ ~LoggingFixture() override
{
Logging::get().setLevelImpl(m_oldEnabledLevel);
Logging::setDestination(m_oldDestination);
diff --git a/tests/unit/util/string-helper.t.cpp b/tests/unit/util/string-helper.t.cpp
index e3229e5..3816fab 100644
--- a/tests/unit/util/string-helper.t.cpp
+++ b/tests/unit/util/string-helper.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2013-2022 Regents of the University of California.
+ * Copyright (c) 2013-2023 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -182,8 +182,7 @@
BOOST_CHECK_EQUAL(escape(":/?#[]@"), "%3A%2F%3F%23%5B%5D%40");
output_test_stream os;
- const char str[] = "\x01\x2a\x3b\xc4\xde\xfa\xb5\xcd\xef";
- escape(os, str, std::strlen(str));
+ escape(os, "\x01\x2a\x3b\xc4\xde\xfa\xb5\xcd\xef");
BOOST_CHECK(os.is_equal("%01%2A%3B%C4%DE%FA%B5%CD%EF"));
}
@@ -196,8 +195,7 @@
BOOST_CHECK_EQUAL(unescape("Bad %a"), "Bad %a");
output_test_stream os;
- const char str[] = "%01%2a%3B%c4%de%fA%B5%Cd%EF";
- unescape(os, str, std::strlen(str));
+ unescape(os, "%01%2a%3B%c4%de%fA%B5%Cd%EF");
BOOST_CHECK(os.is_equal("\x01\x2a\x3b\xc4\xde\xfa\xb5\xcd\xef"));
}