llvm-project
56 строк · 1.5 Кб
1//===----------------------------------------------------------------------===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
9// <map>
10
11// class map
12
13// map(const key_compare& comp, const allocator_type& a);
14
15#include <map>16#include <cassert>17
18#include "test_macros.h"19#include "../../../test_compare.h"20#include "test_allocator.h"21#include "min_allocator.h"22
23int main(int, char**)24{
25{26typedef test_less<int> C;27typedef test_allocator<std::pair<const int, double> > A;28std::map<int, double, C, A> m(C(4), A(5));29assert(m.empty());30assert(m.begin() == m.end());31assert(m.key_comp() == C(4));32assert(m.get_allocator() == A(5));33}34#if TEST_STD_VER >= 1135{36typedef test_less<int> C;37typedef min_allocator<std::pair<const int, double> > A;38std::map<int, double, C, A> m(C(4), A());39assert(m.empty());40assert(m.begin() == m.end());41assert(m.key_comp() == C(4));42assert(m.get_allocator() == A());43}44{45typedef test_less<int> C;46typedef explicit_allocator<std::pair<const int, double> > A;47std::map<int, double, C, A> m(C(4), A{});48assert(m.empty());49assert(m.begin() == m.end());50assert(m.key_comp() == C(4));51assert(m.get_allocator() == A{});52}53#endif54
55return 0;56}
57