Junxiao Shi | a4f2be8 | 2014-03-02 22:56:41 -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 "core/map-value-iterator.hpp" |
| 8 | #include <boost/concept_check.hpp> |
| 9 | |
| 10 | #include "tests/test-common.hpp" |
| 11 | |
| 12 | namespace nfd { |
| 13 | namespace tests { |
| 14 | |
| 15 | BOOST_FIXTURE_TEST_SUITE(CoreMapValueIterator, BaseFixture) |
| 16 | |
| 17 | BOOST_AUTO_TEST_CASE(Basic) |
| 18 | { |
| 19 | typedef std::map<char, int> CharIntMap; |
| 20 | typedef MapValueIterator<CharIntMap> CharIntMapValueIterator; |
| 21 | BOOST_CONCEPT_ASSERT((boost::ForwardIterator<CharIntMapValueIterator>)); |
| 22 | |
| 23 | CharIntMap map; |
| 24 | map['a'] = 1918; |
| 25 | map['b'] = 2675; |
| 26 | map['c'] = 7783; |
| 27 | map['d'] = 2053; |
| 28 | |
| 29 | CharIntMapValueIterator begin(map.begin()); |
| 30 | CharIntMapValueIterator end (map.end ()); |
| 31 | |
| 32 | int expected[] = { 1918, 2675, 7783, 2053 }; |
| 33 | BOOST_CHECK_EQUAL_COLLECTIONS(begin, end, expected, expected + 4); |
| 34 | } |
| 35 | |
| 36 | BOOST_AUTO_TEST_SUITE_END() |
| 37 | |
| 38 | } // namespace tests |
| 39 | } // namespace nfd |