blob: 170e498e477e96905ac6ddf67f37837827a967d1 [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 Pesavento16203ea2024-01-01 15:46:44 -05003 * Copyright (c) 2013-2024 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();
Davide Pesavento4c1ad4c2020-11-16 21:12:02 -050055 m_io.restart();
Davide Pesavento4c1ad4c2020-11-16 21:12:02 -050056 }
57 return netmon.listNetworkInterfaces();
58 }();
59
60 if (!netifs.empty()) {
61 m_netif = netifs.front();
62 }
63 }
64
Junxiao Shi4083c8d2014-10-12 16:43:16 -070065 void
Davide Pesavento2d7c5852022-07-18 16:02:52 -040066 runTest(const std::string& request, bool shouldSucceed, const std::string& expectedUri = "")
Davide Pesaventoe1081cd2016-12-19 23:58:15 -050067 {
Davide Pesavento2d7c5852022-07-18 16:02:52 -040068 BOOST_TEST_CONTEXT(std::quoted(request) << " should " << (shouldSucceed ? "succeed" : "fail")) {
69 bool didInvokeCb = false;
70 FaceUri uri(request);
71 uri.canonize(
72 [&] (const FaceUri& canonicalUri) {
73 BOOST_CHECK_EQUAL(didInvokeCb, false);
74 didInvokeCb = true;
75 BOOST_CHECK_EQUAL(shouldSucceed, true);
76 if (shouldSucceed) {
77 BOOST_CHECK_EQUAL(canonicalUri.toString(), expectedUri);
78 }
79 },
80 [&] (const std::string&) {
81 BOOST_CHECK_EQUAL(didInvokeCb, false);
82 didInvokeCb = true;
83 BOOST_CHECK_EQUAL(shouldSucceed, false);
84 },
85 m_io, 30_s);
Davide Pesaventoe1081cd2016-12-19 23:58:15 -050086
Davide Pesavento2d7c5852022-07-18 16:02:52 -040087 m_io.run();
88 BOOST_CHECK_EQUAL(didInvokeCb, true);
Davide Pesavento2d7c5852022-07-18 16:02:52 -040089 m_io.restart();
Junxiao Shi4083c8d2014-10-12 16:43:16 -070090 }
Junxiao Shi4083c8d2014-10-12 16:43:16 -070091 }
92
Davide Pesavento4c1ad4c2020-11-16 21:12:02 -050093protected:
94 shared_ptr<const net::NetworkInterface> m_netif;
95
Junxiao Shi4083c8d2014-10-12 16:43:16 -070096private:
Davide Pesavento2f46d652023-11-09 23:40:01 -050097 boost::asio::io_context m_io;
Junxiao Shi4083c8d2014-10-12 16:43:16 -070098};
99
Junxiao Shi4083c8d2014-10-12 16:43:16 -0700100BOOST_AUTO_TEST_CASE(ParseInternal)
Junxiao Shi77dcadd2014-10-05 14:40:54 -0700101{
102 FaceUri uri;
103
104 BOOST_CHECK(uri.parse("internal://"));
105 BOOST_CHECK_EQUAL(uri.getScheme(), "internal");
106 BOOST_CHECK_EQUAL(uri.getHost(), "");
107 BOOST_CHECK_EQUAL(uri.getPort(), "");
108 BOOST_CHECK_EQUAL(uri.getPath(), "");
109
110 BOOST_CHECK_EQUAL(uri.parse("internal:"), false);
111 BOOST_CHECK_EQUAL(uri.parse("internal:/"), false);
112}
113
Junxiao Shi4083c8d2014-10-12 16:43:16 -0700114BOOST_AUTO_TEST_CASE(ParseUdp)
Junxiao Shi77dcadd2014-10-05 14:40:54 -0700115{
Davide Pesavento8a8c01b2018-03-11 00:07:52 -0500116 FaceUri uri("udp://hostname:6363");
Junxiao Shi77dcadd2014-10-05 14:40:54 -0700117 BOOST_CHECK_THROW(FaceUri("udp//hostname:6363"), FaceUri::Error);
118 BOOST_CHECK_THROW(FaceUri("udp://hostname:port"), FaceUri::Error);
119
Junxiao Shi77dcadd2014-10-05 14:40:54 -0700120 BOOST_CHECK_EQUAL(uri.parse("udp//hostname:6363"), false);
121
122 BOOST_CHECK(uri.parse("udp://hostname:80"));
123 BOOST_CHECK_EQUAL(uri.getScheme(), "udp");
124 BOOST_CHECK_EQUAL(uri.getHost(), "hostname");
125 BOOST_CHECK_EQUAL(uri.getPort(), "80");
126 BOOST_CHECK_EQUAL(uri.getPath(), "");
127
128 BOOST_CHECK(uri.parse("udp4://192.0.2.1:20"));
129 BOOST_CHECK_EQUAL(uri.getScheme(), "udp4");
130 BOOST_CHECK_EQUAL(uri.getHost(), "192.0.2.1");
131 BOOST_CHECK_EQUAL(uri.getPort(), "20");
132 BOOST_CHECK_EQUAL(uri.getPath(), "");
133
134 BOOST_CHECK(uri.parse("udp6://[2001:db8:3f9:0::1]:6363"));
135 BOOST_CHECK_EQUAL(uri.getScheme(), "udp6");
136 BOOST_CHECK_EQUAL(uri.getHost(), "2001:db8:3f9:0::1");
137 BOOST_CHECK_EQUAL(uri.getPort(), "6363");
138 BOOST_CHECK_EQUAL(uri.getPath(), "");
139
140 BOOST_CHECK(uri.parse("udp6://[2001:db8:3f9:0:3025:ccc5:eeeb:86d3]:6363"));
141 BOOST_CHECK_EQUAL(uri.getScheme(), "udp6");
142 BOOST_CHECK_EQUAL(uri.getHost(), "2001:db8:3f9:0:3025:ccc5:eeeb:86d3");
143 BOOST_CHECK_EQUAL(uri.getPort(), "6363");
144 BOOST_CHECK_EQUAL(uri.getPath(), "");
145
146 BOOST_CHECK_EQUAL(uri.parse("udp6://[2001:db8:3f9:0:3025:ccc5:eeeb:86dg]:6363"), false);
147
Davide Pesaventoe1081cd2016-12-19 23:58:15 -0500148 namespace ip = boost::asio::ip;
149
Davide Pesavento2f46d652023-11-09 23:40:01 -0500150 ip::udp::endpoint endpoint4(ip::make_address_v4("192.0.2.1"), 7777);
Davide Pesavento8a8c01b2018-03-11 00:07:52 -0500151 uri = FaceUri(endpoint4);
152 BOOST_CHECK_EQUAL(uri.toString(), "udp4://192.0.2.1:7777");
Junxiao Shi77dcadd2014-10-05 14:40:54 -0700153
Davide Pesavento2f46d652023-11-09 23:40:01 -0500154 ip::udp::endpoint endpoint6(ip::make_address_v6("2001:DB8::1"), 7777);
Davide Pesavento8a8c01b2018-03-11 00:07:52 -0500155 uri = FaceUri(endpoint6);
156 BOOST_CHECK_EQUAL(uri.toString(), "udp6://[2001:db8::1]:7777");
Yanbiao Liac8b4ca2017-07-10 02:27:50 -0700157
158 BOOST_CHECK(uri.parse("udp6://[fe80::1%25eth1]:6363"));
159 BOOST_CHECK_EQUAL(uri.getHost(), "fe80::1%25eth1");
160
161 BOOST_CHECK(uri.parse("udp6://[fe80::1%eth1]:6363"));
162 BOOST_CHECK_EQUAL(uri.getHost(), "fe80::1%eth1");
163
164 BOOST_CHECK(uri.parse("udp6://[fe80::1%1]:6363"));
165 BOOST_CHECK(uri.parse("udp6://[fe80::1%eth1]"));
Davide Pesaventob984e322018-01-24 19:40:07 -0500166
167 BOOST_CHECK(uri.parse("udp6://[ff01::114%eth#1]"));
168 BOOST_CHECK(uri.parse("udp6://[ff01::114%eth.1,2]"));
169 BOOST_CHECK(uri.parse("udp6://[ff01::114%a+b-c=0]"));
170 BOOST_CHECK(uri.parse("udp6://[ff01::114%[foo]]"));
171 BOOST_CHECK(uri.parse("udp6://[ff01::114%]]"));
172 BOOST_CHECK(uri.parse("udp6://[ff01::114%%]"));
173 BOOST_CHECK(!uri.parse("udp6://[ff01::114%]"));
174 BOOST_CHECK(!uri.parse("udp6://[ff01::114%foo bar]"));
175 BOOST_CHECK(!uri.parse("udp6://[ff01::114%foo/bar]"));
176 BOOST_CHECK(!uri.parse("udp6://[ff01::114%eth0:1]"));
Junxiao Shi77dcadd2014-10-05 14:40:54 -0700177}
178
Davide Pesaventoe1081cd2016-12-19 23:58:15 -0500179BOOST_FIXTURE_TEST_CASE(IsCanonicalUdp, CanonizeFixture)
Junxiao Shi4083c8d2014-10-12 16:43:16 -0700180{
181 BOOST_CHECK_EQUAL(FaceUri::canCanonize("udp"), true);
182 BOOST_CHECK_EQUAL(FaceUri::canCanonize("udp4"), true);
183 BOOST_CHECK_EQUAL(FaceUri::canCanonize("udp6"), true);
184
185 BOOST_CHECK_EQUAL(FaceUri("udp4://192.0.2.1:6363").isCanonical(), true);
186 BOOST_CHECK_EQUAL(FaceUri("udp://192.0.2.1:6363").isCanonical(), false);
187 BOOST_CHECK_EQUAL(FaceUri("udp4://192.0.2.1").isCanonical(), false);
188 BOOST_CHECK_EQUAL(FaceUri("udp4://192.0.2.1:6363/").isCanonical(), false);
189 BOOST_CHECK_EQUAL(FaceUri("udp6://[2001:db8::1]:6363").isCanonical(), true);
190 BOOST_CHECK_EQUAL(FaceUri("udp6://[2001:db8::01]:6363").isCanonical(), false);
Eric Newberry71aecae2017-05-29 00:22:39 -0700191 BOOST_CHECK_EQUAL(FaceUri("udp://[2001:db8::1]:6363").isCanonical(), false);
Junxiao Shi4083c8d2014-10-12 16:43:16 -0700192 BOOST_CHECK_EQUAL(FaceUri("udp://example.net:6363").isCanonical(), false);
193 BOOST_CHECK_EQUAL(FaceUri("udp4://example.net:6363").isCanonical(), false);
194 BOOST_CHECK_EQUAL(FaceUri("udp6://example.net:6363").isCanonical(), false);
195 BOOST_CHECK_EQUAL(FaceUri("udp4://224.0.23.170:56363").isCanonical(), true);
Eric Newberry71aecae2017-05-29 00:22:39 -0700196 BOOST_CHECK_EQUAL(FaceUri("udp4://[2001:db8::1]:6363").isCanonical(), false);
197 BOOST_CHECK_EQUAL(FaceUri("udp6://192.0.2.1:6363").isCanonical(), false);
Yanbiao Liac8b4ca2017-07-10 02:27:50 -0700198
Davide Pesavento4c1ad4c2020-11-16 21:12:02 -0500199 if (m_netif) {
200 auto name = m_netif->getName();
201 auto index = to_string(m_netif->getIndex());
Yanbiao Liac8b4ca2017-07-10 02:27:50 -0700202
203 BOOST_CHECK_EQUAL(FaceUri("udp6://[fe80::1%" + name + "]:6363").isCanonical(), true);
204 BOOST_CHECK_EQUAL(FaceUri("udp6://[fe80::1%" + index + "]:6363").isCanonical(), false);
205 BOOST_CHECK_EQUAL(FaceUri("udp6://[fe80::1%" + name + "]").isCanonical(), false);
206 BOOST_CHECK_EQUAL(FaceUri("udp6://[fe80::1068:dddb:fe26:fe3f%25en0]:6363").isCanonical(), false);
207 }
Alexander Afanasyev1286e022015-01-26 10:42:29 -0800208}
209
Davide Pesavento94048922023-08-11 22:00:01 -0400210BOOST_FIXTURE_TEST_CASE(CanonizeUdpV4, CanonizeFixture,
211 * boost::unit_test::expected_failures(1))
Alexander Afanasyev1286e022015-01-26 10:42:29 -0800212{
Davide Pesaventoeee3e822016-11-26 19:19:34 +0100213 SKIP_IF_IPV4_UNAVAILABLE();
Junxiao Shi4083c8d2014-10-12 16:43:16 -0700214
215 // IPv4 unicast
Davide Pesavento2d7c5852022-07-18 16:02:52 -0400216 runTest("udp4://192.0.2.1:6363", true, "udp4://192.0.2.1:6363");
217 runTest("udp://192.0.2.2:6363", true, "udp4://192.0.2.2:6363");
218 runTest("udp4://192.0.2.3", true, "udp4://192.0.2.3:6363");
219 runTest("udp4://192.0.2.4:6363/", true, "udp4://192.0.2.4:6363");
220 runTest("udp4://192.0.2.5:9695", true, "udp4://192.0.2.5:9695");
221 runTest("udp4://192.0.2.666:6363", false);
222 runTest("udp4://192.0.2.7:99999", false); // Bug #3897
223 runTest("udp4://google-public-dns-a.google.com", true, "udp4://8.8.8.8:6363");
224 runTest("udp4://google-public-dns-a.google.com:70000", false);
225 runTest("udp4://invalid.invalid.", false);
226 runTest("udp://invalid.invalid.", false);
Junxiao Shi4083c8d2014-10-12 16:43:16 -0700227
228 // IPv4 multicast
Davide Pesavento2d7c5852022-07-18 16:02:52 -0400229 runTest("udp4://224.0.23.170:56363", true, "udp4://224.0.23.170:56363");
230 runTest("udp4://224.0.23.170", true, "udp4://224.0.23.170:56363");
231 runTest("udp4://all-routers.mcast.net:56363", true, "udp4://224.0.0.2:56363");
232 runTest("udp://all-routers.mcast.net:56363", true, "udp4://224.0.0.2:56363");
Junxiao Shi4083c8d2014-10-12 16:43:16 -0700233
Eric Newberry71aecae2017-05-29 00:22:39 -0700234 // IPv6 used with udp4 protocol - not canonical
Davide Pesavento2d7c5852022-07-18 16:02:52 -0400235 runTest("udp4://[2001:db8::1]:6363", false);
Alexander Afanasyev1286e022015-01-26 10:42:29 -0800236}
237
Davide Pesavento94048922023-08-11 22:00:01 -0400238BOOST_FIXTURE_TEST_CASE(CanonizeUdpV6, CanonizeFixture,
239 * boost::unit_test::expected_failures(1))
Alexander Afanasyev1286e022015-01-26 10:42:29 -0800240{
Davide Pesaventoeee3e822016-11-26 19:19:34 +0100241 SKIP_IF_IPV6_UNAVAILABLE();
Alexander Afanasyev1286e022015-01-26 10:42:29 -0800242
Junxiao Shi4083c8d2014-10-12 16:43:16 -0700243 // IPv6 unicast
Davide Pesavento2d7c5852022-07-18 16:02:52 -0400244 runTest("udp6://[2001:db8::1]:6363", true, "udp6://[2001:db8::1]:6363");
245 runTest("udp6://[2001:db8::1]", true, "udp6://[2001:db8::1]:6363");
246 runTest("udp://[2001:db8::1]:6363", true, "udp6://[2001:db8::1]:6363");
247 runTest("udp6://[2001:db8::01]:6363", true, "udp6://[2001:db8::1]:6363");
248 runTest("udp6://[2001::db8::1]:6363", false);
249 runTest("udp6://[2001:db8::1]:99999", false); // Bug #3897
250 runTest("udp6://google-public-dns-a.google.com", true, "udp6://[2001:4860:4860::8888]:6363");
251 runTest("udp6://google-public-dns-a.google.com:70000", false);
252 runTest("udp6://invalid.invalid.", false);
Junxiao Shi4083c8d2014-10-12 16:43:16 -0700253
254 // IPv6 multicast
Davide Pesavento2d7c5852022-07-18 16:02:52 -0400255 runTest("udp6://[ff02::2]:56363", true, "udp6://[ff02::2]:56363");
256 runTest("udp6://[ff02::2]", true, "udp6://[ff02::2]:56363");
Junxiao Shi4083c8d2014-10-12 16:43:16 -0700257
Eric Newberry71aecae2017-05-29 00:22:39 -0700258 // IPv4 used with udp6 protocol - not canonical
Davide Pesavento2d7c5852022-07-18 16:02:52 -0400259 runTest("udp6://192.0.2.1:6363", false);
Eric Newberry71aecae2017-05-29 00:22:39 -0700260
Davide Pesavento4c1ad4c2020-11-16 21:12:02 -0500261 if (m_netif) {
262 auto name = m_netif->getName();
263 auto index = to_string(m_netif->getIndex());
Yanbiao Liac8b4ca2017-07-10 02:27:50 -0700264
Davide Pesavento2d7c5852022-07-18 16:02:52 -0400265 runTest("udp6://[fe80::1068:dddb:fe26:fe3f%25" + name + "]:6363", true,
Yanbiao Liac8b4ca2017-07-10 02:27:50 -0700266 "udp6://[fe80::1068:dddb:fe26:fe3f%" + name + "]:6363");
267
Davide Pesavento2d7c5852022-07-18 16:02:52 -0400268 runTest("udp6://[fe80::1068:dddb:fe26:fe3f%" + index + "]:6363", true,
Yanbiao Liac8b4ca2017-07-10 02:27:50 -0700269 "udp6://[fe80::1068:dddb:fe26:fe3f%" + name + "]:6363");
270 }
Junxiao Shi4083c8d2014-10-12 16:43:16 -0700271}
272
273BOOST_AUTO_TEST_CASE(ParseTcp)
Junxiao Shi77dcadd2014-10-05 14:40:54 -0700274{
275 FaceUri uri;
276
277 BOOST_CHECK(uri.parse("tcp://random.host.name"));
278 BOOST_CHECK_EQUAL(uri.getScheme(), "tcp");
279 BOOST_CHECK_EQUAL(uri.getHost(), "random.host.name");
280 BOOST_CHECK_EQUAL(uri.getPort(), "");
281 BOOST_CHECK_EQUAL(uri.getPath(), "");
282
283 BOOST_CHECK_EQUAL(uri.parse("tcp://192.0.2.1:"), false);
284 BOOST_CHECK_EQUAL(uri.parse("tcp://[::zzzz]"), false);
285
Davide Pesaventoe1081cd2016-12-19 23:58:15 -0500286 namespace ip = boost::asio::ip;
287
Davide Pesavento2f46d652023-11-09 23:40:01 -0500288 ip::tcp::endpoint endpoint4(ip::make_address_v4("192.0.2.1"), 7777);
Davide Pesavento8a8c01b2018-03-11 00:07:52 -0500289 uri = FaceUri(endpoint4);
290 BOOST_CHECK_EQUAL(uri.toString(), "tcp4://192.0.2.1:7777");
Junxiao Shi77dcadd2014-10-05 14:40:54 -0700291
Davide Pesavento8a8c01b2018-03-11 00:07:52 -0500292 uri = FaceUri(endpoint4, "wsclient");
293 BOOST_CHECK_EQUAL(uri.toString(), "wsclient://192.0.2.1:7777");
Junxiao Shi77dcadd2014-10-05 14:40:54 -0700294
Davide Pesavento2f46d652023-11-09 23:40:01 -0500295 ip::tcp::endpoint endpoint6(ip::make_address_v6("2001:DB8::1"), 7777);
Davide Pesavento8a8c01b2018-03-11 00:07:52 -0500296 uri = FaceUri(endpoint6);
297 BOOST_CHECK_EQUAL(uri.toString(), "tcp6://[2001:db8::1]:7777");
Yanbiao Liac8b4ca2017-07-10 02:27:50 -0700298
299 BOOST_CHECK(uri.parse("tcp6://[fe80::1%25eth1]:6363"));
300 BOOST_CHECK_EQUAL(uri.getHost(), "fe80::1%25eth1");
301
302 BOOST_CHECK(uri.parse("tcp6://[fe80::1%eth1]:6363"));
303 BOOST_CHECK_EQUAL(uri.getHost(), "fe80::1%eth1");
304
305 BOOST_CHECK(uri.parse("tcp6://[fe80::1%1]:6363"));
306 BOOST_CHECK(uri.parse("tcp6://[fe80::1%eth1]"));
Junxiao Shi77dcadd2014-10-05 14:40:54 -0700307}
308
Davide Pesaventoe1081cd2016-12-19 23:58:15 -0500309BOOST_FIXTURE_TEST_CASE(IsCanonicalTcp, CanonizeFixture)
Junxiao Shi4083c8d2014-10-12 16:43:16 -0700310{
311 BOOST_CHECK_EQUAL(FaceUri::canCanonize("tcp"), true);
312 BOOST_CHECK_EQUAL(FaceUri::canCanonize("tcp4"), true);
313 BOOST_CHECK_EQUAL(FaceUri::canCanonize("tcp6"), true);
314
315 BOOST_CHECK_EQUAL(FaceUri("tcp4://192.0.2.1:6363").isCanonical(), true);
316 BOOST_CHECK_EQUAL(FaceUri("tcp://192.0.2.1:6363").isCanonical(), false);
317 BOOST_CHECK_EQUAL(FaceUri("tcp4://192.0.2.1").isCanonical(), false);
318 BOOST_CHECK_EQUAL(FaceUri("tcp4://192.0.2.1:6363/").isCanonical(), false);
319 BOOST_CHECK_EQUAL(FaceUri("tcp6://[2001:db8::1]:6363").isCanonical(), true);
320 BOOST_CHECK_EQUAL(FaceUri("tcp6://[2001:db8::01]:6363").isCanonical(), false);
Eric Newberry71aecae2017-05-29 00:22:39 -0700321 BOOST_CHECK_EQUAL(FaceUri("tcp://[2001:db8::1]:6363").isCanonical(), false);
Junxiao Shi4083c8d2014-10-12 16:43:16 -0700322 BOOST_CHECK_EQUAL(FaceUri("tcp://example.net:6363").isCanonical(), false);
323 BOOST_CHECK_EQUAL(FaceUri("tcp4://example.net:6363").isCanonical(), false);
324 BOOST_CHECK_EQUAL(FaceUri("tcp6://example.net:6363").isCanonical(), false);
325 BOOST_CHECK_EQUAL(FaceUri("tcp4://224.0.23.170:56363").isCanonical(), false);
Eric Newberry71aecae2017-05-29 00:22:39 -0700326 BOOST_CHECK_EQUAL(FaceUri("tcp4://[2001:db8::1]:6363").isCanonical(), false);
327 BOOST_CHECK_EQUAL(FaceUri("tcp6://192.0.2.1:6363").isCanonical(), false);
Yanbiao Liac8b4ca2017-07-10 02:27:50 -0700328
Davide Pesavento4c1ad4c2020-11-16 21:12:02 -0500329 if (m_netif) {
330 auto name = m_netif->getName();
331 auto index = to_string(m_netif->getIndex());
Yanbiao Liac8b4ca2017-07-10 02:27:50 -0700332
333 BOOST_CHECK_EQUAL(FaceUri("tcp6://[fe80::1%" + name + "]:6363").isCanonical(), true);
334 BOOST_CHECK_EQUAL(FaceUri("tcp6://[fe80::1%" + index + "]:6363").isCanonical(), false);
335 BOOST_CHECK_EQUAL(FaceUri("tcp6://[fe80::1%" + name + "]").isCanonical(), false);
336 BOOST_CHECK_EQUAL(FaceUri("tcp6://[fe80::1068:dddb:fe26:fe3f%25en0]:6363").isCanonical(), false);
337 }
Alexander Afanasyev1286e022015-01-26 10:42:29 -0800338}
339
Davide Pesavento94048922023-08-11 22:00:01 -0400340BOOST_FIXTURE_TEST_CASE(CanonizeTcpV4, CanonizeFixture,
341 * boost::unit_test::expected_failures(1))
Alexander Afanasyev1286e022015-01-26 10:42:29 -0800342{
Davide Pesaventoeee3e822016-11-26 19:19:34 +0100343 SKIP_IF_IPV4_UNAVAILABLE();
Junxiao Shi4083c8d2014-10-12 16:43:16 -0700344
345 // IPv4 unicast
Davide Pesavento2d7c5852022-07-18 16:02:52 -0400346 runTest("tcp4://192.0.2.1:6363", true, "tcp4://192.0.2.1:6363");
347 runTest("tcp://192.0.2.2:6363", true, "tcp4://192.0.2.2:6363");
348 runTest("tcp4://192.0.2.3", true, "tcp4://192.0.2.3:6363");
349 runTest("tcp4://192.0.2.4:6363/", true, "tcp4://192.0.2.4:6363");
350 runTest("tcp4://192.0.2.5:9695", true, "tcp4://192.0.2.5:9695");
351 runTest("tcp4://192.0.2.666:6363", false);
352 runTest("tcp4://192.0.2.7:99999", false); // Bug #3897
353 runTest("tcp4://google-public-dns-a.google.com", true, "tcp4://8.8.8.8:6363");
354 runTest("tcp4://google-public-dns-a.google.com:70000", false);
355 runTest("tcp4://invalid.invalid.", false);
356 runTest("tcp://invalid.invalid.", false);
Junxiao Shi4083c8d2014-10-12 16:43:16 -0700357
358 // IPv4 multicast
Davide Pesavento2d7c5852022-07-18 16:02:52 -0400359 runTest("tcp4://224.0.23.170:56363", false);
360 runTest("tcp4://224.0.23.170", false);
361 runTest("tcp4://all-routers.mcast.net:56363", false);
362 runTest("tcp://all-routers.mcast.net:56363", false);
Junxiao Shi4083c8d2014-10-12 16:43:16 -0700363
Eric Newberry71aecae2017-05-29 00:22:39 -0700364 // IPv6 used with tcp4 protocol - not canonical
Davide Pesavento2d7c5852022-07-18 16:02:52 -0400365 runTest("tcp4://[2001:db8::1]:6363", false);
Eric Newberry71aecae2017-05-29 00:22:39 -0700366
Davide Pesavento4c1ad4c2020-11-16 21:12:02 -0500367 if (m_netif) {
368 auto name = m_netif->getName();
369 auto index = to_string(m_netif->getIndex());
Yanbiao Liac8b4ca2017-07-10 02:27:50 -0700370
Davide Pesavento2d7c5852022-07-18 16:02:52 -0400371 runTest("tcp6://[fe80::1068:dddb:fe26:fe3f%25" + name + "]:6363", true,
Yanbiao Liac8b4ca2017-07-10 02:27:50 -0700372 "tcp6://[fe80::1068:dddb:fe26:fe3f%" + name + "]:6363");
373
Davide Pesavento2d7c5852022-07-18 16:02:52 -0400374 runTest("tcp6://[fe80::1068:dddb:fe26:fe3f%" + index + "]:6363", true,
Yanbiao Liac8b4ca2017-07-10 02:27:50 -0700375 "tcp6://[fe80::1068:dddb:fe26:fe3f%" + name + "]:6363");
376 }
Alexander Afanasyev1286e022015-01-26 10:42:29 -0800377}
378
Davide Pesavento94048922023-08-11 22:00:01 -0400379BOOST_FIXTURE_TEST_CASE(CanonizeTcpV6, CanonizeFixture,
380 * boost::unit_test::expected_failures(1))
Alexander Afanasyev1286e022015-01-26 10:42:29 -0800381{
Davide Pesaventoeee3e822016-11-26 19:19:34 +0100382 SKIP_IF_IPV6_UNAVAILABLE();
Alexander Afanasyev1286e022015-01-26 10:42:29 -0800383
Junxiao Shi4083c8d2014-10-12 16:43:16 -0700384 // IPv6 unicast
Davide Pesavento2d7c5852022-07-18 16:02:52 -0400385 runTest("tcp6://[2001:db8::1]:6363", true, "tcp6://[2001:db8::1]:6363");
386 runTest("tcp6://[2001:db8::1]", true, "tcp6://[2001:db8::1]:6363");
387 runTest("tcp://[2001:db8::1]:6363", true, "tcp6://[2001:db8::1]:6363");
388 runTest("tcp6://[2001:db8::01]:6363", true, "tcp6://[2001:db8::1]:6363");
389 runTest("tcp6://[2001::db8::1]:6363", false);
390 runTest("tcp6://[2001:db8::1]:99999", false); // Bug #3897
391 runTest("tcp6://google-public-dns-a.google.com", true, "tcp6://[2001:4860:4860::8888]:6363");
392 runTest("tcp6://google-public-dns-a.google.com:70000", false);
393 runTest("tcp6://invalid.invalid.", false);
Junxiao Shi4083c8d2014-10-12 16:43:16 -0700394
395 // IPv6 multicast
Davide Pesavento2d7c5852022-07-18 16:02:52 -0400396 runTest("tcp6://[ff02::2]:56363", false);
397 runTest("tcp6://[ff02::2]", false);
Junxiao Shi4083c8d2014-10-12 16:43:16 -0700398
Eric Newberry71aecae2017-05-29 00:22:39 -0700399 // IPv4 used with tcp6 protocol - not canonical
Davide Pesavento2d7c5852022-07-18 16:02:52 -0400400 runTest("tcp6://192.0.2.1:6363", false);
Junxiao Shi4083c8d2014-10-12 16:43:16 -0700401}
402
Davide Pesavento94048922023-08-11 22:00:01 -0400403BOOST_AUTO_TEST_CASE(ParseUnix,
404 * boost::unit_test::expected_failures(1))
Junxiao Shi77dcadd2014-10-05 14:40:54 -0700405{
406 FaceUri uri;
407
408 BOOST_CHECK(uri.parse("unix:///var/run/example.sock"));
409 BOOST_CHECK_EQUAL(uri.getScheme(), "unix");
410 BOOST_CHECK_EQUAL(uri.getHost(), "");
411 BOOST_CHECK_EQUAL(uri.getPort(), "");
412 BOOST_CHECK_EQUAL(uri.getPath(), "/var/run/example.sock");
413
Davide Pesaventoe1081cd2016-12-19 23:58:15 -0500414 // This is not a valid unix:// URI, but the parse would treat "var" as host
415 BOOST_CHECK_EQUAL(uri.parse("unix://var/run/example.sock"), false); // Bug #3896
Junxiao Shi77dcadd2014-10-05 14:40:54 -0700416
Davide Pesaventoe1081cd2016-12-19 23:58:15 -0500417#ifdef BOOST_ASIO_HAS_LOCAL_SOCKETS
418 using boost::asio::local::stream_protocol;
419 stream_protocol::endpoint endpoint("/var/run/example.sock");
Davide Pesavento8a8c01b2018-03-11 00:07:52 -0500420 uri = FaceUri(endpoint);
421 BOOST_CHECK_EQUAL(uri.toString(), "unix:///var/run/example.sock");
Davide Pesaventoe1081cd2016-12-19 23:58:15 -0500422#endif // BOOST_ASIO_HAS_LOCAL_SOCKETS
Junxiao Shi77dcadd2014-10-05 14:40:54 -0700423}
424
Junxiao Shi4083c8d2014-10-12 16:43:16 -0700425BOOST_AUTO_TEST_CASE(ParseFd)
Junxiao Shi77dcadd2014-10-05 14:40:54 -0700426{
427 FaceUri uri;
428
429 BOOST_CHECK(uri.parse("fd://6"));
430 BOOST_CHECK_EQUAL(uri.getScheme(), "fd");
431 BOOST_CHECK_EQUAL(uri.getHost(), "6");
432 BOOST_CHECK_EQUAL(uri.getPort(), "");
433 BOOST_CHECK_EQUAL(uri.getPath(), "");
434
435 int fd = 21;
Davide Pesavento8a8c01b2018-03-11 00:07:52 -0500436 uri = FaceUri::fromFd(fd);
437 BOOST_CHECK_EQUAL(uri.toString(), "fd://21");
Junxiao Shi77dcadd2014-10-05 14:40:54 -0700438}
439
Junxiao Shi4083c8d2014-10-12 16:43:16 -0700440BOOST_AUTO_TEST_CASE(ParseEther)
Junxiao Shi77dcadd2014-10-05 14:40:54 -0700441{
442 FaceUri uri;
443
444 BOOST_CHECK(uri.parse("ether://[08:00:27:01:dd:01]"));
445 BOOST_CHECK_EQUAL(uri.getScheme(), "ether");
446 BOOST_CHECK_EQUAL(uri.getHost(), "08:00:27:01:dd:01");
447 BOOST_CHECK_EQUAL(uri.getPort(), "");
448 BOOST_CHECK_EQUAL(uri.getPath(), "");
449
Junxiao Shi4083c8d2014-10-12 16:43:16 -0700450 BOOST_CHECK_EQUAL(uri.parse("ether://[08:00:27:zz:dd:01]"), false);
Junxiao Shi77dcadd2014-10-05 14:40:54 -0700451
Davide Pesaventoe1081cd2016-12-19 23:58:15 -0500452 auto address = ethernet::Address::fromString("33:33:01:01:01:01");
Davide Pesavento8a8c01b2018-03-11 00:07:52 -0500453 uri = FaceUri(address);
454 BOOST_CHECK_EQUAL(uri.toString(), "ether://[33:33:01:01:01:01]");
Junxiao Shi77dcadd2014-10-05 14:40:54 -0700455}
456
Junxiao Shi4083c8d2014-10-12 16:43:16 -0700457BOOST_FIXTURE_TEST_CASE(CanonizeEther, CanonizeFixture)
458{
459 BOOST_CHECK_EQUAL(FaceUri::canCanonize("ether"), true);
460
461 BOOST_CHECK_EQUAL(FaceUri("ether://[08:00:27:01:01:01]").isCanonical(), true);
462 BOOST_CHECK_EQUAL(FaceUri("ether://[08:00:27:1:1:1]").isCanonical(), false);
463 BOOST_CHECK_EQUAL(FaceUri("ether://[08:00:27:01:01:01]/").isCanonical(), false);
464 BOOST_CHECK_EQUAL(FaceUri("ether://[33:33:01:01:01:01]").isCanonical(), true);
465
Davide Pesavento2d7c5852022-07-18 16:02:52 -0400466 runTest("ether://[08:00:27:01:01:01]", true, "ether://[08:00:27:01:01:01]");
467 runTest("ether://[08:00:27:1:1:1]", true, "ether://[08:00:27:01:01:01]");
468 runTest("ether://[08:00:27:01:01:01]/", true, "ether://[08:00:27:01:01:01]");
469 runTest("ether://[33:33:01:01:01:01]", true, "ether://[33:33:01:01:01:01]");
Junxiao Shi4083c8d2014-10-12 16:43:16 -0700470}
471
Davide Pesavento94048922023-08-11 22:00:01 -0400472BOOST_AUTO_TEST_CASE(ParseDev,
473 * boost::unit_test::expected_failures(1))
Junxiao Shi77dcadd2014-10-05 14:40:54 -0700474{
475 FaceUri uri;
476
477 BOOST_CHECK(uri.parse("dev://eth0"));
478 BOOST_CHECK_EQUAL(uri.getScheme(), "dev");
479 BOOST_CHECK_EQUAL(uri.getHost(), "eth0");
480 BOOST_CHECK_EQUAL(uri.getPort(), "");
481 BOOST_CHECK_EQUAL(uri.getPath(), "");
482
Junxiao Shid5c2f0c2017-04-04 09:52:11 +0000483 BOOST_CHECK_EQUAL(uri.parse("dev://eth0:8888"), false); // Bug #3896
484
Junxiao Shi77dcadd2014-10-05 14:40:54 -0700485 std::string ifname = "en1";
Davide Pesavento8a8c01b2018-03-11 00:07:52 -0500486 uri = FaceUri::fromDev(ifname);
Junxiao Shid5c2f0c2017-04-04 09:52:11 +0000487 BOOST_CHECK_EQUAL(uri.toString(), "dev://en1");
488}
489
490BOOST_AUTO_TEST_CASE(IsCanonicalDev)
491{
492 BOOST_CHECK_EQUAL(FaceUri::canCanonize("dev"), true);
493
494 BOOST_CHECK_EQUAL(FaceUri("dev://eth0").isCanonical(), true);
495 BOOST_CHECK_EQUAL(FaceUri("dev://").isCanonical(), false);
496 BOOST_CHECK_EQUAL(FaceUri("dev://eth0:8888").isCanonical(), false);
497 BOOST_CHECK_EQUAL(FaceUri("dev://eth0/").isCanonical(), false);
498 BOOST_CHECK_EQUAL(FaceUri("dev://eth0/A").isCanonical(), false);
499}
500
501BOOST_FIXTURE_TEST_CASE(CanonizeDev, CanonizeFixture)
502{
Davide Pesavento2d7c5852022-07-18 16:02:52 -0400503 runTest("dev://eth0", true, "dev://eth0");
504 runTest("dev://", false);
505 runTest("dev://eth0:8888", false);
506 runTest("dev://eth0/", true, "dev://eth0");
507 runTest("dev://eth0/A", false);
Junxiao Shi77dcadd2014-10-05 14:40:54 -0700508}
509
Weiwei Liud7f4fda2016-10-19 22:38:39 -0700510BOOST_AUTO_TEST_CASE(ParseUdpDev)
511{
512 FaceUri uri;
513
514 BOOST_CHECK(uri.parse("udp4+dev://eth0:7777"));
515 BOOST_CHECK_EQUAL(uri.getScheme(), "udp4+dev");
516 BOOST_CHECK_EQUAL(uri.getHost(), "eth0");
517 BOOST_CHECK_EQUAL(uri.getPort(), "7777");
518 BOOST_CHECK_EQUAL(uri.getPath(), "");
519
520 BOOST_CHECK(uri.parse("udp6+dev://eth1:7777"));
521 BOOST_CHECK_EQUAL(uri.getScheme(), "udp6+dev");
522 BOOST_CHECK_EQUAL(uri.getHost(), "eth1");
523 BOOST_CHECK_EQUAL(uri.getPort(), "7777");
524 BOOST_CHECK_EQUAL(uri.getPath(), "");
525
526 BOOST_CHECK(uri.parse("abc+efg://eth0"));
527 BOOST_CHECK(!uri.parse("abc+://eth0"));
528 BOOST_CHECK(!uri.parse("+abc://eth0"));
529
Davide Pesaventoe1081cd2016-12-19 23:58:15 -0500530 namespace ip = boost::asio::ip;
Weiwei Liud7f4fda2016-10-19 22:38:39 -0700531
532 ip::udp::endpoint endpoint4(ip::udp::v4(), 7777);
Davide Pesavento8a8c01b2018-03-11 00:07:52 -0500533 uri = FaceUri::fromUdpDev(endpoint4, "en1");
534 BOOST_CHECK_EQUAL(uri.toString(), "udp4+dev://en1:7777");
Weiwei Liud7f4fda2016-10-19 22:38:39 -0700535
536 ip::udp::endpoint endpoint6(ip::udp::v6(), 7777);
Davide Pesavento8a8c01b2018-03-11 00:07:52 -0500537 uri = FaceUri::fromUdpDev(endpoint6, "en2");
538 BOOST_CHECK_EQUAL(uri.toString(), "udp6+dev://en2:7777");
Weiwei Liud7f4fda2016-10-19 22:38:39 -0700539}
540
541BOOST_FIXTURE_TEST_CASE(CanonizeUdpDev, CanonizeFixture)
542{
543 BOOST_CHECK_EQUAL(FaceUri("udp4+dev://eth0:7777").isCanonical(), true);
544 BOOST_CHECK_EQUAL(FaceUri("udp6+dev://eth1:7777").isCanonical(), true);
545 BOOST_CHECK_EQUAL(FaceUri("udp+dev://eth1:7777").isCanonical(), false);
546 BOOST_CHECK_EQUAL(FaceUri("udp6+dev://eth1").isCanonical(), false);
547
Davide Pesavento2d7c5852022-07-18 16:02:52 -0400548 runTest("udp4+dev://en0:7777", true, "udp4+dev://en0:7777");
549 runTest("udp6+dev://en0:7777", true, "udp6+dev://en0:7777");
550 runTest("udp+dev://en1:7777", false);
551 runTest("udp6+dev://en2", false);
Weiwei Liud7f4fda2016-10-19 22:38:39 -0700552}
553
Junxiao Shi4083c8d2014-10-12 16:43:16 -0700554BOOST_AUTO_TEST_CASE(CanonizeEmptyCallback)
555{
Davide Pesavento2f46d652023-11-09 23:40:01 -0500556 boost::asio::io_context io;
Junxiao Shi4083c8d2014-10-12 16:43:16 -0700557
558 // unsupported scheme
Davide Pesavento2d7c5852022-07-18 16:02:52 -0400559 FaceUri("null://").canonize(nullptr, nullptr, io, 1_ms);
Junxiao Shi4083c8d2014-10-12 16:43:16 -0700560
561 // cannot resolve
Davide Pesavento2d7c5852022-07-18 16:02:52 -0400562 FaceUri("udp://192.0.2.333").canonize(nullptr, nullptr, io, 1_ms);
Junxiao Shi4083c8d2014-10-12 16:43:16 -0700563
564 // already canonical
Davide Pesavento2d7c5852022-07-18 16:02:52 -0400565 FaceUri("udp4://192.0.2.1:6363").canonize(nullptr, nullptr, io, 1_ms);
Junxiao Shi4083c8d2014-10-12 16:43:16 -0700566
567 // need DNS resolution
Davide Pesavento2d7c5852022-07-18 16:02:52 -0400568 FaceUri("udp://192.0.2.1:6363").canonize(nullptr, nullptr, io, 1_ms);
Junxiao Shi4083c8d2014-10-12 16:43:16 -0700569
570 io.run(); // should not crash
Davide Pesaventoeee3e822016-11-26 19:19:34 +0100571
572 // avoid "test case [...] did not check any assertions" message from Boost.Test
573 BOOST_CHECK(true);
Junxiao Shi4083c8d2014-10-12 16:43:16 -0700574}
575
576BOOST_FIXTURE_TEST_CASE(CanonizeUnsupported, CanonizeFixture)
577{
578 BOOST_CHECK_EQUAL(FaceUri::canCanonize("internal"), false);
579 BOOST_CHECK_EQUAL(FaceUri::canCanonize("null"), false);
580 BOOST_CHECK_EQUAL(FaceUri::canCanonize("unix"), false);
581 BOOST_CHECK_EQUAL(FaceUri::canCanonize("fd"), false);
Junxiao Shi4083c8d2014-10-12 16:43:16 -0700582
583 BOOST_CHECK_EQUAL(FaceUri("internal://").isCanonical(), false);
584 BOOST_CHECK_EQUAL(FaceUri("null://").isCanonical(), false);
Davide Pesavento16203ea2024-01-01 15:46:44 -0500585 BOOST_CHECK_EQUAL(FaceUri("unix:///run/nfd/nfd.sock").isCanonical(), false);
Junxiao Shi4083c8d2014-10-12 16:43:16 -0700586 BOOST_CHECK_EQUAL(FaceUri("fd://0").isCanonical(), false);
Junxiao Shi4083c8d2014-10-12 16:43:16 -0700587
Davide Pesavento2d7c5852022-07-18 16:02:52 -0400588 runTest("internal://", false);
589 runTest("null://", false);
Davide Pesavento16203ea2024-01-01 15:46:44 -0500590 runTest("unix:///run/nfd/nfd.sock", false);
Davide Pesavento2d7c5852022-07-18 16:02:52 -0400591 runTest("fd://0", false);
Junxiao Shi4083c8d2014-10-12 16:43:16 -0700592}
593
Junxiao Shi77dcadd2014-10-05 14:40:54 -0700594BOOST_AUTO_TEST_CASE(Bug1635)
595{
596 FaceUri uri;
597
598 BOOST_CHECK(uri.parse("wsclient://[::ffff:76.90.11.239]:56366"));
599 BOOST_CHECK_EQUAL(uri.getScheme(), "wsclient");
600 BOOST_CHECK_EQUAL(uri.getHost(), "76.90.11.239");
601 BOOST_CHECK_EQUAL(uri.getPort(), "56366");
602 BOOST_CHECK_EQUAL(uri.getPath(), "");
603 BOOST_CHECK_EQUAL(uri.toString(), "wsclient://76.90.11.239:56366");
604}
605
Junxiao Shi382de672023-08-11 18:17:10 +0000606BOOST_AUTO_TEST_CASE(Compare)
607{
608 FaceUri uri0("udp://[::1]:6363");
609 FaceUri uri1("tcp://[::1]:6363");
610 FaceUri uri2("tcp://127.0.0.1:6363");
Davide Pesavento16203ea2024-01-01 15:46:44 -0500611 FaceUri uri3("unix:///run/nfd/nfd.sock");
Junxiao Shi382de672023-08-11 18:17:10 +0000612
613 BOOST_CHECK_EQUAL(uri0, uri0);
614 BOOST_CHECK_LE(uri0, uri0);
615 BOOST_CHECK_GE(uri0, uri0);
616
617 BOOST_CHECK_GT(uri0, uri1);
618 BOOST_CHECK_GE(uri0, uri1);
619 BOOST_CHECK_NE(uri0, uri1);
620
621 BOOST_CHECK_LT(uri1, uri0);
622 BOOST_CHECK_LE(uri1, uri0);
623 BOOST_CHECK_NE(uri1, uri0);
624
625 BOOST_CHECK_GT(uri0, uri2);
626 BOOST_CHECK_GE(uri0, uri2);
627 BOOST_CHECK_NE(uri0, uri2);
628
629 BOOST_CHECK_LT(uri2, uri0);
630 BOOST_CHECK_LE(uri2, uri0);
631 BOOST_CHECK_NE(uri2, uri0);
632
633 BOOST_CHECK_LT(uri0, uri3);
634 BOOST_CHECK_LE(uri0, uri3);
635 BOOST_CHECK_NE(uri0, uri3);
636
637 BOOST_CHECK_GT(uri3, uri0);
638 BOOST_CHECK_GE(uri3, uri0);
639 BOOST_CHECK_NE(uri3, uri0);
640}
641
Davide Pesaventoeee3e822016-11-26 19:19:34 +0100642BOOST_AUTO_TEST_SUITE_END() // TestFaceUri
Junxiao Shi25467942017-06-30 02:53:14 +0000643BOOST_AUTO_TEST_SUITE_END() // Net
Junxiao Shi77dcadd2014-10-05 14:40:54 -0700644
Davide Pesavento47ce2ee2023-05-09 01:33:33 -0400645} // namespace ndn::tests