blob: 5f8ab6edd460726964c87f7b02d145bda088a674 [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
11#include <boost/test/unit_test.hpp>
12
Alexander Afanasyev18bbf812014-01-29 01:40:23 -080013namespace nfd {
Junxiao Shi2c29f3a2014-01-24 19:59:00 -070014
15BOOST_AUTO_TEST_SUITE(FaceFace)
16
Junxiao Shi32bfeb32014-01-25 18:22:02 -070017BOOST_AUTO_TEST_CASE(Description)
18{
Junxiao Shi8c8d2182014-01-30 22:33:00 -070019 DummyFace face;
Junxiao Shi32bfeb32014-01-25 18:22:02 -070020 face.setDescription("3pFsKrvWr");
21 BOOST_CHECK_EQUAL(face.getDescription(), "3pFsKrvWr");
22}
Junxiao Shi2c29f3a2014-01-24 19:59:00 -070023
Junxiao Shi16b8bc92014-02-17 22:24:55 -070024BOOST_AUTO_TEST_CASE(LocalControlHeaderEnabled)
25{
Alexander Afanasyevbd220a02014-02-20 00:29:56 -080026 DummyLocalFace face;
Junxiao Shi16b8bc92014-02-17 22:24:55 -070027
28 BOOST_CHECK_EQUAL(face.isLocalControlHeaderEnabled(), false);
29
30 face.setLocalControlHeaderFeature(LOCAL_CONTROL_HEADER_FEATURE_IN_FACEID, true);
31 BOOST_CHECK_EQUAL(face.isLocalControlHeaderEnabled(), true);
32 BOOST_CHECK_EQUAL(face.isLocalControlHeaderEnabled(
33 LOCAL_CONTROL_HEADER_FEATURE_IN_FACEID), true);
34 BOOST_CHECK_EQUAL(face.isLocalControlHeaderEnabled(
35 LOCAL_CONTROL_HEADER_FEATURE_NEXTHOP_FACEID), false);
36
37 face.setLocalControlHeaderFeature(LOCAL_CONTROL_HEADER_FEATURE_IN_FACEID, false);
38 BOOST_CHECK_EQUAL(face.isLocalControlHeaderEnabled(), false);
39 BOOST_CHECK_EQUAL(face.isLocalControlHeaderEnabled(
40 LOCAL_CONTROL_HEADER_FEATURE_IN_FACEID), false);
41}
42
Junxiao Shi7860d482014-02-21 23:57:20 -070043BOOST_AUTO_TEST_CASE(Counters)
44{
45 DummyFace face;
46 const FaceCounters& counters = face.getCounters();
47 BOOST_CHECK_EQUAL(counters.getInInterest() , 0);
48 BOOST_CHECK_EQUAL(counters.getInData() , 0);
49 BOOST_CHECK_EQUAL(counters.getOutInterest(), 0);
50 BOOST_CHECK_EQUAL(counters.getOutData() , 0);
51}
52
Junxiao Shi2c29f3a2014-01-24 19:59:00 -070053BOOST_AUTO_TEST_SUITE_END()
54
Alexander Afanasyev18bbf812014-01-29 01:40:23 -080055} // namespace nfd