blob: d48ed70481069b6ae9cedd5d20d8dea27eab1af9 [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 Shi16b8bc92014-02-17 22:24:55 -070028
29 BOOST_CHECK_EQUAL(face.isLocalControlHeaderEnabled(), false);
30
31 face.setLocalControlHeaderFeature(LOCAL_CONTROL_HEADER_FEATURE_IN_FACEID, true);
32 BOOST_CHECK_EQUAL(face.isLocalControlHeaderEnabled(), true);
33 BOOST_CHECK_EQUAL(face.isLocalControlHeaderEnabled(
34 LOCAL_CONTROL_HEADER_FEATURE_IN_FACEID), true);
35 BOOST_CHECK_EQUAL(face.isLocalControlHeaderEnabled(
36 LOCAL_CONTROL_HEADER_FEATURE_NEXTHOP_FACEID), false);
37
38 face.setLocalControlHeaderFeature(LOCAL_CONTROL_HEADER_FEATURE_IN_FACEID, false);
39 BOOST_CHECK_EQUAL(face.isLocalControlHeaderEnabled(), false);
40 BOOST_CHECK_EQUAL(face.isLocalControlHeaderEnabled(
41 LOCAL_CONTROL_HEADER_FEATURE_IN_FACEID), false);
42}
43
Junxiao Shi7860d482014-02-21 23:57:20 -070044BOOST_AUTO_TEST_CASE(Counters)
45{
46 DummyFace face;
47 const FaceCounters& counters = face.getCounters();
48 BOOST_CHECK_EQUAL(counters.getInInterest() , 0);
49 BOOST_CHECK_EQUAL(counters.getInData() , 0);
50 BOOST_CHECK_EQUAL(counters.getOutInterest(), 0);
51 BOOST_CHECK_EQUAL(counters.getOutData() , 0);
52}
53
Junxiao Shi2c29f3a2014-01-24 19:59:00 -070054BOOST_AUTO_TEST_SUITE_END()
55
Junxiao Shid9ee45c2014-02-27 15:38:11 -070056} // namespace tests
Alexander Afanasyev18bbf812014-01-29 01:40:23 -080057} // namespace nfd