Junxiao Shi | 6e69432 | 2014-04-03 10:27:13 -0700 | [diff] [blame] | 1 | /* -*- 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 | |
| 12 | namespace nfd { |
| 13 | namespace tests { |
| 14 | |
| 15 | BOOST_FIXTURE_TEST_SUITE(MgmtFaceFlags, BaseFixture) |
| 16 | |
| 17 | template<typename DummyFaceBase> |
| 18 | class DummyOnDemandFace : public DummyFaceBase |
| 19 | { |
| 20 | public: |
| 21 | DummyOnDemandFace() |
| 22 | { |
| 23 | this->setOnDemand(true); |
| 24 | } |
| 25 | }; |
| 26 | |
| 27 | BOOST_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 | |
| 44 | BOOST_AUTO_TEST_SUITE_END() |
| 45 | |
| 46 | } // namespace tests |
| 47 | } // namespace nfd |