tests: fix several instances of the most vexing parse
Change-Id: I6195bb5cd3ea0fb85e4e10a78319936f0fe5f3f3
Refs: #4545
diff --git a/.travis.yml b/.travis.yml
index 2b37b90..ecb71ec 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -83,11 +83,17 @@
env: COMPILER=clang++-6.0
addons:
apt:
- sources: ["llvm-toolchain-trusty", "ubuntu-toolchain-r-test"]
+ sources: ["llvm-toolchain-trusty-6.0", "ubuntu-toolchain-r-test"]
packages: clang-6.0
+ - os: linux
+ env: COMPILER=clang++-7.0
+ addons:
+ apt:
+ sources: ["llvm-toolchain-trusty", "ubuntu-toolchain-r-test"]
+ packages: clang-7.0
# macOS/clang
- # https://docs.travis-ci.com/user/osx-ci-environment/#OS-X-Version
+ # https://docs.travis-ci.com/user/reference/osx/#OS-X-Version
- os: osx
osx_image: xcode7.3
env: OSX_VERSION=10.11
@@ -100,9 +106,12 @@
- os: osx
osx_image: xcode9.2
env: OSX_VERSION=10.12 USE_OPENSSL_1_1=yes
+ - os: osx
+ osx_image: xcode9.3beta
+ env: OSX_VERSION=10.13
allow_failures:
- - env: COMPILER=clang++-6.0
+ - env: COMPILER=clang++-7.0
- env: OSX_VERSION=10.12 USE_OPENSSL_1_1=yes
fast_finish: true
diff --git a/tests/unit-tests/key-locator.t.cpp b/tests/unit-tests/key-locator.t.cpp
index 8ae8d48..05dc94a 100644
--- a/tests/unit-tests/key-locator.t.cpp
+++ b/tests/unit-tests/key-locator.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).
*
@@ -42,7 +42,7 @@
// These octets are obtained by the snippet below.
// This check is intended to detect unexpected encoding change in the future.
- // for (Buffer::const_iterator it = wire.begin(); it != wire.end(); ++it) {
+ // for (auto it = wire.begin(); it != wire.end(); ++it) {
// printf("0x%02x, ", *it);
// }
static const uint8_t expected[] = {
@@ -51,7 +51,6 @@
BOOST_CHECK_EQUAL_COLLECTIONS(expected, expected + sizeof(expected),
wire.begin(), wire.end());
- BOOST_REQUIRE_NO_THROW(KeyLocator(wire));
KeyLocator b(wire);
BOOST_CHECK(a == b);
BOOST_CHECK_EQUAL(b.getType(), KeyLocator::KeyLocator_None);
@@ -74,7 +73,7 @@
// These octets are obtained by the snippet below.
// This check is intended to detect unexpected encoding change in the future.
- // for (Buffer::const_iterator it = wire.begin(); it != wire.end(); ++it) {
+ // for (auto it = wire.begin(); it != wire.end(); ++it) {
// printf("0x%02x, ", *it);
// }
static const uint8_t expected[] = {
@@ -83,7 +82,6 @@
BOOST_CHECK_EQUAL_COLLECTIONS(expected, expected + sizeof(expected),
wire.begin(), wire.end());
- BOOST_REQUIRE_NO_THROW(KeyLocator(wire));
KeyLocator b(wire);
BOOST_CHECK(a == b);
BOOST_CHECK_EQUAL(b.getType(), KeyLocator::KeyLocator_Name);
@@ -110,7 +108,7 @@
// These octets are obtained by the snippet below.
// This check is intended to detect unexpected encoding change in the future.
- // for (Buffer::const_iterator it = wire.begin(); it != wire.end(); ++it) {
+ // for (auto it = wire.begin(); it != wire.end(); ++it) {
// printf("0x%02x, ", *it);
// }
static const uint8_t expected[] = {
@@ -119,7 +117,6 @@
BOOST_CHECK_EQUAL_COLLECTIONS(expected, expected + sizeof(expected),
wire.begin(), wire.end());
- BOOST_REQUIRE_NO_THROW(KeyLocator(wire));
KeyLocator b(wire);
BOOST_CHECK(a == b);
BOOST_CHECK_EQUAL(b.getType(), KeyLocator::KeyLocator_KeyDigest);
@@ -170,7 +167,6 @@
0x1c, 0x03, 0x7f, 0x01, 0xcc
};
Block wire(wireOctets, sizeof(wireOctets));
- BOOST_REQUIRE_NO_THROW(KeyLocator(wire));
KeyLocator a(wire);
BOOST_CHECK_EQUAL(a.getType(), KeyLocator::KeyLocator_Unknown);
diff --git a/tests/unit-tests/net/face-uri.t.cpp b/tests/unit-tests/net/face-uri.t.cpp
index 73549df..71d76b1 100644
--- a/tests/unit-tests/net/face-uri.t.cpp
+++ b/tests/unit-tests/net/face-uri.t.cpp
@@ -122,11 +122,10 @@
BOOST_AUTO_TEST_CASE(ParseUdp)
{
- BOOST_CHECK_NO_THROW(FaceUri("udp://hostname:6363"));
+ FaceUri uri("udp://hostname:6363");
BOOST_CHECK_THROW(FaceUri("udp//hostname:6363"), FaceUri::Error);
BOOST_CHECK_THROW(FaceUri("udp://hostname:port"), FaceUri::Error);
- FaceUri uri;
BOOST_CHECK_EQUAL(uri.parse("udp//hostname:6363"), false);
BOOST_CHECK(uri.parse("udp://hostname:80"));
@@ -158,12 +157,12 @@
namespace ip = boost::asio::ip;
ip::udp::endpoint endpoint4(ip::address_v4::from_string("192.0.2.1"), 7777);
- BOOST_REQUIRE_NO_THROW(FaceUri(endpoint4));
- BOOST_CHECK_EQUAL(FaceUri(endpoint4).toString(), "udp4://192.0.2.1:7777");
+ uri = FaceUri(endpoint4);
+ BOOST_CHECK_EQUAL(uri.toString(), "udp4://192.0.2.1:7777");
ip::udp::endpoint endpoint6(ip::address_v6::from_string("2001:DB8::1"), 7777);
- BOOST_REQUIRE_NO_THROW(FaceUri(endpoint6));
- BOOST_CHECK_EQUAL(FaceUri(endpoint6).toString(), "udp6://[2001:db8::1]:7777");
+ uri = FaceUri(endpoint6);
+ BOOST_CHECK_EQUAL(uri.toString(), "udp6://[2001:db8::1]:7777");
BOOST_CHECK(uri.parse("udp6://[fe80::1%25eth1]:6363"));
BOOST_CHECK_EQUAL(uri.getHost(), "fe80::1%25eth1");
@@ -303,15 +302,15 @@
namespace ip = boost::asio::ip;
ip::tcp::endpoint endpoint4(ip::address_v4::from_string("192.0.2.1"), 7777);
- BOOST_REQUIRE_NO_THROW(FaceUri(endpoint4));
- BOOST_CHECK_EQUAL(FaceUri(endpoint4).toString(), "tcp4://192.0.2.1:7777");
+ uri = FaceUri(endpoint4);
+ BOOST_CHECK_EQUAL(uri.toString(), "tcp4://192.0.2.1:7777");
- BOOST_REQUIRE_NO_THROW(FaceUri(endpoint4, "wsclient"));
- BOOST_CHECK_EQUAL(FaceUri(endpoint4, "wsclient").toString(), "wsclient://192.0.2.1:7777");
+ uri = FaceUri(endpoint4, "wsclient");
+ BOOST_CHECK_EQUAL(uri.toString(), "wsclient://192.0.2.1:7777");
ip::tcp::endpoint endpoint6(ip::address_v6::from_string("2001:DB8::1"), 7777);
- BOOST_REQUIRE_NO_THROW(FaceUri(endpoint6));
- BOOST_CHECK_EQUAL(FaceUri(endpoint6).toString(), "tcp6://[2001:db8::1]:7777");
+ uri = FaceUri(endpoint6);
+ BOOST_CHECK_EQUAL(uri.toString(), "tcp6://[2001:db8::1]:7777");
BOOST_CHECK(uri.parse("tcp6://[fe80::1%25eth1]:6363"));
BOOST_CHECK_EQUAL(uri.getHost(), "fe80::1%25eth1");
@@ -441,8 +440,8 @@
#ifdef BOOST_ASIO_HAS_LOCAL_SOCKETS
using boost::asio::local::stream_protocol;
stream_protocol::endpoint endpoint("/var/run/example.sock");
- BOOST_REQUIRE_NO_THROW(FaceUri(endpoint));
- BOOST_CHECK_EQUAL(FaceUri(endpoint).toString(), "unix:///var/run/example.sock");
+ uri = FaceUri(endpoint);
+ BOOST_CHECK_EQUAL(uri.toString(), "unix:///var/run/example.sock");
#endif // BOOST_ASIO_HAS_LOCAL_SOCKETS
}
@@ -457,8 +456,8 @@
BOOST_CHECK_EQUAL(uri.getPath(), "");
int fd = 21;
- BOOST_REQUIRE_NO_THROW(FaceUri::fromFd(fd));
- BOOST_CHECK_EQUAL(FaceUri::fromFd(fd).toString(), "fd://21");
+ uri = FaceUri::fromFd(fd);
+ BOOST_CHECK_EQUAL(uri.toString(), "fd://21");
}
BOOST_AUTO_TEST_CASE(ParseEther)
@@ -474,8 +473,8 @@
BOOST_CHECK_EQUAL(uri.parse("ether://[08:00:27:zz:dd:01]"), false);
auto address = ethernet::Address::fromString("33:33:01:01:01:01");
- BOOST_REQUIRE_NO_THROW(FaceUri(address));
- BOOST_CHECK_EQUAL(FaceUri(address).toString(), "ether://[33:33:01:01:01:01]");
+ uri = FaceUri(address);
+ BOOST_CHECK_EQUAL(uri.toString(), "ether://[33:33:01:01:01:01]");
}
BOOST_FIXTURE_TEST_CASE(CanonizeEther, CanonizeFixture)
@@ -509,7 +508,7 @@
BOOST_CHECK_EQUAL(uri.parse("dev://eth0:8888"), false); // Bug #3896
std::string ifname = "en1";
- BOOST_REQUIRE_NO_THROW(uri = FaceUri::fromDev(ifname));
+ uri = FaceUri::fromDev(ifname);
BOOST_CHECK_EQUAL(uri.toString(), "dev://en1");
}
@@ -558,12 +557,12 @@
namespace ip = boost::asio::ip;
ip::udp::endpoint endpoint4(ip::udp::v4(), 7777);
- BOOST_REQUIRE_NO_THROW(FaceUri::fromUdpDev(endpoint4, "en1"));
- BOOST_CHECK_EQUAL(FaceUri::fromUdpDev(endpoint4, "en1").toString(), "udp4+dev://en1:7777");
+ uri = FaceUri::fromUdpDev(endpoint4, "en1");
+ BOOST_CHECK_EQUAL(uri.toString(), "udp4+dev://en1:7777");
ip::udp::endpoint endpoint6(ip::udp::v6(), 7777);
- BOOST_REQUIRE_NO_THROW(FaceUri::fromUdpDev(endpoint6, "en2"));
- BOOST_CHECK_EQUAL(FaceUri::fromUdpDev(endpoint6, "en2").toString(), "udp6+dev://en2:7777");
+ uri = FaceUri::fromUdpDev(endpoint6, "en2");
+ BOOST_CHECK_EQUAL(uri.toString(), "udp6+dev://en2:7777");
}
BOOST_FIXTURE_TEST_CASE(CanonizeUdpDev, CanonizeFixture)
diff --git a/tests/unit-tests/security/signature-sha256-with-ecdsa.t.cpp b/tests/unit-tests/security/signature-sha256-with-ecdsa.t.cpp
index edc15d7..658b1c2 100644
--- a/tests/unit-tests/security/signature-sha256-with-ecdsa.t.cpp
+++ b/tests/unit-tests/security/signature-sha256-with-ecdsa.t.cpp
@@ -77,7 +77,7 @@
Block sigValueBlock(sigValue, sizeof(sigValue));
Signature sig(sigInfoBlock, sigValueBlock);
- BOOST_CHECK_NO_THROW(SignatureSha256WithEcdsa(sig));
+ BOOST_CHECK_NO_THROW(SignatureSha256WithEcdsa{sig});
BOOST_CHECK_NO_THROW(sig.getKeyLocator());
}
diff --git a/tests/unit-tests/security/signature-sha256-with-rsa.t.cpp b/tests/unit-tests/security/signature-sha256-with-rsa.t.cpp
index 4348ade..4599178 100644
--- a/tests/unit-tests/security/signature-sha256-with-rsa.t.cpp
+++ b/tests/unit-tests/security/signature-sha256-with-rsa.t.cpp
@@ -82,7 +82,7 @@
Block sigValueBlock(sigValue, sizeof(sigValue));
Signature sig(sigInfoBlock, sigValueBlock);
- BOOST_CHECK_NO_THROW(SignatureSha256WithRsa(sig));
+ BOOST_CHECK_NO_THROW(SignatureSha256WithRsa{sig});
BOOST_CHECK_NO_THROW(sig.getKeyLocator());
}