blob: de2e03a5a59f0b3d7e87f49da2fc56270395ce26 [file] [log] [blame]
Junxiao Shi13546112015-10-14 19:33:07 -07001/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2/**
Davide Pesavento32065652017-01-15 01:52:21 -05003 * Copyright (c) 2014-2017, 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
30namespace nfd {
31namespace face {
32namespace tests {
33
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);
Junxiao Shi13546112015-10-14 19:33:07 -070051}
52
Davide Pesavento32065652017-01-15 01:52:21 -050053BOOST_AUTO_TEST_CASE(PersistencyChange)
54{
55 initialize();
56
57 BOOST_CHECK_EQUAL(transport->canChangePersistencyTo(ndn::nfd::FACE_PERSISTENCY_ON_DEMAND), true);
58 BOOST_CHECK_EQUAL(transport->canChangePersistencyTo(ndn::nfd::FACE_PERSISTENCY_PERSISTENT), false);
59 BOOST_CHECK_EQUAL(transport->canChangePersistencyTo(ndn::nfd::FACE_PERSISTENCY_PERMANENT), false);
60}
61
Junxiao Shi13546112015-10-14 19:33:07 -070062BOOST_AUTO_TEST_SUITE_END() // TestUnixStreamTransport
63BOOST_AUTO_TEST_SUITE_END() // Face
64
65} // namespace tests
66} // namespace face
67} // namespace nfd