summaryrefslogtreecommitdiff
path: root/libstdc++-v3/testsuite/tr1/6_containers/unordered_multiset
diff options
context:
space:
mode:
Diffstat (limited to 'libstdc++-v3/testsuite/tr1/6_containers/unordered_multiset')
-rw-r--r--libstdc++-v3/testsuite/tr1/6_containers/unordered_multiset/24054.cc52
-rw-r--r--libstdc++-v3/testsuite/tr1/6_containers/unordered_multiset/capacity/29134-multiset.cc38
-rw-r--r--libstdc++-v3/testsuite/tr1/6_containers/unordered_multiset/erase/1.cc129
-rw-r--r--libstdc++-v3/testsuite/tr1/6_containers/unordered_multiset/erase/24061-multiset.cc107
-rw-r--r--libstdc++-v3/testsuite/tr1/6_containers/unordered_multiset/find/multiset1.cc66
-rw-r--r--libstdc++-v3/testsuite/tr1/6_containers/unordered_multiset/insert/24061-multiset.cc57
-rw-r--r--libstdc++-v3/testsuite/tr1/6_containers/unordered_multiset/insert/multiset_range.cc80
-rw-r--r--libstdc++-v3/testsuite/tr1/6_containers/unordered_multiset/insert/multiset_single.cc68
-rw-r--r--libstdc++-v3/testsuite/tr1/6_containers/unordered_multiset/requirements/explicit_instantiation.cc36
-rw-r--r--libstdc++-v3/testsuite/tr1/6_containers/unordered_multiset/requirements/iterator_neg.cc36
-rw-r--r--libstdc++-v3/testsuite/tr1/6_containers/unordered_multiset/requirements/iterator_null_neg.cc28
-rw-r--r--libstdc++-v3/testsuite/tr1/6_containers/unordered_multiset/requirements/typedefs.cc45
-rw-r--r--libstdc++-v3/testsuite/tr1/6_containers/unordered_multiset/swap/1.cc153
-rw-r--r--libstdc++-v3/testsuite/tr1/6_containers/unordered_multiset/swap/2.cc182
14 files changed, 1077 insertions, 0 deletions
diff --git a/libstdc++-v3/testsuite/tr1/6_containers/unordered_multiset/24054.cc b/libstdc++-v3/testsuite/tr1/6_containers/unordered_multiset/24054.cc
new file mode 100644
index 000000000..9b9572012
--- /dev/null
+++ b/libstdc++-v3/testsuite/tr1/6_containers/unordered_multiset/24054.cc
@@ -0,0 +1,52 @@
+// Copyright (C) 2005, 2009 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/>.
+
+// 6.3 Unordered associative containers
+
+#include <tr1/unordered_set>
+#include <string>
+#include <testsuite_hooks.h>
+
+// libstdc++/24054
+void test01()
+{
+ bool test __attribute__((unused)) = true;
+
+ typedef std::tr1::unordered_multiset<std::string> Set;
+
+ Set s;
+
+ s.insert("etaoin");
+ s.insert("etaoin");
+ s.insert("etaoin");
+ s.insert("shrdlu");
+
+ VERIFY( s.erase("") == 0 );
+ VERIFY( s.size() == 4 );
+
+ VERIFY( s.erase("etaoin") == 3 );
+ VERIFY( s.size() == 1 );
+
+ VERIFY( s.erase("shrdlu") == 1 );
+ VERIFY( s.size() == 0 );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/tr1/6_containers/unordered_multiset/capacity/29134-multiset.cc b/libstdc++-v3/testsuite/tr1/6_containers/unordered_multiset/capacity/29134-multiset.cc
new file mode 100644
index 000000000..a0b3fd85c
--- /dev/null
+++ b/libstdc++-v3/testsuite/tr1/6_containers/unordered_multiset/capacity/29134-multiset.cc
@@ -0,0 +1,38 @@
+// Copyright (C) 2006, 2007, 2008, 2009 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/>.
+
+// 6.3.4.5 Class template unordered_multiset
+
+#include <tr1/unordered_set>
+#include <testsuite_hooks.h>
+
+// libstdc++/29134
+void test01()
+{
+ bool test __attribute__((unused)) = true;
+
+ std::tr1::unordered_multiset<int> ums;
+
+ VERIFY( (ums.max_size() == std::allocator<std::tr1::__detail::_Hash_node<
+ int, false> >().max_size()) );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/tr1/6_containers/unordered_multiset/erase/1.cc b/libstdc++-v3/testsuite/tr1/6_containers/unordered_multiset/erase/1.cc
new file mode 100644
index 000000000..5f7ec8930
--- /dev/null
+++ b/libstdc++-v3/testsuite/tr1/6_containers/unordered_multiset/erase/1.cc
@@ -0,0 +1,129 @@
+// 2007-02-22 Paolo Carlini <pcarlini@suse.de>
+//
+// Copyright (C) 2007, 2009 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/>.
+
+// 6.3.4.5 Class template unordered_multiset
+
+#include <tr1/unordered_set>
+#include <string>
+#include <testsuite_hooks.h>
+
+// In the occasion of libstdc++/25896
+void test01()
+{
+ bool test __attribute__((unused)) = true;
+
+ typedef std::tr1::unordered_multiset<std::string> Mset;
+ typedef Mset::iterator iterator;
+ typedef Mset::const_iterator const_iterator;
+
+ Mset ms1;
+
+ ms1.insert("because to why");
+ ms1.insert("the stockholm syndrome");
+ ms1.insert("a cereous night");
+ ms1.insert("eeilo");
+ ms1.insert("protean");
+ ms1.insert("the way you are when");
+ ms1.insert("tillsammans");
+ ms1.insert("umbra/penumbra");
+ ms1.insert("belonging (no longer mix)");
+ ms1.insert("one line behind");
+ VERIFY( ms1.size() == 10 );
+
+ VERIFY( ms1.erase("eeilo") == 1 );
+ VERIFY( ms1.size() == 9 );
+ iterator it1 = ms1.find("eeilo");
+ VERIFY( it1 == ms1.end() );
+
+ VERIFY( ms1.erase("tillsammans") == 1 );
+ VERIFY( ms1.size() == 8 );
+ iterator it2 = ms1.find("tillsammans");
+ VERIFY( it2 == ms1.end() );
+
+ // Must work (see DR 526)
+ iterator it3 = ms1.find("belonging (no longer mix)");
+ VERIFY( it3 != ms1.end() );
+ VERIFY( ms1.erase(*it3) == 1 );
+ VERIFY( ms1.size() == 7 );
+ it3 = ms1.find("belonging (no longer mix)");
+ VERIFY( it3 == ms1.end() );
+
+ VERIFY( !ms1.erase("abra") );
+ VERIFY( ms1.size() == 7 );
+
+ VERIFY( !ms1.erase("eeilo") );
+ VERIFY( ms1.size() == 7 );
+
+ VERIFY( ms1.erase("because to why") == 1 );
+ VERIFY( ms1.size() == 6 );
+ iterator it4 = ms1.find("because to why");
+ VERIFY( it4 == ms1.end() );
+
+ iterator it5 = ms1.find("umbra/penumbra");
+ iterator it6 = ms1.find("one line behind");
+ VERIFY( it5 != ms1.end() );
+ VERIFY( it6 != ms1.end() );
+
+ VERIFY( ms1.find("the stockholm syndrome") != ms1.end() );
+ VERIFY( ms1.find("a cereous night") != ms1.end() );
+ VERIFY( ms1.find("the way you are when") != ms1.end() );
+ VERIFY( ms1.find("a cereous night") != ms1.end() );
+
+ VERIFY( ms1.erase(*it5) == 1 );
+ VERIFY( ms1.size() == 5 );
+ it5 = ms1.find("umbra/penumbra");
+ VERIFY( it5 == ms1.end() );
+
+ VERIFY( ms1.erase(*it6) == 1 );
+ VERIFY( ms1.size() == 4 );
+ it6 = ms1.find("one line behind");
+ VERIFY( it6 == ms1.end() );
+
+ iterator it7 = ms1.begin();
+ iterator it8 = it7;
+ ++it8;
+ iterator it9 = it8;
+ ++it9;
+
+ VERIFY( ms1.erase(*it8) == 1 );
+ VERIFY( ms1.size() == 3 );
+ VERIFY( ++it7 == it9 );
+
+ iterator it10 = it9;
+ ++it10;
+ iterator it11 = it10;
+
+ VERIFY( ms1.erase(*it9) == 1 );
+ VERIFY( ms1.size() == 2 );
+ VERIFY( ++it10 == ms1.end() );
+
+ VERIFY( ms1.erase(ms1.begin()) != ms1.end() );
+ VERIFY( ms1.size() == 1 );
+ VERIFY( ms1.begin() == it11 );
+
+ VERIFY( ms1.erase(*ms1.begin()) == 1 );
+ VERIFY( ms1.size() == 0 );
+ VERIFY( ms1.begin() == ms1.end() );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/tr1/6_containers/unordered_multiset/erase/24061-multiset.cc b/libstdc++-v3/testsuite/tr1/6_containers/unordered_multiset/erase/24061-multiset.cc
new file mode 100644
index 000000000..625ed4eb3
--- /dev/null
+++ b/libstdc++-v3/testsuite/tr1/6_containers/unordered_multiset/erase/24061-multiset.cc
@@ -0,0 +1,107 @@
+// 2005-10-08 Paolo Carlini <pcarlini@suse.de>
+//
+// Copyright (C) 2005, 2009 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/>.
+
+// 6.3.4.5 Class template unordered_multiset
+
+#include <tr1/unordered_set>
+#include <string>
+#include <testsuite_hooks.h>
+
+// libstdc++/24061
+void test01()
+{
+ bool test __attribute__((unused)) = true;
+
+ typedef std::tr1::unordered_multiset<std::string> Mset;
+ typedef Mset::iterator iterator;
+ typedef Mset::const_iterator const_iterator;
+
+ Mset ms1;
+
+ ms1.insert("all the love in the world");
+ ms1.insert("you know what you are?");
+ ms1.insert("the collector");
+ ms1.insert("the hand that feeds");
+ ms1.insert("love is not enough");
+ ms1.insert("every day is exactly the same");
+ ms1.insert("with teeth");
+ ms1.insert("only");
+ ms1.insert("getting smaller");
+ ms1.insert("sunspots");
+
+ ms1.insert("the hand that feeds");
+ ms1.insert("love is not enough");
+ ms1.insert("every day is exactly the same");
+ VERIFY( ms1.size() == 13 );
+
+ iterator it1 = ms1.begin();
+ ++it1;
+ iterator it2 = it1;
+ ++it2;
+ iterator it3 = ms1.erase(it1);
+ VERIFY( ms1.size() == 12 );
+ VERIFY( it3 == it2 );
+ VERIFY( *it3 == *it2 );
+
+ iterator it4 = ms1.begin();
+ ++it4;
+ ++it4;
+ ++it4;
+ iterator it5 = it4;
+ ++it5;
+ ++it5;
+ iterator it6 = ms1.erase(it4, it5);
+ VERIFY( ms1.size() == 10 );
+ VERIFY( it6 == it5 );
+ VERIFY( *it6 == *it5 );
+
+ const_iterator it7 = ms1.begin();
+ ++it7;
+ ++it7;
+ ++it7;
+ const_iterator it8 = it7;
+ ++it8;
+ const_iterator it9 = ms1.erase(it7);
+ VERIFY( ms1.size() == 9 );
+ VERIFY( it9 == it8 );
+ VERIFY( *it9 == *it8 );
+
+ const_iterator it10 = ms1.begin();
+ ++it10;
+ const_iterator it11 = it10;
+ ++it11;
+ ++it11;
+ ++it11;
+ ++it11;
+ const_iterator it12 = ms1.erase(it10, it11);
+ VERIFY( ms1.size() == 5 );
+ VERIFY( it12 == it11 );
+ VERIFY( *it12 == *it11 );
+
+ iterator it13 = ms1.erase(ms1.begin(), ms1.end());
+ VERIFY( ms1.size() == 0 );
+ VERIFY( it13 == ms1.end() );
+ VERIFY( it13 == ms1.begin() );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/tr1/6_containers/unordered_multiset/find/multiset1.cc b/libstdc++-v3/testsuite/tr1/6_containers/unordered_multiset/find/multiset1.cc
new file mode 100644
index 000000000..848cce3f3
--- /dev/null
+++ b/libstdc++-v3/testsuite/tr1/6_containers/unordered_multiset/find/multiset1.cc
@@ -0,0 +1,66 @@
+// { dg-do run }
+
+// 2005-2-18 Matt Austern <austern@apple.com>
+//
+// Copyright (C) 2005, 2009 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/>.
+
+// 6.3.4.5 unordered_set
+// find, equal_range, count
+
+#include <string>
+#include <iterator>
+#include <algorithm>
+#include <tr1/unordered_set>
+#include "testsuite_hooks.h"
+
+bool test __attribute__((unused)) = true;
+
+void test01()
+{
+ typedef std::tr1::unordered_multiset<std::string> Set;
+ Set s;
+ VERIFY(s.empty());
+
+ s.insert("grape");
+ s.insert("banana");
+ s.insert("grape");
+
+ Set::iterator i2 = s.find("banana");
+ VERIFY(i2 != s.end());
+ VERIFY(*i2 == "banana");
+
+ std::pair<Set::iterator, Set::iterator> p = s.equal_range("grape");
+ VERIFY(std::distance(p.first, p.second) == 2);
+ Set::iterator i3 = p.first;
+ ++i3;
+ VERIFY(*p.first == "grape");
+ VERIFY(*i3 == "grape");
+
+ Set::iterator i4 = s.find("lime");
+ VERIFY(i4 == s.end());
+
+ VERIFY(s.count("grape") == 2);
+ VERIFY(s.count("banana") == 1);
+ VERIFY(s.count("lime") == 0);
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/tr1/6_containers/unordered_multiset/insert/24061-multiset.cc b/libstdc++-v3/testsuite/tr1/6_containers/unordered_multiset/insert/24061-multiset.cc
new file mode 100644
index 000000000..496126754
--- /dev/null
+++ b/libstdc++-v3/testsuite/tr1/6_containers/unordered_multiset/insert/24061-multiset.cc
@@ -0,0 +1,57 @@
+// 2005-10-08 Paolo Carlini <pcarlini@suse.de>
+//
+// Copyright (C) 2005, 2009 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/>.
+
+// 6.3.4.5 Class template unordered_multiset
+
+#include <tr1/unordered_set>
+#include <string>
+#include <testsuite_hooks.h>
+
+// libstdc++/24061
+void test01()
+{
+ bool test __attribute__((unused)) = true;
+
+ typedef std::tr1::unordered_multiset<std::string> Mset;
+ typedef Mset::iterator iterator;
+ typedef Mset::const_iterator const_iterator;
+
+ Mset ms1;
+
+ iterator it1 = ms1.insert(ms1.begin(), "all the love in the world");
+ VERIFY( ms1.size() == 1 );
+ VERIFY( *it1 == "all the love in the world" );
+
+ const_iterator cit1(it1);
+ const_iterator cit2 = ms1.insert(cit1, "you know what you are?");
+ VERIFY( ms1.size() == 2 );
+ VERIFY( cit2 != cit1 );
+ VERIFY( *cit2 == "you know what you are?" );
+
+ iterator it2 = ms1.insert(it1, "all the love in the world");
+ VERIFY( ms1.size() == 3 );
+ VERIFY( it2 != it1 );
+ VERIFY( *it2 == "all the love in the world" );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/tr1/6_containers/unordered_multiset/insert/multiset_range.cc b/libstdc++-v3/testsuite/tr1/6_containers/unordered_multiset/insert/multiset_range.cc
new file mode 100644
index 000000000..512b4a0bf
--- /dev/null
+++ b/libstdc++-v3/testsuite/tr1/6_containers/unordered_multiset/insert/multiset_range.cc
@@ -0,0 +1,80 @@
+// { dg-do run }
+
+// 2005-2-17 Matt Austern <austern@apple.com>
+//
+// Copyright (C) 2005, 2009 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/>.
+
+// 6.3.4.5 unordered_multiset
+// range insert
+
+#include <string>
+#include <iterator>
+#include <algorithm>
+#include <tr1/unordered_set>
+#include <testsuite_hooks.h>
+
+bool test __attribute__((unused)) = true;
+
+void test01()
+{
+ typedef std::tr1::unordered_multiset<std::string> Set;
+ Set s;
+ VERIFY(s.empty());
+
+ const int N = 10;
+ const std::string A[N] = { "red", "green", "blue", "violet", "cyan",
+ "magenta", "yellow", "orange", "pink", "gray" };
+
+ s.insert(A+0, A+N);
+ VERIFY(s.size() == static_cast<unsigned int>(N));
+ VERIFY(std::distance(s.begin(), s.end()) == N);
+
+ for (int i = 0; i < N; ++i) {
+ std::string str = A[i];
+ Set::iterator it = std::find(s.begin(), s.end(), str);
+ VERIFY(it != s.end());
+ }
+}
+
+void test02()
+{
+ typedef std::tr1::unordered_multiset<int> Set;
+ Set s;
+ VERIFY(s.empty());
+
+ const int N = 8;
+ const int A[N] = { 3, 7, 4, 8, 2, 4, 6, 7 };
+
+ s.insert(A+0, A+N);
+ VERIFY(s.size() == static_cast<unsigned int>(N));
+ VERIFY(std::distance(s.begin(), s.end()) == N);
+
+ VERIFY(std::count(s.begin(), s.end(), 2) == 1);
+ VERIFY(std::count(s.begin(), s.end(), 3) == 1);
+ VERIFY(std::count(s.begin(), s.end(), 4) == 2);
+ VERIFY(std::count(s.begin(), s.end(), 6) == 1);
+ VERIFY(std::count(s.begin(), s.end(), 7) == 2);
+ VERIFY(std::count(s.begin(), s.end(), 8) == 1);
+}
+
+int main()
+{
+ test01();
+ test02();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/tr1/6_containers/unordered_multiset/insert/multiset_single.cc b/libstdc++-v3/testsuite/tr1/6_containers/unordered_multiset/insert/multiset_single.cc
new file mode 100644
index 000000000..aa70459c7
--- /dev/null
+++ b/libstdc++-v3/testsuite/tr1/6_containers/unordered_multiset/insert/multiset_single.cc
@@ -0,0 +1,68 @@
+// { dg-do run }
+
+// 2005-2-17 Matt Austern <austern@apple.com>
+//
+// Copyright (C) 2005, 2009 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/>.
+
+// 6.3.4.5 unordered_multiset
+// Single-element insert
+
+#include <string>
+#include <iterator>
+#include <tr1/unordered_set>
+#include "testsuite_hooks.h"
+
+bool test __attribute__((unused)) = true;
+
+void test01()
+{
+ typedef std::tr1::unordered_multiset<std::string> Set;
+ Set s;
+ VERIFY(s.empty());
+
+ Set::iterator i = s.insert("abcde");
+ VERIFY(s.size() == 1);
+ VERIFY(std::distance(s.begin(), s.end()) == 1);
+ VERIFY(i == s.begin());
+ VERIFY(*i == "abcde");
+}
+
+void test02()
+{
+ typedef std::tr1::unordered_multiset<std::string> Set;
+ Set s;
+ VERIFY(s.empty());
+
+ s.insert("abcde");
+ Set::iterator i = s.insert("abcde");
+ VERIFY(s.size() == 2);
+ VERIFY(std::distance(s.begin(), s.end()) == 2);
+ VERIFY(*i == "abcde");
+
+ Set::iterator i2 = s.begin();
+ ++i2;
+ VERIFY(i == s.begin() || i == i2);
+ VERIFY(*(s.begin()) == "abcde" && *i2 == "abcde");
+}
+
+int main()
+{
+ test01();
+ test02();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/tr1/6_containers/unordered_multiset/requirements/explicit_instantiation.cc b/libstdc++-v3/testsuite/tr1/6_containers/unordered_multiset/requirements/explicit_instantiation.cc
new file mode 100644
index 000000000..cb22c632e
--- /dev/null
+++ b/libstdc++-v3/testsuite/tr1/6_containers/unordered_multiset/requirements/explicit_instantiation.cc
@@ -0,0 +1,36 @@
+// { dg-do compile }
+
+// 2005-02-17 Matt Austern <austern@apple.com>
+//
+// Copyright (C) 2005, 2006, 2007, 2009 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/>.
+
+// 6.3.4.5 unordered_multiset
+
+#include <tr1/unordered_set>
+
+using namespace std::tr1;
+using std::equal_to;
+using std::allocator;
+
+template class unordered_multiset<int>;
+template class unordered_multiset<float, hash<float>, equal_to<float>,
+ allocator<float> >;
+template class unordered_multiset<int, hash<int>, equal_to<int>,
+ allocator<char> >;
+template class __unordered_multiset<float, hash<float>, equal_to<float>,
+ allocator<float>, true>;
diff --git a/libstdc++-v3/testsuite/tr1/6_containers/unordered_multiset/requirements/iterator_neg.cc b/libstdc++-v3/testsuite/tr1/6_containers/unordered_multiset/requirements/iterator_neg.cc
new file mode 100644
index 000000000..f73ca5bbf
--- /dev/null
+++ b/libstdc++-v3/testsuite/tr1/6_containers/unordered_multiset/requirements/iterator_neg.cc
@@ -0,0 +1,36 @@
+// 2005-10-02 Paolo Carlini <pcarlini@suse.de>
+//
+// Copyright (C) 2005, 2009 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/>.
+//
+
+// { dg-do compile }
+
+#include <tr1/unordered_set>
+
+void test01()
+{
+ typedef std::tr1::unordered_multiset<int> Mset;
+
+ Mset ms;
+
+ Mset::const_iterator cit = ms.begin();
+ *cit = 0; // { dg-error "read-only" }
+
+ Mset::const_local_iterator clit = ms.begin(0);
+ *clit = 0; // { dg-error "read-only" }
+}
diff --git a/libstdc++-v3/testsuite/tr1/6_containers/unordered_multiset/requirements/iterator_null_neg.cc b/libstdc++-v3/testsuite/tr1/6_containers/unordered_multiset/requirements/iterator_null_neg.cc
new file mode 100644
index 000000000..2201b2d29
--- /dev/null
+++ b/libstdc++-v3/testsuite/tr1/6_containers/unordered_multiset/requirements/iterator_null_neg.cc
@@ -0,0 +1,28 @@
+// 2005-09-10 Paolo Carlini <pcarlini@suse.de>
+//
+// Copyright (C) 2005, 2009, 2010 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/>.
+//
+
+// { dg-do compile }
+
+// libstdc++/23781
+#include <tr1/unordered_set>
+#include <cstddef>
+
+std::tr1::unordered_multiset<int>::iterator it3 = NULL; // { dg-error "conversion" }
+std::tr1::unordered_multiset<int>::const_iterator cit3 = NULL; // { dg-error "conversion" }
diff --git a/libstdc++-v3/testsuite/tr1/6_containers/unordered_multiset/requirements/typedefs.cc b/libstdc++-v3/testsuite/tr1/6_containers/unordered_multiset/requirements/typedefs.cc
new file mode 100644
index 000000000..36cc16dc3
--- /dev/null
+++ b/libstdc++-v3/testsuite/tr1/6_containers/unordered_multiset/requirements/typedefs.cc
@@ -0,0 +1,45 @@
+// { dg-do compile }
+// 2008-08-27 Paolo Carlini <paolo.carlini@oracle.com>
+
+// Copyright (C) 2008, 2009 Free Software Foundation
+//
+// 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/>.
+
+// 6.3.4.5 unordered_multiset
+
+#include <tr1/unordered_set>
+
+void test01()
+{
+ // Check for required typedefs
+ typedef std::tr1::unordered_multiset<int> test_type;
+
+ typedef test_type::key_type key_type;
+ typedef test_type::value_type value_type;
+ typedef test_type::hasher hasher;
+ typedef test_type::key_equal key_equal;
+ typedef test_type::allocator_type allocator_type;
+ typedef test_type::pointer pointer;
+ typedef test_type::const_pointer const_pointer;
+ typedef test_type::reference reference;
+ typedef test_type::const_reference const_reference;
+ typedef test_type::size_type size_type;
+ typedef test_type::difference_type difference_type;
+ typedef test_type::iterator iterator;
+ typedef test_type::const_iterator const_iterator;
+ typedef test_type::local_iterator local_iterator;
+ typedef test_type::const_local_iterator const_local_iterator;
+}
diff --git a/libstdc++-v3/testsuite/tr1/6_containers/unordered_multiset/swap/1.cc b/libstdc++-v3/testsuite/tr1/6_containers/unordered_multiset/swap/1.cc
new file mode 100644
index 000000000..c164be4ff
--- /dev/null
+++ b/libstdc++-v3/testsuite/tr1/6_containers/unordered_multiset/swap/1.cc
@@ -0,0 +1,153 @@
+// 2005-12-20 Paolo Carlini <pcarlini@suse.de>
+
+// Copyright (C) 2005, 2009 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/>.
+
+// 6.3.4.5 unordered_multiset::swap
+
+#include <tr1/unordered_set>
+#include <set>
+#include <testsuite_hooks.h>
+#include <testsuite_allocator.h>
+
+// uneq_allocator as a non-empty allocator.
+void
+test01()
+{
+ bool test __attribute__((unused)) = true;
+ using namespace std::tr1;
+ using std::equal_to;
+ using std::multiset;
+
+ typedef __gnu_test::uneq_allocator<char> my_alloc;
+ typedef unordered_multiset<char, hash<char>, equal_to<char>, my_alloc>
+ my_umset;
+
+ const char title01[] = "Rivers of sand";
+ const char title02[] = "Concret PH";
+ const char title03[] = "Sonatas and Interludes for Prepared Piano";
+ const char title04[] = "never as tired as when i'm waking up";
+
+ const size_t N1 = sizeof(title01);
+ const size_t N2 = sizeof(title02);
+ const size_t N3 = sizeof(title03);
+ const size_t N4 = sizeof(title04);
+
+ typedef multiset<char> my_mset;
+ const my_mset mset01_ref(title01, title01 + N1);
+ const my_mset mset02_ref(title02, title02 + N2);
+ const my_mset mset03_ref(title03, title03 + N3);
+ const my_mset mset04_ref(title04, title04 + N4);
+
+ my_umset::size_type size01, size02;
+
+ my_alloc alloc01(1);
+
+ my_umset umset01(10, hash<char>(), equal_to<char>(), alloc01);
+ size01 = umset01.size();
+ my_umset umset02(10, hash<char>(), equal_to<char>(), alloc01);
+ size02 = umset02.size();
+
+ umset01.swap(umset02);
+ VERIFY( umset01.size() == size02 );
+ VERIFY( umset01.empty() );
+ VERIFY( umset02.size() == size01 );
+ VERIFY( umset02.empty() );
+
+ my_umset umset03(10, hash<char>(), equal_to<char>(), alloc01);
+ size01 = umset03.size();
+ my_umset umset04(mset02_ref.begin(), mset02_ref.end(), 10, hash<char>(),
+ equal_to<char>(), alloc01);
+ size02 = umset04.size();
+
+ umset03.swap(umset04);
+ VERIFY( umset03.size() == size02 );
+ VERIFY( my_mset(umset03.begin(), umset03.end()) == mset02_ref );
+ VERIFY( umset04.size() == size01 );
+ VERIFY( umset04.empty() );
+
+ my_umset umset05(mset01_ref.begin(), mset01_ref.end(), 10, hash<char>(),
+ equal_to<char>(), alloc01);
+ size01 = umset05.size();
+ my_umset umset06(mset02_ref.begin(), mset02_ref.end(), 10, hash<char>(),
+ equal_to<char>(), alloc01);
+ size02 = umset06.size();
+
+ umset05.swap(umset06);
+ VERIFY( umset05.size() == size02 );
+ VERIFY( my_mset(umset05.begin(), umset05.end()) == mset02_ref );
+ VERIFY( umset06.size() == size01 );
+ VERIFY( my_mset(umset06.begin(), umset06.end()) == mset01_ref );
+
+ my_umset umset07(mset01_ref.begin(), mset01_ref.end(), 10, hash<char>(),
+ equal_to<char>(), alloc01);
+ size01 = umset07.size();
+ my_umset umset08(mset03_ref.begin(), mset03_ref.end(), 10, hash<char>(),
+ equal_to<char>(), alloc01);
+ size02 = umset08.size();
+
+ umset07.swap(umset08);
+ VERIFY( umset07.size() == size02 );
+ VERIFY( my_mset(umset07.begin(), umset07.end()) == mset03_ref );
+ VERIFY( umset08.size() == size01 );
+ VERIFY( my_mset(umset08.begin(), umset08.end()) == mset01_ref );
+
+ my_umset umset09(mset03_ref.begin(), mset03_ref.end(), 10, hash<char>(),
+ equal_to<char>(), alloc01);
+ size01 = umset09.size();
+ my_umset umset10(mset04_ref.begin(), mset04_ref.end(), 10, hash<char>(),
+ equal_to<char>(), alloc01);
+ size02 = umset10.size();
+
+ umset09.swap(umset10);
+ VERIFY( umset09.size() == size02 );
+ VERIFY( my_mset(umset09.begin(), umset09.end()) == mset04_ref );
+ VERIFY( umset10.size() == size01 );
+ VERIFY( my_mset(umset10.begin(), umset10.end()) == mset03_ref );
+
+ my_umset umset11(mset04_ref.begin(), mset04_ref.end(), 10, hash<char>(),
+ equal_to<char>(), alloc01);
+ size01 = umset11.size();
+ my_umset umset12(mset01_ref.begin(), mset01_ref.end(), 10, hash<char>(),
+ equal_to<char>(), alloc01);
+ size02 = umset12.size();
+
+ umset11.swap(umset12);
+ VERIFY( umset11.size() == size02 );
+ VERIFY( my_mset(umset11.begin(), umset11.end()) == mset01_ref );
+ VERIFY( umset12.size() == size01 );
+ VERIFY( my_mset(umset12.begin(), umset12.end()) == mset04_ref );
+
+ my_umset umset13(mset03_ref.begin(), mset03_ref.end(), 10, hash<char>(),
+ equal_to<char>(), alloc01);
+ size01 = umset13.size();
+ my_umset umset14(mset03_ref.begin(), mset03_ref.end(), 10, hash<char>(),
+ equal_to<char>(), alloc01);
+ size02 = umset14.size();
+
+ umset13.swap(umset14);
+ VERIFY( umset13.size() == size02 );
+ VERIFY( my_mset(umset13.begin(), umset13.end()) == mset03_ref );
+ VERIFY( umset14.size() == size01 );
+ VERIFY( my_mset(umset14.begin(), umset14.end()) == mset03_ref );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/tr1/6_containers/unordered_multiset/swap/2.cc b/libstdc++-v3/testsuite/tr1/6_containers/unordered_multiset/swap/2.cc
new file mode 100644
index 000000000..a4328f919
--- /dev/null
+++ b/libstdc++-v3/testsuite/tr1/6_containers/unordered_multiset/swap/2.cc
@@ -0,0 +1,182 @@
+// 2005-12-20 Paolo Carlini <pcarlini@suse.de>
+
+// Copyright (C) 2005, 2009 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/>.
+
+// 6.3.4.5 unordered_multiset::swap
+
+#include <tr1/unordered_set>
+#include <set>
+#include <testsuite_hooks.h>
+#include <testsuite_allocator.h>
+
+// uneq_allocator, two different personalities.
+void
+test01()
+{
+ bool test __attribute__((unused)) = true;
+ using namespace std::tr1;
+ using std::equal_to;
+ using std::multiset;
+
+ typedef __gnu_test::uneq_allocator<char> my_alloc;
+ typedef unordered_multiset<char, hash<char>, equal_to<char>, my_alloc>
+ my_umset;
+
+ const char title01[] = "Rivers of sand";
+ const char title02[] = "Concret PH";
+ const char title03[] = "Sonatas and Interludes for Prepared Piano";
+ const char title04[] = "never as tired as when i'm waking up";
+
+ const size_t N1 = sizeof(title01);
+ const size_t N2 = sizeof(title02);
+ const size_t N3 = sizeof(title03);
+ const size_t N4 = sizeof(title04);
+
+ typedef multiset<char> my_mset;
+ const my_mset mset01_ref(title01, title01 + N1);
+ const my_mset mset02_ref(title02, title02 + N2);
+ const my_mset mset03_ref(title03, title03 + N3);
+ const my_mset mset04_ref(title04, title04 + N4);
+
+ my_umset::size_type size01, size02;
+
+ my_alloc alloc01(1), alloc02(2);
+ int personality01, personality02;
+
+ my_umset umset01(10, hash<char>(), equal_to<char>(), alloc01);
+ size01 = umset01.size();
+ personality01 = umset01.get_allocator().get_personality();
+ my_umset umset02(10, hash<char>(), equal_to<char>(), alloc02);
+ size02 = umset02.size();
+ personality02 = umset02.get_allocator().get_personality();
+
+ umset01.swap(umset02);
+ VERIFY( umset01.size() == size02 );
+ VERIFY( umset01.empty() );
+ VERIFY( umset02.size() == size01 );
+ VERIFY( umset02.empty() );
+ VERIFY( umset01.get_allocator().get_personality() == personality02 );
+ VERIFY( umset02.get_allocator().get_personality() == personality01 );
+
+ my_umset umset03(10, hash<char>(), equal_to<char>(), alloc02);
+ size01 = umset03.size();
+ personality01 = umset03.get_allocator().get_personality();
+ my_umset umset04(mset02_ref.begin(), mset02_ref.end(), 10, hash<char>(),
+ equal_to<char>(), alloc01);
+ size02 = umset04.size();
+ personality02 = umset04.get_allocator().get_personality();
+
+ umset03.swap(umset04);
+ VERIFY( umset03.size() == size02 );
+ VERIFY( my_mset(umset03.begin(), umset03.end()) == mset02_ref );
+ VERIFY( umset04.size() == size01 );
+ VERIFY( umset04.empty() );
+ VERIFY( umset03.get_allocator().get_personality() == personality02 );
+ VERIFY( umset04.get_allocator().get_personality() == personality01 );
+
+ my_umset umset05(mset01_ref.begin(), mset01_ref.end(), 10, hash<char>(),
+ equal_to<char>(), alloc01);
+ size01 = umset05.size();
+ personality01 = umset05.get_allocator().get_personality();
+ my_umset umset06(mset02_ref.begin(), mset02_ref.end(), 10, hash<char>(),
+ equal_to<char>(), alloc02);
+ size02 = umset06.size();
+ personality02 = umset06.get_allocator().get_personality();
+
+ umset05.swap(umset06);
+ VERIFY( umset05.size() == size02 );
+ VERIFY( my_mset(umset05.begin(), umset05.end()) == mset02_ref );
+ VERIFY( umset06.size() == size01 );
+ VERIFY( my_mset(umset06.begin(), umset06.end()) == mset01_ref );
+ VERIFY( umset05.get_allocator().get_personality() == personality02 );
+ VERIFY( umset06.get_allocator().get_personality() == personality01 );
+
+ my_umset umset07(mset01_ref.begin(), mset01_ref.end(), 10, hash<char>(),
+ equal_to<char>(), alloc02);
+ size01 = umset07.size();
+ personality01 = umset07.get_allocator().get_personality();
+ my_umset umset08(mset03_ref.begin(), mset03_ref.end(), 10, hash<char>(),
+ equal_to<char>(), alloc01);
+ size02 = umset08.size();
+ personality02 = umset08.get_allocator().get_personality();
+
+ umset07.swap(umset08);
+ VERIFY( umset07.size() == size02 );
+ VERIFY( my_mset(umset07.begin(), umset07.end()) == mset03_ref );
+ VERIFY( umset08.size() == size01 );
+ VERIFY( my_mset(umset08.begin(), umset08.end()) == mset01_ref );
+ VERIFY( umset07.get_allocator().get_personality() == personality02 );
+ VERIFY( umset08.get_allocator().get_personality() == personality01 );
+
+ my_umset umset09(mset03_ref.begin(), mset03_ref.end(), 10, hash<char>(),
+ equal_to<char>(), alloc01);
+ size01 = umset09.size();
+ personality01 = umset09.get_allocator().get_personality();
+ my_umset umset10(mset04_ref.begin(), mset04_ref.end(), 10, hash<char>(),
+ equal_to<char>(), alloc02);
+ size02 = umset10.size();
+ personality02 = umset10.get_allocator().get_personality();
+
+ umset09.swap(umset10);
+ VERIFY( umset09.size() == size02 );
+ VERIFY( my_mset(umset09.begin(), umset09.end()) == mset04_ref );
+ VERIFY( umset10.size() == size01 );
+ VERIFY( my_mset(umset10.begin(), umset10.end()) == mset03_ref );
+ VERIFY( umset09.get_allocator().get_personality() == personality02 );
+ VERIFY( umset10.get_allocator().get_personality() == personality01 );
+
+ my_umset umset11(mset04_ref.begin(), mset04_ref.end(), 10, hash<char>(),
+ equal_to<char>(), alloc02);
+ size01 = umset11.size();
+ personality01 = umset11.get_allocator().get_personality();
+ my_umset umset12(mset01_ref.begin(), mset01_ref.end(), 10, hash<char>(),
+ equal_to<char>(), alloc01);
+ size02 = umset12.size();
+ personality02 = umset12.get_allocator().get_personality();
+
+ umset11.swap(umset12);
+ VERIFY( umset11.size() == size02 );
+ VERIFY( my_mset(umset11.begin(), umset11.end()) == mset01_ref );
+ VERIFY( umset12.size() == size01 );
+ VERIFY( my_mset(umset12.begin(), umset12.end()) == mset04_ref );
+ VERIFY( umset11.get_allocator().get_personality() == personality02 );
+ VERIFY( umset12.get_allocator().get_personality() == personality01 );
+
+ my_umset umset13(mset03_ref.begin(), mset03_ref.end(), 10, hash<char>(),
+ equal_to<char>(), alloc01);
+ size01 = umset13.size();
+ personality01 = umset13.get_allocator().get_personality();
+ my_umset umset14(mset03_ref.begin(), mset03_ref.end(), 10, hash<char>(),
+ equal_to<char>(), alloc02);
+ size02 = umset14.size();
+ personality02 = umset14.get_allocator().get_personality();
+
+ umset13.swap(umset14);
+ VERIFY( umset13.size() == size02 );
+ VERIFY( my_mset(umset13.begin(), umset13.end()) == mset03_ref );
+ VERIFY( umset14.size() == size01 );
+ VERIFY( my_mset(umset14.begin(), umset14.end()) == mset03_ref );
+ VERIFY( umset13.get_allocator().get_personality() == personality02 );
+ VERIFY( umset14.get_allocator().get_personality() == personality01 );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}