blob: 8a46da6ec1522575632b7128159737e6fe407deb [file] [log] [blame]
Junxiao Shia4f2be82014-03-02 22:56:41 -07001/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2/**
Alexander Afanasyev9bcbc7c2014-04-06 19:37:37 -07003 * Copyright (c) 2014 Regents of the University of California,
4 * Arizona Board of Regents,
5 * Colorado State University,
6 * University Pierre & Marie Curie, Sorbonne University,
7 * Washington University in St. Louis,
8 * Beijing Institute of Technology
9 *
10 * This file is part of NFD (Named Data Networking Forwarding Daemon).
11 * See AUTHORS.md for complete list of NFD authors and contributors.
12 *
13 * NFD is free software: you can redistribute it and/or modify it under the terms
14 * of the GNU General Public License as published by the Free Software Foundation,
15 * either version 3 of the License, or (at your option) any later version.
16 *
17 * NFD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
18 * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
19 * PURPOSE. See the GNU General Public License for more details.
20 *
21 * You should have received a copy of the GNU General Public License along with
22 * NFD, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>.
23 **/
Junxiao Shia4f2be82014-03-02 22:56:41 -070024
25#include "core/map-value-iterator.hpp"
26#include <boost/concept_check.hpp>
27
28#include "tests/test-common.hpp"
29
30namespace nfd {
31namespace tests {
32
33BOOST_FIXTURE_TEST_SUITE(CoreMapValueIterator, BaseFixture)
34
35BOOST_AUTO_TEST_CASE(Basic)
36{
37 typedef std::map<char, int> CharIntMap;
38 typedef MapValueIterator<CharIntMap> CharIntMapValueIterator;
39 BOOST_CONCEPT_ASSERT((boost::ForwardIterator<CharIntMapValueIterator>));
40
41 CharIntMap map;
42 map['a'] = 1918;
43 map['b'] = 2675;
44 map['c'] = 7783;
45 map['d'] = 2053;
46
47 CharIntMapValueIterator begin(map.begin());
48 CharIntMapValueIterator end (map.end ());
49
50 int expected[] = { 1918, 2675, 7783, 2053 };
51 BOOST_CHECK_EQUAL_COLLECTIONS(begin, end, expected, expected + 4);
52}
53
54BOOST_AUTO_TEST_SUITE_END()
55
56} // namespace tests
57} // namespace nfd