]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - test/std/containers/unord/unord.multiset/bucket_count.pass.cpp
Vendor import of libc++ release_39 branch r276489:
[FreeBSD/FreeBSD.git] / test / std / containers / unord / unord.multiset / bucket_count.pass.cpp
1 //===----------------------------------------------------------------------===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is dual licensed under the MIT and the University of Illinois Open
6 // Source Licenses. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9
10 // <unordered_set>
11
12 // template <class Value, class Hash = hash<Value>, class Pred = equal_to<Value>,
13 //           class Alloc = allocator<Value>>
14 // class unordered_multiset
15
16 // size_type bucket_count() const;
17
18 #include <unordered_set>
19 #include <cassert>
20
21 #include "min_allocator.h"
22
23 int main()
24 {
25     {
26         typedef std::unordered_multiset<int> C;
27         typedef C::const_iterator I;
28         typedef int P;
29         const C c;
30         assert(c.bucket_count() == 0);
31     }
32     {
33         typedef std::unordered_multiset<int> C;
34         typedef C::const_iterator I;
35         typedef int P;
36         P a[] =
37         {
38             P(10),
39             P(20),
40             P(30),
41             P(40),
42             P(50),
43             P(60),
44             P(70),
45             P(80)
46         };
47         const C c(std::begin(a), std::end(a));
48         assert(c.bucket_count() >= 11);
49     }
50 #if TEST_STD_VER >= 11
51     {
52         typedef std::unordered_multiset<int, std::hash<int>,
53                                       std::equal_to<int>, min_allocator<int>> C;
54         typedef C::const_iterator I;
55         typedef int P;
56         const C c;
57         assert(c.bucket_count() == 0);
58     }
59     {
60         typedef std::unordered_multiset<int, std::hash<int>,
61                                       std::equal_to<int>, min_allocator<int>> C;
62         typedef C::const_iterator I;
63         typedef int P;
64         P a[] =
65         {
66             P(10),
67             P(20),
68             P(30),
69             P(40),
70             P(50),
71             P(60),
72             P(70),
73             P(80)
74         };
75         const C c(std::begin(a), std::end(a));
76         assert(c.bucket_count() >= 11);
77     }
78 #endif
79 }