blob: 46c03451242674db6657c1222070e4eed3cec51f [file] [log] [blame]
Junxiao Shi2c29f3a2014-01-24 19:59:00 -07001/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2/**
Alexander Afanasyev9bcbc7c2014-04-06 19:37:37 -07003 * Copyright (c) 2014 Regents of the University of California,
4 * 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 *
10 * This file is part of NFD (Named Data Networking Forwarding Daemon).
11 * See AUTHORS.md for complete list of NFD authors and contributors.
12 *
13 * NFD is free software: you can redistribute it and/or modify it under the terms
14 * of the GNU General Public License as published by the Free Software Foundation,
15 * either version 3 of the License, or (at your option) any later version.
16 *
17 * NFD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
18 * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
19 * PURPOSE. See the GNU General Public License for more details.
20 *
21 * You should have received a copy of the GNU General Public License along with
22 * NFD, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>.
23 **/
Junxiao Shi2c29f3a2014-01-24 19:59:00 -070024
25#include "face/face.hpp"
Alexander Afanasyevbd220a02014-02-20 00:29:56 -080026#include "face/local-face.hpp"
Junxiao Shicbba04c2014-01-26 14:21:22 -070027#include "dummy-face.hpp"
Junxiao Shi2c29f3a2014-01-24 19:59:00 -070028
Junxiao Shid9ee45c2014-02-27 15:38:11 -070029#include "tests/test-common.hpp"
Junxiao Shi2c29f3a2014-01-24 19:59:00 -070030
Alexander Afanasyev18bbf812014-01-29 01:40:23 -080031namespace nfd {
Junxiao Shid9ee45c2014-02-27 15:38:11 -070032namespace tests {
Junxiao Shi2c29f3a2014-01-24 19:59:00 -070033
Junxiao Shid9ee45c2014-02-27 15:38:11 -070034BOOST_FIXTURE_TEST_SUITE(FaceFace, BaseFixture)
Junxiao Shi2c29f3a2014-01-24 19:59:00 -070035
Junxiao Shi32bfeb32014-01-25 18:22:02 -070036BOOST_AUTO_TEST_CASE(Description)
37{
Junxiao Shi8c8d2182014-01-30 22:33:00 -070038 DummyFace face;
Junxiao Shi32bfeb32014-01-25 18:22:02 -070039 face.setDescription("3pFsKrvWr");
40 BOOST_CHECK_EQUAL(face.getDescription(), "3pFsKrvWr");
41}
Junxiao Shi2c29f3a2014-01-24 19:59:00 -070042
Junxiao Shi16b8bc92014-02-17 22:24:55 -070043BOOST_AUTO_TEST_CASE(LocalControlHeaderEnabled)
44{
Alexander Afanasyevbd220a02014-02-20 00:29:56 -080045 DummyLocalFace face;
Junxiao Shi6e694322014-04-03 10:27:13 -070046
Junxiao Shi16b8bc92014-02-17 22:24:55 -070047 BOOST_CHECK_EQUAL(face.isLocalControlHeaderEnabled(), false);
Junxiao Shi6e694322014-04-03 10:27:13 -070048
Steve DiBenedetto7564d972014-03-24 14:28:46 -060049 face.setLocalControlHeaderFeature(LOCAL_CONTROL_FEATURE_INCOMING_FACE_ID, true);
Junxiao Shi16b8bc92014-02-17 22:24:55 -070050 BOOST_CHECK_EQUAL(face.isLocalControlHeaderEnabled(), true);
Steve DiBenedetto7564d972014-03-24 14:28:46 -060051 BOOST_CHECK_EQUAL(face.isLocalControlHeaderEnabled(LOCAL_CONTROL_FEATURE_INCOMING_FACE_ID), true);
Junxiao Shi16b8bc92014-02-17 22:24:55 -070052 BOOST_CHECK_EQUAL(face.isLocalControlHeaderEnabled(
Steve DiBenedetto7564d972014-03-24 14:28:46 -060053 LOCAL_CONTROL_FEATURE_NEXT_HOP_FACE_ID), false);
Junxiao Shi6e694322014-04-03 10:27:13 -070054
Steve DiBenedetto7564d972014-03-24 14:28:46 -060055 face.setLocalControlHeaderFeature(LOCAL_CONTROL_FEATURE_INCOMING_FACE_ID, false);
Junxiao Shi16b8bc92014-02-17 22:24:55 -070056 BOOST_CHECK_EQUAL(face.isLocalControlHeaderEnabled(), false);
57 BOOST_CHECK_EQUAL(face.isLocalControlHeaderEnabled(
Steve DiBenedetto7564d972014-03-24 14:28:46 -060058 LOCAL_CONTROL_FEATURE_INCOMING_FACE_ID), false);
Junxiao Shi16b8bc92014-02-17 22:24:55 -070059}
60
Junxiao Shi7860d482014-02-21 23:57:20 -070061BOOST_AUTO_TEST_CASE(Counters)
62{
63 DummyFace face;
64 const FaceCounters& counters = face.getCounters();
Junxiao Shi6e694322014-04-03 10:27:13 -070065 BOOST_CHECK_EQUAL(counters.getNInInterests() , 0);
66 BOOST_CHECK_EQUAL(counters.getNInDatas() , 0);
67 BOOST_CHECK_EQUAL(counters.getNOutInterests(), 0);
68 BOOST_CHECK_EQUAL(counters.getNOutDatas() , 0);
Junxiao Shi7860d482014-02-21 23:57:20 -070069}
70
Junxiao Shi2c29f3a2014-01-24 19:59:00 -070071BOOST_AUTO_TEST_SUITE_END()
72
Junxiao Shid9ee45c2014-02-27 15:38:11 -070073} // namespace tests
Alexander Afanasyev18bbf812014-01-29 01:40:23 -080074} // namespace nfd