blob: fe34b0114d002e402ef051bef7910f1b23e91502 [file] [log] [blame]
Junxiao Shi77dcadd2014-10-05 14:40:54 -07001/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
Yanbiao Liac8b4ca2017-07-10 02:27:50 -07002/*
Davide Pesavento152ef442023-04-22 02:02:29 -04003 * Copyright (c) 2013-2023 Regents of the University of California,
Junxiao Shid5c2f0c2017-04-04 09:52:11 +00004 * Arizona Board of Regents,
5 * Colorado State University,
6 * University Pierre & Marie Curie, Sorbonne University,
7 * Washington University in St. Louis,
8 * Beijing Institute of Technology,
9 * The University of Memphis.
Junxiao Shi77dcadd2014-10-05 14:40:54 -070010 *
11 * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
12 *
13 * ndn-cxx library is free software: you can redistribute it and/or modify it under the
14 * terms of the GNU Lesser General Public License as published by the Free Software
15 * Foundation, either version 3 of the License, or (at your option) any later version.
16 *
17 * ndn-cxx library is distributed in the hope that it will be useful, but WITHOUT ANY
18 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
19 * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
20 *
21 * You should have received copies of the GNU General Public License and GNU Lesser
22 * General Public License along with ndn-cxx, e.g., in COPYING.md file. If not, see
23 * <http://www.gnu.org/licenses/>.
24 *
25 * See AUTHORS.md for complete list of ndn-cxx authors and contributors.
26 */
27
Davide Pesavento7e780642018-11-24 15:51:34 -050028#include "ndn-cxx/net/face-uri.hpp"
Davide Pesavento4c1ad4c2020-11-16 21:12:02 -050029#include "ndn-cxx/net/network-interface.hpp"
30#include "ndn-cxx/net/network-monitor.hpp"
Junxiao Shi77dcadd2014-10-05 14:40:54 -070031
Davide Pesavento7e780642018-11-24 15:51:34 -050032#include "tests/boost-test.hpp"
Davide Pesavento7e780642018-11-24 15:51:34 -050033#include "tests/unit/net/network-configuration-detector.hpp"
Junxiao Shi77dcadd2014-10-05 14:40:54 -070034
Davide Pesavento152ef442023-04-22 02:02:29 -040035#include <boost/concept_check.hpp>
36
Davide Pesavento47ce2ee2023-05-09 01:33:33 -040037namespace ndn::tests {
Alexander Afanasyev1286e022015-01-26 10:42:29 -080038
Davide Pesavento152ef442023-04-22 02:02:29 -040039BOOST_CONCEPT_ASSERT((boost::EqualityComparable<FaceUri>));
Junxiao Shi382de672023-08-11 18:17:10 +000040BOOST_CONCEPT_ASSERT((boost::Comparable<FaceUri>));
Davide Pesavento152ef442023-04-22 02:02:29 -040041
Junxiao Shi25467942017-06-30 02:53:14 +000042BOOST_AUTO_TEST_SUITE(Net)
Davide Pesaventoeee3e822016-11-26 19:19:34 +010043BOOST_AUTO_TEST_SUITE(TestFaceUri)
Junxiao Shi77dcadd2014-10-05 14:40:54 -070044
Davide Pesavento4c1ad4c2020-11-16 21:12:02 -050045class CanonizeFixture
Junxiao Shi4083c8d2014-10-12 16:43:16 -070046{
47protected:
Davide Pesavento4c1ad4c2020-11-16 21:12:02 -050048 CanonizeFixture()
49 {
50 static const auto netifs = [this] {
51 net::NetworkMonitor netmon(m_io);
52 if (netmon.getCapabilities() & net::NetworkMonitor::CAP_ENUM) {
53 netmon.onEnumerationCompleted.connect([this] { m_io.stop(); });
54 m_io.run();
55#if BOOST_VERSION >= 106600
56 m_io.restart();
57#else
58 m_io.reset();
59#endif
60 }
61 return netmon.listNetworkInterfaces();
62 }();
63
64 if (!netifs.empty()) {
65 m_netif = netifs.front();
66 }
67 }
68
Junxiao Shi4083c8d2014-10-12 16:43:16 -070069 void
Davide Pesavento2d7c5852022-07-18 16:02:52 -040070 runTest(const std::string& request, bool shouldSucceed, const std::string& expectedUri = "")
Davide Pesaventoe1081cd2016-12-19 23:58:15 -050071 {
Davide Pesavento2d7c5852022-07-18 16:02:52 -040072 BOOST_TEST_CONTEXT(std::quoted(request) << " should " << (shouldSucceed ? "succeed" : "fail")) {
73 bool didInvokeCb = false;
74 FaceUri uri(request);
75 uri.canonize(
76 [&] (const FaceUri& canonicalUri) {
77 BOOST_CHECK_EQUAL(didInvokeCb, false);
78 didInvokeCb = true;
79 BOOST_CHECK_EQUAL(shouldSucceed, true);
80 if (shouldSucceed) {
81 BOOST_CHECK_EQUAL(canonicalUri.toString(), expectedUri);
82 }
83 },
84 [&] (const std::string&) {
85 BOOST_CHECK_EQUAL(didInvokeCb, false);
86 didInvokeCb = true;
87 BOOST_CHECK_EQUAL(shouldSucceed, false);
88 },
89 m_io, 30_s);
Davide Pesaventoe1081cd2016-12-19 23:58:15 -050090
Davide Pesavento2d7c5852022-07-18 16:02:52 -040091 m_io.run();
92 BOOST_CHECK_EQUAL(didInvokeCb, true);
93#if BOOST_VERSION >= 106600
94 m_io.restart();
95#else
96 m_io.reset();
97#endif
Junxiao Shi4083c8d2014-10-12 16:43:16 -070098 }
Junxiao Shi4083c8d2014-10-12 16:43:16 -070099 }
100
Davide Pesavento4c1ad4c2020-11-16 21:12:02 -0500101protected:
102 shared_ptr<const net::NetworkInterface> m_netif;
103
Junxiao Shi4083c8d2014-10-12 16:43:16 -0700104private:
105 boost::asio::io_service m_io;
Junxiao Shi4083c8d2014-10-12 16:43:16 -0700106};
107
Junxiao Shi4083c8d2014-10-12 16:43:16 -0700108BOOST_AUTO_TEST_CASE(ParseInternal)
Junxiao Shi77dcadd2014-10-05 14:40:54 -0700109{
110 FaceUri uri;
111
112 BOOST_CHECK(uri.parse("internal://"));
113 BOOST_CHECK_EQUAL(uri.getScheme(), "internal");
114 BOOST_CHECK_EQUAL(uri.getHost(), "");
115 BOOST_CHECK_EQUAL(uri.getPort(), "");
116 BOOST_CHECK_EQUAL(uri.getPath(), "");
117
118 BOOST_CHECK_EQUAL(uri.parse("internal:"), false);
119 BOOST_CHECK_EQUAL(uri.parse("internal:/"), false);
120}
121
Junxiao Shi4083c8d2014-10-12 16:43:16 -0700122BOOST_AUTO_TEST_CASE(ParseUdp)
Junxiao Shi77dcadd2014-10-05 14:40:54 -0700123{
Davide Pesavento8a8c01b2018-03-11 00:07:52 -0500124 FaceUri uri("udp://hostname:6363");
Junxiao Shi77dcadd2014-10-05 14:40:54 -0700125 BOOST_CHECK_THROW(FaceUri("udp//hostname:6363"), FaceUri::Error);
126 BOOST_CHECK_THROW(FaceUri("udp://hostname:port"), FaceUri::Error);
127
Junxiao Shi77dcadd2014-10-05 14:40:54 -0700128 BOOST_CHECK_EQUAL(uri.parse("udp//hostname:6363"), false);
129
130 BOOST_CHECK(uri.parse("udp://hostname:80"));
131 BOOST_CHECK_EQUAL(uri.getScheme(), "udp");
132 BOOST_CHECK_EQUAL(uri.getHost(), "hostname");
133 BOOST_CHECK_EQUAL(uri.getPort(), "80");
134 BOOST_CHECK_EQUAL(uri.getPath(), "");
135
136 BOOST_CHECK(uri.parse("udp4://192.0.2.1:20"));
137 BOOST_CHECK_EQUAL(uri.getScheme(), "udp4");
138 BOOST_CHECK_EQUAL(uri.getHost(), "192.0.2.1");
139 BOOST_CHECK_EQUAL(uri.getPort(), "20");
140 BOOST_CHECK_EQUAL(uri.getPath(), "");
141
142 BOOST_CHECK(uri.parse("udp6://[2001:db8:3f9:0::1]:6363"));
143 BOOST_CHECK_EQUAL(uri.getScheme(), "udp6");
144 BOOST_CHECK_EQUAL(uri.getHost(), "2001:db8:3f9:0::1");
145 BOOST_CHECK_EQUAL(uri.getPort(), "6363");
146 BOOST_CHECK_EQUAL(uri.getPath(), "");
147
148 BOOST_CHECK(uri.parse("udp6://[2001:db8:3f9:0:3025:ccc5:eeeb:86d3]:6363"));
149 BOOST_CHECK_EQUAL(uri.getScheme(), "udp6");
150 BOOST_CHECK_EQUAL(uri.getHost(), "2001:db8:3f9:0:3025:ccc5:eeeb:86d3");
151 BOOST_CHECK_EQUAL(uri.getPort(), "6363");
152 BOOST_CHECK_EQUAL(uri.getPath(), "");
153
154 BOOST_CHECK_EQUAL(uri.parse("udp6://[2001:db8:3f9:0:3025:ccc5:eeeb:86dg]:6363"), false);
155
Davide Pesaventoe1081cd2016-12-19 23:58:15 -0500156 namespace ip = boost::asio::ip;
157
Junxiao Shi77dcadd2014-10-05 14:40:54 -0700158 ip::udp::endpoint endpoint4(ip::address_v4::from_string("192.0.2.1"), 7777);
Davide Pesavento8a8c01b2018-03-11 00:07:52 -0500159 uri = FaceUri(endpoint4);
160 BOOST_CHECK_EQUAL(uri.toString(), "udp4://192.0.2.1:7777");
Junxiao Shi77dcadd2014-10-05 14:40:54 -0700161
162 ip::udp::endpoint endpoint6(ip::address_v6::from_string("2001:DB8::1"), 7777);
Davide Pesavento8a8c01b2018-03-11 00:07:52 -0500163 uri = FaceUri(endpoint6);
164 BOOST_CHECK_EQUAL(uri.toString(), "udp6://[2001:db8::1]:7777");
Yanbiao Liac8b4ca2017-07-10 02:27:50 -0700165
166 BOOST_CHECK(uri.parse("udp6://[fe80::1%25eth1]:6363"));
167 BOOST_CHECK_EQUAL(uri.getHost(), "fe80::1%25eth1");
168
169 BOOST_CHECK(uri.parse("udp6://[fe80::1%eth1]:6363"));
170 BOOST_CHECK_EQUAL(uri.getHost(), "fe80::1%eth1");
171
172 BOOST_CHECK(uri.parse("udp6://[fe80::1%1]:6363"));
173 BOOST_CHECK(uri.parse("udp6://[fe80::1%eth1]"));
Davide Pesaventob984e322018-01-24 19:40:07 -0500174
175 BOOST_CHECK(uri.parse("udp6://[ff01::114%eth#1]"));
176 BOOST_CHECK(uri.parse("udp6://[ff01::114%eth.1,2]"));
177 BOOST_CHECK(uri.parse("udp6://[ff01::114%a+b-c=0]"));
178 BOOST_CHECK(uri.parse("udp6://[ff01::114%[foo]]"));
179 BOOST_CHECK(uri.parse("udp6://[ff01::114%]]"));
180 BOOST_CHECK(uri.parse("udp6://[ff01::114%%]"));
181 BOOST_CHECK(!uri.parse("udp6://[ff01::114%]"));
182 BOOST_CHECK(!uri.parse("udp6://[ff01::114%foo bar]"));
183 BOOST_CHECK(!uri.parse("udp6://[ff01::114%foo/bar]"));
184 BOOST_CHECK(!uri.parse("udp6://[ff01::114%eth0:1]"));
Junxiao Shi77dcadd2014-10-05 14:40:54 -0700185}
186
Davide Pesaventoe1081cd2016-12-19 23:58:15 -0500187BOOST_FIXTURE_TEST_CASE(IsCanonicalUdp, CanonizeFixture)
Junxiao Shi4083c8d2014-10-12 16:43:16 -0700188{
189 BOOST_CHECK_EQUAL(FaceUri::canCanonize("udp"), true);
190 BOOST_CHECK_EQUAL(FaceUri::canCanonize("udp4"), true);
191 BOOST_CHECK_EQUAL(FaceUri::canCanonize("udp6"), true);
192
193 BOOST_CHECK_EQUAL(FaceUri("udp4://192.0.2.1:6363").isCanonical(), true);
194 BOOST_CHECK_EQUAL(FaceUri("udp://192.0.2.1:6363").isCanonical(), false);
195 BOOST_CHECK_EQUAL(FaceUri("udp4://192.0.2.1").isCanonical(), false);
196 BOOST_CHECK_EQUAL(FaceUri("udp4://192.0.2.1:6363/").isCanonical(), false);
197 BOOST_CHECK_EQUAL(FaceUri("udp6://[2001:db8::1]:6363").isCanonical(), true);
198 BOOST_CHECK_EQUAL(FaceUri("udp6://[2001:db8::01]:6363").isCanonical(), false);
Eric Newberry71aecae2017-05-29 00:22:39 -0700199 BOOST_CHECK_EQUAL(FaceUri("udp://[2001:db8::1]:6363").isCanonical(), false);
Junxiao Shi4083c8d2014-10-12 16:43:16 -0700200 BOOST_CHECK_EQUAL(FaceUri("udp://example.net:6363").isCanonical(), false);
201 BOOST_CHECK_EQUAL(FaceUri("udp4://example.net:6363").isCanonical(), false);
202 BOOST_CHECK_EQUAL(FaceUri("udp6://example.net:6363").isCanonical(), false);
203 BOOST_CHECK_EQUAL(FaceUri("udp4://224.0.23.170:56363").isCanonical(), true);
Eric Newberry71aecae2017-05-29 00:22:39 -0700204 BOOST_CHECK_EQUAL(FaceUri("udp4://[2001:db8::1]:6363").isCanonical(), false);
205 BOOST_CHECK_EQUAL(FaceUri("udp6://192.0.2.1:6363").isCanonical(), false);
Yanbiao Liac8b4ca2017-07-10 02:27:50 -0700206
Davide Pesavento4c1ad4c2020-11-16 21:12:02 -0500207 if (m_netif) {
208 auto name = m_netif->getName();
209 auto index = to_string(m_netif->getIndex());
Yanbiao Liac8b4ca2017-07-10 02:27:50 -0700210
211 BOOST_CHECK_EQUAL(FaceUri("udp6://[fe80::1%" + name + "]:6363").isCanonical(), true);
212 BOOST_CHECK_EQUAL(FaceUri("udp6://[fe80::1%" + index + "]:6363").isCanonical(), false);
213 BOOST_CHECK_EQUAL(FaceUri("udp6://[fe80::1%" + name + "]").isCanonical(), false);
214 BOOST_CHECK_EQUAL(FaceUri("udp6://[fe80::1068:dddb:fe26:fe3f%25en0]:6363").isCanonical(), false);
215 }
Alexander Afanasyev1286e022015-01-26 10:42:29 -0800216}
217
Davide Pesaventoe1081cd2016-12-19 23:58:15 -0500218BOOST_AUTO_TEST_CASE_EXPECTED_FAILURES(CanonizeUdpV4, 1)
Alexander Afanasyev1286e022015-01-26 10:42:29 -0800219BOOST_FIXTURE_TEST_CASE(CanonizeUdpV4, CanonizeFixture)
220{
Davide Pesaventoeee3e822016-11-26 19:19:34 +0100221 SKIP_IF_IPV4_UNAVAILABLE();
Junxiao Shi4083c8d2014-10-12 16:43:16 -0700222
223 // IPv4 unicast
Davide Pesavento2d7c5852022-07-18 16:02:52 -0400224 runTest("udp4://192.0.2.1:6363", true, "udp4://192.0.2.1:6363");
225 runTest("udp://192.0.2.2:6363", true, "udp4://192.0.2.2:6363");
226 runTest("udp4://192.0.2.3", true, "udp4://192.0.2.3:6363");
227 runTest("udp4://192.0.2.4:6363/", true, "udp4://192.0.2.4:6363");
228 runTest("udp4://192.0.2.5:9695", true, "udp4://192.0.2.5:9695");
229 runTest("udp4://192.0.2.666:6363", false);
230 runTest("udp4://192.0.2.7:99999", false); // Bug #3897
231 runTest("udp4://google-public-dns-a.google.com", true, "udp4://8.8.8.8:6363");
232 runTest("udp4://google-public-dns-a.google.com:70000", false);
233 runTest("udp4://invalid.invalid.", false);
234 runTest("udp://invalid.invalid.", false);
Junxiao Shi4083c8d2014-10-12 16:43:16 -0700235
236 // IPv4 multicast
Davide Pesavento2d7c5852022-07-18 16:02:52 -0400237 runTest("udp4://224.0.23.170:56363", true, "udp4://224.0.23.170:56363");
238 runTest("udp4://224.0.23.170", true, "udp4://224.0.23.170:56363");
239 runTest("udp4://all-routers.mcast.net:56363", true, "udp4://224.0.0.2:56363");
240 runTest("udp://all-routers.mcast.net:56363", true, "udp4://224.0.0.2:56363");
Junxiao Shi4083c8d2014-10-12 16:43:16 -0700241
Eric Newberry71aecae2017-05-29 00:22:39 -0700242 // IPv6 used with udp4 protocol - not canonical
Davide Pesavento2d7c5852022-07-18 16:02:52 -0400243 runTest("udp4://[2001:db8::1]:6363", false);
Alexander Afanasyev1286e022015-01-26 10:42:29 -0800244}
245
Davide Pesaventoe1081cd2016-12-19 23:58:15 -0500246BOOST_AUTO_TEST_CASE_EXPECTED_FAILURES(CanonizeUdpV6, 1)
Alexander Afanasyev1286e022015-01-26 10:42:29 -0800247BOOST_FIXTURE_TEST_CASE(CanonizeUdpV6, CanonizeFixture)
248{
Davide Pesaventoeee3e822016-11-26 19:19:34 +0100249 SKIP_IF_IPV6_UNAVAILABLE();
Alexander Afanasyev1286e022015-01-26 10:42:29 -0800250
Junxiao Shi4083c8d2014-10-12 16:43:16 -0700251 // IPv6 unicast
Davide Pesavento2d7c5852022-07-18 16:02:52 -0400252 runTest("udp6://[2001:db8::1]:6363", true, "udp6://[2001:db8::1]:6363");
253 runTest("udp6://[2001:db8::1]", true, "udp6://[2001:db8::1]:6363");
254 runTest("udp://[2001:db8::1]:6363", true, "udp6://[2001:db8::1]:6363");
255 runTest("udp6://[2001:db8::01]:6363", true, "udp6://[2001:db8::1]:6363");
256 runTest("udp6://[2001::db8::1]:6363", false);
257 runTest("udp6://[2001:db8::1]:99999", false); // Bug #3897
258 runTest("udp6://google-public-dns-a.google.com", true, "udp6://[2001:4860:4860::8888]:6363");
259 runTest("udp6://google-public-dns-a.google.com:70000", false);
260 runTest("udp6://invalid.invalid.", false);
Junxiao Shi4083c8d2014-10-12 16:43:16 -0700261
262 // IPv6 multicast
Davide Pesavento2d7c5852022-07-18 16:02:52 -0400263 runTest("udp6://[ff02::2]:56363", true, "udp6://[ff02::2]:56363");
264 runTest("udp6://[ff02::2]", true, "udp6://[ff02::2]:56363");
Junxiao Shi4083c8d2014-10-12 16:43:16 -0700265
Eric Newberry71aecae2017-05-29 00:22:39 -0700266 // IPv4 used with udp6 protocol - not canonical
Davide Pesavento2d7c5852022-07-18 16:02:52 -0400267 runTest("udp6://192.0.2.1:6363", false);
Eric Newberry71aecae2017-05-29 00:22:39 -0700268
Davide Pesavento4c1ad4c2020-11-16 21:12:02 -0500269 if (m_netif) {
270 auto name = m_netif->getName();
271 auto index = to_string(m_netif->getIndex());
Yanbiao Liac8b4ca2017-07-10 02:27:50 -0700272
Davide Pesavento2d7c5852022-07-18 16:02:52 -0400273 runTest("udp6://[fe80::1068:dddb:fe26:fe3f%25" + name + "]:6363", true,
Yanbiao Liac8b4ca2017-07-10 02:27:50 -0700274 "udp6://[fe80::1068:dddb:fe26:fe3f%" + name + "]:6363");
275
Davide Pesavento2d7c5852022-07-18 16:02:52 -0400276 runTest("udp6://[fe80::1068:dddb:fe26:fe3f%" + index + "]:6363", true,
Yanbiao Liac8b4ca2017-07-10 02:27:50 -0700277 "udp6://[fe80::1068:dddb:fe26:fe3f%" + name + "]:6363");
278 }
Junxiao Shi4083c8d2014-10-12 16:43:16 -0700279}
280
281BOOST_AUTO_TEST_CASE(ParseTcp)
Junxiao Shi77dcadd2014-10-05 14:40:54 -0700282{
283 FaceUri uri;
284
285 BOOST_CHECK(uri.parse("tcp://random.host.name"));
286 BOOST_CHECK_EQUAL(uri.getScheme(), "tcp");
287 BOOST_CHECK_EQUAL(uri.getHost(), "random.host.name");
288 BOOST_CHECK_EQUAL(uri.getPort(), "");
289 BOOST_CHECK_EQUAL(uri.getPath(), "");
290
291 BOOST_CHECK_EQUAL(uri.parse("tcp://192.0.2.1:"), false);
292 BOOST_CHECK_EQUAL(uri.parse("tcp://[::zzzz]"), false);
293
Davide Pesaventoe1081cd2016-12-19 23:58:15 -0500294 namespace ip = boost::asio::ip;
295
Junxiao Shi77dcadd2014-10-05 14:40:54 -0700296 ip::tcp::endpoint endpoint4(ip::address_v4::from_string("192.0.2.1"), 7777);
Davide Pesavento8a8c01b2018-03-11 00:07:52 -0500297 uri = FaceUri(endpoint4);
298 BOOST_CHECK_EQUAL(uri.toString(), "tcp4://192.0.2.1:7777");
Junxiao Shi77dcadd2014-10-05 14:40:54 -0700299
Davide Pesavento8a8c01b2018-03-11 00:07:52 -0500300 uri = FaceUri(endpoint4, "wsclient");
301 BOOST_CHECK_EQUAL(uri.toString(), "wsclient://192.0.2.1:7777");
Junxiao Shi77dcadd2014-10-05 14:40:54 -0700302
303 ip::tcp::endpoint endpoint6(ip::address_v6::from_string("2001:DB8::1"), 7777);
Davide Pesavento8a8c01b2018-03-11 00:07:52 -0500304 uri = FaceUri(endpoint6);
305 BOOST_CHECK_EQUAL(uri.toString(), "tcp6://[2001:db8::1]:7777");
Yanbiao Liac8b4ca2017-07-10 02:27:50 -0700306
307 BOOST_CHECK(uri.parse("tcp6://[fe80::1%25eth1]:6363"));
308 BOOST_CHECK_EQUAL(uri.getHost(), "fe80::1%25eth1");
309
310 BOOST_CHECK(uri.parse("tcp6://[fe80::1%eth1]:6363"));
311 BOOST_CHECK_EQUAL(uri.getHost(), "fe80::1%eth1");
312
313 BOOST_CHECK(uri.parse("tcp6://[fe80::1%1]:6363"));
314 BOOST_CHECK(uri.parse("tcp6://[fe80::1%eth1]"));
Junxiao Shi77dcadd2014-10-05 14:40:54 -0700315}
316
Davide Pesaventoe1081cd2016-12-19 23:58:15 -0500317BOOST_FIXTURE_TEST_CASE(IsCanonicalTcp, CanonizeFixture)
Junxiao Shi4083c8d2014-10-12 16:43:16 -0700318{
319 BOOST_CHECK_EQUAL(FaceUri::canCanonize("tcp"), true);
320 BOOST_CHECK_EQUAL(FaceUri::canCanonize("tcp4"), true);
321 BOOST_CHECK_EQUAL(FaceUri::canCanonize("tcp6"), true);
322
323 BOOST_CHECK_EQUAL(FaceUri("tcp4://192.0.2.1:6363").isCanonical(), true);
324 BOOST_CHECK_EQUAL(FaceUri("tcp://192.0.2.1:6363").isCanonical(), false);
325 BOOST_CHECK_EQUAL(FaceUri("tcp4://192.0.2.1").isCanonical(), false);
326 BOOST_CHECK_EQUAL(FaceUri("tcp4://192.0.2.1:6363/").isCanonical(), false);
327 BOOST_CHECK_EQUAL(FaceUri("tcp6://[2001:db8::1]:6363").isCanonical(), true);
328 BOOST_CHECK_EQUAL(FaceUri("tcp6://[2001:db8::01]:6363").isCanonical(), false);
Eric Newberry71aecae2017-05-29 00:22:39 -0700329 BOOST_CHECK_EQUAL(FaceUri("tcp://[2001:db8::1]:6363").isCanonical(), false);
Junxiao Shi4083c8d2014-10-12 16:43:16 -0700330 BOOST_CHECK_EQUAL(FaceUri("tcp://example.net:6363").isCanonical(), false);
331 BOOST_CHECK_EQUAL(FaceUri("tcp4://example.net:6363").isCanonical(), false);
332 BOOST_CHECK_EQUAL(FaceUri("tcp6://example.net:6363").isCanonical(), false);
333 BOOST_CHECK_EQUAL(FaceUri("tcp4://224.0.23.170:56363").isCanonical(), false);
Eric Newberry71aecae2017-05-29 00:22:39 -0700334 BOOST_CHECK_EQUAL(FaceUri("tcp4://[2001:db8::1]:6363").isCanonical(), false);
335 BOOST_CHECK_EQUAL(FaceUri("tcp6://192.0.2.1:6363").isCanonical(), false);
Yanbiao Liac8b4ca2017-07-10 02:27:50 -0700336
Davide Pesavento4c1ad4c2020-11-16 21:12:02 -0500337 if (m_netif) {
338 auto name = m_netif->getName();
339 auto index = to_string(m_netif->getIndex());
Yanbiao Liac8b4ca2017-07-10 02:27:50 -0700340
341 BOOST_CHECK_EQUAL(FaceUri("tcp6://[fe80::1%" + name + "]:6363").isCanonical(), true);
342 BOOST_CHECK_EQUAL(FaceUri("tcp6://[fe80::1%" + index + "]:6363").isCanonical(), false);
343 BOOST_CHECK_EQUAL(FaceUri("tcp6://[fe80::1%" + name + "]").isCanonical(), false);
344 BOOST_CHECK_EQUAL(FaceUri("tcp6://[fe80::1068:dddb:fe26:fe3f%25en0]:6363").isCanonical(), false);
345 }
Alexander Afanasyev1286e022015-01-26 10:42:29 -0800346}
347
Davide Pesaventoe1081cd2016-12-19 23:58:15 -0500348BOOST_AUTO_TEST_CASE_EXPECTED_FAILURES(CanonizeTcpV4, 1)
Alexander Afanasyev1286e022015-01-26 10:42:29 -0800349BOOST_FIXTURE_TEST_CASE(CanonizeTcpV4, CanonizeFixture)
350{
Davide Pesaventoeee3e822016-11-26 19:19:34 +0100351 SKIP_IF_IPV4_UNAVAILABLE();
Junxiao Shi4083c8d2014-10-12 16:43:16 -0700352
353 // IPv4 unicast
Davide Pesavento2d7c5852022-07-18 16:02:52 -0400354 runTest("tcp4://192.0.2.1:6363", true, "tcp4://192.0.2.1:6363");
355 runTest("tcp://192.0.2.2:6363", true, "tcp4://192.0.2.2:6363");
356 runTest("tcp4://192.0.2.3", true, "tcp4://192.0.2.3:6363");
357 runTest("tcp4://192.0.2.4:6363/", true, "tcp4://192.0.2.4:6363");
358 runTest("tcp4://192.0.2.5:9695", true, "tcp4://192.0.2.5:9695");
359 runTest("tcp4://192.0.2.666:6363", false);
360 runTest("tcp4://192.0.2.7:99999", false); // Bug #3897
361 runTest("tcp4://google-public-dns-a.google.com", true, "tcp4://8.8.8.8:6363");
362 runTest("tcp4://google-public-dns-a.google.com:70000", false);
363 runTest("tcp4://invalid.invalid.", false);
364 runTest("tcp://invalid.invalid.", false);
Junxiao Shi4083c8d2014-10-12 16:43:16 -0700365
366 // IPv4 multicast
Davide Pesavento2d7c5852022-07-18 16:02:52 -0400367 runTest("tcp4://224.0.23.170:56363", false);
368 runTest("tcp4://224.0.23.170", false);
369 runTest("tcp4://all-routers.mcast.net:56363", false);
370 runTest("tcp://all-routers.mcast.net:56363", false);
Junxiao Shi4083c8d2014-10-12 16:43:16 -0700371
Eric Newberry71aecae2017-05-29 00:22:39 -0700372 // IPv6 used with tcp4 protocol - not canonical
Davide Pesavento2d7c5852022-07-18 16:02:52 -0400373 runTest("tcp4://[2001:db8::1]:6363", false);
Eric Newberry71aecae2017-05-29 00:22:39 -0700374
Davide Pesavento4c1ad4c2020-11-16 21:12:02 -0500375 if (m_netif) {
376 auto name = m_netif->getName();
377 auto index = to_string(m_netif->getIndex());
Yanbiao Liac8b4ca2017-07-10 02:27:50 -0700378
Davide Pesavento2d7c5852022-07-18 16:02:52 -0400379 runTest("tcp6://[fe80::1068:dddb:fe26:fe3f%25" + name + "]:6363", true,
Yanbiao Liac8b4ca2017-07-10 02:27:50 -0700380 "tcp6://[fe80::1068:dddb:fe26:fe3f%" + name + "]:6363");
381
Davide Pesavento2d7c5852022-07-18 16:02:52 -0400382 runTest("tcp6://[fe80::1068:dddb:fe26:fe3f%" + index + "]:6363", true,
Yanbiao Liac8b4ca2017-07-10 02:27:50 -0700383 "tcp6://[fe80::1068:dddb:fe26:fe3f%" + name + "]:6363");
384 }
Alexander Afanasyev1286e022015-01-26 10:42:29 -0800385}
386
Davide Pesaventoe1081cd2016-12-19 23:58:15 -0500387BOOST_AUTO_TEST_CASE_EXPECTED_FAILURES(CanonizeTcpV6, 1)
Alexander Afanasyev1286e022015-01-26 10:42:29 -0800388BOOST_FIXTURE_TEST_CASE(CanonizeTcpV6, CanonizeFixture)
389{
Davide Pesaventoeee3e822016-11-26 19:19:34 +0100390 SKIP_IF_IPV6_UNAVAILABLE();
Alexander Afanasyev1286e022015-01-26 10:42:29 -0800391
Junxiao Shi4083c8d2014-10-12 16:43:16 -0700392 // IPv6 unicast
Davide Pesavento2d7c5852022-07-18 16:02:52 -0400393 runTest("tcp6://[2001:db8::1]:6363", true, "tcp6://[2001:db8::1]:6363");
394 runTest("tcp6://[2001:db8::1]", true, "tcp6://[2001:db8::1]:6363");
395 runTest("tcp://[2001:db8::1]:6363", true, "tcp6://[2001:db8::1]:6363");
396 runTest("tcp6://[2001:db8::01]:6363", true, "tcp6://[2001:db8::1]:6363");
397 runTest("tcp6://[2001::db8::1]:6363", false);
398 runTest("tcp6://[2001:db8::1]:99999", false); // Bug #3897
399 runTest("tcp6://google-public-dns-a.google.com", true, "tcp6://[2001:4860:4860::8888]:6363");
400 runTest("tcp6://google-public-dns-a.google.com:70000", false);
401 runTest("tcp6://invalid.invalid.", false);
Junxiao Shi4083c8d2014-10-12 16:43:16 -0700402
403 // IPv6 multicast
Davide Pesavento2d7c5852022-07-18 16:02:52 -0400404 runTest("tcp6://[ff02::2]:56363", false);
405 runTest("tcp6://[ff02::2]", false);
Junxiao Shi4083c8d2014-10-12 16:43:16 -0700406
Eric Newberry71aecae2017-05-29 00:22:39 -0700407 // IPv4 used with tcp6 protocol - not canonical
Davide Pesavento2d7c5852022-07-18 16:02:52 -0400408 runTest("tcp6://192.0.2.1:6363", false);
Junxiao Shi4083c8d2014-10-12 16:43:16 -0700409}
410
Davide Pesaventoe1081cd2016-12-19 23:58:15 -0500411BOOST_AUTO_TEST_CASE_EXPECTED_FAILURES(ParseUnix, 1)
Junxiao Shi4083c8d2014-10-12 16:43:16 -0700412BOOST_AUTO_TEST_CASE(ParseUnix)
Junxiao Shi77dcadd2014-10-05 14:40:54 -0700413{
414 FaceUri uri;
415
416 BOOST_CHECK(uri.parse("unix:///var/run/example.sock"));
417 BOOST_CHECK_EQUAL(uri.getScheme(), "unix");
418 BOOST_CHECK_EQUAL(uri.getHost(), "");
419 BOOST_CHECK_EQUAL(uri.getPort(), "");
420 BOOST_CHECK_EQUAL(uri.getPath(), "/var/run/example.sock");
421
Davide Pesaventoe1081cd2016-12-19 23:58:15 -0500422 // This is not a valid unix:// URI, but the parse would treat "var" as host
423 BOOST_CHECK_EQUAL(uri.parse("unix://var/run/example.sock"), false); // Bug #3896
Junxiao Shi77dcadd2014-10-05 14:40:54 -0700424
Davide Pesaventoe1081cd2016-12-19 23:58:15 -0500425#ifdef BOOST_ASIO_HAS_LOCAL_SOCKETS
426 using boost::asio::local::stream_protocol;
427 stream_protocol::endpoint endpoint("/var/run/example.sock");
Davide Pesavento8a8c01b2018-03-11 00:07:52 -0500428 uri = FaceUri(endpoint);
429 BOOST_CHECK_EQUAL(uri.toString(), "unix:///var/run/example.sock");
Davide Pesaventoe1081cd2016-12-19 23:58:15 -0500430#endif // BOOST_ASIO_HAS_LOCAL_SOCKETS
Junxiao Shi77dcadd2014-10-05 14:40:54 -0700431}
432
Junxiao Shi4083c8d2014-10-12 16:43:16 -0700433BOOST_AUTO_TEST_CASE(ParseFd)
Junxiao Shi77dcadd2014-10-05 14:40:54 -0700434{
435 FaceUri uri;
436
437 BOOST_CHECK(uri.parse("fd://6"));
438 BOOST_CHECK_EQUAL(uri.getScheme(), "fd");
439 BOOST_CHECK_EQUAL(uri.getHost(), "6");
440 BOOST_CHECK_EQUAL(uri.getPort(), "");
441 BOOST_CHECK_EQUAL(uri.getPath(), "");
442
443 int fd = 21;
Davide Pesavento8a8c01b2018-03-11 00:07:52 -0500444 uri = FaceUri::fromFd(fd);
445 BOOST_CHECK_EQUAL(uri.toString(), "fd://21");
Junxiao Shi77dcadd2014-10-05 14:40:54 -0700446}
447
Junxiao Shi4083c8d2014-10-12 16:43:16 -0700448BOOST_AUTO_TEST_CASE(ParseEther)
Junxiao Shi77dcadd2014-10-05 14:40:54 -0700449{
450 FaceUri uri;
451
452 BOOST_CHECK(uri.parse("ether://[08:00:27:01:dd:01]"));
453 BOOST_CHECK_EQUAL(uri.getScheme(), "ether");
454 BOOST_CHECK_EQUAL(uri.getHost(), "08:00:27:01:dd:01");
455 BOOST_CHECK_EQUAL(uri.getPort(), "");
456 BOOST_CHECK_EQUAL(uri.getPath(), "");
457
Junxiao Shi4083c8d2014-10-12 16:43:16 -0700458 BOOST_CHECK_EQUAL(uri.parse("ether://[08:00:27:zz:dd:01]"), false);
Junxiao Shi77dcadd2014-10-05 14:40:54 -0700459
Davide Pesaventoe1081cd2016-12-19 23:58:15 -0500460 auto address = ethernet::Address::fromString("33:33:01:01:01:01");
Davide Pesavento8a8c01b2018-03-11 00:07:52 -0500461 uri = FaceUri(address);
462 BOOST_CHECK_EQUAL(uri.toString(), "ether://[33:33:01:01:01:01]");
Junxiao Shi77dcadd2014-10-05 14:40:54 -0700463}
464
Junxiao Shi4083c8d2014-10-12 16:43:16 -0700465BOOST_FIXTURE_TEST_CASE(CanonizeEther, CanonizeFixture)
466{
467 BOOST_CHECK_EQUAL(FaceUri::canCanonize("ether"), true);
468
469 BOOST_CHECK_EQUAL(FaceUri("ether://[08:00:27:01:01:01]").isCanonical(), true);
470 BOOST_CHECK_EQUAL(FaceUri("ether://[08:00:27:1:1:1]").isCanonical(), false);
471 BOOST_CHECK_EQUAL(FaceUri("ether://[08:00:27:01:01:01]/").isCanonical(), false);
472 BOOST_CHECK_EQUAL(FaceUri("ether://[33:33:01:01:01:01]").isCanonical(), true);
473
Davide Pesavento2d7c5852022-07-18 16:02:52 -0400474 runTest("ether://[08:00:27:01:01:01]", true, "ether://[08:00:27:01:01:01]");
475 runTest("ether://[08:00:27:1:1:1]", true, "ether://[08:00:27:01:01:01]");
476 runTest("ether://[08:00:27:01:01:01]/", true, "ether://[08:00:27:01:01:01]");
477 runTest("ether://[33:33:01:01:01:01]", true, "ether://[33:33:01:01:01:01]");
Junxiao Shi4083c8d2014-10-12 16:43:16 -0700478}
479
Junxiao Shid5c2f0c2017-04-04 09:52:11 +0000480BOOST_AUTO_TEST_CASE_EXPECTED_FAILURES(ParseDev, 1)
Junxiao Shi4083c8d2014-10-12 16:43:16 -0700481BOOST_AUTO_TEST_CASE(ParseDev)
Junxiao Shi77dcadd2014-10-05 14:40:54 -0700482{
483 FaceUri uri;
484
485 BOOST_CHECK(uri.parse("dev://eth0"));
486 BOOST_CHECK_EQUAL(uri.getScheme(), "dev");
487 BOOST_CHECK_EQUAL(uri.getHost(), "eth0");
488 BOOST_CHECK_EQUAL(uri.getPort(), "");
489 BOOST_CHECK_EQUAL(uri.getPath(), "");
490
Junxiao Shid5c2f0c2017-04-04 09:52:11 +0000491 BOOST_CHECK_EQUAL(uri.parse("dev://eth0:8888"), false); // Bug #3896
492
Junxiao Shi77dcadd2014-10-05 14:40:54 -0700493 std::string ifname = "en1";
Davide Pesavento8a8c01b2018-03-11 00:07:52 -0500494 uri = FaceUri::fromDev(ifname);
Junxiao Shid5c2f0c2017-04-04 09:52:11 +0000495 BOOST_CHECK_EQUAL(uri.toString(), "dev://en1");
496}
497
498BOOST_AUTO_TEST_CASE(IsCanonicalDev)
499{
500 BOOST_CHECK_EQUAL(FaceUri::canCanonize("dev"), true);
501
502 BOOST_CHECK_EQUAL(FaceUri("dev://eth0").isCanonical(), true);
503 BOOST_CHECK_EQUAL(FaceUri("dev://").isCanonical(), false);
504 BOOST_CHECK_EQUAL(FaceUri("dev://eth0:8888").isCanonical(), false);
505 BOOST_CHECK_EQUAL(FaceUri("dev://eth0/").isCanonical(), false);
506 BOOST_CHECK_EQUAL(FaceUri("dev://eth0/A").isCanonical(), false);
507}
508
509BOOST_FIXTURE_TEST_CASE(CanonizeDev, CanonizeFixture)
510{
Davide Pesavento2d7c5852022-07-18 16:02:52 -0400511 runTest("dev://eth0", true, "dev://eth0");
512 runTest("dev://", false);
513 runTest("dev://eth0:8888", false);
514 runTest("dev://eth0/", true, "dev://eth0");
515 runTest("dev://eth0/A", false);
Junxiao Shi77dcadd2014-10-05 14:40:54 -0700516}
517
Weiwei Liud7f4fda2016-10-19 22:38:39 -0700518BOOST_AUTO_TEST_CASE(ParseUdpDev)
519{
520 FaceUri uri;
521
522 BOOST_CHECK(uri.parse("udp4+dev://eth0:7777"));
523 BOOST_CHECK_EQUAL(uri.getScheme(), "udp4+dev");
524 BOOST_CHECK_EQUAL(uri.getHost(), "eth0");
525 BOOST_CHECK_EQUAL(uri.getPort(), "7777");
526 BOOST_CHECK_EQUAL(uri.getPath(), "");
527
528 BOOST_CHECK(uri.parse("udp6+dev://eth1:7777"));
529 BOOST_CHECK_EQUAL(uri.getScheme(), "udp6+dev");
530 BOOST_CHECK_EQUAL(uri.getHost(), "eth1");
531 BOOST_CHECK_EQUAL(uri.getPort(), "7777");
532 BOOST_CHECK_EQUAL(uri.getPath(), "");
533
534 BOOST_CHECK(uri.parse("abc+efg://eth0"));
535 BOOST_CHECK(!uri.parse("abc+://eth0"));
536 BOOST_CHECK(!uri.parse("+abc://eth0"));
537
Davide Pesaventoe1081cd2016-12-19 23:58:15 -0500538 namespace ip = boost::asio::ip;
Weiwei Liud7f4fda2016-10-19 22:38:39 -0700539
540 ip::udp::endpoint endpoint4(ip::udp::v4(), 7777);
Davide Pesavento8a8c01b2018-03-11 00:07:52 -0500541 uri = FaceUri::fromUdpDev(endpoint4, "en1");
542 BOOST_CHECK_EQUAL(uri.toString(), "udp4+dev://en1:7777");
Weiwei Liud7f4fda2016-10-19 22:38:39 -0700543
544 ip::udp::endpoint endpoint6(ip::udp::v6(), 7777);
Davide Pesavento8a8c01b2018-03-11 00:07:52 -0500545 uri = FaceUri::fromUdpDev(endpoint6, "en2");
546 BOOST_CHECK_EQUAL(uri.toString(), "udp6+dev://en2:7777");
Weiwei Liud7f4fda2016-10-19 22:38:39 -0700547}
548
549BOOST_FIXTURE_TEST_CASE(CanonizeUdpDev, CanonizeFixture)
550{
551 BOOST_CHECK_EQUAL(FaceUri("udp4+dev://eth0:7777").isCanonical(), true);
552 BOOST_CHECK_EQUAL(FaceUri("udp6+dev://eth1:7777").isCanonical(), true);
553 BOOST_CHECK_EQUAL(FaceUri("udp+dev://eth1:7777").isCanonical(), false);
554 BOOST_CHECK_EQUAL(FaceUri("udp6+dev://eth1").isCanonical(), false);
555
Davide Pesavento2d7c5852022-07-18 16:02:52 -0400556 runTest("udp4+dev://en0:7777", true, "udp4+dev://en0:7777");
557 runTest("udp6+dev://en0:7777", true, "udp6+dev://en0:7777");
558 runTest("udp+dev://en1:7777", false);
559 runTest("udp6+dev://en2", false);
Weiwei Liud7f4fda2016-10-19 22:38:39 -0700560}
561
Junxiao Shi4083c8d2014-10-12 16:43:16 -0700562BOOST_AUTO_TEST_CASE(CanonizeEmptyCallback)
563{
564 boost::asio::io_service io;
565
566 // unsupported scheme
Davide Pesavento2d7c5852022-07-18 16:02:52 -0400567 FaceUri("null://").canonize(nullptr, nullptr, io, 1_ms);
Junxiao Shi4083c8d2014-10-12 16:43:16 -0700568
569 // cannot resolve
Davide Pesavento2d7c5852022-07-18 16:02:52 -0400570 FaceUri("udp://192.0.2.333").canonize(nullptr, nullptr, io, 1_ms);
Junxiao Shi4083c8d2014-10-12 16:43:16 -0700571
572 // already canonical
Davide Pesavento2d7c5852022-07-18 16:02:52 -0400573 FaceUri("udp4://192.0.2.1:6363").canonize(nullptr, nullptr, io, 1_ms);
Junxiao Shi4083c8d2014-10-12 16:43:16 -0700574
575 // need DNS resolution
Davide Pesavento2d7c5852022-07-18 16:02:52 -0400576 FaceUri("udp://192.0.2.1:6363").canonize(nullptr, nullptr, io, 1_ms);
Junxiao Shi4083c8d2014-10-12 16:43:16 -0700577
578 io.run(); // should not crash
Davide Pesaventoeee3e822016-11-26 19:19:34 +0100579
580 // avoid "test case [...] did not check any assertions" message from Boost.Test
581 BOOST_CHECK(true);
Junxiao Shi4083c8d2014-10-12 16:43:16 -0700582}
583
584BOOST_FIXTURE_TEST_CASE(CanonizeUnsupported, CanonizeFixture)
585{
586 BOOST_CHECK_EQUAL(FaceUri::canCanonize("internal"), false);
587 BOOST_CHECK_EQUAL(FaceUri::canCanonize("null"), false);
588 BOOST_CHECK_EQUAL(FaceUri::canCanonize("unix"), false);
589 BOOST_CHECK_EQUAL(FaceUri::canCanonize("fd"), false);
Junxiao Shi4083c8d2014-10-12 16:43:16 -0700590
591 BOOST_CHECK_EQUAL(FaceUri("internal://").isCanonical(), false);
592 BOOST_CHECK_EQUAL(FaceUri("null://").isCanonical(), false);
593 BOOST_CHECK_EQUAL(FaceUri("unix:///var/run/nfd.sock").isCanonical(), false);
594 BOOST_CHECK_EQUAL(FaceUri("fd://0").isCanonical(), false);
Junxiao Shi4083c8d2014-10-12 16:43:16 -0700595
Davide Pesavento2d7c5852022-07-18 16:02:52 -0400596 runTest("internal://", false);
597 runTest("null://", false);
598 runTest("unix:///var/run/nfd.sock", false);
599 runTest("fd://0", false);
Junxiao Shi4083c8d2014-10-12 16:43:16 -0700600}
601
Junxiao Shi77dcadd2014-10-05 14:40:54 -0700602BOOST_AUTO_TEST_CASE(Bug1635)
603{
604 FaceUri uri;
605
606 BOOST_CHECK(uri.parse("wsclient://[::ffff:76.90.11.239]:56366"));
607 BOOST_CHECK_EQUAL(uri.getScheme(), "wsclient");
608 BOOST_CHECK_EQUAL(uri.getHost(), "76.90.11.239");
609 BOOST_CHECK_EQUAL(uri.getPort(), "56366");
610 BOOST_CHECK_EQUAL(uri.getPath(), "");
611 BOOST_CHECK_EQUAL(uri.toString(), "wsclient://76.90.11.239:56366");
612}
613
Junxiao Shi382de672023-08-11 18:17:10 +0000614BOOST_AUTO_TEST_CASE(Compare)
615{
616 FaceUri uri0("udp://[::1]:6363");
617 FaceUri uri1("tcp://[::1]:6363");
618 FaceUri uri2("tcp://127.0.0.1:6363");
619 FaceUri uri3("unix:///run/ndn/nfd.sock");
620
621 BOOST_CHECK_EQUAL(uri0, uri0);
622 BOOST_CHECK_LE(uri0, uri0);
623 BOOST_CHECK_GE(uri0, uri0);
624
625 BOOST_CHECK_GT(uri0, uri1);
626 BOOST_CHECK_GE(uri0, uri1);
627 BOOST_CHECK_NE(uri0, uri1);
628
629 BOOST_CHECK_LT(uri1, uri0);
630 BOOST_CHECK_LE(uri1, uri0);
631 BOOST_CHECK_NE(uri1, uri0);
632
633 BOOST_CHECK_GT(uri0, uri2);
634 BOOST_CHECK_GE(uri0, uri2);
635 BOOST_CHECK_NE(uri0, uri2);
636
637 BOOST_CHECK_LT(uri2, uri0);
638 BOOST_CHECK_LE(uri2, uri0);
639 BOOST_CHECK_NE(uri2, uri0);
640
641 BOOST_CHECK_LT(uri0, uri3);
642 BOOST_CHECK_LE(uri0, uri3);
643 BOOST_CHECK_NE(uri0, uri3);
644
645 BOOST_CHECK_GT(uri3, uri0);
646 BOOST_CHECK_GE(uri3, uri0);
647 BOOST_CHECK_NE(uri3, uri0);
648}
649
Davide Pesaventoeee3e822016-11-26 19:19:34 +0100650BOOST_AUTO_TEST_SUITE_END() // TestFaceUri
Junxiao Shi25467942017-06-30 02:53:14 +0000651BOOST_AUTO_TEST_SUITE_END() // Net
Junxiao Shi77dcadd2014-10-05 14:40:54 -0700652
Davide Pesavento47ce2ee2023-05-09 01:33:33 -0400653} // namespace ndn::tests