blob: 41d47db605695c250bb8891a8fb0e1429f53b44b [file] [log] [blame]
Eric Newberryc3a46792017-09-24 14:54:24 -07001/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2/*
Davide Pesavento74daf742018-11-23 18:14:13 -05003 * Copyright (c) 2013-2018 Regents of the University of California.
Eric Newberryc3a46792017-09-24 14:54:24 -07004 *
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 Shi1e36ceb2018-12-17 13:20:26 -070022#include "ndn-cxx/detail/packet-base.hpp"
Davide Pesavento7e780642018-11-24 15:51:34 -050023#include "ndn-cxx/interest.hpp"
24#include "ndn-cxx/lp/tags.hpp"
Eric Newberryc3a46792017-09-24 14:54:24 -070025
Davide Pesavento7e780642018-11-24 15:51:34 -050026#include "tests/boost-test.hpp"
Eric Newberryc3a46792017-09-24 14:54:24 -070027
28namespace ndn {
29namespace tests {
30
Junxiao Shi1e36ceb2018-12-17 13:20:26 -070031BOOST_AUTO_TEST_SUITE(Detail)
Eric Newberryc3a46792017-09-24 14:54:24 -070032BOOST_AUTO_TEST_SUITE(TestPacketBase)
33
34BOOST_AUTO_TEST_CASE(CongestionMark)
35{
36 Interest interest;
37
38 BOOST_CHECK_EQUAL(interest.getCongestionMark(), 0);
39
40 auto tag = interest.getTag<lp::CongestionMarkTag>();
41 BOOST_CHECK(!tag);
42
43 interest.setCongestionMark(true);
44 tag = interest.getTag<lp::CongestionMarkTag>();
45 BOOST_REQUIRE(tag);
46 BOOST_CHECK_EQUAL(*tag, 1);
47
48 interest.setCongestionMark(false);
49 tag = interest.getTag<lp::CongestionMarkTag>();
50 BOOST_CHECK(!tag);
51
52 interest.setCongestionMark(300);
53 tag = interest.getTag<lp::CongestionMarkTag>();
54 BOOST_REQUIRE(tag);
55 BOOST_CHECK_EQUAL(*tag, 300);
56
57 interest.setCongestionMark(0);
58 tag = interest.getTag<lp::CongestionMarkTag>();
59 BOOST_CHECK(!tag);
60}
61
62BOOST_AUTO_TEST_SUITE_END() // TestPacketBase
Junxiao Shi1e36ceb2018-12-17 13:20:26 -070063BOOST_AUTO_TEST_SUITE_END() // Detail
Eric Newberryc3a46792017-09-24 14:54:24 -070064
65} // namespace tests
66} // namespace ndn