1 // { dg-options "-std=gnu++11" }
3 // Copyright (C) 2012 Free Software Foundation, Inc.
5 // This file is part of the GNU ISO C++ Library. This library is free
6 // software; you can redistribute it and/or modify it under the
7 // terms of the GNU General Public License as published by the
8 // Free Software Foundation; either version 3, or (at your option)
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
16 // You should have received a copy of the GNU General Public License along
17 // with this library; see the file COPYING3. If not see
18 // <http://www.gnu.org/licenses/>.
20 #include <unordered_map>
21 #include <testsuite_hooks.h>
26 get_nb_bucket_elems(const std::unordered_multimap
<int, int>& us
)
29 for (std::size_t b
= 0; b
!= us
.bucket_count(); ++b
)
30 nb
+= us
.bucket_size(b
);
38 bool test
__attribute__((unused
)) = true;
40 std::unordered_multimap
<int, int> umm
;
41 umm
.insert(make_pair(10, 1));
42 VERIFY( umm
.size() == 1 );
43 VERIFY( std::distance(umm
.begin(), umm
.end()) == umm
.size() );
44 VERIFY( get_nb_bucket_elems(umm
) == umm
.size() );
46 umm
.insert(make_pair(10, 2));
47 VERIFY( umm
.size() == 2 );
48 VERIFY( std::distance(umm
.begin(), umm
.end()) == umm
.size() );
49 VERIFY( get_nb_bucket_elems(umm
) == umm
.size() );
51 umm
.insert(make_pair(10, 3));
52 VERIFY( umm
.size() == 3 );
53 VERIFY( std::distance(umm
.begin(), umm
.end()) == umm
.size() );
54 VERIFY( get_nb_bucket_elems(umm
) == umm
.size() );
56 umm
.insert(make_pair(10, 4));
57 VERIFY( umm
.size() == 4 );
58 VERIFY( std::distance(umm
.begin(), umm
.end()) == umm
.size() );
59 VERIFY( get_nb_bucket_elems(umm
) == umm
.size() );
61 umm
.insert(make_pair(10, 5));
62 VERIFY( umm
.size() == 5 );
63 VERIFY( std::distance(umm
.begin(), umm
.end()) == umm
.size() );
64 VERIFY( get_nb_bucket_elems(umm
) == umm
.size() );
66 umm
.insert(make_pair(24, 6));
67 VERIFY( umm
.size() == 6 );
68 VERIFY( std::distance(umm
.begin(), umm
.end()) == umm
.size() );
69 VERIFY( get_nb_bucket_elems(umm
) == umm
.size() );
71 umm
.insert(make_pair(25, 7));
72 VERIFY( umm
.size() == 7 );
73 VERIFY( std::distance(umm
.begin(), umm
.end()) == umm
.size() );
74 VERIFY( get_nb_bucket_elems(umm
) == umm
.size() );
76 umm
.insert(make_pair(2, 8));
77 VERIFY( umm
.size() == 8 );
78 VERIFY( std::distance(umm
.begin(), umm
.end()) == umm
.size() );
79 VERIFY( get_nb_bucket_elems(umm
) == umm
.size() );
81 umm
.insert(make_pair(2, 9));
82 VERIFY( umm
.size() == 9 );
83 VERIFY( std::distance(umm
.begin(), umm
.end()) == umm
.size() );
84 VERIFY( get_nb_bucket_elems(umm
) == umm
.size() );
86 umm
.insert(make_pair(1, 10));
87 VERIFY( umm
.size() == 10 );
88 VERIFY( std::distance(umm
.begin(), umm
.end()) == umm
.size() );
89 VERIFY( get_nb_bucket_elems(umm
) == umm
.size() );
91 umm
.insert(make_pair(10, 11));
92 VERIFY( umm
.size() == 11 );
93 VERIFY( std::distance(umm
.begin(), umm
.end()) == umm
.size() );
94 VERIFY( get_nb_bucket_elems(umm
) == umm
.size() );