blob: 41acb0bcc5a552c9c9982d478d0c73a2432a94f0 [file] [log] [blame]
Junxiao Shi13546112015-10-14 19:33:07 -07001/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
Eric Newberryb49313d2017-12-24 20:22:27 -07002/*
Davide Pesaventoe422f9e2022-06-03 01:30:23 -04003 * Copyright (c) 2014-2022, Regents of the University of California,
Junxiao Shi13546112015-10-14 19:33:07 -07004 * 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.
10 *
11 * This file is part of NFD (Named Data Networking Forwarding Daemon).
12 * See AUTHORS.md for complete list of NFD authors and contributors.
13 *
14 * NFD is free software: you can redistribute it and/or modify it under the terms
15 * of the GNU General Public License as published by the Free Software Foundation,
16 * either version 3 of the License, or (at your option) any later version.
17 *
18 * NFD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
19 * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
20 * PURPOSE. See the GNU General Public License for more details.
21 *
22 * You should have received a copy of the GNU General Public License along with
23 * NFD, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>.
24 */
25
Eric Newberry65caf202015-12-17 15:08:16 -070026#include "transport-test-common.hpp"
27
Eric Newberryf68f3782015-12-11 00:31:32 -070028#include "unix-stream-transport-fixture.hpp"
Junxiao Shi13546112015-10-14 19:33:07 -070029
Davide Pesaventoe422f9e2022-06-03 01:30:23 -040030namespace nfd::tests {
31
32using namespace nfd::face;
Junxiao Shi13546112015-10-14 19:33:07 -070033
Junxiao Shi13546112015-10-14 19:33:07 -070034BOOST_AUTO_TEST_SUITE(Face)
Eric Newberryf68f3782015-12-11 00:31:32 -070035BOOST_FIXTURE_TEST_SUITE(TestUnixStreamTransport, UnixStreamTransportFixture)
Junxiao Shi13546112015-10-14 19:33:07 -070036
37BOOST_AUTO_TEST_CASE(StaticProperties)
38{
Eric Newberryf68f3782015-12-11 00:31:32 -070039 initialize();
Junxiao Shi13546112015-10-14 19:33:07 -070040
Eric Newberryf68f3782015-12-11 00:31:32 -070041 checkStaticPropertiesInitialized(*transport);
Junxiao Shi13546112015-10-14 19:33:07 -070042
Eric Newberryf68f3782015-12-11 00:31:32 -070043 BOOST_CHECK_EQUAL(transport->getLocalUri().getScheme(), "unix");
44 BOOST_CHECK_EQUAL(transport->getLocalUri().getHost(), "");
45 BOOST_CHECK_EQUAL(transport->getLocalUri().getPath(), localEp.path());
46 BOOST_CHECK_EQUAL(transport->getRemoteUri().getScheme(), "fd");
47 BOOST_CHECK_EQUAL(transport->getScope(), ndn::nfd::FACE_SCOPE_LOCAL);
48 BOOST_CHECK_EQUAL(transport->getPersistency(), ndn::nfd::FACE_PERSISTENCY_ON_DEMAND);
49 BOOST_CHECK_EQUAL(transport->getLinkType(), ndn::nfd::LINK_TYPE_POINT_TO_POINT);
50 BOOST_CHECK_EQUAL(transport->getMtu(), MTU_UNLIMITED);
Eric Newberryb49313d2017-12-24 20:22:27 -070051 BOOST_CHECK_EQUAL(transport->getSendQueueCapacity(), QUEUE_UNSUPPORTED);
Junxiao Shi13546112015-10-14 19:33:07 -070052}
53
Davide Pesavento32065652017-01-15 01:52:21 -050054BOOST_AUTO_TEST_CASE(PersistencyChange)
55{
56 initialize();
57
58 BOOST_CHECK_EQUAL(transport->canChangePersistencyTo(ndn::nfd::FACE_PERSISTENCY_ON_DEMAND), true);
59 BOOST_CHECK_EQUAL(transport->canChangePersistencyTo(ndn::nfd::FACE_PERSISTENCY_PERSISTENT), false);
60 BOOST_CHECK_EQUAL(transport->canChangePersistencyTo(ndn::nfd::FACE_PERSISTENCY_PERMANENT), false);
61}
62
Junxiao Shi13546112015-10-14 19:33:07 -070063BOOST_AUTO_TEST_SUITE_END() // TestUnixStreamTransport
64BOOST_AUTO_TEST_SUITE_END() // Face
65
Davide Pesaventoe422f9e2022-06-03 01:30:23 -040066} // namespace nfd::tests