Improve and simplify code with modern C++ features
Change-Id: I28d84df3087492ab2ecbeb91169a2cde12c9e31e
diff --git a/tests/unit-tests/security/v2/trust-anchor-container.t.cpp b/tests/unit-tests/security/v2/trust-anchor-container.t.cpp
index 30749ac..efd6ca3 100644
--- a/tests/unit-tests/security/v2/trust-anchor-container.t.cpp
+++ b/tests/unit-tests/security/v2/trust-anchor-container.t.cpp
@@ -46,16 +46,15 @@
public:
AnchorContainerTestFixture()
{
- boost::filesystem::create_directory(boost::filesystem::path(UNIT_TEST_CONFIG_PATH));
+ namespace fs = boost::filesystem;
- certDirPath = boost::filesystem::path(UNIT_TEST_CONFIG_PATH) / std::string("test-cert-dir");
- boost::filesystem::create_directory(certDirPath);
+ fs::create_directory(fs::path(UNIT_TEST_CONFIG_PATH));
- certPath1 = boost::filesystem::path(UNIT_TEST_CONFIG_PATH) /
- std::string("test-cert-dir") / std::string("trust-anchor-1.cert");
+ certDirPath = fs::path(UNIT_TEST_CONFIG_PATH) / "test-cert-dir";
+ fs::create_directory(certDirPath);
- certPath2 = boost::filesystem::path(UNIT_TEST_CONFIG_PATH) /
- std::string("test-cert-dir") / std::string("trust-anchor-2.cert");
+ certPath1 = fs::path(UNIT_TEST_CONFIG_PATH) / "test-cert-dir" / "trust-anchor-1.cert";
+ certPath2 = fs::path(UNIT_TEST_CONFIG_PATH) / "test-cert-dir" / "trust-anchor-2.cert";
identity1 = addIdentity("/TestAnchorContainer/First");
cert1 = identity1.getDefaultKey().getDefaultCertificate();
diff --git a/tests/unit-tests/security/v2/validator-config/rule.t.cpp b/tests/unit-tests/security/v2/validator-config/rule.t.cpp
index 6c2e631..bb78dfe 100644
--- a/tests/unit-tests/security/v2/validator-config/rule.t.cpp
+++ b/tests/unit-tests/security/v2/validator-config/rule.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2013-2017 Regents of the University of California.
+ * Copyright (c) 2013-2018 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -157,9 +157,9 @@
BOOST_FIXTURE_TEST_CASE_TEMPLATE(FilterAndChecker, PktType, PktTypes, RuleFixture<PktType::value>)
{
- std::string config = std::string("") + R"CONF(
+ std::string config = R"CONF(
id rule-id
- for )CONF" + (PktType::value == tlv::Data ? "data" : "interest") + R"CONF(
+ for )CONF" + (PktType::value == tlv::Data ? "data"s : "interest"s) + R"CONF(
filter
{
type name