1 // { dg-do run { target c++11 } }
3 // 2011-10-28 Paolo Carlini <paolo.carlini@oracle.com>
5 // Copyright (C) 2011-2025 Free Software Foundation, Inc.
7 // This file is part of the GNU ISO C++ Library. This library is free
8 // software; you can redistribute it and/or modify it under the
9 // terms of the GNU General Public License as published by the
10 // Free Software Foundation; either version 3, or (at your option)
13 // This library is distributed in the hope that it will be useful,
14 // but WITHOUT ANY WARRANTY; without even the implied warranty of
15 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 // GNU General Public License for more details.
18 // You should have received a copy of the GNU General Public License along
19 // with this library; see the file COPYING3. If not see
20 // <http://www.gnu.org/licenses/>.
23 #include <unordered_set>
24 #include <testsuite_hooks.h>
30 unordered_multiset
<int> ums0
;
31 VERIFY( ums0
.count(0) == 0 );
32 VERIFY( ums0
.count(1) == 0 );
35 VERIFY( ums0
.count(0) == 0 );
36 VERIFY( ums0
.count(1) == 1 );
39 VERIFY( ums0
.count(0) == 0 );
40 VERIFY( ums0
.count(1) == 2 );
43 VERIFY( ums0
.count(2) == 1 );
48 VERIFY( ums0
.count(3) == 3 );
51 VERIFY( ums0
.count(2) == 0 );
54 VERIFY( ums0
.count(0) == 0 );
56 unordered_multiset
<int> ums1(ums0
);
57 VERIFY( ums1
.count(0) == 0 );
58 VERIFY( ums1
.count(1) == 2 );
59 VERIFY( ums1
.count(2) == 0 );
60 VERIFY( ums1
.count(3) == 3 );
63 VERIFY( ums0
.count(0) == 0 );
64 VERIFY( ums0
.count(1) == 0 );
65 VERIFY( ums0
.count(2) == 0 );
66 VERIFY( ums0
.count(3) == 0 );
73 VERIFY( ums1
.count(4) == 1 );
74 VERIFY( ums1
.count(5) == 4 );
77 VERIFY( ums1
.count(1) == 0 );
79 ums1
.erase(ums1
.find(5));
80 VERIFY( ums1
.count(5) == 3 );
84 VERIFY( ums1
.count(1) == 2 );
87 VERIFY( ums1
.count(5) == 0 );
89 ums1
.erase(ums1
.find(4));
90 VERIFY( ums1
.count(4) == 0 );
93 VERIFY( ums1
.count(0) == 0 );
94 VERIFY( ums1
.count(1) == 0 );
95 VERIFY( ums1
.count(2) == 0 );
96 VERIFY( ums1
.count(3) == 0 );
97 VERIFY( ums1
.count(4) == 0 );
98 VERIFY( ums1
.count(5) == 0 );