aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaolo Carlini <paolo@gcc.gnu.org>2011-10-28 11:54:04 +0000
committerPaolo Carlini <paolo@gcc.gnu.org>2011-10-28 11:54:04 +0000
commit4a6b297c988434269153703b27fff9e9037894fb (patch)
tree4951b69b2285d4676dca4199f19c9039eef48383
parentb27df4bbaf6b18a2ef60b585c6706f89b36affa1 (diff)
downloadgcc-4a6b297c988434269153703b27fff9e9037894fb.zip
gcc-4a6b297c988434269153703b27fff9e9037894fb.tar.gz
gcc-4a6b297c988434269153703b27fff9e9037894fb.tar.bz2
count.cc: New.
2011-10-28 Paolo Carlini <paolo.carlini@oracle.com> * testsuite/23_containers/unordered_map/operations/count.cc: New. * testsuite/23_containers/multimap/operations/count.cc: Likewise. * testsuite/23_containers/set/operations/count.cc: Likewise. * testsuite/23_containers/unordered_multimap/operations/count.cc: Likewise. * testsuite/23_containers/unordered_set/operations/count.cc: Likewise. * testsuite/23_containers/multiset/operations/count.cc: Likewise. * testsuite/23_containers/unordered_multiset/operations/count.cc: Likewise. * testsuite/23_containers/map/operations/count.cc: Likewise. From-SVN: r180612
-rw-r--r--libstdc++-v3/testsuite/23_containers/map/operations/count.cc106
-rw-r--r--libstdc++-v3/testsuite/23_containers/multimap/operations/count.cc106
-rw-r--r--libstdc++-v3/testsuite/23_containers/multiset/operations/count.cc104
-rw-r--r--libstdc++-v3/testsuite/23_containers/set/operations/count.cc104
-rw-r--r--libstdc++-v3/testsuite/23_containers/unordered_map/operations/count.cc108
-rw-r--r--libstdc++-v3/testsuite/23_containers/unordered_multimap/operations/count.cc108
-rw-r--r--libstdc++-v3/testsuite/23_containers/unordered_multiset/operations/count.cc106
-rw-r--r--libstdc++-v3/testsuite/23_containers/unordered_set/operations/count.cc106
8 files changed, 848 insertions, 0 deletions
diff --git a/libstdc++-v3/testsuite/23_containers/map/operations/count.cc b/libstdc++-v3/testsuite/23_containers/map/operations/count.cc
new file mode 100644
index 0000000..dfbaee6ed
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/map/operations/count.cc
@@ -0,0 +1,106 @@
+// 2011-10-28 Paolo Carlini <paolo.carlini@oracle.com>
+
+// Copyright (C) 2011 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+//
+
+#include <map>
+#include <testsuite_hooks.h>
+
+void test01()
+{
+ bool test __attribute__((unused)) = true;
+ using namespace std;
+
+ typedef map<int, int>::value_type value_type;
+
+ map<int, int> m0;
+ VERIFY( m0.count(0) == 0 );
+ VERIFY( m0.count(1) == 0 );
+
+ m0.insert(value_type(1, 1));
+ VERIFY( m0.count(0) == 0 );
+ VERIFY( m0.count(1) == 1 );
+
+ m0.insert(value_type(1, 2));
+ VERIFY( m0.count(0) == 0 );
+ VERIFY( m0.count(1) == 1 );
+
+ m0.insert(value_type(2, 1));
+ VERIFY( m0.count(2) == 1 );
+
+ m0.insert(value_type(3, 1));
+ m0.insert(value_type(3, 2));
+ m0.insert(value_type(3, 3));
+ VERIFY( m0.count(3) == 1 );
+
+ m0.erase(2);
+ VERIFY( m0.count(2) == 0 );
+
+ m0.erase(0);
+ VERIFY( m0.count(0) == 0 );
+
+ map<int, int> m1(m0);
+ VERIFY( m1.count(0) == 0 );
+ VERIFY( m1.count(1) == 1 );
+ VERIFY( m1.count(2) == 0 );
+ VERIFY( m1.count(3) == 1 );
+
+ m0.clear();
+ VERIFY( m0.count(0) == 0 );
+ VERIFY( m0.count(1) == 0 );
+ VERIFY( m0.count(2) == 0 );
+ VERIFY( m0.count(3) == 0 );
+
+ m1.insert(value_type(4, 1));
+ m1.insert(value_type(5, 1));
+ m1.insert(value_type(5, 2));
+ m1.insert(value_type(5, 3));
+ m1.insert(value_type(5, 4));
+ VERIFY( m1.count(4) == 1 );
+ VERIFY( m1.count(5) == 1 );
+
+ m1.erase(1);
+ VERIFY( m1.count(1) == 0 );
+
+ m1.erase(m1.find(5));
+ VERIFY( m1.count(5) == 0 );
+
+ m1.insert(value_type(1, 1));
+ m1.insert(value_type(1, 2));
+ VERIFY( m1.count(1) == 1 );
+
+ m1.erase(5);
+ VERIFY( m1.count(5) == 0 );
+
+ m1.erase(m1.find(4));
+ VERIFY( m1.count(4) == 0 );
+
+ m1.clear();
+ VERIFY( m1.count(0) == 0 );
+ VERIFY( m1.count(1) == 0 );
+ VERIFY( m1.count(2) == 0 );
+ VERIFY( m1.count(3) == 0 );
+ VERIFY( m1.count(4) == 0 );
+ VERIFY( m1.count(5) == 0 );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/multimap/operations/count.cc b/libstdc++-v3/testsuite/23_containers/multimap/operations/count.cc
new file mode 100644
index 0000000..2658615
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/multimap/operations/count.cc
@@ -0,0 +1,106 @@
+// 2011-10-28 Paolo Carlini <paolo.carlini@oracle.com>
+
+// Copyright (C) 2011 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+//
+
+#include <map>
+#include <testsuite_hooks.h>
+
+void test01()
+{
+ bool test __attribute__((unused)) = true;
+ using namespace std;
+
+ typedef multimap<int, int>::value_type value_type;
+
+ multimap<int, int> mm0;
+ VERIFY( mm0.count(0) == 0 );
+ VERIFY( mm0.count(1) == 0 );
+
+ mm0.insert(value_type(1, 1));
+ VERIFY( mm0.count(0) == 0 );
+ VERIFY( mm0.count(1) == 1 );
+
+ mm0.insert(value_type(1, 2));
+ VERIFY( mm0.count(0) == 0 );
+ VERIFY( mm0.count(1) == 2 );
+
+ mm0.insert(value_type(2, 1));
+ VERIFY( mm0.count(2) == 1 );
+
+ mm0.insert(value_type(3, 1));
+ mm0.insert(value_type(3, 2));
+ mm0.insert(value_type(3, 3));
+ VERIFY( mm0.count(3) == 3 );
+
+ mm0.erase(2);
+ VERIFY( mm0.count(2) == 0 );
+
+ mm0.erase(0);
+ VERIFY( mm0.count(0) == 0 );
+
+ multimap<int, int> mm1(mm0);
+ VERIFY( mm1.count(0) == 0 );
+ VERIFY( mm1.count(1) == 2 );
+ VERIFY( mm1.count(2) == 0 );
+ VERIFY( mm1.count(3) == 3 );
+
+ mm0.clear();
+ VERIFY( mm0.count(0) == 0 );
+ VERIFY( mm0.count(1) == 0 );
+ VERIFY( mm0.count(2) == 0 );
+ VERIFY( mm0.count(3) == 0 );
+
+ mm1.insert(value_type(4, 1));
+ mm1.insert(value_type(5, 1));
+ mm1.insert(value_type(5, 2));
+ mm1.insert(value_type(5, 3));
+ mm1.insert(value_type(5, 4));
+ VERIFY( mm1.count(4) == 1 );
+ VERIFY( mm1.count(5) == 4 );
+
+ mm1.erase(1);
+ VERIFY( mm1.count(1) == 0 );
+
+ mm1.erase(mm1.find(5));
+ VERIFY( mm1.count(5) == 3 );
+
+ mm1.insert(value_type(1, 1));
+ mm1.insert(value_type(1, 2));
+ VERIFY( mm1.count(1) == 2 );
+
+ mm1.erase(5);
+ VERIFY( mm1.count(5) == 0 );
+
+ mm1.erase(mm1.find(4));
+ VERIFY( mm1.count(4) == 0 );
+
+ mm1.clear();
+ VERIFY( mm1.count(0) == 0 );
+ VERIFY( mm1.count(1) == 0 );
+ VERIFY( mm1.count(2) == 0 );
+ VERIFY( mm1.count(3) == 0 );
+ VERIFY( mm1.count(4) == 0 );
+ VERIFY( mm1.count(5) == 0 );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/multiset/operations/count.cc b/libstdc++-v3/testsuite/23_containers/multiset/operations/count.cc
new file mode 100644
index 0000000..9632387
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/multiset/operations/count.cc
@@ -0,0 +1,104 @@
+// 2011-10-28 Paolo Carlini <paolo.carlini@oracle.com>
+
+// Copyright (C) 2011 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+//
+
+#include <set>
+#include <testsuite_hooks.h>
+
+void test01()
+{
+ bool test __attribute__((unused)) = true;
+ using namespace std;
+
+ multiset<int> ms0;
+ VERIFY( ms0.count(0) == 0 );
+ VERIFY( ms0.count(1) == 0 );
+
+ ms0.insert(1);
+ VERIFY( ms0.count(0) == 0 );
+ VERIFY( ms0.count(1) == 1 );
+
+ ms0.insert(1);
+ VERIFY( ms0.count(0) == 0 );
+ VERIFY( ms0.count(1) == 2 );
+
+ ms0.insert(2);
+ VERIFY( ms0.count(2) == 1 );
+
+ ms0.insert(3);
+ ms0.insert(3);
+ ms0.insert(3);
+ VERIFY( ms0.count(3) == 3 );
+
+ ms0.erase(2);
+ VERIFY( ms0.count(2) == 0 );
+
+ ms0.erase(0);
+ VERIFY( ms0.count(0) == 0 );
+
+ multiset<int> ms1(ms0);
+ VERIFY( ms1.count(0) == 0 );
+ VERIFY( ms1.count(1) == 2 );
+ VERIFY( ms1.count(2) == 0 );
+ VERIFY( ms1.count(3) == 3 );
+
+ ms0.clear();
+ VERIFY( ms0.count(0) == 0 );
+ VERIFY( ms0.count(1) == 0 );
+ VERIFY( ms0.count(2) == 0 );
+ VERIFY( ms0.count(3) == 0 );
+
+ ms1.insert(4);
+ ms1.insert(5);
+ ms1.insert(5);
+ ms1.insert(5);
+ ms1.insert(5);
+ VERIFY( ms1.count(4) == 1 );
+ VERIFY( ms1.count(5) == 4 );
+
+ ms1.erase(1);
+ VERIFY( ms1.count(1) == 0 );
+
+ ms1.erase(ms1.find(5));
+ VERIFY( ms1.count(5) == 3 );
+
+ ms1.insert(1);
+ ms1.insert(1);
+ VERIFY( ms1.count(1) == 2 );
+
+ ms1.erase(5);
+ VERIFY( ms1.count(5) == 0 );
+
+ ms1.erase(ms1.find(4));
+ VERIFY( ms1.count(4) == 0 );
+
+ ms1.clear();
+ VERIFY( ms1.count(0) == 0 );
+ VERIFY( ms1.count(1) == 0 );
+ VERIFY( ms1.count(2) == 0 );
+ VERIFY( ms1.count(3) == 0 );
+ VERIFY( ms1.count(4) == 0 );
+ VERIFY( ms1.count(5) == 0 );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/set/operations/count.cc b/libstdc++-v3/testsuite/23_containers/set/operations/count.cc
new file mode 100644
index 0000000..4a6b0f2
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/set/operations/count.cc
@@ -0,0 +1,104 @@
+// 2011-10-28 Paolo Carlini <paolo.carlini@oracle.com>
+
+// Copyright (C) 2011 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+//
+
+#include <set>
+#include <testsuite_hooks.h>
+
+void test01()
+{
+ bool test __attribute__((unused)) = true;
+ using namespace std;
+
+ set<int> s0;
+ VERIFY( s0.count(0) == 0 );
+ VERIFY( s0.count(1) == 0 );
+
+ s0.insert(1);
+ VERIFY( s0.count(0) == 0 );
+ VERIFY( s0.count(1) == 1 );
+
+ s0.insert(1);
+ VERIFY( s0.count(0) == 0 );
+ VERIFY( s0.count(1) == 1 );
+
+ s0.insert(2);
+ VERIFY( s0.count(2) == 1 );
+
+ s0.insert(3);
+ s0.insert(3);
+ s0.insert(3);
+ VERIFY( s0.count(3) == 1 );
+
+ s0.erase(2);
+ VERIFY( s0.count(2) == 0 );
+
+ s0.erase(0);
+ VERIFY( s0.count(0) == 0 );
+
+ set<int> s1(s0);
+ VERIFY( s1.count(0) == 0 );
+ VERIFY( s1.count(1) == 1 );
+ VERIFY( s1.count(2) == 0 );
+ VERIFY( s1.count(3) == 1 );
+
+ s0.clear();
+ VERIFY( s0.count(0) == 0 );
+ VERIFY( s0.count(1) == 0 );
+ VERIFY( s0.count(2) == 0 );
+ VERIFY( s0.count(3) == 0 );
+
+ s1.insert(4);
+ s1.insert(5);
+ s1.insert(5);
+ s1.insert(5);
+ s1.insert(5);
+ VERIFY( s1.count(4) == 1 );
+ VERIFY( s1.count(5) == 1 );
+
+ s1.erase(1);
+ VERIFY( s1.count(1) == 0 );
+
+ s1.erase(s1.find(5));
+ VERIFY( s1.count(5) == 0 );
+
+ s1.insert(1);
+ s1.insert(1);
+ VERIFY( s1.count(1) == 1 );
+
+ s1.erase(5);
+ VERIFY( s1.count(5) == 0 );
+
+ s1.erase(s1.find(4));
+ VERIFY( s1.count(4) == 0 );
+
+ s1.clear();
+ VERIFY( s1.count(0) == 0 );
+ VERIFY( s1.count(1) == 0 );
+ VERIFY( s1.count(2) == 0 );
+ VERIFY( s1.count(3) == 0 );
+ VERIFY( s1.count(4) == 0 );
+ VERIFY( s1.count(5) == 0 );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/unordered_map/operations/count.cc b/libstdc++-v3/testsuite/23_containers/unordered_map/operations/count.cc
new file mode 100644
index 0000000..4aedc5e
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/unordered_map/operations/count.cc
@@ -0,0 +1,108 @@
+// { dg-options "-std=gnu++0x" }
+
+// 2011-10-28 Paolo Carlini <paolo.carlini@oracle.com>
+
+// Copyright (C) 2011 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+//
+
+#include <unordered_map>
+#include <testsuite_hooks.h>
+
+void test01()
+{
+ bool test __attribute__((unused)) = true;
+ using namespace std;
+
+ typedef unordered_map<int, int>::value_type value_type;
+
+ unordered_map<int, int> um0;
+ VERIFY( um0.count(0) == 0 );
+ VERIFY( um0.count(1) == 0 );
+
+ um0.insert(value_type(1, 1));
+ VERIFY( um0.count(0) == 0 );
+ VERIFY( um0.count(1) == 1 );
+
+ um0.insert(value_type(1, 2));
+ VERIFY( um0.count(0) == 0 );
+ VERIFY( um0.count(1) == 1 );
+
+ um0.insert(value_type(2, 1));
+ VERIFY( um0.count(2) == 1 );
+
+ um0.insert(value_type(3, 1));
+ um0.insert(value_type(3, 2));
+ um0.insert(value_type(3, 3));
+ VERIFY( um0.count(3) == 1 );
+
+ um0.erase(2);
+ VERIFY( um0.count(2) == 0 );
+
+ um0.erase(0);
+ VERIFY( um0.count(0) == 0 );
+
+ unordered_map<int, int> um1(um0);
+ VERIFY( um1.count(0) == 0 );
+ VERIFY( um1.count(1) == 1 );
+ VERIFY( um1.count(2) == 0 );
+ VERIFY( um1.count(3) == 1 );
+
+ um0.clear();
+ VERIFY( um0.count(0) == 0 );
+ VERIFY( um0.count(1) == 0 );
+ VERIFY( um0.count(2) == 0 );
+ VERIFY( um0.count(3) == 0 );
+
+ um1.insert(value_type(4, 1));
+ um1.insert(value_type(5, 1));
+ um1.insert(value_type(5, 2));
+ um1.insert(value_type(5, 3));
+ um1.insert(value_type(5, 4));
+ VERIFY( um1.count(4) == 1 );
+ VERIFY( um1.count(5) == 1 );
+
+ um1.erase(1);
+ VERIFY( um1.count(1) == 0 );
+
+ um1.erase(um1.find(5));
+ VERIFY( um1.count(5) == 0 );
+
+ um1.insert(value_type(1, 1));
+ um1.insert(value_type(1, 2));
+ VERIFY( um1.count(1) == 1 );
+
+ um1.erase(5);
+ VERIFY( um1.count(5) == 0 );
+
+ um1.erase(um1.find(4));
+ VERIFY( um1.count(4) == 0 );
+
+ um1.clear();
+ VERIFY( um1.count(0) == 0 );
+ VERIFY( um1.count(1) == 0 );
+ VERIFY( um1.count(2) == 0 );
+ VERIFY( um1.count(3) == 0 );
+ VERIFY( um1.count(4) == 0 );
+ VERIFY( um1.count(5) == 0 );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/unordered_multimap/operations/count.cc b/libstdc++-v3/testsuite/23_containers/unordered_multimap/operations/count.cc
new file mode 100644
index 0000000..12f9e1f
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/unordered_multimap/operations/count.cc
@@ -0,0 +1,108 @@
+// { dg-options "-std=gnu++0x" }
+
+// 2011-10-28 Paolo Carlini <paolo.carlini@oracle.com>
+
+// Copyright (C) 2011 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+//
+
+#include <unordered_map>
+#include <testsuite_hooks.h>
+
+void test01()
+{
+ bool test __attribute__((unused)) = true;
+ using namespace std;
+
+ typedef unordered_multimap<int, int>::value_type value_type;
+
+ unordered_multimap<int, int> umm0;
+ VERIFY( umm0.count(0) == 0 );
+ VERIFY( umm0.count(1) == 0 );
+
+ umm0.insert(value_type(1, 1));
+ VERIFY( umm0.count(0) == 0 );
+ VERIFY( umm0.count(1) == 1 );
+
+ umm0.insert(value_type(1, 2));
+ VERIFY( umm0.count(0) == 0 );
+ VERIFY( umm0.count(1) == 2 );
+
+ umm0.insert(value_type(2, 1));
+ VERIFY( umm0.count(2) == 1 );
+
+ umm0.insert(value_type(3, 1));
+ umm0.insert(value_type(3, 2));
+ umm0.insert(value_type(3, 3));
+ VERIFY( umm0.count(3) == 3 );
+
+ umm0.erase(2);
+ VERIFY( umm0.count(2) == 0 );
+
+ umm0.erase(0);
+ VERIFY( umm0.count(0) == 0 );
+
+ unordered_multimap<int, int> umm1(umm0);
+ VERIFY( umm1.count(0) == 0 );
+ VERIFY( umm1.count(1) == 2 );
+ VERIFY( umm1.count(2) == 0 );
+ VERIFY( umm1.count(3) == 3 );
+
+ umm0.clear();
+ VERIFY( umm0.count(0) == 0 );
+ VERIFY( umm0.count(1) == 0 );
+ VERIFY( umm0.count(2) == 0 );
+ VERIFY( umm0.count(3) == 0 );
+
+ umm1.insert(value_type(4, 1));
+ umm1.insert(value_type(5, 1));
+ umm1.insert(value_type(5, 2));
+ umm1.insert(value_type(5, 3));
+ umm1.insert(value_type(5, 4));
+ VERIFY( umm1.count(4) == 1 );
+ VERIFY( umm1.count(5) == 4 );
+
+ umm1.erase(1);
+ VERIFY( umm1.count(1) == 0 );
+
+ umm1.erase(umm1.find(5));
+ VERIFY( umm1.count(5) == 3 );
+
+ umm1.insert(value_type(1, 1));
+ umm1.insert(value_type(1, 2));
+ VERIFY( umm1.count(1) == 2 );
+
+ umm1.erase(5);
+ VERIFY( umm1.count(5) == 0 );
+
+ umm1.erase(umm1.find(4));
+ VERIFY( umm1.count(4) == 0 );
+
+ umm1.clear();
+ VERIFY( umm1.count(0) == 0 );
+ VERIFY( umm1.count(1) == 0 );
+ VERIFY( umm1.count(2) == 0 );
+ VERIFY( umm1.count(3) == 0 );
+ VERIFY( umm1.count(4) == 0 );
+ VERIFY( umm1.count(5) == 0 );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/unordered_multiset/operations/count.cc b/libstdc++-v3/testsuite/23_containers/unordered_multiset/operations/count.cc
new file mode 100644
index 0000000..17c37f8
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/unordered_multiset/operations/count.cc
@@ -0,0 +1,106 @@
+// { dg-options "-std=gnu++0x" }
+
+// 2011-10-28 Paolo Carlini <paolo.carlini@oracle.com>
+
+// Copyright (C) 2011 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+//
+
+#include <unordered_set>
+#include <testsuite_hooks.h>
+
+void test01()
+{
+ bool test __attribute__((unused)) = true;
+ using namespace std;
+
+ unordered_multiset<int> ums0;
+ VERIFY( ums0.count(0) == 0 );
+ VERIFY( ums0.count(1) == 0 );
+
+ ums0.insert(1);
+ VERIFY( ums0.count(0) == 0 );
+ VERIFY( ums0.count(1) == 1 );
+
+ ums0.insert(1);
+ VERIFY( ums0.count(0) == 0 );
+ VERIFY( ums0.count(1) == 2 );
+
+ ums0.insert(2);
+ VERIFY( ums0.count(2) == 1 );
+
+ ums0.insert(3);
+ ums0.insert(3);
+ ums0.insert(3);
+ VERIFY( ums0.count(3) == 3 );
+
+ ums0.erase(2);
+ VERIFY( ums0.count(2) == 0 );
+
+ ums0.erase(0);
+ VERIFY( ums0.count(0) == 0 );
+
+ unordered_multiset<int> ums1(ums0);
+ VERIFY( ums1.count(0) == 0 );
+ VERIFY( ums1.count(1) == 2 );
+ VERIFY( ums1.count(2) == 0 );
+ VERIFY( ums1.count(3) == 3 );
+
+ ums0.clear();
+ VERIFY( ums0.count(0) == 0 );
+ VERIFY( ums0.count(1) == 0 );
+ VERIFY( ums0.count(2) == 0 );
+ VERIFY( ums0.count(3) == 0 );
+
+ ums1.insert(4);
+ ums1.insert(5);
+ ums1.insert(5);
+ ums1.insert(5);
+ ums1.insert(5);
+ VERIFY( ums1.count(4) == 1 );
+ VERIFY( ums1.count(5) == 4 );
+
+ ums1.erase(1);
+ VERIFY( ums1.count(1) == 0 );
+
+ ums1.erase(ums1.find(5));
+ VERIFY( ums1.count(5) == 3 );
+
+ ums1.insert(1);
+ ums1.insert(1);
+ VERIFY( ums1.count(1) == 2 );
+
+ ums1.erase(5);
+ VERIFY( ums1.count(5) == 0 );
+
+ ums1.erase(ums1.find(4));
+ VERIFY( ums1.count(4) == 0 );
+
+ ums1.clear();
+ VERIFY( ums1.count(0) == 0 );
+ VERIFY( ums1.count(1) == 0 );
+ VERIFY( ums1.count(2) == 0 );
+ VERIFY( ums1.count(3) == 0 );
+ VERIFY( ums1.count(4) == 0 );
+ VERIFY( ums1.count(5) == 0 );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/unordered_set/operations/count.cc b/libstdc++-v3/testsuite/23_containers/unordered_set/operations/count.cc
new file mode 100644
index 0000000..942338f
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/unordered_set/operations/count.cc
@@ -0,0 +1,106 @@
+// { dg-options "-std=gnu++0x" }
+
+// 2011-10-28 Paolo Carlini <paolo.carlini@oracle.com>
+
+// Copyright (C) 2011 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+//
+
+#include <unordered_set>
+#include <testsuite_hooks.h>
+
+void test01()
+{
+ bool test __attribute__((unused)) = true;
+ using namespace std;
+
+ unordered_set<int> us0;
+ VERIFY( us0.count(0) == 0 );
+ VERIFY( us0.count(1) == 0 );
+
+ us0.insert(1);
+ VERIFY( us0.count(0) == 0 );
+ VERIFY( us0.count(1) == 1 );
+
+ us0.insert(1);
+ VERIFY( us0.count(0) == 0 );
+ VERIFY( us0.count(1) == 1 );
+
+ us0.insert(2);
+ VERIFY( us0.count(2) == 1 );
+
+ us0.insert(3);
+ us0.insert(3);
+ us0.insert(3);
+ VERIFY( us0.count(3) == 1 );
+
+ us0.erase(2);
+ VERIFY( us0.count(2) == 0 );
+
+ us0.erase(0);
+ VERIFY( us0.count(0) == 0 );
+
+ unordered_set<int> us1(us0);
+ VERIFY( us1.count(0) == 0 );
+ VERIFY( us1.count(1) == 1 );
+ VERIFY( us1.count(2) == 0 );
+ VERIFY( us1.count(3) == 1 );
+
+ us0.clear();
+ VERIFY( us0.count(0) == 0 );
+ VERIFY( us0.count(1) == 0 );
+ VERIFY( us0.count(2) == 0 );
+ VERIFY( us0.count(3) == 0 );
+
+ us1.insert(4);
+ us1.insert(5);
+ us1.insert(5);
+ us1.insert(5);
+ us1.insert(5);
+ VERIFY( us1.count(4) == 1 );
+ VERIFY( us1.count(5) == 1 );
+
+ us1.erase(1);
+ VERIFY( us1.count(1) == 0 );
+
+ us1.erase(us1.find(5));
+ VERIFY( us1.count(5) == 0 );
+
+ us1.insert(1);
+ us1.insert(1);
+ VERIFY( us1.count(1) == 1 );
+
+ us1.erase(5);
+ VERIFY( us1.count(5) == 0 );
+
+ us1.erase(us1.find(4));
+ VERIFY( us1.count(4) == 0 );
+
+ us1.clear();
+ VERIFY( us1.count(0) == 0 );
+ VERIFY( us1.count(1) == 0 );
+ VERIFY( us1.count(2) == 0 );
+ VERIFY( us1.count(3) == 0 );
+ VERIFY( us1.count(4) == 0 );
+ VERIFY( us1.count(5) == 0 );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}