blob: 00e4c8be3dcec059d872637f6384aab861e180eb [file] [log] [blame]
Junxiao Shi6e694322014-04-03 10:27:13 -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 "mgmt/face-flags.hpp"
8
9#include "tests/test-common.hpp"
10#include "tests/face/dummy-face.hpp"
11
12namespace nfd {
13namespace tests {
14
15BOOST_FIXTURE_TEST_SUITE(MgmtFaceFlags, BaseFixture)
16
17template<typename DummyFaceBase>
18class DummyOnDemandFace : public DummyFaceBase
19{
20public:
21 DummyOnDemandFace()
22 {
23 this->setOnDemand(true);
24 }
25};
26
27BOOST_AUTO_TEST_CASE(Get)
28{
29 DummyFace face1;
30 BOOST_CHECK_EQUAL(getFaceFlags(face1), 0);
31
32 DummyLocalFace face2;
33 BOOST_CHECK_EQUAL(getFaceFlags(face2), static_cast<uint64_t>(ndn::nfd::FACE_IS_LOCAL));
34
35 DummyOnDemandFace<DummyFace> face3;
36 BOOST_CHECK_EQUAL(getFaceFlags(face3), static_cast<uint64_t>(ndn::nfd::FACE_IS_ON_DEMAND));
37
38 DummyOnDemandFace<DummyLocalFace> face4;
39 BOOST_CHECK_EQUAL(getFaceFlags(face4), static_cast<uint64_t>(ndn::nfd::FACE_IS_LOCAL |
40 ndn::nfd::FACE_IS_ON_DEMAND));
41
42}
43
44BOOST_AUTO_TEST_SUITE_END()
45
46} // namespace tests
47} // namespace nfd