1 //===----------------------------------------------------------------------===//
3 // The LLVM Compiler Infrastructure
5 // This file is dual licensed under the MIT and the University of Illinois Open
6 // Source Licenses. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
12 // template <class Key, class T, class Hash = hash<Key>, class Pred = equal_to<Key>,
13 // class Alloc = allocator<pair<const Key, T>>>
14 // class unordered_multimap
16 // size_type bucket_size(size_type n) const
19 #define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
22 #include <unordered_map>
26 #include "test_macros.h"
27 #include "min_allocator.h"
32 typedef std::unordered_multimap<int, std::string> C;
33 typedef std::pair<int, std::string> P;
43 const C c(std::begin(a), std::end(a));
44 assert(c.bucket_count() >= 7);
45 LIBCPP_ASSERT(c.bucket_size(0) == 0);
46 LIBCPP_ASSERT(c.bucket_size(1) == 2);
47 LIBCPP_ASSERT(c.bucket_size(2) == 2);
48 LIBCPP_ASSERT(c.bucket_size(3) == 1);
49 LIBCPP_ASSERT(c.bucket_size(4) == 1);
50 LIBCPP_ASSERT(c.bucket_size(5) == 0);
51 LIBCPP_ASSERT(c.bucket_size(6) == 0);
53 #if TEST_STD_VER >= 11
55 typedef std::unordered_multimap<int, std::string, std::hash<int>, std::equal_to<int>,
56 min_allocator<std::pair<const int, std::string>>> C;
57 typedef std::pair<int, std::string> P;
67 const C c(std::begin(a), std::end(a));
68 assert(c.bucket_count() >= 7);
69 LIBCPP_ASSERT(c.bucket_size(0) == 0);
70 LIBCPP_ASSERT(c.bucket_size(1) == 2);
71 LIBCPP_ASSERT(c.bucket_size(2) == 2);
72 LIBCPP_ASSERT(c.bucket_size(3) == 1);
73 LIBCPP_ASSERT(c.bucket_size(4) == 1);
74 LIBCPP_ASSERT(c.bucket_size(5) == 0);
75 LIBCPP_ASSERT(c.bucket_size(6) == 0);
78 #if _LIBCPP_DEBUG_LEVEL >= 1
80 typedef std::unordered_multimap<int, std::string> C;
82 C::size_type i = c.bucket_size(3);