Eric Newberry | c3a4679 | 2017-09-24 14:54:24 -0700 | [diff] [blame] | 1 | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
| 2 | /* |
Davide Pesavento | 47ce2ee | 2023-05-09 01:33:33 -0400 | [diff] [blame] | 3 | * Copyright (c) 2013-2023 Regents of the University of California. |
Eric Newberry | c3a4679 | 2017-09-24 14:54:24 -0700 | [diff] [blame] | 4 | * |
| 5 | * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions). |
| 6 | * |
| 7 | * ndn-cxx library is free software: you can redistribute it and/or modify it under the |
| 8 | * terms of the GNU Lesser General Public License as published by the Free Software |
| 9 | * Foundation, either version 3 of the License, or (at your option) any later version. |
| 10 | * |
| 11 | * ndn-cxx library is distributed in the hope that it will be useful, but WITHOUT ANY |
| 12 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A |
| 13 | * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. |
| 14 | * |
| 15 | * You should have received copies of the GNU General Public License and GNU Lesser |
| 16 | * General Public License along with ndn-cxx, e.g., in COPYING.md file. If not, see |
| 17 | * <http://www.gnu.org/licenses/>. |
| 18 | * |
| 19 | * See AUTHORS.md for complete list of ndn-cxx authors and contributors. |
| 20 | */ |
| 21 | |
Junxiao Shi | 1e36ceb | 2018-12-17 13:20:26 -0700 | [diff] [blame] | 22 | #include "ndn-cxx/detail/packet-base.hpp" |
Davide Pesavento | 7e78064 | 2018-11-24 15:51:34 -0500 | [diff] [blame] | 23 | #include "ndn-cxx/interest.hpp" |
| 24 | #include "ndn-cxx/lp/tags.hpp" |
Eric Newberry | c3a4679 | 2017-09-24 14:54:24 -0700 | [diff] [blame] | 25 | |
Davide Pesavento | 7e78064 | 2018-11-24 15:51:34 -0500 | [diff] [blame] | 26 | #include "tests/boost-test.hpp" |
Eric Newberry | c3a4679 | 2017-09-24 14:54:24 -0700 | [diff] [blame] | 27 | |
Davide Pesavento | 47ce2ee | 2023-05-09 01:33:33 -0400 | [diff] [blame] | 28 | namespace ndn::tests { |
Eric Newberry | c3a4679 | 2017-09-24 14:54:24 -0700 | [diff] [blame] | 29 | |
Junxiao Shi | 1e36ceb | 2018-12-17 13:20:26 -0700 | [diff] [blame] | 30 | BOOST_AUTO_TEST_SUITE(Detail) |
Eric Newberry | c3a4679 | 2017-09-24 14:54:24 -0700 | [diff] [blame] | 31 | BOOST_AUTO_TEST_SUITE(TestPacketBase) |
| 32 | |
| 33 | BOOST_AUTO_TEST_CASE(CongestionMark) |
| 34 | { |
| 35 | Interest interest; |
| 36 | |
| 37 | BOOST_CHECK_EQUAL(interest.getCongestionMark(), 0); |
| 38 | |
| 39 | auto tag = interest.getTag<lp::CongestionMarkTag>(); |
| 40 | BOOST_CHECK(!tag); |
| 41 | |
| 42 | interest.setCongestionMark(true); |
| 43 | tag = interest.getTag<lp::CongestionMarkTag>(); |
| 44 | BOOST_REQUIRE(tag); |
| 45 | BOOST_CHECK_EQUAL(*tag, 1); |
| 46 | |
| 47 | interest.setCongestionMark(false); |
| 48 | tag = interest.getTag<lp::CongestionMarkTag>(); |
| 49 | BOOST_CHECK(!tag); |
| 50 | |
| 51 | interest.setCongestionMark(300); |
| 52 | tag = interest.getTag<lp::CongestionMarkTag>(); |
| 53 | BOOST_REQUIRE(tag); |
| 54 | BOOST_CHECK_EQUAL(*tag, 300); |
| 55 | |
| 56 | interest.setCongestionMark(0); |
| 57 | tag = interest.getTag<lp::CongestionMarkTag>(); |
| 58 | BOOST_CHECK(!tag); |
| 59 | } |
| 60 | |
| 61 | BOOST_AUTO_TEST_SUITE_END() // TestPacketBase |
Junxiao Shi | 1e36ceb | 2018-12-17 13:20:26 -0700 | [diff] [blame] | 62 | BOOST_AUTO_TEST_SUITE_END() // Detail |
Eric Newberry | c3a4679 | 2017-09-24 14:54:24 -0700 | [diff] [blame] | 63 | |
Davide Pesavento | 47ce2ee | 2023-05-09 01:33:33 -0400 | [diff] [blame] | 64 | } // namespace ndn::tests |