blob: c874b8fb2258b08468ded6ce7e3bab31448eabf8 [file] [log] [blame]
Junxiao Shia4f2be82014-03-02 22:56:41 -07001/* -*- 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
12namespace nfd {
13namespace tests {
14
15BOOST_FIXTURE_TEST_SUITE(CoreMapValueIterator, BaseFixture)
16
17BOOST_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
36BOOST_AUTO_TEST_SUITE_END()
37
38} // namespace tests
39} // namespace nfd