blob: c4ae02609167ec000ceb1475a7058204c661fc99 [file] [log] [blame]
Alexander Afanasyev5fc795f2014-10-20 23:06:56 -04001/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
Junxiao Shi1ad0b4b2017-08-18 14:19:14 +00002/*
Davide Pesaventof6b45892023-03-13 15:00:51 -04003 * Copyright (c) 2013-2023 Regents of the University of California.
Alexander Afanasyev5fc795f2014-10-20 23:06:56 -04004 *
5 * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
6 *
7 * ndn-cxx library is free software: you can redistribute it and/or modify it under the
8 * terms of the GNU Lesser General Public License as published by the Free Software
9 * Foundation, either version 3 of the License, or (at your option) any later version.
10 *
11 * ndn-cxx library is distributed in the hope that it will be useful, but WITHOUT ANY
12 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
13 * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
14 *
15 * You should have received copies of the GNU General Public License and GNU Lesser
16 * General Public License along with ndn-cxx, e.g., in COPYING.md file. If not, see
17 * <http://www.gnu.org/licenses/>.
18 *
19 * See AUTHORS.md for complete list of ndn-cxx authors and contributors.
20 */
21
Davide Pesavento7e780642018-11-24 15:51:34 -050022#include "ndn-cxx/face.hpp"
23#include "ndn-cxx/lp/tags.hpp"
24#include "ndn-cxx/transport/tcp-transport.hpp"
25#include "ndn-cxx/transport/unix-transport.hpp"
Davide Pesaventof135f152022-01-06 20:43:06 -050026#include "ndn-cxx/util/config-file.hpp"
Davide Pesavento7e780642018-11-24 15:51:34 -050027#include "ndn-cxx/util/dummy-client-face.hpp"
Alexander Afanasyev5fc795f2014-10-20 23:06:56 -040028
Davide Pesavento4c1ad4c2020-11-16 21:12:02 -050029#include "tests/test-common.hpp"
30#include "tests/unit/io-key-chain-fixture.hpp"
Alexander Afanasyev5fc795f2014-10-20 23:06:56 -040031
Junxiao Shiec475a72019-01-13 21:53:55 +000032#include <boost/logic/tribool.hpp>
33
Davide Pesavento47ce2ee2023-05-09 01:33:33 -040034namespace ndn::tests {
Junxiao Shia60d9362014-11-12 09:38:21 -070035
Junxiao Shiec475a72019-01-13 21:53:55 +000036struct WantPrefixRegReply;
37struct NoPrefixRegReply;
38
39template<typename PrefixRegReply = WantPrefixRegReply>
Davide Pesavento4c1ad4c2020-11-16 21:12:02 -050040class FaceFixture : public IoKeyChainFixture
Alexander Afanasyev5fc795f2014-10-20 23:06:56 -040041{
Davide Pesaventod247d492020-01-28 21:30:20 -050042protected:
Junxiao Shiec475a72019-01-13 21:53:55 +000043 FaceFixture()
Davide Pesavento187e9f92023-03-20 22:46:22 -040044 : face(m_io, m_keyChain, {true, !std::is_same_v<PrefixRegReply, NoPrefixRegReply>})
Alexander Afanasyev5fc795f2014-10-20 23:06:56 -040045 {
Davide Pesavento187e9f92023-03-20 22:46:22 -040046 static_assert(std::is_same_v<PrefixRegReply, WantPrefixRegReply> ||
47 std::is_same_v<PrefixRegReply, NoPrefixRegReply>, "");
Junxiao Shiec475a72019-01-13 21:53:55 +000048 }
49
50 /** \brief Execute a prefix registration, and optionally check the name in callback.
51 * \return whether the prefix registration succeeded.
52 */
53 bool
Davide Pesaventoeb87c282023-03-15 21:07:02 -040054 runPrefixReg(std::function<void(const RegisterPrefixSuccessCallback&,
55 const RegisterPrefixFailureCallback&)> f)
Junxiao Shiec475a72019-01-13 21:53:55 +000056 {
57 boost::logic::tribool result = boost::logic::indeterminate;
Davide Pesaventod247d492020-01-28 21:30:20 -050058 f([&] (auto) { result = true; },
59 [&] (auto, auto) { result = false; });
Junxiao Shiec475a72019-01-13 21:53:55 +000060
61 advanceClocks(1_ms);
62 BOOST_REQUIRE(!boost::logic::indeterminate(result));
63 return static_cast<bool>(result);
64 }
65
66 /** \brief Execute a prefix unregistration, and optionally check the name in callback.
67 * \return whether the prefix unregistration succeeded.
68 */
69 bool
Davide Pesaventoeb87c282023-03-15 21:07:02 -040070 runPrefixUnreg(std::function<void(const UnregisterPrefixSuccessCallback&,
71 const UnregisterPrefixFailureCallback&)> f)
Junxiao Shiec475a72019-01-13 21:53:55 +000072 {
73 boost::logic::tribool result = boost::logic::indeterminate;
Davide Pesaventod247d492020-01-28 21:30:20 -050074 f([&] { result = true; },
75 [&] (auto) { result = false; });
Junxiao Shiec475a72019-01-13 21:53:55 +000076
77 advanceClocks(1_ms);
78 BOOST_REQUIRE(!boost::logic::indeterminate(result));
79 return static_cast<bool>(result);
Alexander Afanasyev5fc795f2014-10-20 23:06:56 -040080 }
81
Davide Pesaventod247d492020-01-28 21:30:20 -050082protected:
Alexander Afanasyev9bdbb832015-12-30 12:54:22 -080083 DummyClientFace face;
Alexander Afanasyev5fc795f2014-10-20 23:06:56 -040084};
85
Junxiao Shiec475a72019-01-13 21:53:55 +000086BOOST_FIXTURE_TEST_SUITE(TestFace, FaceFixture<>)
Alexander Afanasyev5fc795f2014-10-20 23:06:56 -040087
Davide Pesaventod247d492020-01-28 21:30:20 -050088BOOST_AUTO_TEST_SUITE(ExpressInterest)
Junxiao Shi103d8ed2016-08-07 20:34:10 +000089
Davide Pesaventod247d492020-01-28 21:30:20 -050090BOOST_AUTO_TEST_CASE(ReplyData)
Alexander Afanasyev5fc795f2014-10-20 23:06:56 -040091{
Alexander Afanasyevd3a55b22014-11-18 19:23:28 -080092 size_t nData = 0;
Junxiao Shib55e5d32018-07-18 13:32:00 -060093 face.expressInterest(*makeInterest("/Hello/World", true, 50_ms),
Alexander Afanasyev9bdbb832015-12-30 12:54:22 -080094 [&] (const Interest& i, const Data& d) {
95 BOOST_CHECK(i.getName().isPrefixOf(d.getName()));
96 BOOST_CHECK_EQUAL(i.getName(), "/Hello/World");
97 ++nData;
98 },
Davide Pesavento152ef442023-04-22 02:02:29 -040099 std::bind([] { BOOST_FAIL("Unexpected Nack"); }),
100 std::bind([] { BOOST_FAIL("Unexpected timeout"); }));
Eric Newberry83872fd2015-08-06 17:01:24 -0700101
Davide Pesavento0f830802018-01-16 23:58:58 -0500102 advanceClocks(40_ms);
Eric Newberry83872fd2015-08-06 17:01:24 -0700103
Junxiao Shi85d90832016-08-04 03:19:46 +0000104 face.receive(*makeData("/Bye/World/a"));
105 face.receive(*makeData("/Hello/World/a"));
Eric Newberry83872fd2015-08-06 17:01:24 -0700106
Davide Pesavento0f830802018-01-16 23:58:58 -0500107 advanceClocks(50_ms, 2);
Eric Newberry83872fd2015-08-06 17:01:24 -0700108
109 BOOST_CHECK_EQUAL(nData, 1);
Alexander Afanasyev9bdbb832015-12-30 12:54:22 -0800110 BOOST_CHECK_EQUAL(face.sentInterests.size(), 1);
111 BOOST_CHECK_EQUAL(face.sentData.size(), 0);
Eric Newberry83872fd2015-08-06 17:01:24 -0700112
113 size_t nTimeouts = 0;
Junxiao Shib55e5d32018-07-18 13:32:00 -0600114 face.expressInterest(*makeInterest("/Hello/World/a/2", false, 50_ms),
Davide Pesavento152ef442023-04-22 02:02:29 -0400115 std::bind([]{}),
116 std::bind([]{}),
117 std::bind([&nTimeouts] { ++nTimeouts; }));
Davide Pesavento0f830802018-01-16 23:58:58 -0500118 advanceClocks(200_ms, 5);
Eric Newberry83872fd2015-08-06 17:01:24 -0700119 BOOST_CHECK_EQUAL(nTimeouts, 1);
120}
121
Davide Pesaventod247d492020-01-28 21:30:20 -0500122BOOST_AUTO_TEST_CASE(MultipleData)
Alexander Afanasyev1013fd02017-01-03 13:19:03 -0800123{
124 size_t nData = 0;
125
Junxiao Shib55e5d32018-07-18 13:32:00 -0600126 face.expressInterest(*makeInterest("/Hello/World", true, 50_ms),
Davide Pesaventod247d492020-01-28 21:30:20 -0500127 [&] (const auto&, const auto&) { ++nData; },
Davide Pesavento152ef442023-04-22 02:02:29 -0400128 std::bind([] { BOOST_FAIL("Unexpected Nack"); }),
129 std::bind([] { BOOST_FAIL("Unexpected timeout"); }));
Alexander Afanasyev1013fd02017-01-03 13:19:03 -0800130
Junxiao Shib55e5d32018-07-18 13:32:00 -0600131 face.expressInterest(*makeInterest("/Hello/World/a", true, 50_ms),
Davide Pesaventod247d492020-01-28 21:30:20 -0500132 [&] (const auto&, const auto&) { ++nData; },
Davide Pesavento152ef442023-04-22 02:02:29 -0400133 std::bind([] { BOOST_FAIL("Unexpected Nack"); }),
134 std::bind([] { BOOST_FAIL("Unexpected timeout"); }));
Alexander Afanasyev1013fd02017-01-03 13:19:03 -0800135
Davide Pesavento0f830802018-01-16 23:58:58 -0500136 advanceClocks(40_ms);
Alexander Afanasyev1013fd02017-01-03 13:19:03 -0800137
138 face.receive(*makeData("/Hello/World/a/b"));
139
Davide Pesavento0f830802018-01-16 23:58:58 -0500140 advanceClocks(50_ms, 2);
Alexander Afanasyev1013fd02017-01-03 13:19:03 -0800141
142 BOOST_CHECK_EQUAL(nData, 2);
143 BOOST_CHECK_EQUAL(face.sentInterests.size(), 2);
144 BOOST_CHECK_EQUAL(face.sentData.size(), 0);
145}
146
Davide Pesaventod247d492020-01-28 21:30:20 -0500147BOOST_AUTO_TEST_CASE(EmptyDataCallback)
Junxiao Shi76e0eb22016-08-08 05:54:10 +0000148{
Junxiao Shib55e5d32018-07-18 13:32:00 -0600149 face.expressInterest(*makeInterest("/Hello/World", true),
Junxiao Shi76e0eb22016-08-08 05:54:10 +0000150 nullptr,
Davide Pesavento152ef442023-04-22 02:02:29 -0400151 std::bind([] { BOOST_FAIL("Unexpected Nack"); }),
152 std::bind([] { BOOST_FAIL("Unexpected timeout"); }));
Davide Pesavento0f830802018-01-16 23:58:58 -0500153 advanceClocks(1_ms);
Junxiao Shi76e0eb22016-08-08 05:54:10 +0000154
155 BOOST_CHECK_NO_THROW(do {
156 face.receive(*makeData("/Hello/World/a"));
Davide Pesavento0f830802018-01-16 23:58:58 -0500157 advanceClocks(1_ms);
Junxiao Shi76e0eb22016-08-08 05:54:10 +0000158 } while (false));
159}
160
Davide Pesaventod247d492020-01-28 21:30:20 -0500161BOOST_AUTO_TEST_CASE(Timeout)
Alexander Afanasyev5fc795f2014-10-20 23:06:56 -0400162{
Alexander Afanasyevd3a55b22014-11-18 19:23:28 -0800163 size_t nTimeouts = 0;
Junxiao Shib55e5d32018-07-18 13:32:00 -0600164 face.expressInterest(*makeInterest("/Hello/World", false, 50_ms),
Davide Pesavento152ef442023-04-22 02:02:29 -0400165 std::bind([] { BOOST_FAIL("Unexpected Data"); }),
166 std::bind([] { BOOST_FAIL("Unexpected Nack"); }),
Alexander Afanasyev9bdbb832015-12-30 12:54:22 -0800167 [&nTimeouts] (const Interest& i) {
168 BOOST_CHECK_EQUAL(i.getName(), "/Hello/World");
169 ++nTimeouts;
170 });
Eric Newberry83872fd2015-08-06 17:01:24 -0700171
Davide Pesavento0f830802018-01-16 23:58:58 -0500172 advanceClocks(200_ms, 5);
Eric Newberry83872fd2015-08-06 17:01:24 -0700173
174 BOOST_CHECK_EQUAL(nTimeouts, 1);
Alexander Afanasyev9bdbb832015-12-30 12:54:22 -0800175 BOOST_CHECK_EQUAL(face.sentInterests.size(), 1);
176 BOOST_CHECK_EQUAL(face.sentData.size(), 0);
177 BOOST_CHECK_EQUAL(face.sentNacks.size(), 0);
Eric Newberry83872fd2015-08-06 17:01:24 -0700178}
179
Davide Pesaventod247d492020-01-28 21:30:20 -0500180BOOST_AUTO_TEST_CASE(EmptyTimeoutCallback)
Junxiao Shi76e0eb22016-08-08 05:54:10 +0000181{
Junxiao Shib55e5d32018-07-18 13:32:00 -0600182 face.expressInterest(*makeInterest("/Hello/World", false, 50_ms),
Davide Pesavento152ef442023-04-22 02:02:29 -0400183 std::bind([] { BOOST_FAIL("Unexpected Data"); }),
184 std::bind([] { BOOST_FAIL("Unexpected Nack"); }),
Junxiao Shi76e0eb22016-08-08 05:54:10 +0000185 nullptr);
Davide Pesavento0f830802018-01-16 23:58:58 -0500186 advanceClocks(40_ms);
Junxiao Shi76e0eb22016-08-08 05:54:10 +0000187
188 BOOST_CHECK_NO_THROW(do {
Davide Pesavento0f830802018-01-16 23:58:58 -0500189 advanceClocks(6_ms, 2);
Junxiao Shi76e0eb22016-08-08 05:54:10 +0000190 } while (false));
191}
192
Davide Pesaventod247d492020-01-28 21:30:20 -0500193BOOST_AUTO_TEST_CASE(ReplyNack)
Eric Newberry83872fd2015-08-06 17:01:24 -0700194{
195 size_t nNacks = 0;
196
Junxiao Shib55e5d32018-07-18 13:32:00 -0600197 auto interest = makeInterest("/Hello/World", false, 50_ms);
Eric Newberry83872fd2015-08-06 17:01:24 -0700198
Junxiao Shib55e5d32018-07-18 13:32:00 -0600199 face.expressInterest(*interest,
Davide Pesavento152ef442023-04-22 02:02:29 -0400200 std::bind([] { BOOST_FAIL("Unexpected Data"); }),
Alexander Afanasyev9bdbb832015-12-30 12:54:22 -0800201 [&] (const Interest& i, const lp::Nack& n) {
202 BOOST_CHECK(i.getName().isPrefixOf(n.getInterest().getName()));
203 BOOST_CHECK_EQUAL(i.getName(), "/Hello/World");
204 BOOST_CHECK_EQUAL(n.getReason(), lp::NackReason::DUPLICATE);
205 ++nNacks;
206 },
Davide Pesavento152ef442023-04-22 02:02:29 -0400207 std::bind([] { BOOST_FAIL("Unexpected timeout"); }));
Eric Newberry83872fd2015-08-06 17:01:24 -0700208
Davide Pesavento0f830802018-01-16 23:58:58 -0500209 advanceClocks(40_ms);
Eric Newberry83872fd2015-08-06 17:01:24 -0700210
Junxiao Shif5b5ae22016-08-08 05:54:41 +0000211 face.receive(makeNack(face.sentInterests.at(0), lp::NackReason::DUPLICATE));
Eric Newberry83872fd2015-08-06 17:01:24 -0700212
Davide Pesavento0f830802018-01-16 23:58:58 -0500213 advanceClocks(50_ms, 2);
Eric Newberry83872fd2015-08-06 17:01:24 -0700214
215 BOOST_CHECK_EQUAL(nNacks, 1);
Alexander Afanasyev9bdbb832015-12-30 12:54:22 -0800216 BOOST_CHECK_EQUAL(face.sentInterests.size(), 1);
Eric Newberry83872fd2015-08-06 17:01:24 -0700217}
218
Davide Pesaventod247d492020-01-28 21:30:20 -0500219BOOST_AUTO_TEST_CASE(MultipleNacks)
Alexander Afanasyev1013fd02017-01-03 13:19:03 -0800220{
221 size_t nNacks = 0;
222
Junxiao Shib55e5d32018-07-18 13:32:00 -0600223 auto interest = makeInterest("/Hello/World", false, 50_ms, 1);
224 face.expressInterest(*interest,
Davide Pesavento152ef442023-04-22 02:02:29 -0400225 std::bind([] { BOOST_FAIL("Unexpected Data"); }),
Davide Pesaventod247d492020-01-28 21:30:20 -0500226 [&] (const auto&, const auto&) { ++nNacks; },
Davide Pesavento152ef442023-04-22 02:02:29 -0400227 std::bind([] { BOOST_FAIL("Unexpected timeout"); }));
Alexander Afanasyev1013fd02017-01-03 13:19:03 -0800228
Junxiao Shib55e5d32018-07-18 13:32:00 -0600229 interest->setNonce(2);
230 face.expressInterest(*interest,
Davide Pesavento152ef442023-04-22 02:02:29 -0400231 std::bind([] { BOOST_FAIL("Unexpected Data"); }),
Davide Pesaventod247d492020-01-28 21:30:20 -0500232 [&] (const auto&, const auto&) { ++nNacks; },
Davide Pesavento152ef442023-04-22 02:02:29 -0400233 std::bind([] { BOOST_FAIL("Unexpected timeout"); }));
Alexander Afanasyev1013fd02017-01-03 13:19:03 -0800234
Davide Pesavento0f830802018-01-16 23:58:58 -0500235 advanceClocks(40_ms);
Alexander Afanasyev1013fd02017-01-03 13:19:03 -0800236
237 face.receive(makeNack(face.sentInterests.at(1), lp::NackReason::DUPLICATE));
238
Davide Pesavento0f830802018-01-16 23:58:58 -0500239 advanceClocks(50_ms, 2);
Alexander Afanasyev1013fd02017-01-03 13:19:03 -0800240
241 BOOST_CHECK_EQUAL(nNacks, 2);
242 BOOST_CHECK_EQUAL(face.sentInterests.size(), 2);
243}
244
Davide Pesaventod247d492020-01-28 21:30:20 -0500245BOOST_AUTO_TEST_CASE(EmptyNackCallback)
Junxiao Shi76e0eb22016-08-08 05:54:10 +0000246{
Junxiao Shib55e5d32018-07-18 13:32:00 -0600247 face.expressInterest(*makeInterest("/Hello/World"),
Davide Pesavento152ef442023-04-22 02:02:29 -0400248 std::bind([] { BOOST_FAIL("Unexpected Data"); }),
Junxiao Shi76e0eb22016-08-08 05:54:10 +0000249 nullptr,
Davide Pesavento152ef442023-04-22 02:02:29 -0400250 std::bind([] { BOOST_FAIL("Unexpected timeout"); }));
Davide Pesavento0f830802018-01-16 23:58:58 -0500251 advanceClocks(1_ms);
Junxiao Shi76e0eb22016-08-08 05:54:10 +0000252
253 BOOST_CHECK_NO_THROW(do {
254 face.receive(makeNack(face.sentInterests.at(0), lp::NackReason::DUPLICATE));
Davide Pesavento0f830802018-01-16 23:58:58 -0500255 advanceClocks(1_ms);
Junxiao Shi76e0eb22016-08-08 05:54:10 +0000256 } while (false));
257}
258
Davide Pesaventod247d492020-01-28 21:30:20 -0500259BOOST_AUTO_TEST_CASE(PutDataFromDataCallback) // Bug 4596
260{
261 face.expressInterest(*makeInterest("/localhost/notification/1"),
262 [&] (const auto&, const auto&) {
263 face.put(*makeData("/chronosync/sampleDigest/1"));
264 }, nullptr, nullptr);
265 advanceClocks(10_ms);
266 BOOST_CHECK_EQUAL(face.sentInterests.back().getName(), "/localhost/notification/1");
267
268 face.receive(*makeInterest("/chronosync/sampleDigest", true));
269 advanceClocks(10_ms);
270
271 face.put(*makeData("/localhost/notification/1"));
272 advanceClocks(10_ms);
273 BOOST_CHECK_EQUAL(face.sentData.back().getName(), "/chronosync/sampleDigest/1");
274}
275
276BOOST_AUTO_TEST_CASE(DestroyWithPendingInterest)
277{
Davide Pesavento4c1ad4c2020-11-16 21:12:02 -0500278 auto face2 = make_unique<DummyClientFace>(m_io, m_keyChain);
Davide Pesaventod247d492020-01-28 21:30:20 -0500279 face2->expressInterest(*makeInterest("/Hello/World", false, 50_ms),
280 nullptr, nullptr, nullptr);
281 advanceClocks(50_ms, 2);
282 face2.reset();
283
284 advanceClocks(50_ms, 2); // should not crash - Bug 2518
285
286 // avoid "test case [...] did not check any assertions" message from Boost.Test
287 BOOST_CHECK(true);
288}
289
290BOOST_AUTO_TEST_CASE(Handle)
Junxiao Shi80609d42019-01-29 18:15:22 +0000291{
292 auto hdl = face.expressInterest(*makeInterest("/Hello/World", true, 50_ms),
Davide Pesavento152ef442023-04-22 02:02:29 -0400293 std::bind([] { BOOST_FAIL("Unexpected data"); }),
294 std::bind([] { BOOST_FAIL("Unexpected nack"); }),
295 std::bind([] { BOOST_FAIL("Unexpected timeout"); }));
Davide Pesaventod247d492020-01-28 21:30:20 -0500296 advanceClocks(1_ms);
Junxiao Shi80609d42019-01-29 18:15:22 +0000297 hdl.cancel();
Davide Pesaventod247d492020-01-28 21:30:20 -0500298 advanceClocks(1_ms);
Junxiao Shi80609d42019-01-29 18:15:22 +0000299 face.receive(*makeData("/Hello/World/%21"));
300 advanceClocks(200_ms, 5);
301
Davide Pesaventod247d492020-01-28 21:30:20 -0500302 // cancel after destructing face
Davide Pesavento4c1ad4c2020-11-16 21:12:02 -0500303 auto face2 = make_unique<DummyClientFace>(m_io, m_keyChain);
Davide Pesaventod247d492020-01-28 21:30:20 -0500304 auto hdl2 = face2->expressInterest(*makeInterest("/Hello/World", true, 50_ms),
Davide Pesavento152ef442023-04-22 02:02:29 -0400305 std::bind([] { BOOST_FAIL("Unexpected data"); }),
306 std::bind([] { BOOST_FAIL("Unexpected nack"); }),
307 std::bind([] { BOOST_FAIL("Unexpected timeout"); }));
Davide Pesaventod247d492020-01-28 21:30:20 -0500308 advanceClocks(1_ms);
309 face2.reset();
310 advanceClocks(1_ms);
311 hdl2.cancel(); // should not crash
312 advanceClocks(1_ms);
313
Junxiao Shi80609d42019-01-29 18:15:22 +0000314 // avoid "test case [...] did not check any assertions" message from Boost.Test
315 BOOST_CHECK(true);
316}
317
Davide Pesaventod247d492020-01-28 21:30:20 -0500318BOOST_AUTO_TEST_SUITE_END() // ExpressInterest
319
Junxiao Shi103d8ed2016-08-07 20:34:10 +0000320BOOST_AUTO_TEST_CASE(RemoveAllPendingInterests)
Ilya Moiseenko56b0bf82015-11-08 11:14:28 -0500321{
Junxiao Shib55e5d32018-07-18 13:32:00 -0600322 face.expressInterest(*makeInterest("/Hello/World/0", false, 50_ms),
Davide Pesavento152ef442023-04-22 02:02:29 -0400323 std::bind([] { BOOST_FAIL("Unexpected data"); }),
324 std::bind([] { BOOST_FAIL("Unexpected nack"); }),
325 std::bind([] { BOOST_FAIL("Unexpected timeout"); }));
Ilya Moiseenko56b0bf82015-11-08 11:14:28 -0500326
Junxiao Shib55e5d32018-07-18 13:32:00 -0600327 face.expressInterest(*makeInterest("/Hello/World/1", false, 50_ms),
Davide Pesavento152ef442023-04-22 02:02:29 -0400328 std::bind([] { BOOST_FAIL("Unexpected data"); }),
329 std::bind([] { BOOST_FAIL("Unexpected nack"); }),
330 std::bind([] { BOOST_FAIL("Unexpected timeout"); }));
Ilya Moiseenko56b0bf82015-11-08 11:14:28 -0500331
Davide Pesavento0f830802018-01-16 23:58:58 -0500332 advanceClocks(10_ms);
Ilya Moiseenko56b0bf82015-11-08 11:14:28 -0500333
Alexander Afanasyev9bdbb832015-12-30 12:54:22 -0800334 face.removeAllPendingInterests();
Davide Pesavento0f830802018-01-16 23:58:58 -0500335 advanceClocks(10_ms);
Ilya Moiseenko56b0bf82015-11-08 11:14:28 -0500336
Alexander Afanasyev9bdbb832015-12-30 12:54:22 -0800337 BOOST_CHECK_EQUAL(face.getNPendingInterests(), 0);
Ilya Moiseenko56b0bf82015-11-08 11:14:28 -0500338
Junxiao Shi85d90832016-08-04 03:19:46 +0000339 face.receive(*makeData("/Hello/World/0"));
340 face.receive(*makeData("/Hello/World/1"));
Davide Pesavento0f830802018-01-16 23:58:58 -0500341 advanceClocks(200_ms, 5);
Ilya Moiseenko56b0bf82015-11-08 11:14:28 -0500342}
343
Junxiao Shi103d8ed2016-08-07 20:34:10 +0000344BOOST_AUTO_TEST_SUITE(Producer)
345
Junxiao Shie7bb6c82016-08-08 23:16:35 +0000346BOOST_AUTO_TEST_CASE(PutData)
347{
348 BOOST_CHECK_EQUAL(face.sentData.size(), 0);
349
350 Data data("/4g7xxcuEow/KFvK5Kf2m");
351 signData(data);
352 face.put(data);
353
354 lp::CachePolicy cachePolicy;
355 cachePolicy.setPolicy(lp::CachePolicyType::NO_CACHE);
356 data.setTag(make_shared<lp::CachePolicyTag>(cachePolicy));
Eric Newberry4d261b62016-11-10 13:40:09 -0700357 data.setTag(make_shared<lp::CongestionMarkTag>(1));
Junxiao Shie7bb6c82016-08-08 23:16:35 +0000358 face.put(data);
359
Davide Pesavento0f830802018-01-16 23:58:58 -0500360 advanceClocks(10_ms);
Junxiao Shie7bb6c82016-08-08 23:16:35 +0000361 BOOST_REQUIRE_EQUAL(face.sentData.size(), 2);
362 BOOST_CHECK(face.sentData[0].getTag<lp::CachePolicyTag>() == nullptr);
Eric Newberry4d261b62016-11-10 13:40:09 -0700363 BOOST_CHECK(face.sentData[0].getTag<lp::CongestionMarkTag>() == nullptr);
Junxiao Shie7bb6c82016-08-08 23:16:35 +0000364 BOOST_CHECK(face.sentData[1].getTag<lp::CachePolicyTag>() != nullptr);
Eric Newberry4d261b62016-11-10 13:40:09 -0700365 BOOST_CHECK(face.sentData[1].getTag<lp::CongestionMarkTag>() != nullptr);
Junxiao Shie7bb6c82016-08-08 23:16:35 +0000366}
367
Junxiao Shib6828912017-11-20 14:06:32 +0000368BOOST_AUTO_TEST_CASE(PutDataLoopback)
369{
370 bool hasInterest1 = false, hasData = false;
371
372 // first InterestFilter allows loopback and should receive Interest
Davide Pesavento720e25c2019-07-14 01:33:52 -0400373 face.setInterestFilter("/", [&] (const InterestFilter&, const Interest&) {
Junxiao Shib6828912017-11-20 14:06:32 +0000374 hasInterest1 = true;
375 // do not respond with Data right away, so Face must send Interest to forwarder
376 });
377 // second InterestFilter disallows loopback and should not receive Interest
378 face.setInterestFilter(InterestFilter("/").allowLoopback(false),
Davide Pesavento152ef442023-04-22 02:02:29 -0400379 std::bind([] { BOOST_ERROR("Unexpected Interest on second InterestFilter"); }));
Junxiao Shib6828912017-11-20 14:06:32 +0000380
Junxiao Shib55e5d32018-07-18 13:32:00 -0600381 face.expressInterest(*makeInterest("/A", true),
Davide Pesavento152ef442023-04-22 02:02:29 -0400382 std::bind([&] { hasData = true; }),
383 std::bind([] { BOOST_FAIL("Unexpected nack"); }),
384 std::bind([] { BOOST_FAIL("Unexpected timeout"); }));
Davide Pesavento0f830802018-01-16 23:58:58 -0500385 advanceClocks(1_ms);
Junxiao Shib6828912017-11-20 14:06:32 +0000386 BOOST_CHECK_EQUAL(hasInterest1, true); // Interest looped back
387 BOOST_CHECK_EQUAL(face.sentInterests.size(), 1); // Interest sent to forwarder
388 BOOST_CHECK_EQUAL(hasData, false); // waiting for Data
389
390 face.put(*makeData("/A/B")); // first InterestFilter responds with Data
Davide Pesavento0f830802018-01-16 23:58:58 -0500391 advanceClocks(1_ms);
Junxiao Shib6828912017-11-20 14:06:32 +0000392 BOOST_CHECK_EQUAL(hasData, true);
393 BOOST_CHECK_EQUAL(face.sentData.size(), 0); // do not spill Data to forwarder
394}
395
Junxiao Shi859888f2017-09-12 14:29:16 +0000396BOOST_AUTO_TEST_CASE(PutMultipleData)
397{
398 bool hasInterest1 = false;
399 // register two Interest destinations
Davide Pesavento152ef442023-04-22 02:02:29 -0400400 face.setInterestFilter("/", std::bind([&] {
Junxiao Shi859888f2017-09-12 14:29:16 +0000401 hasInterest1 = true;
402 // sending Data right away from the first destination, don't care whether Interest goes to second destination
403 face.put(*makeData("/A/B"));
404 }));
Davide Pesavento152ef442023-04-22 02:02:29 -0400405 face.setInterestFilter("/", std::bind([]{}));
Davide Pesavento0f830802018-01-16 23:58:58 -0500406 advanceClocks(10_ms);
Junxiao Shi859888f2017-09-12 14:29:16 +0000407
Junxiao Shib55e5d32018-07-18 13:32:00 -0600408 face.receive(*makeInterest("/A", true));
Davide Pesavento0f830802018-01-16 23:58:58 -0500409 advanceClocks(10_ms);
Junxiao Shi859888f2017-09-12 14:29:16 +0000410 BOOST_CHECK(hasInterest1);
411 BOOST_CHECK_EQUAL(face.sentData.size(), 1);
412 BOOST_CHECK_EQUAL(face.sentData.at(0).getName(), "/A/B");
413
414 face.put(*makeData("/A/C"));
415 BOOST_CHECK_EQUAL(face.sentData.size(), 1); // additional Data are ignored
416}
417
Junxiao Shi103d8ed2016-08-07 20:34:10 +0000418BOOST_AUTO_TEST_CASE(PutNack)
419{
Davide Pesavento152ef442023-04-22 02:02:29 -0400420 face.setInterestFilter("/", std::bind([]{})); // register one Interest destination so that face can accept Nacks
Davide Pesavento0f830802018-01-16 23:58:58 -0500421 advanceClocks(10_ms);
Junxiao Shi79a7a162017-09-09 08:33:57 +0000422
Junxiao Shi103d8ed2016-08-07 20:34:10 +0000423 BOOST_CHECK_EQUAL(face.sentNacks.size(), 0);
424
Davide Pesaventof6b45892023-03-13 15:00:51 -0400425 face.put(makeNack(*makeInterest("/unsolicited", false, std::nullopt, 18645250),
Junxiao Shib55e5d32018-07-18 13:32:00 -0600426 lp::NackReason::NO_ROUTE));
Davide Pesavento0f830802018-01-16 23:58:58 -0500427 advanceClocks(10_ms);
Junxiao Shi1ad0b4b2017-08-18 14:19:14 +0000428 BOOST_CHECK_EQUAL(face.sentNacks.size(), 0); // unsolicited Nack would not be sent
Eric Newberry4d261b62016-11-10 13:40:09 -0700429
Davide Pesaventof6b45892023-03-13 15:00:51 -0400430 auto interest1 = makeInterest("/Hello/World", false, std::nullopt, 14247162);
Junxiao Shib55e5d32018-07-18 13:32:00 -0600431 face.receive(*interest1);
Davide Pesaventof6b45892023-03-13 15:00:51 -0400432 auto interest2 = makeInterest("/another/prefix", false, std::nullopt, 92203002);
Junxiao Shib55e5d32018-07-18 13:32:00 -0600433 face.receive(*interest2);
Davide Pesavento0f830802018-01-16 23:58:58 -0500434 advanceClocks(10_ms);
Junxiao Shi1ad0b4b2017-08-18 14:19:14 +0000435
Junxiao Shib55e5d32018-07-18 13:32:00 -0600436 face.put(makeNack(*interest1, lp::NackReason::DUPLICATE));
Davide Pesavento0f830802018-01-16 23:58:58 -0500437 advanceClocks(10_ms);
Junxiao Shi1ad0b4b2017-08-18 14:19:14 +0000438 BOOST_REQUIRE_EQUAL(face.sentNacks.size(), 1);
439 BOOST_CHECK_EQUAL(face.sentNacks[0].getReason(), lp::NackReason::DUPLICATE);
440 BOOST_CHECK(face.sentNacks[0].getTag<lp::CongestionMarkTag>() == nullptr);
441
Junxiao Shib55e5d32018-07-18 13:32:00 -0600442 auto nack = makeNack(*interest2, lp::NackReason::NO_ROUTE);
Eric Newberry4d261b62016-11-10 13:40:09 -0700443 nack.setTag(make_shared<lp::CongestionMarkTag>(1));
444 face.put(nack);
Davide Pesavento0f830802018-01-16 23:58:58 -0500445 advanceClocks(10_ms);
Eric Newberry4d261b62016-11-10 13:40:09 -0700446 BOOST_REQUIRE_EQUAL(face.sentNacks.size(), 2);
Junxiao Shi1ad0b4b2017-08-18 14:19:14 +0000447 BOOST_CHECK_EQUAL(face.sentNacks[1].getReason(), lp::NackReason::NO_ROUTE);
Eric Newberry4d261b62016-11-10 13:40:09 -0700448 BOOST_CHECK(face.sentNacks[1].getTag<lp::CongestionMarkTag>() != nullptr);
Junxiao Shi103d8ed2016-08-07 20:34:10 +0000449}
Ilya Moiseenko56b0bf82015-11-08 11:14:28 -0500450
Junxiao Shi79a7a162017-09-09 08:33:57 +0000451BOOST_AUTO_TEST_CASE(PutMultipleNack)
452{
Junxiao Shi859888f2017-09-12 14:29:16 +0000453 bool hasInterest1 = false, hasInterest2 = false;
454 // register two Interest destinations
455 face.setInterestFilter("/", [&] (const InterestFilter&, const Interest& interest) {
456 hasInterest1 = true;
457 // sending Nack right away from the first destination, Interest should still go to second destination
458 face.put(makeNack(interest, lp::NackReason::CONGESTION));
459 });
Davide Pesavento152ef442023-04-22 02:02:29 -0400460 face.setInterestFilter("/", std::bind([&] { hasInterest2 = true; }));
Davide Pesavento0f830802018-01-16 23:58:58 -0500461 advanceClocks(10_ms);
Junxiao Shi79a7a162017-09-09 08:33:57 +0000462
Davide Pesaventof6b45892023-03-13 15:00:51 -0400463 auto interest = makeInterest("/A", false, std::nullopt, 14333271);
Junxiao Shib55e5d32018-07-18 13:32:00 -0600464 face.receive(*interest);
Davide Pesavento0f830802018-01-16 23:58:58 -0500465 advanceClocks(10_ms);
Junxiao Shi859888f2017-09-12 14:29:16 +0000466 BOOST_CHECK(hasInterest1);
467 BOOST_CHECK(hasInterest2);
Junxiao Shi79a7a162017-09-09 08:33:57 +0000468
Junxiao Shi859888f2017-09-12 14:29:16 +0000469 // Nack from first destination is received, should wait for a response from the other destination
470 BOOST_CHECK_EQUAL(face.sentNacks.size(), 0);
Junxiao Shi79a7a162017-09-09 08:33:57 +0000471
Junxiao Shib55e5d32018-07-18 13:32:00 -0600472 face.put(makeNack(*interest, lp::NackReason::NO_ROUTE)); // Nack from second destination
Davide Pesavento0f830802018-01-16 23:58:58 -0500473 advanceClocks(10_ms);
Junxiao Shi859888f2017-09-12 14:29:16 +0000474 BOOST_CHECK_EQUAL(face.sentNacks.size(), 1); // sending Nack after both destinations Nacked
Junxiao Shi79a7a162017-09-09 08:33:57 +0000475 BOOST_CHECK_EQUAL(face.sentNacks.at(0).getReason(), lp::NackReason::CONGESTION); // least severe reason
476
Junxiao Shib55e5d32018-07-18 13:32:00 -0600477 face.put(makeNack(*interest, lp::NackReason::DUPLICATE));
Junxiao Shi79a7a162017-09-09 08:33:57 +0000478 BOOST_CHECK_EQUAL(face.sentNacks.size(), 1); // additional Nacks are ignored
479}
480
Junxiao Shib6828912017-11-20 14:06:32 +0000481BOOST_AUTO_TEST_CASE(PutMultipleNackLoopback)
482{
483 bool hasInterest1 = false, hasNack = false;
484
485 // first InterestFilter allows loopback and should receive Interest
486 face.setInterestFilter("/", [&] (const InterestFilter&, const Interest& interest) {
487 hasInterest1 = true;
488 face.put(makeNack(interest, lp::NackReason::CONGESTION));
489 });
490 // second InterestFilter disallows loopback and should not receive Interest
491 face.setInterestFilter(InterestFilter("/").allowLoopback(false),
Davide Pesavento152ef442023-04-22 02:02:29 -0400492 std::bind([] { BOOST_ERROR("Unexpected Interest on second InterestFilter"); }));
Junxiao Shib6828912017-11-20 14:06:32 +0000493
Davide Pesaventof6b45892023-03-13 15:00:51 -0400494 auto interest = makeInterest("/A", false, std::nullopt, 28395852);
Junxiao Shib55e5d32018-07-18 13:32:00 -0600495 face.expressInterest(*interest,
Davide Pesavento152ef442023-04-22 02:02:29 -0400496 std::bind([] { BOOST_FAIL("Unexpected data"); }),
Junxiao Shib6828912017-11-20 14:06:32 +0000497 [&] (const Interest&, const lp::Nack& nack) {
498 hasNack = true;
499 BOOST_CHECK_EQUAL(nack.getReason(), lp::NackReason::CONGESTION);
500 },
Davide Pesavento152ef442023-04-22 02:02:29 -0400501 std::bind([] { BOOST_FAIL("Unexpected timeout"); }));
Davide Pesavento0f830802018-01-16 23:58:58 -0500502 advanceClocks(1_ms);
Junxiao Shib6828912017-11-20 14:06:32 +0000503 BOOST_CHECK_EQUAL(hasInterest1, true); // Interest looped back
504 BOOST_CHECK_EQUAL(face.sentInterests.size(), 1); // Interest sent to forwarder
505 BOOST_CHECK_EQUAL(hasNack, false); // waiting for Nack from forwarder
506
Junxiao Shib55e5d32018-07-18 13:32:00 -0600507 face.receive(makeNack(*interest, lp::NackReason::NO_ROUTE));
Davide Pesavento0f830802018-01-16 23:58:58 -0500508 advanceClocks(1_ms);
Junxiao Shib6828912017-11-20 14:06:32 +0000509 BOOST_CHECK_EQUAL(hasNack, true);
510}
511
Davide Pesaventod247d492020-01-28 21:30:20 -0500512BOOST_AUTO_TEST_SUITE_END() // Producer
513
514BOOST_AUTO_TEST_SUITE(RegisterPrefix)
515
516BOOST_FIXTURE_TEST_CASE(Failure, FaceFixture<NoPrefixRegReply>)
517{
518 BOOST_CHECK(!runPrefixReg([&] (const auto& success, const auto& failure) {
519 face.registerPrefix("/Hello/World", success, failure);
520 this->advanceClocks(5_s, 20); // wait for command timeout
521 }));
522}
523
524BOOST_AUTO_TEST_CASE(Handle)
525{
526 RegisteredPrefixHandle hdl;
527 auto doReg = [&] {
528 return runPrefixReg([&] (const auto& success, const auto& failure) {
529 hdl = face.registerPrefix("/Hello/World", success, failure);
530 });
531 };
532 auto doUnreg = [&] {
533 return runPrefixUnreg([&] (const auto& success, const auto& failure) {
534 hdl.unregister(success, failure);
535 });
536 };
537
538 // despite the "undefined behavior" warning, we try not to crash, but no API guarantee for this
539 BOOST_CHECK(!doUnreg());
540
541 // cancel after unregister
542 BOOST_CHECK(doReg());
543 BOOST_CHECK(doUnreg());
544 hdl.cancel();
545 advanceClocks(1_ms);
546
547 // unregister after cancel
548 BOOST_CHECK(doReg());
549 hdl.cancel();
550 advanceClocks(1_ms);
551 BOOST_CHECK(!doUnreg());
552
553 // cancel after destructing face
Davide Pesavento4c1ad4c2020-11-16 21:12:02 -0500554 auto face2 = make_unique<DummyClientFace>(m_io, m_keyChain);
Davide Pesaventod247d492020-01-28 21:30:20 -0500555 hdl = face2->registerPrefix("/Hello/World/2", nullptr,
Davide Pesavento152ef442023-04-22 02:02:29 -0400556 std::bind([] { BOOST_FAIL("Unexpected registerPrefix failure"); }));
Davide Pesaventod247d492020-01-28 21:30:20 -0500557 advanceClocks(1_ms);
558 face2.reset();
559 advanceClocks(1_ms);
560 hdl.cancel(); // should not crash
561 advanceClocks(1_ms);
562
563 // unregister after destructing face
Davide Pesavento4c1ad4c2020-11-16 21:12:02 -0500564 auto face3 = make_unique<DummyClientFace>(m_io, m_keyChain);
Davide Pesaventod247d492020-01-28 21:30:20 -0500565 hdl = face3->registerPrefix("/Hello/World/3", nullptr,
Davide Pesavento152ef442023-04-22 02:02:29 -0400566 std::bind([] { BOOST_FAIL("Unexpected registerPrefix failure"); }));
Davide Pesaventod247d492020-01-28 21:30:20 -0500567 advanceClocks(1_ms);
568 face3.reset();
569 advanceClocks(1_ms);
570 BOOST_CHECK(!doUnreg());
571}
572
573BOOST_AUTO_TEST_SUITE_END() // RegisterPrefix
574
575BOOST_AUTO_TEST_SUITE(SetInterestFilter)
576
577BOOST_AUTO_TEST_CASE(SetAndCancel)
Alexander Afanasyev5fc795f2014-10-20 23:06:56 -0400578{
Alexander Afanasyevd3a55b22014-11-18 19:23:28 -0800579 size_t nInterests = 0;
580 size_t nRegs = 0;
Davide Pesavento720e25c2019-07-14 01:33:52 -0400581 auto hdl = face.setInterestFilter("/Hello/World",
Davide Pesavento152ef442023-04-22 02:02:29 -0400582 std::bind([&nInterests] { ++nInterests; }),
583 std::bind([&nRegs] { ++nRegs; }),
584 std::bind([] { BOOST_FAIL("Unexpected setInterestFilter failure"); }));
Davide Pesavento0f830802018-01-16 23:58:58 -0500585 advanceClocks(25_ms, 4);
Alexander Afanasyevd3a55b22014-11-18 19:23:28 -0800586 BOOST_CHECK_EQUAL(nRegs, 1);
587 BOOST_CHECK_EQUAL(nInterests, 0);
Alexander Afanasyev5fc795f2014-10-20 23:06:56 -0400588
Junxiao Shib55e5d32018-07-18 13:32:00 -0600589 face.receive(*makeInterest("/Hello/World/%21"));
Davide Pesavento0f830802018-01-16 23:58:58 -0500590 advanceClocks(25_ms, 4);
Alexander Afanasyev5fc795f2014-10-20 23:06:56 -0400591
Alexander Afanasyevd3a55b22014-11-18 19:23:28 -0800592 BOOST_CHECK_EQUAL(nRegs, 1);
593 BOOST_CHECK_EQUAL(nInterests, 1);
Alexander Afanasyev5fc795f2014-10-20 23:06:56 -0400594
Junxiao Shib55e5d32018-07-18 13:32:00 -0600595 face.receive(*makeInterest("/Bye/World/%21"));
Davide Pesavento0f830802018-01-16 23:58:58 -0500596 advanceClocks(10000_ms, 10);
Alexander Afanasyevd3a55b22014-11-18 19:23:28 -0800597 BOOST_CHECK_EQUAL(nInterests, 1);
Alexander Afanasyev5fc795f2014-10-20 23:06:56 -0400598
Junxiao Shib55e5d32018-07-18 13:32:00 -0600599 face.receive(*makeInterest("/Hello/World/%21/2"));
Davide Pesavento0f830802018-01-16 23:58:58 -0500600 advanceClocks(25_ms, 4);
Alexander Afanasyevd3a55b22014-11-18 19:23:28 -0800601 BOOST_CHECK_EQUAL(nInterests, 2);
602
603 // removing filter
Davide Pesavento720e25c2019-07-14 01:33:52 -0400604 hdl.cancel();
Davide Pesavento0f830802018-01-16 23:58:58 -0500605 advanceClocks(25_ms, 4);
Alexander Afanasyev5fc795f2014-10-20 23:06:56 -0400606
Junxiao Shib55e5d32018-07-18 13:32:00 -0600607 face.receive(*makeInterest("/Hello/World/%21/3"));
Alexander Afanasyevd3a55b22014-11-18 19:23:28 -0800608 BOOST_CHECK_EQUAL(nInterests, 2);
Alexander Afanasyevd3a55b22014-11-18 19:23:28 -0800609}
Alexander Afanasyev5fc795f2014-10-20 23:06:56 -0400610
Davide Pesaventod247d492020-01-28 21:30:20 -0500611BOOST_AUTO_TEST_CASE(EmptyInterestCallback)
Junxiao Shi76e0eb22016-08-08 05:54:10 +0000612{
613 face.setInterestFilter("/A", nullptr);
Davide Pesavento0f830802018-01-16 23:58:58 -0500614 advanceClocks(1_ms);
Junxiao Shi76e0eb22016-08-08 05:54:10 +0000615
616 BOOST_CHECK_NO_THROW(do {
617 face.receive(*makeInterest("/A/1"));
Davide Pesavento0f830802018-01-16 23:58:58 -0500618 advanceClocks(1_ms);
Junxiao Shi76e0eb22016-08-08 05:54:10 +0000619 } while (false));
620}
621
Davide Pesaventod247d492020-01-28 21:30:20 -0500622BOOST_AUTO_TEST_CASE(WithoutSuccessCallback)
Joao Pereira0b3cac52015-07-02 14:49:49 -0400623{
624 size_t nInterests = 0;
Davide Pesavento720e25c2019-07-14 01:33:52 -0400625 auto hdl = face.setInterestFilter("/Hello/World",
Davide Pesavento152ef442023-04-22 02:02:29 -0400626 std::bind([&nInterests] { ++nInterests; }),
627 std::bind([] { BOOST_FAIL("Unexpected setInterestFilter failure"); }));
Davide Pesavento0f830802018-01-16 23:58:58 -0500628 advanceClocks(25_ms, 4);
Joao Pereira0b3cac52015-07-02 14:49:49 -0400629 BOOST_CHECK_EQUAL(nInterests, 0);
630
Junxiao Shib55e5d32018-07-18 13:32:00 -0600631 face.receive(*makeInterest("/Hello/World/%21"));
Davide Pesavento0f830802018-01-16 23:58:58 -0500632 advanceClocks(25_ms, 4);
Joao Pereira0b3cac52015-07-02 14:49:49 -0400633
634 BOOST_CHECK_EQUAL(nInterests, 1);
635
Junxiao Shib55e5d32018-07-18 13:32:00 -0600636 face.receive(*makeInterest("/Bye/World/%21"));
Davide Pesavento0f830802018-01-16 23:58:58 -0500637 advanceClocks(10000_ms, 10);
Joao Pereira0b3cac52015-07-02 14:49:49 -0400638 BOOST_CHECK_EQUAL(nInterests, 1);
639
Junxiao Shib55e5d32018-07-18 13:32:00 -0600640 face.receive(*makeInterest("/Hello/World/%21/2"));
Davide Pesavento0f830802018-01-16 23:58:58 -0500641 advanceClocks(25_ms, 4);
Joao Pereira0b3cac52015-07-02 14:49:49 -0400642 BOOST_CHECK_EQUAL(nInterests, 2);
643
644 // removing filter
Davide Pesavento720e25c2019-07-14 01:33:52 -0400645 hdl.cancel();
Davide Pesavento0f830802018-01-16 23:58:58 -0500646 advanceClocks(25_ms, 4);
Joao Pereira0b3cac52015-07-02 14:49:49 -0400647
Junxiao Shib55e5d32018-07-18 13:32:00 -0600648 face.receive(*makeInterest("/Hello/World/%21/3"));
Joao Pereira0b3cac52015-07-02 14:49:49 -0400649 BOOST_CHECK_EQUAL(nInterests, 2);
Joao Pereira0b3cac52015-07-02 14:49:49 -0400650}
651
Davide Pesaventod247d492020-01-28 21:30:20 -0500652BOOST_FIXTURE_TEST_CASE(Failure, FaceFixture<NoPrefixRegReply>)
Alexander Afanasyevd3a55b22014-11-18 19:23:28 -0800653{
654 // don't enable registration reply
655 size_t nRegFailed = 0;
Alexander Afanasyev9bdbb832015-12-30 12:54:22 -0800656 face.setInterestFilter("/Hello/World",
Davide Pesavento152ef442023-04-22 02:02:29 -0400657 std::bind([] { BOOST_FAIL("Unexpected Interest"); }),
658 std::bind([] { BOOST_FAIL("Unexpected success of setInterestFilter"); }),
659 std::bind([&nRegFailed] { ++nRegFailed; }));
Alexander Afanasyevd3a55b22014-11-18 19:23:28 -0800660
Davide Pesavento0f830802018-01-16 23:58:58 -0500661 advanceClocks(25_ms, 4);
Alexander Afanasyevd3a55b22014-11-18 19:23:28 -0800662 BOOST_CHECK_EQUAL(nRegFailed, 0);
663
Davide Pesavento0f830802018-01-16 23:58:58 -0500664 advanceClocks(2000_ms, 5);
Alexander Afanasyevd3a55b22014-11-18 19:23:28 -0800665 BOOST_CHECK_EQUAL(nRegFailed, 1);
Alexander Afanasyev5fc795f2014-10-20 23:06:56 -0400666}
667
Davide Pesaventod247d492020-01-28 21:30:20 -0500668BOOST_FIXTURE_TEST_CASE(FailureWithoutSuccessCallback, FaceFixture<NoPrefixRegReply>)
Joao Pereira0b3cac52015-07-02 14:49:49 -0400669{
670 // don't enable registration reply
671 size_t nRegFailed = 0;
Alexander Afanasyev9bdbb832015-12-30 12:54:22 -0800672 face.setInterestFilter("/Hello/World",
Davide Pesavento152ef442023-04-22 02:02:29 -0400673 std::bind([] { BOOST_FAIL("Unexpected Interest"); }),
674 std::bind([&nRegFailed] { ++nRegFailed; }));
Joao Pereira0b3cac52015-07-02 14:49:49 -0400675
Davide Pesavento0f830802018-01-16 23:58:58 -0500676 advanceClocks(25_ms, 4);
Joao Pereira0b3cac52015-07-02 14:49:49 -0400677 BOOST_CHECK_EQUAL(nRegFailed, 0);
678
Davide Pesavento0f830802018-01-16 23:58:58 -0500679 advanceClocks(2000_ms, 5);
Joao Pereira0b3cac52015-07-02 14:49:49 -0400680 BOOST_CHECK_EQUAL(nRegFailed, 1);
681}
682
Alexander Afanasyevd3a55b22014-11-18 19:23:28 -0800683BOOST_AUTO_TEST_CASE(SimilarFilters)
684{
685 size_t nInInterests1 = 0;
Alexander Afanasyev9bdbb832015-12-30 12:54:22 -0800686 face.setInterestFilter("/Hello/World",
Davide Pesavento152ef442023-04-22 02:02:29 -0400687 std::bind([&nInInterests1] { ++nInInterests1; }),
Junxiao Shi103d8ed2016-08-07 20:34:10 +0000688 nullptr,
Davide Pesavento152ef442023-04-22 02:02:29 -0400689 std::bind([] { BOOST_FAIL("Unexpected setInterestFilter failure"); }));
Alexander Afanasyevd3a55b22014-11-18 19:23:28 -0800690
691 size_t nInInterests2 = 0;
Alexander Afanasyev9bdbb832015-12-30 12:54:22 -0800692 face.setInterestFilter("/Hello",
Davide Pesavento152ef442023-04-22 02:02:29 -0400693 std::bind([&nInInterests2] { ++nInInterests2; }),
Junxiao Shi103d8ed2016-08-07 20:34:10 +0000694 nullptr,
Davide Pesavento152ef442023-04-22 02:02:29 -0400695 std::bind([] { BOOST_FAIL("Unexpected setInterestFilter failure"); }));
Alexander Afanasyev5fc795f2014-10-20 23:06:56 -0400696
Alexander Afanasyevd3a55b22014-11-18 19:23:28 -0800697 size_t nInInterests3 = 0;
Alexander Afanasyev9bdbb832015-12-30 12:54:22 -0800698 face.setInterestFilter("/Los/Angeles/Lakers",
Davide Pesavento152ef442023-04-22 02:02:29 -0400699 std::bind([&nInInterests3] { ++nInInterests3; }),
Junxiao Shi103d8ed2016-08-07 20:34:10 +0000700 nullptr,
Davide Pesavento152ef442023-04-22 02:02:29 -0400701 std::bind([] { BOOST_FAIL("Unexpected setInterestFilter failure"); }));
Alexander Afanasyev5fc795f2014-10-20 23:06:56 -0400702
Davide Pesavento0f830802018-01-16 23:58:58 -0500703 advanceClocks(25_ms, 4);
Alexander Afanasyev5fc795f2014-10-20 23:06:56 -0400704
Junxiao Shib55e5d32018-07-18 13:32:00 -0600705 face.receive(*makeInterest("/Hello/World/%21"));
Davide Pesavento0f830802018-01-16 23:58:58 -0500706 advanceClocks(25_ms, 4);
Alexander Afanasyev5fc795f2014-10-20 23:06:56 -0400707
Alexander Afanasyevd3a55b22014-11-18 19:23:28 -0800708 BOOST_CHECK_EQUAL(nInInterests1, 1);
709 BOOST_CHECK_EQUAL(nInInterests2, 1);
710 BOOST_CHECK_EQUAL(nInInterests3, 0);
Alexander Afanasyev5fc795f2014-10-20 23:06:56 -0400711}
712
Davide Pesaventod247d492020-01-28 21:30:20 -0500713BOOST_AUTO_TEST_CASE(RegexFilter)
Alexander Afanasyev5fc795f2014-10-20 23:06:56 -0400714{
Alexander Afanasyevd3a55b22014-11-18 19:23:28 -0800715 size_t nInInterests = 0;
Alexander Afanasyev9bdbb832015-12-30 12:54:22 -0800716 face.setInterestFilter(InterestFilter("/Hello/World", "<><b><c>?"),
Davide Pesavento152ef442023-04-22 02:02:29 -0400717 std::bind([&nInInterests] { ++nInInterests; }),
Junxiao Shi103d8ed2016-08-07 20:34:10 +0000718 nullptr,
Davide Pesavento152ef442023-04-22 02:02:29 -0400719 std::bind([] { BOOST_FAIL("Unexpected setInterestFilter failure"); }));
Alexander Afanasyev5fc795f2014-10-20 23:06:56 -0400720
Davide Pesavento0f830802018-01-16 23:58:58 -0500721 advanceClocks(25_ms, 4);
Alexander Afanasyev5fc795f2014-10-20 23:06:56 -0400722
Junxiao Shib55e5d32018-07-18 13:32:00 -0600723 face.receive(*makeInterest("/Hello/World/a")); // shouldn't match
Alexander Afanasyev5fc795f2014-10-20 23:06:56 -0400724 BOOST_CHECK_EQUAL(nInInterests, 0);
725
Junxiao Shib55e5d32018-07-18 13:32:00 -0600726 face.receive(*makeInterest("/Hello/World/a/b")); // should match
Alexander Afanasyev5fc795f2014-10-20 23:06:56 -0400727 BOOST_CHECK_EQUAL(nInInterests, 1);
728
Junxiao Shib55e5d32018-07-18 13:32:00 -0600729 face.receive(*makeInterest("/Hello/World/a/b/c")); // should match
Alexander Afanasyev5fc795f2014-10-20 23:06:56 -0400730 BOOST_CHECK_EQUAL(nInInterests, 2);
731
Junxiao Shib55e5d32018-07-18 13:32:00 -0600732 face.receive(*makeInterest("/Hello/World/a/b/d")); // should not match
Alexander Afanasyev5fc795f2014-10-20 23:06:56 -0400733 BOOST_CHECK_EQUAL(nInInterests, 2);
734}
735
Davide Pesaventod247d492020-01-28 21:30:20 -0500736BOOST_AUTO_TEST_CASE(RegexFilterError)
737{
738 face.setInterestFilter(InterestFilter("/Hello/World", "<><b><c>?"),
739 [] (const Name&, const Interest&) {
740 BOOST_FAIL("InterestFilter::Error should have been triggered");
741 },
742 nullptr,
Davide Pesavento152ef442023-04-22 02:02:29 -0400743 std::bind([] { BOOST_FAIL("Unexpected setInterestFilter failure"); }));
Davide Pesaventod247d492020-01-28 21:30:20 -0500744
745 advanceClocks(25_ms, 4);
746
747 BOOST_CHECK_THROW(face.receive(*makeInterest("/Hello/World/XXX/b/c")), InterestFilter::Error);
748}
749
750BOOST_AUTO_TEST_CASE(RegexFilterAndRegisterPrefix)
Alexander Afanasyev5fc795f2014-10-20 23:06:56 -0400751{
Alexander Afanasyevd3a55b22014-11-18 19:23:28 -0800752 size_t nInInterests = 0;
Alexander Afanasyev9bdbb832015-12-30 12:54:22 -0800753 face.setInterestFilter(InterestFilter("/Hello/World", "<><b><c>?"),
Davide Pesavento152ef442023-04-22 02:02:29 -0400754 std::bind([&nInInterests] { ++nInInterests; }));
Alexander Afanasyev5fc795f2014-10-20 23:06:56 -0400755
Alexander Afanasyevd3a55b22014-11-18 19:23:28 -0800756 size_t nRegSuccesses = 0;
Alexander Afanasyev9bdbb832015-12-30 12:54:22 -0800757 face.registerPrefix("/Hello/World",
Davide Pesavento152ef442023-04-22 02:02:29 -0400758 std::bind([&nRegSuccesses] { ++nRegSuccesses; }),
759 std::bind([] { BOOST_FAIL("Unexpected setInterestFilter failure"); }));
Alexander Afanasyev5fc795f2014-10-20 23:06:56 -0400760
Davide Pesavento0f830802018-01-16 23:58:58 -0500761 advanceClocks(25_ms, 4);
Alexander Afanasyev5fc795f2014-10-20 23:06:56 -0400762 BOOST_CHECK_EQUAL(nRegSuccesses, 1);
763
Junxiao Shib55e5d32018-07-18 13:32:00 -0600764 face.receive(*makeInterest("/Hello/World/a")); // shouldn't match
Alexander Afanasyev5fc795f2014-10-20 23:06:56 -0400765 BOOST_CHECK_EQUAL(nInInterests, 0);
766
Junxiao Shib55e5d32018-07-18 13:32:00 -0600767 face.receive(*makeInterest("/Hello/World/a/b")); // should match
Alexander Afanasyev5fc795f2014-10-20 23:06:56 -0400768 BOOST_CHECK_EQUAL(nInInterests, 1);
769
Junxiao Shib55e5d32018-07-18 13:32:00 -0600770 face.receive(*makeInterest("/Hello/World/a/b/c")); // should match
Alexander Afanasyev5fc795f2014-10-20 23:06:56 -0400771 BOOST_CHECK_EQUAL(nInInterests, 2);
772
Junxiao Shib55e5d32018-07-18 13:32:00 -0600773 face.receive(*makeInterest("/Hello/World/a/b/d")); // should not match
Alexander Afanasyev5fc795f2014-10-20 23:06:56 -0400774 BOOST_CHECK_EQUAL(nInInterests, 2);
775}
776
Davide Pesaventod247d492020-01-28 21:30:20 -0500777BOOST_FIXTURE_TEST_CASE(WithoutRegisterPrefix, FaceFixture<NoPrefixRegReply>) // Bug 2318
Junxiao Shia1ea5062014-12-27 22:33:39 -0700778{
779 // This behavior is specific to DummyClientFace.
780 // Regular Face won't accept incoming packets until something is sent.
781
782 int hit = 0;
Davide Pesavento152ef442023-04-22 02:02:29 -0400783 face.setInterestFilter(Name("/"), std::bind([&hit] { ++hit; }));
Alexander Afanasyev9bdbb832015-12-30 12:54:22 -0800784 face.processEvents(time::milliseconds(-1));
Junxiao Shia1ea5062014-12-27 22:33:39 -0700785
Junxiao Shib55e5d32018-07-18 13:32:00 -0600786 face.receive(*makeInterest("/A"));
Alexander Afanasyev9bdbb832015-12-30 12:54:22 -0800787 face.processEvents(time::milliseconds(-1));
Junxiao Shia1ea5062014-12-27 22:33:39 -0700788
789 BOOST_CHECK_EQUAL(hit, 1);
790}
791
Davide Pesaventod247d492020-01-28 21:30:20 -0500792BOOST_AUTO_TEST_CASE(Handle)
Junxiao Shi60aaef02019-01-14 04:59:30 +0000793{
794 int hit = 0;
Davide Pesavento152ef442023-04-22 02:02:29 -0400795 InterestFilterHandle hdl = face.setInterestFilter(Name("/"), std::bind([&hit] { ++hit; }));
Junxiao Shi60aaef02019-01-14 04:59:30 +0000796 face.processEvents(-1_ms);
797
798 face.receive(*makeInterest("/A"));
799 face.processEvents(-1_ms);
800 BOOST_CHECK_EQUAL(hit, 1);
801
802 hdl.cancel();
803 face.processEvents(-1_ms);
804
805 face.receive(*makeInterest("/B"));
806 face.processEvents(-1_ms);
807 BOOST_CHECK_EQUAL(hit, 1);
Davide Pesaventod247d492020-01-28 21:30:20 -0500808
809 // cancel after destructing face
Davide Pesavento4c1ad4c2020-11-16 21:12:02 -0500810 auto face2 = make_unique<DummyClientFace>(m_io, m_keyChain);
Davide Pesaventod247d492020-01-28 21:30:20 -0500811 InterestFilterHandle hdl2 = face2->setInterestFilter("/Hello/World/2", nullptr);
812 advanceClocks(1_ms);
813 face2.reset();
814 advanceClocks(1_ms);
815 hdl2.cancel(); // should not crash
816 advanceClocks(1_ms);
Junxiao Shi60aaef02019-01-14 04:59:30 +0000817}
818
Davide Pesaventod247d492020-01-28 21:30:20 -0500819BOOST_AUTO_TEST_SUITE_END() // SetInterestFilter
Junxiao Shiae0b4182016-08-08 22:53:17 +0000820
Alexander Afanasyev8e158542014-11-18 00:47:18 -0500821BOOST_AUTO_TEST_CASE(ProcessEvents)
822{
Alexander Afanasyev9bdbb832015-12-30 12:54:22 -0800823 face.processEvents(time::milliseconds(-1)); // io_service::reset()/poll() inside
Alexander Afanasyev8e158542014-11-18 00:47:18 -0500824
Alexander Afanasyevd3a55b22014-11-18 19:23:28 -0800825 size_t nRegSuccesses = 0;
Alexander Afanasyev9bdbb832015-12-30 12:54:22 -0800826 face.registerPrefix("/Hello/World",
Davide Pesavento152ef442023-04-22 02:02:29 -0400827 std::bind([&nRegSuccesses] { ++nRegSuccesses; }),
828 std::bind([] { BOOST_FAIL("Unexpected setInterestFilter failure"); }));
Alexander Afanasyev8e158542014-11-18 00:47:18 -0500829
830 // io_service::poll() without reset
Alexander Afanasyev9bdbb832015-12-30 12:54:22 -0800831 face.getIoService().poll();
Alexander Afanasyev8e158542014-11-18 00:47:18 -0500832 BOOST_CHECK_EQUAL(nRegSuccesses, 0);
833
Alexander Afanasyev9bdbb832015-12-30 12:54:22 -0800834 face.processEvents(time::milliseconds(-1)); // io_service::reset()/poll() inside
Alexander Afanasyev8e158542014-11-18 00:47:18 -0500835 BOOST_CHECK_EQUAL(nRegSuccesses, 1);
836}
837
Junxiao Shiae0b4182016-08-08 22:53:17 +0000838BOOST_AUTO_TEST_CASE(DestroyWithoutProcessEvents) // Bug 3248
839{
Davide Pesavento4c1ad4c2020-11-16 21:12:02 -0500840 auto face2 = make_unique<Face>(m_io);
Junxiao Shiae0b4182016-08-08 22:53:17 +0000841 face2.reset();
842
Davide Pesavento4c1ad4c2020-11-16 21:12:02 -0500843 m_io.poll(); // should not crash
Davide Pesaventoeee3e822016-11-26 19:19:34 +0100844
845 // avoid "test case [...] did not check any assertions" message from Boost.Test
846 BOOST_CHECK(true);
Junxiao Shiae0b4182016-08-08 22:53:17 +0000847}
848
Junxiao Shiae0b4182016-08-08 22:53:17 +0000849BOOST_AUTO_TEST_SUITE(Transport)
850
851using ndn::Transport;
852
Davide Pesavento4c1ad4c2020-11-16 21:12:02 -0500853BOOST_FIXTURE_TEST_CASE(FaceTransport, IoKeyChainFixture)
Alexander Afanasyev3a6da362015-12-29 20:31:03 -0800854{
Alexander Afanasyev3a6da362015-12-29 20:31:03 -0800855 BOOST_CHECK(Face().getTransport() != nullptr);
856
Alexander Afanasyevbb64c172015-12-29 20:32:45 -0800857 BOOST_CHECK(Face(shared_ptr<Transport>()).getTransport() != nullptr);
Davide Pesavento4c1ad4c2020-11-16 21:12:02 -0500858 BOOST_CHECK(Face(shared_ptr<Transport>(), m_io).getTransport() != nullptr);
859 BOOST_CHECK(Face(shared_ptr<Transport>(), m_io, m_keyChain).getTransport() != nullptr);
Alexander Afanasyev3a6da362015-12-29 20:31:03 -0800860
861 auto transport = make_shared<TcpTransport>("localhost", "6363"); // no real io operations will be scheduled
862 BOOST_CHECK(Face(transport).getTransport() == transport);
Davide Pesavento4c1ad4c2020-11-16 21:12:02 -0500863 BOOST_CHECK(Face(transport, m_io).getTransport() == transport);
864 BOOST_CHECK(Face(transport, m_io, m_keyChain).getTransport() == transport);
Alexander Afanasyev3a6da362015-12-29 20:31:03 -0800865}
866
Davide Pesavento4c1ad4c2020-11-16 21:12:02 -0500867class WithEnv
Alexander Afanasyevcf490552016-06-27 22:51:36 -0700868{
869public:
870 WithEnv()
871 {
872 if (getenv("NDN_CLIENT_TRANSPORT") != nullptr) {
873 m_oldTransport = getenv("NDN_CLIENT_TRANSPORT");
874 unsetenv("NDN_CLIENT_TRANSPORT");
875 }
876 }
877
878 void
879 configure(const std::string& faceUri)
880 {
Davide Pesavento4c1ad4c2020-11-16 21:12:02 -0500881 setenv("NDN_CLIENT_TRANSPORT", faceUri.data(), true);
Alexander Afanasyevcf490552016-06-27 22:51:36 -0700882 }
883
884 ~WithEnv()
885 {
886 if (!m_oldTransport.empty()) {
Davide Pesavento4c1ad4c2020-11-16 21:12:02 -0500887 setenv("NDN_CLIENT_TRANSPORT", m_oldTransport.data(), true);
Alexander Afanasyevcf490552016-06-27 22:51:36 -0700888 }
889 else {
890 unsetenv("NDN_CLIENT_TRANSPORT");
891 }
892 }
893
894private:
895 std::string m_oldTransport;
896};
897
898class WithConfig : private TestHomeFixture<DefaultPibDir>
899{
900public:
901 void
902 configure(const std::string& faceUri)
903 {
904 createClientConf({"transport=" + faceUri});
905 }
906};
907
908class WithEnvAndConfig : public WithEnv, public WithConfig
909{
910};
911
Davide Pesavento47ce2ee2023-05-09 01:33:33 -0400912using ConfigOptions = boost::mpl::vector<WithEnv, WithConfig>;
Alexander Afanasyevcf490552016-06-27 22:51:36 -0700913
914BOOST_FIXTURE_TEST_CASE(NoConfig, WithEnvAndConfig) // fixture configures test HOME and PIB/TPM path
Alexander Afanasyev57e00362016-06-23 13:22:54 -0700915{
916 shared_ptr<Face> face;
917 BOOST_REQUIRE_NO_THROW(face = make_shared<Face>());
918 BOOST_CHECK(dynamic_pointer_cast<UnixTransport>(face->getTransport()) != nullptr);
Alexander Afanasyev57e00362016-06-23 13:22:54 -0700919}
920
Alexander Afanasyevcf490552016-06-27 22:51:36 -0700921BOOST_FIXTURE_TEST_CASE_TEMPLATE(Unix, T, ConfigOptions, T)
922{
923 this->configure("unix://some/path");
Alexander Afanasyev57e00362016-06-23 13:22:54 -0700924
Alexander Afanasyevcf490552016-06-27 22:51:36 -0700925 shared_ptr<Face> face;
926 BOOST_REQUIRE_NO_THROW(face = make_shared<Face>());
927 BOOST_CHECK(dynamic_pointer_cast<UnixTransport>(face->getTransport()) != nullptr);
928}
929
930BOOST_FIXTURE_TEST_CASE_TEMPLATE(Tcp, T, ConfigOptions, T)
931{
932 this->configure("tcp://127.0.0.1:6000");
933
934 shared_ptr<Face> face;
935 BOOST_REQUIRE_NO_THROW(face = make_shared<Face>());
936 BOOST_CHECK(dynamic_pointer_cast<TcpTransport>(face->getTransport()) != nullptr);
937}
938
939BOOST_FIXTURE_TEST_CASE_TEMPLATE(WrongTransport, T, ConfigOptions, T)
940{
941 this->configure("wrong-transport:");
942
943 BOOST_CHECK_THROW(make_shared<Face>(), ConfigFile::Error);
944}
945
946BOOST_FIXTURE_TEST_CASE_TEMPLATE(WrongUri, T, ConfigOptions, T)
947{
948 this->configure("wrong-uri");
949
950 BOOST_CHECK_THROW(make_shared<Face>(), ConfigFile::Error);
951}
952
953BOOST_FIXTURE_TEST_CASE(EnvOverride, WithEnvAndConfig)
954{
955 this->WithEnv::configure("tcp://127.0.0.1:6000");
956 this->WithConfig::configure("unix://some/path");
957
958 shared_ptr<Face> face;
959 BOOST_REQUIRE_NO_THROW(face = make_shared<Face>());
960 BOOST_CHECK(dynamic_pointer_cast<TcpTransport>(face->getTransport()) != nullptr);
961}
962
963BOOST_FIXTURE_TEST_CASE(ExplicitTransport, WithEnvAndConfig)
964{
965 this->WithEnv::configure("wrong-uri");
966 this->WithConfig::configure("wrong-transport:");
967
968 auto transport = make_shared<UnixTransport>("unix://some/path");
969 shared_ptr<Face> face;
970 BOOST_REQUIRE_NO_THROW(face = make_shared<Face>(transport));
971 BOOST_CHECK(dynamic_pointer_cast<UnixTransport>(face->getTransport()) != nullptr);
972}
973
Junxiao Shiae0b4182016-08-08 22:53:17 +0000974BOOST_AUTO_TEST_SUITE_END() // Transport
975
Alexander Afanasyev57e00362016-06-23 13:22:54 -0700976BOOST_AUTO_TEST_SUITE_END() // TestFace
977
Davide Pesavento47ce2ee2023-05-09 01:33:33 -0400978} // namespace ndn::tests