blob: e1b7ee9ef8561b035ece6eb2877a5eb96ec73c42 [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 Pesavento0c526032024-01-31 21:14:01 -050068 BOOST_TEST_INFO_SCOPE(std::quoted(request) << " should " << (shouldSucceed ? "succeed" : "fail"));
Davide Pesaventoe1081cd2016-12-19 23:58:15 -050069
Davide Pesavento0c526032024-01-31 21:14:01 -050070 bool didInvokeCb = false;
71 FaceUri uri(request);
72 uri.canonize(
73 [&] (const FaceUri& canonicalUri) {
74 BOOST_CHECK_EQUAL(didInvokeCb, false);
75 didInvokeCb = true;
76 BOOST_CHECK_EQUAL(shouldSucceed, true);
77 if (shouldSucceed) {
78 BOOST_CHECK_EQUAL(canonicalUri.toString(), expectedUri);
79 }
80 },
81 [&] (const std::string&) {
82 BOOST_CHECK_EQUAL(didInvokeCb, false);
83 didInvokeCb = true;
84 BOOST_CHECK_EQUAL(shouldSucceed, false);
85 },
86 m_io, 30_s);
87
88 m_io.run();
89 BOOST_CHECK_EQUAL(didInvokeCb, true);
90 m_io.restart();
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,
Davide Pesavento13260512024-02-01 21:16:04 -0500211 * ut::precondition(NetworkConfigurationDetector::hasIpv4)
Davide Pesavento0c526032024-01-31 21:14:01 -0500212 * ut::expected_failures(1))
Alexander Afanasyev1286e022015-01-26 10:42:29 -0800213{
Junxiao Shi4083c8d2014-10-12 16:43:16 -0700214 // IPv4 unicast
Davide Pesavento2d7c5852022-07-18 16:02:52 -0400215 runTest("udp4://192.0.2.1:6363", true, "udp4://192.0.2.1:6363");
216 runTest("udp://192.0.2.2:6363", true, "udp4://192.0.2.2:6363");
217 runTest("udp4://192.0.2.3", true, "udp4://192.0.2.3:6363");
218 runTest("udp4://192.0.2.4:6363/", true, "udp4://192.0.2.4:6363");
219 runTest("udp4://192.0.2.5:9695", true, "udp4://192.0.2.5:9695");
220 runTest("udp4://192.0.2.666:6363", false);
221 runTest("udp4://192.0.2.7:99999", false); // Bug #3897
222 runTest("udp4://google-public-dns-a.google.com", true, "udp4://8.8.8.8:6363");
223 runTest("udp4://google-public-dns-a.google.com:70000", false);
224 runTest("udp4://invalid.invalid.", false);
225 runTest("udp://invalid.invalid.", false);
Junxiao Shi4083c8d2014-10-12 16:43:16 -0700226
227 // IPv4 multicast
Davide Pesavento2d7c5852022-07-18 16:02:52 -0400228 runTest("udp4://224.0.23.170:56363", true, "udp4://224.0.23.170:56363");
229 runTest("udp4://224.0.23.170", true, "udp4://224.0.23.170:56363");
230 runTest("udp4://all-routers.mcast.net:56363", true, "udp4://224.0.0.2:56363");
231 runTest("udp://all-routers.mcast.net:56363", true, "udp4://224.0.0.2:56363");
Junxiao Shi4083c8d2014-10-12 16:43:16 -0700232
Eric Newberry71aecae2017-05-29 00:22:39 -0700233 // IPv6 used with udp4 protocol - not canonical
Davide Pesavento2d7c5852022-07-18 16:02:52 -0400234 runTest("udp4://[2001:db8::1]:6363", false);
Alexander Afanasyev1286e022015-01-26 10:42:29 -0800235}
236
Davide Pesavento94048922023-08-11 22:00:01 -0400237BOOST_FIXTURE_TEST_CASE(CanonizeUdpV6, CanonizeFixture,
Davide Pesavento13260512024-02-01 21:16:04 -0500238 * ut::precondition(NetworkConfigurationDetector::hasIpv6)
Davide Pesavento0c526032024-01-31 21:14:01 -0500239 * ut::expected_failures(1))
Alexander Afanasyev1286e022015-01-26 10:42:29 -0800240{
Junxiao Shi4083c8d2014-10-12 16:43:16 -0700241 // IPv6 unicast
Davide Pesavento2d7c5852022-07-18 16:02:52 -0400242 runTest("udp6://[2001:db8::1]:6363", true, "udp6://[2001:db8::1]:6363");
243 runTest("udp6://[2001:db8::1]", true, "udp6://[2001:db8::1]:6363");
244 runTest("udp://[2001:db8::1]:6363", true, "udp6://[2001:db8::1]:6363");
245 runTest("udp6://[2001:db8::01]:6363", true, "udp6://[2001:db8::1]:6363");
246 runTest("udp6://[2001::db8::1]:6363", false);
247 runTest("udp6://[2001:db8::1]:99999", false); // Bug #3897
248 runTest("udp6://google-public-dns-a.google.com", true, "udp6://[2001:4860:4860::8888]:6363");
249 runTest("udp6://google-public-dns-a.google.com:70000", false);
250 runTest("udp6://invalid.invalid.", false);
Junxiao Shi4083c8d2014-10-12 16:43:16 -0700251
252 // IPv6 multicast
Davide Pesavento2d7c5852022-07-18 16:02:52 -0400253 runTest("udp6://[ff02::2]:56363", true, "udp6://[ff02::2]:56363");
254 runTest("udp6://[ff02::2]", true, "udp6://[ff02::2]:56363");
Junxiao Shi4083c8d2014-10-12 16:43:16 -0700255
Eric Newberry71aecae2017-05-29 00:22:39 -0700256 // IPv4 used with udp6 protocol - not canonical
Davide Pesavento2d7c5852022-07-18 16:02:52 -0400257 runTest("udp6://192.0.2.1:6363", false);
Eric Newberry71aecae2017-05-29 00:22:39 -0700258
Davide Pesavento4c1ad4c2020-11-16 21:12:02 -0500259 if (m_netif) {
260 auto name = m_netif->getName();
261 auto index = to_string(m_netif->getIndex());
Yanbiao Liac8b4ca2017-07-10 02:27:50 -0700262
Davide Pesavento2d7c5852022-07-18 16:02:52 -0400263 runTest("udp6://[fe80::1068:dddb:fe26:fe3f%25" + name + "]:6363", true,
Yanbiao Liac8b4ca2017-07-10 02:27:50 -0700264 "udp6://[fe80::1068:dddb:fe26:fe3f%" + name + "]:6363");
265
Davide Pesavento2d7c5852022-07-18 16:02:52 -0400266 runTest("udp6://[fe80::1068:dddb:fe26:fe3f%" + index + "]:6363", true,
Yanbiao Liac8b4ca2017-07-10 02:27:50 -0700267 "udp6://[fe80::1068:dddb:fe26:fe3f%" + name + "]:6363");
268 }
Junxiao Shi4083c8d2014-10-12 16:43:16 -0700269}
270
271BOOST_AUTO_TEST_CASE(ParseTcp)
Junxiao Shi77dcadd2014-10-05 14:40:54 -0700272{
273 FaceUri uri;
274
275 BOOST_CHECK(uri.parse("tcp://random.host.name"));
276 BOOST_CHECK_EQUAL(uri.getScheme(), "tcp");
277 BOOST_CHECK_EQUAL(uri.getHost(), "random.host.name");
278 BOOST_CHECK_EQUAL(uri.getPort(), "");
279 BOOST_CHECK_EQUAL(uri.getPath(), "");
280
281 BOOST_CHECK_EQUAL(uri.parse("tcp://192.0.2.1:"), false);
282 BOOST_CHECK_EQUAL(uri.parse("tcp://[::zzzz]"), false);
283
Davide Pesaventoe1081cd2016-12-19 23:58:15 -0500284 namespace ip = boost::asio::ip;
285
Davide Pesavento2f46d652023-11-09 23:40:01 -0500286 ip::tcp::endpoint endpoint4(ip::make_address_v4("192.0.2.1"), 7777);
Davide Pesavento8a8c01b2018-03-11 00:07:52 -0500287 uri = FaceUri(endpoint4);
288 BOOST_CHECK_EQUAL(uri.toString(), "tcp4://192.0.2.1:7777");
Junxiao Shi77dcadd2014-10-05 14:40:54 -0700289
Davide Pesavento8a8c01b2018-03-11 00:07:52 -0500290 uri = FaceUri(endpoint4, "wsclient");
291 BOOST_CHECK_EQUAL(uri.toString(), "wsclient://192.0.2.1:7777");
Junxiao Shi77dcadd2014-10-05 14:40:54 -0700292
Davide Pesavento2f46d652023-11-09 23:40:01 -0500293 ip::tcp::endpoint endpoint6(ip::make_address_v6("2001:DB8::1"), 7777);
Davide Pesavento8a8c01b2018-03-11 00:07:52 -0500294 uri = FaceUri(endpoint6);
295 BOOST_CHECK_EQUAL(uri.toString(), "tcp6://[2001:db8::1]:7777");
Yanbiao Liac8b4ca2017-07-10 02:27:50 -0700296
297 BOOST_CHECK(uri.parse("tcp6://[fe80::1%25eth1]:6363"));
298 BOOST_CHECK_EQUAL(uri.getHost(), "fe80::1%25eth1");
299
300 BOOST_CHECK(uri.parse("tcp6://[fe80::1%eth1]:6363"));
301 BOOST_CHECK_EQUAL(uri.getHost(), "fe80::1%eth1");
302
303 BOOST_CHECK(uri.parse("tcp6://[fe80::1%1]:6363"));
304 BOOST_CHECK(uri.parse("tcp6://[fe80::1%eth1]"));
Junxiao Shi77dcadd2014-10-05 14:40:54 -0700305}
306
Davide Pesaventoe1081cd2016-12-19 23:58:15 -0500307BOOST_FIXTURE_TEST_CASE(IsCanonicalTcp, CanonizeFixture)
Junxiao Shi4083c8d2014-10-12 16:43:16 -0700308{
309 BOOST_CHECK_EQUAL(FaceUri::canCanonize("tcp"), true);
310 BOOST_CHECK_EQUAL(FaceUri::canCanonize("tcp4"), true);
311 BOOST_CHECK_EQUAL(FaceUri::canCanonize("tcp6"), true);
312
313 BOOST_CHECK_EQUAL(FaceUri("tcp4://192.0.2.1:6363").isCanonical(), true);
314 BOOST_CHECK_EQUAL(FaceUri("tcp://192.0.2.1:6363").isCanonical(), false);
315 BOOST_CHECK_EQUAL(FaceUri("tcp4://192.0.2.1").isCanonical(), false);
316 BOOST_CHECK_EQUAL(FaceUri("tcp4://192.0.2.1:6363/").isCanonical(), false);
317 BOOST_CHECK_EQUAL(FaceUri("tcp6://[2001:db8::1]:6363").isCanonical(), true);
318 BOOST_CHECK_EQUAL(FaceUri("tcp6://[2001:db8::01]:6363").isCanonical(), false);
Eric Newberry71aecae2017-05-29 00:22:39 -0700319 BOOST_CHECK_EQUAL(FaceUri("tcp://[2001:db8::1]:6363").isCanonical(), false);
Junxiao Shi4083c8d2014-10-12 16:43:16 -0700320 BOOST_CHECK_EQUAL(FaceUri("tcp://example.net:6363").isCanonical(), false);
321 BOOST_CHECK_EQUAL(FaceUri("tcp4://example.net:6363").isCanonical(), false);
322 BOOST_CHECK_EQUAL(FaceUri("tcp6://example.net:6363").isCanonical(), false);
323 BOOST_CHECK_EQUAL(FaceUri("tcp4://224.0.23.170:56363").isCanonical(), false);
Eric Newberry71aecae2017-05-29 00:22:39 -0700324 BOOST_CHECK_EQUAL(FaceUri("tcp4://[2001:db8::1]:6363").isCanonical(), false);
325 BOOST_CHECK_EQUAL(FaceUri("tcp6://192.0.2.1:6363").isCanonical(), false);
Yanbiao Liac8b4ca2017-07-10 02:27:50 -0700326
Davide Pesavento4c1ad4c2020-11-16 21:12:02 -0500327 if (m_netif) {
328 auto name = m_netif->getName();
329 auto index = to_string(m_netif->getIndex());
Yanbiao Liac8b4ca2017-07-10 02:27:50 -0700330
331 BOOST_CHECK_EQUAL(FaceUri("tcp6://[fe80::1%" + name + "]:6363").isCanonical(), true);
332 BOOST_CHECK_EQUAL(FaceUri("tcp6://[fe80::1%" + index + "]:6363").isCanonical(), false);
333 BOOST_CHECK_EQUAL(FaceUri("tcp6://[fe80::1%" + name + "]").isCanonical(), false);
334 BOOST_CHECK_EQUAL(FaceUri("tcp6://[fe80::1068:dddb:fe26:fe3f%25en0]:6363").isCanonical(), false);
335 }
Alexander Afanasyev1286e022015-01-26 10:42:29 -0800336}
337
Davide Pesavento94048922023-08-11 22:00:01 -0400338BOOST_FIXTURE_TEST_CASE(CanonizeTcpV4, CanonizeFixture,
Davide Pesavento13260512024-02-01 21:16:04 -0500339 * ut::precondition(NetworkConfigurationDetector::hasIpv4)
Davide Pesavento0c526032024-01-31 21:14:01 -0500340 * ut::expected_failures(1))
Alexander Afanasyev1286e022015-01-26 10:42:29 -0800341{
Junxiao Shi4083c8d2014-10-12 16:43:16 -0700342 // IPv4 unicast
Davide Pesavento2d7c5852022-07-18 16:02:52 -0400343 runTest("tcp4://192.0.2.1:6363", true, "tcp4://192.0.2.1:6363");
344 runTest("tcp://192.0.2.2:6363", true, "tcp4://192.0.2.2:6363");
345 runTest("tcp4://192.0.2.3", true, "tcp4://192.0.2.3:6363");
346 runTest("tcp4://192.0.2.4:6363/", true, "tcp4://192.0.2.4:6363");
347 runTest("tcp4://192.0.2.5:9695", true, "tcp4://192.0.2.5:9695");
348 runTest("tcp4://192.0.2.666:6363", false);
349 runTest("tcp4://192.0.2.7:99999", false); // Bug #3897
350 runTest("tcp4://google-public-dns-a.google.com", true, "tcp4://8.8.8.8:6363");
351 runTest("tcp4://google-public-dns-a.google.com:70000", false);
352 runTest("tcp4://invalid.invalid.", false);
353 runTest("tcp://invalid.invalid.", false);
Junxiao Shi4083c8d2014-10-12 16:43:16 -0700354
355 // IPv4 multicast
Davide Pesavento2d7c5852022-07-18 16:02:52 -0400356 runTest("tcp4://224.0.23.170:56363", false);
357 runTest("tcp4://224.0.23.170", false);
358 runTest("tcp4://all-routers.mcast.net:56363", false);
359 runTest("tcp://all-routers.mcast.net:56363", false);
Junxiao Shi4083c8d2014-10-12 16:43:16 -0700360
Eric Newberry71aecae2017-05-29 00:22:39 -0700361 // IPv6 used with tcp4 protocol - not canonical
Davide Pesavento2d7c5852022-07-18 16:02:52 -0400362 runTest("tcp4://[2001:db8::1]:6363", false);
Eric Newberry71aecae2017-05-29 00:22:39 -0700363
Davide Pesavento4c1ad4c2020-11-16 21:12:02 -0500364 if (m_netif) {
365 auto name = m_netif->getName();
366 auto index = to_string(m_netif->getIndex());
Yanbiao Liac8b4ca2017-07-10 02:27:50 -0700367
Davide Pesavento2d7c5852022-07-18 16:02:52 -0400368 runTest("tcp6://[fe80::1068:dddb:fe26:fe3f%25" + name + "]:6363", true,
Yanbiao Liac8b4ca2017-07-10 02:27:50 -0700369 "tcp6://[fe80::1068:dddb:fe26:fe3f%" + name + "]:6363");
370
Davide Pesavento2d7c5852022-07-18 16:02:52 -0400371 runTest("tcp6://[fe80::1068:dddb:fe26:fe3f%" + index + "]:6363", true,
Yanbiao Liac8b4ca2017-07-10 02:27:50 -0700372 "tcp6://[fe80::1068:dddb:fe26:fe3f%" + name + "]:6363");
373 }
Alexander Afanasyev1286e022015-01-26 10:42:29 -0800374}
375
Davide Pesavento94048922023-08-11 22:00:01 -0400376BOOST_FIXTURE_TEST_CASE(CanonizeTcpV6, CanonizeFixture,
Davide Pesavento13260512024-02-01 21:16:04 -0500377 * ut::precondition(NetworkConfigurationDetector::hasIpv6)
Davide Pesavento0c526032024-01-31 21:14:01 -0500378 * ut::expected_failures(1))
Alexander Afanasyev1286e022015-01-26 10:42:29 -0800379{
Junxiao Shi4083c8d2014-10-12 16:43:16 -0700380 // IPv6 unicast
Davide Pesavento2d7c5852022-07-18 16:02:52 -0400381 runTest("tcp6://[2001:db8::1]:6363", true, "tcp6://[2001:db8::1]:6363");
382 runTest("tcp6://[2001:db8::1]", true, "tcp6://[2001:db8::1]:6363");
383 runTest("tcp://[2001:db8::1]:6363", true, "tcp6://[2001:db8::1]:6363");
384 runTest("tcp6://[2001:db8::01]:6363", true, "tcp6://[2001:db8::1]:6363");
385 runTest("tcp6://[2001::db8::1]:6363", false);
386 runTest("tcp6://[2001:db8::1]:99999", false); // Bug #3897
387 runTest("tcp6://google-public-dns-a.google.com", true, "tcp6://[2001:4860:4860::8888]:6363");
388 runTest("tcp6://google-public-dns-a.google.com:70000", false);
389 runTest("tcp6://invalid.invalid.", false);
Junxiao Shi4083c8d2014-10-12 16:43:16 -0700390
391 // IPv6 multicast
Davide Pesavento2d7c5852022-07-18 16:02:52 -0400392 runTest("tcp6://[ff02::2]:56363", false);
393 runTest("tcp6://[ff02::2]", false);
Junxiao Shi4083c8d2014-10-12 16:43:16 -0700394
Eric Newberry71aecae2017-05-29 00:22:39 -0700395 // IPv4 used with tcp6 protocol - not canonical
Davide Pesavento2d7c5852022-07-18 16:02:52 -0400396 runTest("tcp6://192.0.2.1:6363", false);
Junxiao Shi4083c8d2014-10-12 16:43:16 -0700397}
398
Davide Pesavento94048922023-08-11 22:00:01 -0400399BOOST_AUTO_TEST_CASE(ParseUnix,
Davide Pesavento0c526032024-01-31 21:14:01 -0500400 * ut::expected_failures(1))
Junxiao Shi77dcadd2014-10-05 14:40:54 -0700401{
402 FaceUri uri;
403
404 BOOST_CHECK(uri.parse("unix:///var/run/example.sock"));
405 BOOST_CHECK_EQUAL(uri.getScheme(), "unix");
406 BOOST_CHECK_EQUAL(uri.getHost(), "");
407 BOOST_CHECK_EQUAL(uri.getPort(), "");
408 BOOST_CHECK_EQUAL(uri.getPath(), "/var/run/example.sock");
409
Davide Pesaventoe1081cd2016-12-19 23:58:15 -0500410 // This is not a valid unix:// URI, but the parse would treat "var" as host
411 BOOST_CHECK_EQUAL(uri.parse("unix://var/run/example.sock"), false); // Bug #3896
Junxiao Shi77dcadd2014-10-05 14:40:54 -0700412
Davide Pesaventoe1081cd2016-12-19 23:58:15 -0500413#ifdef BOOST_ASIO_HAS_LOCAL_SOCKETS
414 using boost::asio::local::stream_protocol;
415 stream_protocol::endpoint endpoint("/var/run/example.sock");
Davide Pesavento8a8c01b2018-03-11 00:07:52 -0500416 uri = FaceUri(endpoint);
417 BOOST_CHECK_EQUAL(uri.toString(), "unix:///var/run/example.sock");
Davide Pesaventoe1081cd2016-12-19 23:58:15 -0500418#endif // BOOST_ASIO_HAS_LOCAL_SOCKETS
Junxiao Shi77dcadd2014-10-05 14:40:54 -0700419}
420
Junxiao Shi4083c8d2014-10-12 16:43:16 -0700421BOOST_AUTO_TEST_CASE(ParseFd)
Junxiao Shi77dcadd2014-10-05 14:40:54 -0700422{
423 FaceUri uri;
424
425 BOOST_CHECK(uri.parse("fd://6"));
426 BOOST_CHECK_EQUAL(uri.getScheme(), "fd");
427 BOOST_CHECK_EQUAL(uri.getHost(), "6");
428 BOOST_CHECK_EQUAL(uri.getPort(), "");
429 BOOST_CHECK_EQUAL(uri.getPath(), "");
430
431 int fd = 21;
Davide Pesavento8a8c01b2018-03-11 00:07:52 -0500432 uri = FaceUri::fromFd(fd);
433 BOOST_CHECK_EQUAL(uri.toString(), "fd://21");
Junxiao Shi77dcadd2014-10-05 14:40:54 -0700434}
435
Junxiao Shi4083c8d2014-10-12 16:43:16 -0700436BOOST_AUTO_TEST_CASE(ParseEther)
Junxiao Shi77dcadd2014-10-05 14:40:54 -0700437{
438 FaceUri uri;
439
440 BOOST_CHECK(uri.parse("ether://[08:00:27:01:dd:01]"));
441 BOOST_CHECK_EQUAL(uri.getScheme(), "ether");
442 BOOST_CHECK_EQUAL(uri.getHost(), "08:00:27:01:dd:01");
443 BOOST_CHECK_EQUAL(uri.getPort(), "");
444 BOOST_CHECK_EQUAL(uri.getPath(), "");
445
Junxiao Shi4083c8d2014-10-12 16:43:16 -0700446 BOOST_CHECK_EQUAL(uri.parse("ether://[08:00:27:zz:dd:01]"), false);
Junxiao Shi77dcadd2014-10-05 14:40:54 -0700447
Davide Pesaventoe1081cd2016-12-19 23:58:15 -0500448 auto address = ethernet::Address::fromString("33:33:01:01:01:01");
Davide Pesavento8a8c01b2018-03-11 00:07:52 -0500449 uri = FaceUri(address);
450 BOOST_CHECK_EQUAL(uri.toString(), "ether://[33:33:01:01:01:01]");
Junxiao Shi77dcadd2014-10-05 14:40:54 -0700451}
452
Junxiao Shi4083c8d2014-10-12 16:43:16 -0700453BOOST_FIXTURE_TEST_CASE(CanonizeEther, CanonizeFixture)
454{
455 BOOST_CHECK_EQUAL(FaceUri::canCanonize("ether"), true);
456
457 BOOST_CHECK_EQUAL(FaceUri("ether://[08:00:27:01:01:01]").isCanonical(), true);
458 BOOST_CHECK_EQUAL(FaceUri("ether://[08:00:27:1:1:1]").isCanonical(), false);
459 BOOST_CHECK_EQUAL(FaceUri("ether://[08:00:27:01:01:01]/").isCanonical(), false);
460 BOOST_CHECK_EQUAL(FaceUri("ether://[33:33:01:01:01:01]").isCanonical(), true);
461
Davide Pesavento2d7c5852022-07-18 16:02:52 -0400462 runTest("ether://[08:00:27:01:01:01]", true, "ether://[08:00:27:01:01:01]");
463 runTest("ether://[08:00:27:1:1:1]", true, "ether://[08:00:27:01:01:01]");
464 runTest("ether://[08:00:27:01:01:01]/", true, "ether://[08:00:27:01:01:01]");
465 runTest("ether://[33:33:01:01:01:01]", true, "ether://[33:33:01:01:01:01]");
Junxiao Shi4083c8d2014-10-12 16:43:16 -0700466}
467
Davide Pesavento94048922023-08-11 22:00:01 -0400468BOOST_AUTO_TEST_CASE(ParseDev,
Davide Pesavento0c526032024-01-31 21:14:01 -0500469 * ut::expected_failures(1))
Junxiao Shi77dcadd2014-10-05 14:40:54 -0700470{
471 FaceUri uri;
472
473 BOOST_CHECK(uri.parse("dev://eth0"));
474 BOOST_CHECK_EQUAL(uri.getScheme(), "dev");
475 BOOST_CHECK_EQUAL(uri.getHost(), "eth0");
476 BOOST_CHECK_EQUAL(uri.getPort(), "");
477 BOOST_CHECK_EQUAL(uri.getPath(), "");
478
Junxiao Shid5c2f0c2017-04-04 09:52:11 +0000479 BOOST_CHECK_EQUAL(uri.parse("dev://eth0:8888"), false); // Bug #3896
480
Junxiao Shi77dcadd2014-10-05 14:40:54 -0700481 std::string ifname = "en1";
Davide Pesavento8a8c01b2018-03-11 00:07:52 -0500482 uri = FaceUri::fromDev(ifname);
Junxiao Shid5c2f0c2017-04-04 09:52:11 +0000483 BOOST_CHECK_EQUAL(uri.toString(), "dev://en1");
484}
485
486BOOST_AUTO_TEST_CASE(IsCanonicalDev)
487{
488 BOOST_CHECK_EQUAL(FaceUri::canCanonize("dev"), true);
489
490 BOOST_CHECK_EQUAL(FaceUri("dev://eth0").isCanonical(), true);
491 BOOST_CHECK_EQUAL(FaceUri("dev://").isCanonical(), false);
492 BOOST_CHECK_EQUAL(FaceUri("dev://eth0:8888").isCanonical(), false);
493 BOOST_CHECK_EQUAL(FaceUri("dev://eth0/").isCanonical(), false);
494 BOOST_CHECK_EQUAL(FaceUri("dev://eth0/A").isCanonical(), false);
495}
496
497BOOST_FIXTURE_TEST_CASE(CanonizeDev, CanonizeFixture)
498{
Davide Pesavento2d7c5852022-07-18 16:02:52 -0400499 runTest("dev://eth0", true, "dev://eth0");
500 runTest("dev://", false);
501 runTest("dev://eth0:8888", false);
502 runTest("dev://eth0/", true, "dev://eth0");
503 runTest("dev://eth0/A", false);
Junxiao Shi77dcadd2014-10-05 14:40:54 -0700504}
505
Weiwei Liud7f4fda2016-10-19 22:38:39 -0700506BOOST_AUTO_TEST_CASE(ParseUdpDev)
507{
508 FaceUri uri;
509
510 BOOST_CHECK(uri.parse("udp4+dev://eth0:7777"));
511 BOOST_CHECK_EQUAL(uri.getScheme(), "udp4+dev");
512 BOOST_CHECK_EQUAL(uri.getHost(), "eth0");
513 BOOST_CHECK_EQUAL(uri.getPort(), "7777");
514 BOOST_CHECK_EQUAL(uri.getPath(), "");
515
516 BOOST_CHECK(uri.parse("udp6+dev://eth1:7777"));
517 BOOST_CHECK_EQUAL(uri.getScheme(), "udp6+dev");
518 BOOST_CHECK_EQUAL(uri.getHost(), "eth1");
519 BOOST_CHECK_EQUAL(uri.getPort(), "7777");
520 BOOST_CHECK_EQUAL(uri.getPath(), "");
521
522 BOOST_CHECK(uri.parse("abc+efg://eth0"));
523 BOOST_CHECK(!uri.parse("abc+://eth0"));
524 BOOST_CHECK(!uri.parse("+abc://eth0"));
525
Davide Pesaventoe1081cd2016-12-19 23:58:15 -0500526 namespace ip = boost::asio::ip;
Weiwei Liud7f4fda2016-10-19 22:38:39 -0700527
528 ip::udp::endpoint endpoint4(ip::udp::v4(), 7777);
Davide Pesavento8a8c01b2018-03-11 00:07:52 -0500529 uri = FaceUri::fromUdpDev(endpoint4, "en1");
530 BOOST_CHECK_EQUAL(uri.toString(), "udp4+dev://en1:7777");
Weiwei Liud7f4fda2016-10-19 22:38:39 -0700531
532 ip::udp::endpoint endpoint6(ip::udp::v6(), 7777);
Davide Pesavento8a8c01b2018-03-11 00:07:52 -0500533 uri = FaceUri::fromUdpDev(endpoint6, "en2");
534 BOOST_CHECK_EQUAL(uri.toString(), "udp6+dev://en2:7777");
Weiwei Liud7f4fda2016-10-19 22:38:39 -0700535}
536
537BOOST_FIXTURE_TEST_CASE(CanonizeUdpDev, CanonizeFixture)
538{
539 BOOST_CHECK_EQUAL(FaceUri("udp4+dev://eth0:7777").isCanonical(), true);
540 BOOST_CHECK_EQUAL(FaceUri("udp6+dev://eth1:7777").isCanonical(), true);
541 BOOST_CHECK_EQUAL(FaceUri("udp+dev://eth1:7777").isCanonical(), false);
542 BOOST_CHECK_EQUAL(FaceUri("udp6+dev://eth1").isCanonical(), false);
543
Davide Pesavento2d7c5852022-07-18 16:02:52 -0400544 runTest("udp4+dev://en0:7777", true, "udp4+dev://en0:7777");
545 runTest("udp6+dev://en0:7777", true, "udp6+dev://en0:7777");
546 runTest("udp+dev://en1:7777", false);
547 runTest("udp6+dev://en2", false);
Weiwei Liud7f4fda2016-10-19 22:38:39 -0700548}
549
Junxiao Shi4083c8d2014-10-12 16:43:16 -0700550BOOST_AUTO_TEST_CASE(CanonizeEmptyCallback)
551{
Davide Pesavento2f46d652023-11-09 23:40:01 -0500552 boost::asio::io_context io;
Junxiao Shi4083c8d2014-10-12 16:43:16 -0700553
554 // unsupported scheme
Davide Pesavento2d7c5852022-07-18 16:02:52 -0400555 FaceUri("null://").canonize(nullptr, nullptr, io, 1_ms);
Junxiao Shi4083c8d2014-10-12 16:43:16 -0700556
557 // cannot resolve
Davide Pesavento2d7c5852022-07-18 16:02:52 -0400558 FaceUri("udp://192.0.2.333").canonize(nullptr, nullptr, io, 1_ms);
Junxiao Shi4083c8d2014-10-12 16:43:16 -0700559
560 // already canonical
Davide Pesavento2d7c5852022-07-18 16:02:52 -0400561 FaceUri("udp4://192.0.2.1:6363").canonize(nullptr, nullptr, io, 1_ms);
Junxiao Shi4083c8d2014-10-12 16:43:16 -0700562
563 // need DNS resolution
Davide Pesavento2d7c5852022-07-18 16:02:52 -0400564 FaceUri("udp://192.0.2.1:6363").canonize(nullptr, nullptr, io, 1_ms);
Junxiao Shi4083c8d2014-10-12 16:43:16 -0700565
566 io.run(); // should not crash
Davide Pesaventoeee3e822016-11-26 19:19:34 +0100567
568 // avoid "test case [...] did not check any assertions" message from Boost.Test
569 BOOST_CHECK(true);
Junxiao Shi4083c8d2014-10-12 16:43:16 -0700570}
571
572BOOST_FIXTURE_TEST_CASE(CanonizeUnsupported, CanonizeFixture)
573{
574 BOOST_CHECK_EQUAL(FaceUri::canCanonize("internal"), false);
575 BOOST_CHECK_EQUAL(FaceUri::canCanonize("null"), false);
576 BOOST_CHECK_EQUAL(FaceUri::canCanonize("unix"), false);
577 BOOST_CHECK_EQUAL(FaceUri::canCanonize("fd"), false);
Junxiao Shi4083c8d2014-10-12 16:43:16 -0700578
579 BOOST_CHECK_EQUAL(FaceUri("internal://").isCanonical(), false);
580 BOOST_CHECK_EQUAL(FaceUri("null://").isCanonical(), false);
Davide Pesavento16203ea2024-01-01 15:46:44 -0500581 BOOST_CHECK_EQUAL(FaceUri("unix:///run/nfd/nfd.sock").isCanonical(), false);
Junxiao Shi4083c8d2014-10-12 16:43:16 -0700582 BOOST_CHECK_EQUAL(FaceUri("fd://0").isCanonical(), false);
Junxiao Shi4083c8d2014-10-12 16:43:16 -0700583
Davide Pesavento2d7c5852022-07-18 16:02:52 -0400584 runTest("internal://", false);
585 runTest("null://", false);
Davide Pesavento16203ea2024-01-01 15:46:44 -0500586 runTest("unix:///run/nfd/nfd.sock", false);
Davide Pesavento2d7c5852022-07-18 16:02:52 -0400587 runTest("fd://0", false);
Junxiao Shi4083c8d2014-10-12 16:43:16 -0700588}
589
Davide Pesavento0c526032024-01-31 21:14:01 -0500590BOOST_AUTO_TEST_CASE(Ipv4MappedIpv6Address,
591 * ut::description("test for bug #1635"))
Junxiao Shi77dcadd2014-10-05 14:40:54 -0700592{
593 FaceUri uri;
594
595 BOOST_CHECK(uri.parse("wsclient://[::ffff:76.90.11.239]:56366"));
596 BOOST_CHECK_EQUAL(uri.getScheme(), "wsclient");
597 BOOST_CHECK_EQUAL(uri.getHost(), "76.90.11.239");
598 BOOST_CHECK_EQUAL(uri.getPort(), "56366");
599 BOOST_CHECK_EQUAL(uri.getPath(), "");
600 BOOST_CHECK_EQUAL(uri.toString(), "wsclient://76.90.11.239:56366");
601}
602
Junxiao Shi382de672023-08-11 18:17:10 +0000603BOOST_AUTO_TEST_CASE(Compare)
604{
605 FaceUri uri0("udp://[::1]:6363");
606 FaceUri uri1("tcp://[::1]:6363");
607 FaceUri uri2("tcp://127.0.0.1:6363");
Davide Pesavento16203ea2024-01-01 15:46:44 -0500608 FaceUri uri3("unix:///run/nfd/nfd.sock");
Junxiao Shi382de672023-08-11 18:17:10 +0000609
610 BOOST_CHECK_EQUAL(uri0, uri0);
611 BOOST_CHECK_LE(uri0, uri0);
612 BOOST_CHECK_GE(uri0, uri0);
613
614 BOOST_CHECK_GT(uri0, uri1);
615 BOOST_CHECK_GE(uri0, uri1);
616 BOOST_CHECK_NE(uri0, uri1);
617
618 BOOST_CHECK_LT(uri1, uri0);
619 BOOST_CHECK_LE(uri1, uri0);
620 BOOST_CHECK_NE(uri1, uri0);
621
622 BOOST_CHECK_GT(uri0, uri2);
623 BOOST_CHECK_GE(uri0, uri2);
624 BOOST_CHECK_NE(uri0, uri2);
625
626 BOOST_CHECK_LT(uri2, uri0);
627 BOOST_CHECK_LE(uri2, uri0);
628 BOOST_CHECK_NE(uri2, uri0);
629
630 BOOST_CHECK_LT(uri0, uri3);
631 BOOST_CHECK_LE(uri0, uri3);
632 BOOST_CHECK_NE(uri0, uri3);
633
634 BOOST_CHECK_GT(uri3, uri0);
635 BOOST_CHECK_GE(uri3, uri0);
636 BOOST_CHECK_NE(uri3, uri0);
637}
638
Davide Pesaventoeee3e822016-11-26 19:19:34 +0100639BOOST_AUTO_TEST_SUITE_END() // TestFaceUri
Junxiao Shi25467942017-06-30 02:53:14 +0000640BOOST_AUTO_TEST_SUITE_END() // Net
Junxiao Shi77dcadd2014-10-05 14:40:54 -0700641
Davide Pesavento47ce2ee2023-05-09 01:33:33 -0400642} // namespace ndn::tests