blob: 61870356caa52134a65392719db8a094b62e9349 [file] [log] [blame]
Junxiao Shi2c29f3a2014-01-24 19:59:00 -07001/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2/**
3 * Copyright (C) 2014 Named Data Networking Project
4 * See COPYING for copyright and distribution information.
5 */
6
7#include "face/face.hpp"
Alexander Afanasyevbd220a02014-02-20 00:29:56 -08008#include "face/local-face.hpp"
Junxiao Shicbba04c2014-01-26 14:21:22 -07009#include "dummy-face.hpp"
Junxiao Shi2c29f3a2014-01-24 19:59:00 -070010
Junxiao Shid9ee45c2014-02-27 15:38:11 -070011#include "tests/test-common.hpp"
Junxiao Shi2c29f3a2014-01-24 19:59:00 -070012
Alexander Afanasyev18bbf812014-01-29 01:40:23 -080013namespace nfd {
Junxiao Shid9ee45c2014-02-27 15:38:11 -070014namespace tests {
Junxiao Shi2c29f3a2014-01-24 19:59:00 -070015
Junxiao Shid9ee45c2014-02-27 15:38:11 -070016BOOST_FIXTURE_TEST_SUITE(FaceFace, BaseFixture)
Junxiao Shi2c29f3a2014-01-24 19:59:00 -070017
Junxiao Shi32bfeb32014-01-25 18:22:02 -070018BOOST_AUTO_TEST_CASE(Description)
19{
Junxiao Shi8c8d2182014-01-30 22:33:00 -070020 DummyFace face;
Junxiao Shi32bfeb32014-01-25 18:22:02 -070021 face.setDescription("3pFsKrvWr");
22 BOOST_CHECK_EQUAL(face.getDescription(), "3pFsKrvWr");
23}
Junxiao Shi2c29f3a2014-01-24 19:59:00 -070024
Junxiao Shi16b8bc92014-02-17 22:24:55 -070025BOOST_AUTO_TEST_CASE(LocalControlHeaderEnabled)
26{
Alexander Afanasyevbd220a02014-02-20 00:29:56 -080027 DummyLocalFace face;
Junxiao Shi6e694322014-04-03 10:27:13 -070028
Junxiao Shi16b8bc92014-02-17 22:24:55 -070029 BOOST_CHECK_EQUAL(face.isLocalControlHeaderEnabled(), false);
Junxiao Shi6e694322014-04-03 10:27:13 -070030
Steve DiBenedetto7564d972014-03-24 14:28:46 -060031 face.setLocalControlHeaderFeature(LOCAL_CONTROL_FEATURE_INCOMING_FACE_ID, true);
Junxiao Shi16b8bc92014-02-17 22:24:55 -070032 BOOST_CHECK_EQUAL(face.isLocalControlHeaderEnabled(), true);
Steve DiBenedetto7564d972014-03-24 14:28:46 -060033 BOOST_CHECK_EQUAL(face.isLocalControlHeaderEnabled(LOCAL_CONTROL_FEATURE_INCOMING_FACE_ID), true);
Junxiao Shi16b8bc92014-02-17 22:24:55 -070034 BOOST_CHECK_EQUAL(face.isLocalControlHeaderEnabled(
Steve DiBenedetto7564d972014-03-24 14:28:46 -060035 LOCAL_CONTROL_FEATURE_NEXT_HOP_FACE_ID), false);
Junxiao Shi6e694322014-04-03 10:27:13 -070036
Steve DiBenedetto7564d972014-03-24 14:28:46 -060037 face.setLocalControlHeaderFeature(LOCAL_CONTROL_FEATURE_INCOMING_FACE_ID, false);
Junxiao Shi16b8bc92014-02-17 22:24:55 -070038 BOOST_CHECK_EQUAL(face.isLocalControlHeaderEnabled(), false);
39 BOOST_CHECK_EQUAL(face.isLocalControlHeaderEnabled(
Steve DiBenedetto7564d972014-03-24 14:28:46 -060040 LOCAL_CONTROL_FEATURE_INCOMING_FACE_ID), false);
Junxiao Shi16b8bc92014-02-17 22:24:55 -070041}
42
Junxiao Shi7860d482014-02-21 23:57:20 -070043BOOST_AUTO_TEST_CASE(Counters)
44{
45 DummyFace face;
46 const FaceCounters& counters = face.getCounters();
Junxiao Shi6e694322014-04-03 10:27:13 -070047 BOOST_CHECK_EQUAL(counters.getNInInterests() , 0);
48 BOOST_CHECK_EQUAL(counters.getNInDatas() , 0);
49 BOOST_CHECK_EQUAL(counters.getNOutInterests(), 0);
50 BOOST_CHECK_EQUAL(counters.getNOutDatas() , 0);
Junxiao Shi7860d482014-02-21 23:57:20 -070051}
52
Junxiao Shi2c29f3a2014-01-24 19:59:00 -070053BOOST_AUTO_TEST_SUITE_END()
54
Junxiao Shid9ee45c2014-02-27 15:38:11 -070055} // namespace tests
Alexander Afanasyev18bbf812014-01-29 01:40:23 -080056} // namespace nfd