initializer_list_compare_alloc.pass.cpp revision bc8d3f97eb5c958007f2713238472e0c1c8fe02c
1//===----------------------------------------------------------------------===//
2//
3// ��������������������The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9
10// <map>
11
12// class map
13
14// map(initializer_list<value_type> il, const key_compare& comp, const allocator_type& a);
15
16#include <map>
17#include <cassert>
18#include "../../../test_compare.h"
19#include "../../../test_allocator.h"
20
21int main()
22{
23#ifdef _LIBCPP_MOVE
24    typedef std::pair<const int, double> V;
25    typedef test_compare<std::less<int> > C;
26    typedef test_allocator<std::pair<const int, double> > A;
27    std::map<int, double, C, A> m({
28                                   {1, 1},
29                                   {1, 1.5},
30                                   {1, 2},
31                                   {2, 1},
32                                   {2, 1.5},
33                                   {2, 2},
34                                   {3, 1},
35                                   {3, 1.5},
36                                   {3, 2}
37                                  }, C(3), A(6));
38    assert(m.size() == 3);
39    assert(distance(m.begin(), m.end()) == 3);
40    assert(*m.begin() == V(1, 1));
41    assert(*next(m.begin()) == V(2, 1));
42    assert(*next(m.begin(), 2) == V(3, 1));
43    assert(m.key_comp() == C(3));
44    assert(m.get_allocator() == A(6));
45#endif
46}
47