blob: 8b4dfa2586f29cc7d11a9006f709dbb830c29015 [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
22#include "packet-base.hpp"
23
24#include "../boost-test.hpp"
25#include "interest.hpp"
26#include "lp/tags.hpp"
27
28namespace ndn {
29namespace tests {
30
31BOOST_AUTO_TEST_SUITE(TestPacketBase)
32
33BOOST_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
61BOOST_AUTO_TEST_SUITE_END() // TestPacketBase
62
63} // namespace tests
64} // namespace ndn