summaryrefslogtreecommitdiff
path: root/libstdc++-v3/testsuite/tr1/6_containers
diff options
context:
space:
mode:
Diffstat (limited to 'libstdc++-v3/testsuite/tr1/6_containers')
-rw-r--r--libstdc++-v3/testsuite/tr1/6_containers/array/capacity/empty.cc53
-rw-r--r--libstdc++-v3/testsuite/tr1/6_containers/array/capacity/max_size.cc52
-rw-r--r--libstdc++-v3/testsuite/tr1/6_containers/array/capacity/size.cc53
-rw-r--r--libstdc++-v3/testsuite/tr1/6_containers/array/comparison_operators/equal.cc45
-rw-r--r--libstdc++-v3/testsuite/tr1/6_containers/array/comparison_operators/greater.cc45
-rw-r--r--libstdc++-v3/testsuite/tr1/6_containers/array/comparison_operators/greater_or_equal.cc45
-rw-r--r--libstdc++-v3/testsuite/tr1/6_containers/array/comparison_operators/less.cc45
-rw-r--r--libstdc++-v3/testsuite/tr1/6_containers/array/comparison_operators/less_or_equal.cc45
-rw-r--r--libstdc++-v3/testsuite/tr1/6_containers/array/comparison_operators/not_equal.cc45
-rw-r--r--libstdc++-v3/testsuite/tr1/6_containers/array/cons/aggregate_initialization.cc43
-rw-r--r--libstdc++-v3/testsuite/tr1/6_containers/array/element_access/at_out_of_range.cc56
-rw-r--r--libstdc++-v3/testsuite/tr1/6_containers/array/element_access/back.cc50
-rw-r--r--libstdc++-v3/testsuite/tr1/6_containers/array/element_access/data.cc50
-rw-r--r--libstdc++-v3/testsuite/tr1/6_containers/array/element_access/front.cc50
-rw-r--r--libstdc++-v3/testsuite/tr1/6_containers/array/iterators/end_is_one_past.cc46
-rw-r--r--libstdc++-v3/testsuite/tr1/6_containers/array/requirements/assign.cc46
-rw-r--r--libstdc++-v3/testsuite/tr1/6_containers/array/requirements/contiguous.cc46
-rw-r--r--libstdc++-v3/testsuite/tr1/6_containers/array/requirements/explicit_instantiation.cc27
-rw-r--r--libstdc++-v3/testsuite/tr1/6_containers/array/requirements/member_swap.cc48
-rw-r--r--libstdc++-v3/testsuite/tr1/6_containers/array/requirements/typedefs.cc40
-rw-r--r--libstdc++-v3/testsuite/tr1/6_containers/array/requirements/zero_sized_arrays.cc61
-rw-r--r--libstdc++-v3/testsuite/tr1/6_containers/array/specialized_algorithms/swap.cc48
-rw-r--r--libstdc++-v3/testsuite/tr1/6_containers/array/tuple_interface/get.cc51
-rw-r--r--libstdc++-v3/testsuite/tr1/6_containers/array/tuple_interface/tuple_element.cc51
-rw-r--r--libstdc++-v3/testsuite/tr1/6_containers/array/tuple_interface/tuple_size.cc48
-rw-r--r--libstdc++-v3/testsuite/tr1/6_containers/hash/24799.cc73
-rw-r--r--libstdc++-v3/testsuite/tr1/6_containers/hash/operators/size_t.cc75
-rw-r--r--libstdc++-v3/testsuite/tr1/6_containers/hash/requirements/base_classes.cc32
-rw-r--r--libstdc++-v3/testsuite/tr1/6_containers/hash/requirements/explicit_instantiation.cc50
-rw-r--r--libstdc++-v3/testsuite/tr1/6_containers/headers/array/synopsis.cc51
-rw-r--r--libstdc++-v3/testsuite/tr1/6_containers/headers/functional/synopsis.cc32
-rw-r--r--libstdc++-v3/testsuite/tr1/6_containers/headers/tuple/synopsis.cc70
-rw-r--r--libstdc++-v3/testsuite/tr1/6_containers/headers/tuple/types_std_tr1.cc25
-rw-r--r--libstdc++-v3/testsuite/tr1/6_containers/headers/unordered_map/synopsis.cc52
-rw-r--r--libstdc++-v3/testsuite/tr1/6_containers/headers/unordered_set/synopsis.cc51
-rw-r--r--libstdc++-v3/testsuite/tr1/6_containers/tuple/comparison_operators/35480_neg.cc32
-rw-r--r--libstdc++-v3/testsuite/tr1/6_containers/tuple/comparison_operators/comparisons.cc50
-rw-r--r--libstdc++-v3/testsuite/tr1/6_containers/tuple/cons/assignment.cc53
-rw-r--r--libstdc++-v3/testsuite/tr1/6_containers/tuple/cons/big_tuples.cc108
-rw-r--r--libstdc++-v3/testsuite/tr1/6_containers/tuple/cons/constructor.cc67
-rw-r--r--libstdc++-v3/testsuite/tr1/6_containers/tuple/creation_functions/23978.cc46
-rw-r--r--libstdc++-v3/testsuite/tr1/6_containers/tuple/creation_functions/make_tuple.cc38
-rw-r--r--libstdc++-v3/testsuite/tr1/6_containers/tuple/creation_functions/tie.cc43
-rw-r--r--libstdc++-v3/testsuite/tr1/6_containers/tuple/creation_functions/tie2.cc36
-rw-r--r--libstdc++-v3/testsuite/tr1/6_containers/tuple/element_access/get.cc45
-rw-r--r--libstdc++-v3/testsuite/tr1/6_containers/tuple/requirements/explicit_instantiation.cc25
-rw-r--r--libstdc++-v3/testsuite/tr1/6_containers/tuple/tuple_element.cc39
-rw-r--r--libstdc++-v3/testsuite/tr1/6_containers/tuple/tuple_size.cc39
-rw-r--r--libstdc++-v3/testsuite/tr1/6_containers/unordered_map/24064.cc47
-rw-r--r--libstdc++-v3/testsuite/tr1/6_containers/unordered_map/capacity/29134-map.cc38
-rw-r--r--libstdc++-v3/testsuite/tr1/6_containers/unordered_map/erase/1.cc130
-rw-r--r--libstdc++-v3/testsuite/tr1/6_containers/unordered_map/erase/24061-map.cc105
-rw-r--r--libstdc++-v3/testsuite/tr1/6_containers/unordered_map/find/map1.cc70
-rw-r--r--libstdc++-v3/testsuite/tr1/6_containers/unordered_map/insert/24061-map.cc60
-rw-r--r--libstdc++-v3/testsuite/tr1/6_containers/unordered_map/insert/array_syntax.cc60
-rw-r--r--libstdc++-v3/testsuite/tr1/6_containers/unordered_map/insert/map_range.cc98
-rw-r--r--libstdc++-v3/testsuite/tr1/6_containers/unordered_map/insert/map_single.cc73
-rw-r--r--libstdc++-v3/testsuite/tr1/6_containers/unordered_map/requirements/explicit_instantiation.cc42
-rw-r--r--libstdc++-v3/testsuite/tr1/6_containers/unordered_map/requirements/iterator_neg.cc40
-rw-r--r--libstdc++-v3/testsuite/tr1/6_containers/unordered_map/requirements/iterator_null_neg.cc28
-rw-r--r--libstdc++-v3/testsuite/tr1/6_containers/unordered_map/requirements/typedefs.cc46
-rw-r--r--libstdc++-v3/testsuite/tr1/6_containers/unordered_map/swap/1.cc163
-rw-r--r--libstdc++-v3/testsuite/tr1/6_containers/unordered_map/swap/2.cc192
-rw-r--r--libstdc++-v3/testsuite/tr1/6_containers/unordered_multimap/capacity/29134-multimap.cc38
-rw-r--r--libstdc++-v3/testsuite/tr1/6_containers/unordered_multimap/erase/1.cc130
-rw-r--r--libstdc++-v3/testsuite/tr1/6_containers/unordered_multimap/erase/24061-multimap.cc108
-rw-r--r--libstdc++-v3/testsuite/tr1/6_containers/unordered_multimap/find/multimap1.cc84
-rw-r--r--libstdc++-v3/testsuite/tr1/6_containers/unordered_multimap/insert/24061-multimap.cc60
-rw-r--r--libstdc++-v3/testsuite/tr1/6_containers/unordered_multimap/insert/multimap_range.cc92
-rw-r--r--libstdc++-v3/testsuite/tr1/6_containers/unordered_multimap/insert/multimap_single.cc77
-rw-r--r--libstdc++-v3/testsuite/tr1/6_containers/unordered_multimap/requirements/explicit_instantiation.cc42
-rw-r--r--libstdc++-v3/testsuite/tr1/6_containers/unordered_multimap/requirements/iterator_neg.cc40
-rw-r--r--libstdc++-v3/testsuite/tr1/6_containers/unordered_multimap/requirements/iterator_null_neg.cc28
-rw-r--r--libstdc++-v3/testsuite/tr1/6_containers/unordered_multimap/requirements/typedefs.cc46
-rw-r--r--libstdc++-v3/testsuite/tr1/6_containers/unordered_multimap/swap/1.cc177
-rw-r--r--libstdc++-v3/testsuite/tr1/6_containers/unordered_multimap/swap/2.cc206
-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
-rw-r--r--libstdc++-v3/testsuite/tr1/6_containers/unordered_set/23053.cc38
-rw-r--r--libstdc++-v3/testsuite/tr1/6_containers/unordered_set/23465.cc63
-rw-r--r--libstdc++-v3/testsuite/tr1/6_containers/unordered_set/26127.cc38
-rw-r--r--libstdc++-v3/testsuite/tr1/6_containers/unordered_set/26132.cc57
-rw-r--r--libstdc++-v3/testsuite/tr1/6_containers/unordered_set/capacity/29134-set.cc38
-rw-r--r--libstdc++-v3/testsuite/tr1/6_containers/unordered_set/erase/1.cc129
-rw-r--r--libstdc++-v3/testsuite/tr1/6_containers/unordered_set/erase/24061-set.cc104
-rw-r--r--libstdc++-v3/testsuite/tr1/6_containers/unordered_set/find/set1.cc65
-rw-r--r--libstdc++-v3/testsuite/tr1/6_containers/unordered_set/insert/24061-set.cc57
-rw-r--r--libstdc++-v3/testsuite/tr1/6_containers/unordered_set/insert/set_range.cc80
-rw-r--r--libstdc++-v3/testsuite/tr1/6_containers/unordered_set/insert/set_single.cc66
-rw-r--r--libstdc++-v3/testsuite/tr1/6_containers/unordered_set/requirements/explicit_instantiation.cc36
-rw-r--r--libstdc++-v3/testsuite/tr1/6_containers/unordered_set/requirements/iterator_neg.cc36
-rw-r--r--libstdc++-v3/testsuite/tr1/6_containers/unordered_set/requirements/iterator_null_neg.cc28
-rw-r--r--libstdc++-v3/testsuite/tr1/6_containers/unordered_set/requirements/iterators_default_constructor.cc31
-rw-r--r--libstdc++-v3/testsuite/tr1/6_containers/unordered_set/requirements/typedefs.cc45
-rw-r--r--libstdc++-v3/testsuite/tr1/6_containers/unordered_set/swap/1.cc152
-rw-r--r--libstdc++-v3/testsuite/tr1/6_containers/unordered_set/swap/2.cc181
-rw-r--r--libstdc++-v3/testsuite/tr1/6_containers/utility/19535.cc41
-rw-r--r--libstdc++-v3/testsuite/tr1/6_containers/utility/pair.cc55
110 files changed, 7058 insertions, 0 deletions
diff --git a/libstdc++-v3/testsuite/tr1/6_containers/array/capacity/empty.cc b/libstdc++-v3/testsuite/tr1/6_containers/array/capacity/empty.cc
new file mode 100644
index 000000000..24a561916
--- /dev/null
+++ b/libstdc++-v3/testsuite/tr1/6_containers/array/capacity/empty.cc
@@ -0,0 +1,53 @@
+// 2004-10-20 Benjamin Kosnik <bkoz@redhat.com>
+//
+// Copyright (C) 2004, 2005, 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.2.2 Class template array
+
+#include <tr1/array>
+#include <testsuite_hooks.h>
+
+void
+test01()
+{
+ {
+ const size_t len = 5;
+ typedef std::tr1::array<int, len> array_type;
+ bool test __attribute__((unused)) = true;
+ array_type a = { { 0, 1, 2, 3, 4 } };
+
+ VERIFY( a.empty() == false );
+ }
+
+ {
+ const size_t len = 0;
+ typedef std::tr1::array<int, len> array_type;
+ bool test __attribute__((unused)) = true;
+ array_type a;
+
+ VERIFY( a.empty() == true );
+ }
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
+
diff --git a/libstdc++-v3/testsuite/tr1/6_containers/array/capacity/max_size.cc b/libstdc++-v3/testsuite/tr1/6_containers/array/capacity/max_size.cc
new file mode 100644
index 000000000..d5321192c
--- /dev/null
+++ b/libstdc++-v3/testsuite/tr1/6_containers/array/capacity/max_size.cc
@@ -0,0 +1,52 @@
+// 2004-10-20 Benjamin Kosnik <bkoz@redhat.com>
+//
+// Copyright (C) 2004, 2005, 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.2.2 Class template array
+
+#include <tr1/array>
+#include <testsuite_hooks.h>
+
+void
+test01()
+{
+ {
+ const size_t len = 5;
+ typedef std::tr1::array<int, len> array_type;
+ bool test __attribute__((unused)) = true;
+ array_type a = { { 0, 1, 2, 3, 4 } };
+
+ VERIFY( a.max_size() == len );
+ }
+
+ {
+ const size_t len = 0;
+ typedef std::tr1::array<int, len> array_type;
+ bool test __attribute__((unused)) = true;
+ array_type a;
+
+ VERIFY( a.max_size() == len );
+ }
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/tr1/6_containers/array/capacity/size.cc b/libstdc++-v3/testsuite/tr1/6_containers/array/capacity/size.cc
new file mode 100644
index 000000000..3c7d29278
--- /dev/null
+++ b/libstdc++-v3/testsuite/tr1/6_containers/array/capacity/size.cc
@@ -0,0 +1,53 @@
+// 2004-10-20 Benjamin Kosnik <bkoz@redhat.com>
+//
+// Copyright (C) 2004, 2005, 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.2.2 Class template array
+
+#include <tr1/array>
+#include <testsuite_hooks.h>
+
+void
+test01()
+{
+ {
+ const size_t len = 5;
+ typedef std::tr1::array<int, len> array_type;
+ bool test __attribute__((unused)) = true;
+ array_type a = { { 0, 1, 2, 3, 4 } };
+
+ VERIFY( a.size() == len );
+ }
+
+ {
+ const size_t len = 0;
+ typedef std::tr1::array<int, len> array_type;
+ bool test __attribute__((unused)) = true;
+ array_type a;
+
+ VERIFY( a.size() == len );
+ }
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
+
diff --git a/libstdc++-v3/testsuite/tr1/6_containers/array/comparison_operators/equal.cc b/libstdc++-v3/testsuite/tr1/6_containers/array/comparison_operators/equal.cc
new file mode 100644
index 000000000..7e9ac4acd
--- /dev/null
+++ b/libstdc++-v3/testsuite/tr1/6_containers/array/comparison_operators/equal.cc
@@ -0,0 +1,45 @@
+// 2004-10-20 Benjamin Kosnik <bkoz@redhat.com>
+//
+// Copyright (C) 2004, 2005, 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.2.2 Class template array
+
+#include <tr1/array>
+#include <testsuite_hooks.h>
+
+void
+test01()
+{
+ const size_t len = 5;
+ typedef std::tr1::array<int, len> array_type;
+ bool test __attribute__((unused)) = true;
+ array_type a = { { 0, 1, 2, 3, 4 } };
+ array_type b = { { 0, 1, 2, 3, 4 } };
+ array_type c = { { 0, 1, 2, 3 } };
+
+ VERIFY( a == b );
+ VERIFY( !(a == c) );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
+
diff --git a/libstdc++-v3/testsuite/tr1/6_containers/array/comparison_operators/greater.cc b/libstdc++-v3/testsuite/tr1/6_containers/array/comparison_operators/greater.cc
new file mode 100644
index 000000000..bbe02d6ad
--- /dev/null
+++ b/libstdc++-v3/testsuite/tr1/6_containers/array/comparison_operators/greater.cc
@@ -0,0 +1,45 @@
+// 2004-10-20 Benjamin Kosnik <bkoz@redhat.com>
+//
+// Copyright (C) 2004, 2005, 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.2.2 Class template array
+
+#include <tr1/array>
+#include <testsuite_hooks.h>
+
+void
+test01()
+{
+ const size_t len = 5;
+ typedef std::tr1::array<int, len> array_type;
+ bool test __attribute__((unused)) = true;
+ array_type a = { { 0, 1, 2, 3, 4 } };
+ array_type b = { { 0, 1, 2, 3, 4 } };
+ array_type c = { { 0, 1, 2, 3, 7 } };
+
+ VERIFY( !(a > b) );
+ VERIFY( c > a );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
+
diff --git a/libstdc++-v3/testsuite/tr1/6_containers/array/comparison_operators/greater_or_equal.cc b/libstdc++-v3/testsuite/tr1/6_containers/array/comparison_operators/greater_or_equal.cc
new file mode 100644
index 000000000..0f5fb250a
--- /dev/null
+++ b/libstdc++-v3/testsuite/tr1/6_containers/array/comparison_operators/greater_or_equal.cc
@@ -0,0 +1,45 @@
+// 2004-10-20 Benjamin Kosnik <bkoz@redhat.com>
+//
+// Copyright (C) 2004, 2005, 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.2.2 Class template array
+
+#include <tr1/array>
+#include <testsuite_hooks.h>
+
+void
+test01()
+{
+ const size_t len = 5;
+ typedef std::tr1::array<int, len> array_type;
+ bool test __attribute__((unused)) = true;
+ array_type a = { { 0, 1, 2, 3, 4 } };
+ array_type b = { { 0, 1, 2, 3, 4 } };
+ array_type c = { { 0, 1, 2, 3, 7 } };
+
+ VERIFY( a >= b );
+ VERIFY( c >= a );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
+
diff --git a/libstdc++-v3/testsuite/tr1/6_containers/array/comparison_operators/less.cc b/libstdc++-v3/testsuite/tr1/6_containers/array/comparison_operators/less.cc
new file mode 100644
index 000000000..8db6ec6ad
--- /dev/null
+++ b/libstdc++-v3/testsuite/tr1/6_containers/array/comparison_operators/less.cc
@@ -0,0 +1,45 @@
+// 2004-10-20 Benjamin Kosnik <bkoz@redhat.com>
+//
+// Copyright (C) 2004, 2005, 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.2.2 Class template array
+
+#include <tr1/array>
+#include <testsuite_hooks.h>
+
+void
+test01()
+{
+ const size_t len = 5;
+ typedef std::tr1::array<int, len> array_type;
+ bool test __attribute__((unused)) = true;
+ array_type a = { { 0, 1, 2, 3, 4 } };
+ array_type b = { { 0, 1, 2, 3, 4 } };
+ array_type c = { { 0, 1, 2, 3, 7 } };
+
+ VERIFY( !(a < b) );
+ VERIFY( a < c );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
+
diff --git a/libstdc++-v3/testsuite/tr1/6_containers/array/comparison_operators/less_or_equal.cc b/libstdc++-v3/testsuite/tr1/6_containers/array/comparison_operators/less_or_equal.cc
new file mode 100644
index 000000000..8ff18b300
--- /dev/null
+++ b/libstdc++-v3/testsuite/tr1/6_containers/array/comparison_operators/less_or_equal.cc
@@ -0,0 +1,45 @@
+// 2004-10-20 Benjamin Kosnik <bkoz@redhat.com>
+//
+// Copyright (C) 2004, 2005, 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.2.2 Class template array
+
+#include <tr1/array>
+#include <testsuite_hooks.h>
+
+void
+test01()
+{
+ const size_t len = 5;
+ typedef std::tr1::array<int, len> array_type;
+ bool test __attribute__((unused)) = true;
+ array_type a = { { 0, 1, 2, 3, 4 } };
+ array_type b = { { 0, 1, 2, 3, 4 } };
+ array_type c = { { 0, 1, 2, 3, 7 } };
+
+ VERIFY( a <= b );
+ VERIFY( a <= c );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
+
diff --git a/libstdc++-v3/testsuite/tr1/6_containers/array/comparison_operators/not_equal.cc b/libstdc++-v3/testsuite/tr1/6_containers/array/comparison_operators/not_equal.cc
new file mode 100644
index 000000000..957c05ebc
--- /dev/null
+++ b/libstdc++-v3/testsuite/tr1/6_containers/array/comparison_operators/not_equal.cc
@@ -0,0 +1,45 @@
+// 2004-10-20 Benjamin Kosnik <bkoz@redhat.com>
+//
+// Copyright (C) 2004, 2005, 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.2.2 Class template array
+
+#include <tr1/array>
+#include <testsuite_hooks.h>
+
+void
+test01()
+{
+ const size_t len = 5;
+ typedef std::tr1::array<int, len> array_type;
+ bool test __attribute__((unused)) = true;
+ array_type a = { { 0, 1, 2, 3, 4 } };
+ array_type b = { { 0, 1, 2, 3, 4 } };
+ array_type c = { { 0, 1, 2, 3 } };
+
+ VERIFY( !(a != b) );
+ VERIFY( a != c );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
+
diff --git a/libstdc++-v3/testsuite/tr1/6_containers/array/cons/aggregate_initialization.cc b/libstdc++-v3/testsuite/tr1/6_containers/array/cons/aggregate_initialization.cc
new file mode 100644
index 000000000..78085f940
--- /dev/null
+++ b/libstdc++-v3/testsuite/tr1/6_containers/array/cons/aggregate_initialization.cc
@@ -0,0 +1,43 @@
+// { dg-do compile }
+
+// 2004-10-20 Benjamin Kosnik <bkoz@redhat.com>
+//
+// Copyright (C) 2004, 2005, 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.2.2 Class template array
+
+#include <tr1/array>
+
+void
+test01()
+{
+ typedef std::tr1::array<int, 5> array_type;
+
+ array_type a = { { 0, 1, 2, 3, 4 } };
+ array_type b = { { 0, 1, 2, 3 } };
+
+ a = b;
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
+
diff --git a/libstdc++-v3/testsuite/tr1/6_containers/array/element_access/at_out_of_range.cc b/libstdc++-v3/testsuite/tr1/6_containers/array/element_access/at_out_of_range.cc
new file mode 100644
index 000000000..4a53a6d99
--- /dev/null
+++ b/libstdc++-v3/testsuite/tr1/6_containers/array/element_access/at_out_of_range.cc
@@ -0,0 +1,56 @@
+// 2004-10-20 Benjamin Kosnik <bkoz@redhat.com>
+//
+// Copyright (C) 2004, 2005, 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.2.2 Class template array
+
+#include <tr1/array>
+#include <stdexcept>
+#include <testsuite_hooks.h>
+
+void
+test01()
+{
+ const size_t len = 5;
+ typedef std::tr1::array<int, len> array_type;
+ bool test __attribute__((unused)) = true;
+ array_type a = { { 0, 1, 2, 3, 4 } };
+
+ try
+ {
+ a.at(len);
+ VERIFY( false );
+ }
+ catch(std::out_of_range& obj)
+ {
+ // Expected.
+ VERIFY( true );
+ }
+ catch(...)
+ {
+ // Failed.
+ VERIFY( false );
+ }
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/tr1/6_containers/array/element_access/back.cc b/libstdc++-v3/testsuite/tr1/6_containers/array/element_access/back.cc
new file mode 100644
index 000000000..3c0ea2490
--- /dev/null
+++ b/libstdc++-v3/testsuite/tr1/6_containers/array/element_access/back.cc
@@ -0,0 +1,50 @@
+// 2005-08-26 Paolo Carlini <pcarlini@suse.de>
+//
+// Copyright (C) 2005, 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.2.2 Class template array
+
+#include <tr1/array>
+#include <testsuite_hooks.h>
+
+void
+test01()
+{
+ bool test __attribute__((unused)) = true;
+
+ const size_t len = 5;
+ typedef std::tr1::array<int, len> array_type;
+
+ {
+ array_type a = { { 0, 1, 2, 3, 4 } };
+ int& ri = a.back();
+ VERIFY( ri == 4 );
+ }
+
+ {
+ const array_type ca = { { 4, 3, 2, 1, 0 } };
+ const int& cri = ca.back();
+ VERIFY( cri == 0 );
+ }
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/tr1/6_containers/array/element_access/data.cc b/libstdc++-v3/testsuite/tr1/6_containers/array/element_access/data.cc
new file mode 100644
index 000000000..80f27e7fc
--- /dev/null
+++ b/libstdc++-v3/testsuite/tr1/6_containers/array/element_access/data.cc
@@ -0,0 +1,50 @@
+// 2005-08-26 Paolo Carlini <pcarlini@suse.de>
+//
+// Copyright (C) 2005, 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.2.2 Class template array
+
+#include <tr1/array>
+#include <testsuite_hooks.h>
+
+void
+test01()
+{
+ bool test __attribute__((unused)) = true;
+
+ const size_t len = 5;
+ typedef std::tr1::array<int, len> array_type;
+
+ {
+ array_type a = { { 0, 1, 2, 3, 4 } };
+ int* pi = a.data();
+ VERIFY( *pi == 0 );
+ }
+
+ {
+ const array_type ca = { { 4, 3, 2, 1, 0 } };
+ const int* pci = ca.data();
+ VERIFY( *pci == 4 );
+ }
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/tr1/6_containers/array/element_access/front.cc b/libstdc++-v3/testsuite/tr1/6_containers/array/element_access/front.cc
new file mode 100644
index 000000000..e7eb139ed
--- /dev/null
+++ b/libstdc++-v3/testsuite/tr1/6_containers/array/element_access/front.cc
@@ -0,0 +1,50 @@
+// 2005-08-26 Paolo Carlini <pcarlini@suse.de>
+//
+// Copyright (C) 2005, 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.2.2 Class template array
+
+#include <tr1/array>
+#include <testsuite_hooks.h>
+
+void
+test01()
+{
+ bool test __attribute__((unused)) = true;
+
+ const size_t len = 5;
+ typedef std::tr1::array<int, len> array_type;
+
+ {
+ array_type a = { { 0, 1, 2, 3, 4 } };
+ int& ri = a.front();
+ VERIFY( ri == 0 );
+ }
+
+ {
+ const array_type ca = { { 4, 3, 2, 1, 0 } };
+ const int& cri = ca.front();
+ VERIFY( cri == 4 );
+ }
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/tr1/6_containers/array/iterators/end_is_one_past.cc b/libstdc++-v3/testsuite/tr1/6_containers/array/iterators/end_is_one_past.cc
new file mode 100644
index 000000000..92ff761db
--- /dev/null
+++ b/libstdc++-v3/testsuite/tr1/6_containers/array/iterators/end_is_one_past.cc
@@ -0,0 +1,46 @@
+// 2004-10-20 Benjamin Kosnik <bkoz@redhat.com>
+//
+// Copyright (C) 2004, 2005, 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.2.2 Class template array
+
+#include <tr1/array>
+#include <stdexcept>
+#include <testsuite_hooks.h>
+
+void
+test01()
+{
+ const size_t len = 5;
+ typedef std::tr1::array<int, len> array_type;
+ bool test __attribute__((unused)) = true;
+ array_type a = { { 0, 1, 2, 3, 4 } };
+
+ array_type::iterator b = a.begin();
+ array_type::iterator e = a.end();
+
+ VERIFY( e != (b + a.size() - 1));
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
+
diff --git a/libstdc++-v3/testsuite/tr1/6_containers/array/requirements/assign.cc b/libstdc++-v3/testsuite/tr1/6_containers/array/requirements/assign.cc
new file mode 100644
index 000000000..5925cc796
--- /dev/null
+++ b/libstdc++-v3/testsuite/tr1/6_containers/array/requirements/assign.cc
@@ -0,0 +1,46 @@
+// 2006-02-24 Paolo Carlini <pcarlini@suse.de>
+//
+// 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.2.2 Class template array
+
+#include <tr1/array>
+#include <testsuite_hooks.h>
+
+void
+test01()
+{
+ bool test __attribute__((unused)) = true;
+
+ const size_t len = 3;
+ typedef std::tr1::array<int, len> array_type;
+
+ array_type a = { { 0, 1, 2 } };
+ const int value = 5;
+
+ a.assign(value);
+ VERIFY( a[0] == value );
+ VERIFY( a[1] == value );
+ VERIFY( a[2] == value );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/tr1/6_containers/array/requirements/contiguous.cc b/libstdc++-v3/testsuite/tr1/6_containers/array/requirements/contiguous.cc
new file mode 100644
index 000000000..e22b96cbe
--- /dev/null
+++ b/libstdc++-v3/testsuite/tr1/6_containers/array/requirements/contiguous.cc
@@ -0,0 +1,46 @@
+// 2004-10-20 Benjamin Kosnik <bkoz@redhat.com>
+//
+// Copyright (C) 2004, 2005, 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.2.2 Class template array
+
+#include <tr1/array>
+#include <testsuite_hooks.h>
+
+void
+test01()
+{
+ const size_t len = 5;
+ typedef std::tr1::array<int, len> array_type;
+ bool test __attribute__((unused)) = true;
+ array_type a = { { 0, 1, 2, 3, 4 } };
+
+ // &a[n] == &a[0] + n for all 0 <= n < N.
+ for (size_t i = 0; i < len; ++i)
+ {
+ VERIFY( &a[i] == &a[0] + i );
+ }
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
+
diff --git a/libstdc++-v3/testsuite/tr1/6_containers/array/requirements/explicit_instantiation.cc b/libstdc++-v3/testsuite/tr1/6_containers/array/requirements/explicit_instantiation.cc
new file mode 100644
index 000000000..0074de7cb
--- /dev/null
+++ b/libstdc++-v3/testsuite/tr1/6_containers/array/requirements/explicit_instantiation.cc
@@ -0,0 +1,27 @@
+// { dg-do compile }
+
+// 2004-10-20 Benjamin Kosnik <bkoz@redhat.com>
+//
+// Copyright (C) 2004, 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.2.2 Class template array
+
+#include <tr1/array>
+
+template class std::tr1::array<int, 5>;
diff --git a/libstdc++-v3/testsuite/tr1/6_containers/array/requirements/member_swap.cc b/libstdc++-v3/testsuite/tr1/6_containers/array/requirements/member_swap.cc
new file mode 100644
index 000000000..ea663bf71
--- /dev/null
+++ b/libstdc++-v3/testsuite/tr1/6_containers/array/requirements/member_swap.cc
@@ -0,0 +1,48 @@
+// 2006-02-24 Paolo Carlini <pcarlini@suse.de>
+//
+// 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.2.2 Class template array
+
+#include <tr1/array>
+#include <testsuite_hooks.h>
+
+void
+test01()
+{
+ bool test __attribute__((unused)) = true;
+
+ const size_t len = 5;
+ typedef std::tr1::array<int, len> array_type;
+
+ array_type a = { { 0, 1, 2, 3, 4 } };
+ const array_type a_ref = a;
+
+ array_type b = { { 4, 3, 2, 1, 0 } };
+ const array_type b_ref = b;
+
+ a.swap(b);
+ VERIFY( a == b_ref );
+ VERIFY( b == a_ref );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/tr1/6_containers/array/requirements/typedefs.cc b/libstdc++-v3/testsuite/tr1/6_containers/array/requirements/typedefs.cc
new file mode 100644
index 000000000..9f616ee75
--- /dev/null
+++ b/libstdc++-v3/testsuite/tr1/6_containers/array/requirements/typedefs.cc
@@ -0,0 +1,40 @@
+// { dg-do compile }
+
+// 2004-10-20 Benjamin Kosnik <bkoz@redhat.com>
+//
+// Copyright (C) 2004, 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.2.2 Class template array
+
+#include <tr1/array>
+
+void test01()
+{
+ // Check for required typedefs
+ typedef std::tr1::array<int, 5> test_type;
+ typedef test_type::reference reference;
+ typedef test_type::const_reference const_reference;
+ typedef test_type::iterator iterator;
+ typedef test_type::const_iterator const_iterator;
+ typedef test_type::size_type size_type;
+ typedef test_type::difference_type difference_type;
+ typedef test_type::value_type value_type;
+ typedef test_type::reverse_iterator reverse_iterator;
+ typedef test_type::const_reverse_iterator const_reverse_iterator;
+}
diff --git a/libstdc++-v3/testsuite/tr1/6_containers/array/requirements/zero_sized_arrays.cc b/libstdc++-v3/testsuite/tr1/6_containers/array/requirements/zero_sized_arrays.cc
new file mode 100644
index 000000000..1ea4f8aee
--- /dev/null
+++ b/libstdc++-v3/testsuite/tr1/6_containers/array/requirements/zero_sized_arrays.cc
@@ -0,0 +1,61 @@
+// 2004-10-20 Benjamin Kosnik <bkoz@redhat.com>
+//
+// Copyright (C) 2004, 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.2.2.4 Zero sized arrays
+
+#include <tr1/array>
+#include <testsuite_hooks.h>
+
+void
+test01()
+{
+ const size_t len = 0;
+ typedef std::tr1::array<int, len> array_type;
+ bool test __attribute__((unused)) = true;
+
+ // 1: ?
+ array_type a = { };
+
+ // 2
+ array_type b;
+
+ // 3
+ // begin() == end()
+ VERIFY( a.begin() == a.end() );
+ VERIFY( b.begin() == b.end() );
+
+ // 4: ?
+ // begin() == end() == unique value.
+ {
+ typedef std::tr1::array<long, len> array_type1;
+ typedef std::tr1::array<char, len> array_type2;
+ array_type1 one;
+ array_type2 two;
+ void* v1 = one.begin();
+ void* v2 = two.begin();
+ VERIFY( v1 != v2 );
+ }
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
+
diff --git a/libstdc++-v3/testsuite/tr1/6_containers/array/specialized_algorithms/swap.cc b/libstdc++-v3/testsuite/tr1/6_containers/array/specialized_algorithms/swap.cc
new file mode 100644
index 000000000..1f0ae9d7f
--- /dev/null
+++ b/libstdc++-v3/testsuite/tr1/6_containers/array/specialized_algorithms/swap.cc
@@ -0,0 +1,48 @@
+// 2006-02-24 Paolo Carlini <pcarlini@suse.de>
+//
+// 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.2.2.2 array specialized algorithms
+
+#include <tr1/array>
+#include <testsuite_hooks.h>
+
+void
+test01()
+{
+ bool test __attribute__((unused)) = true;
+
+ const size_t len = 5;
+ typedef std::tr1::array<int, len> array_type;
+
+ array_type a = { { 0, 1, 2, 3, 4 } };
+ const array_type a_ref = a;
+
+ array_type b = { { 4, 3, 2, 1, 0 } };
+ const array_type b_ref = b;
+
+ std::tr1::swap(a, b);
+ VERIFY( a == b_ref );
+ VERIFY( b == a_ref );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/tr1/6_containers/array/tuple_interface/get.cc b/libstdc++-v3/testsuite/tr1/6_containers/array/tuple_interface/get.cc
new file mode 100644
index 000000000..de0531da2
--- /dev/null
+++ b/libstdc++-v3/testsuite/tr1/6_containers/array/tuple_interface/get.cc
@@ -0,0 +1,51 @@
+// 2005-08-26 Paolo Carlini <pcarlini@suse.de>
+//
+// Copyright (C) 2005, 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.2.2 Class template array
+
+#include <tr1/array>
+#include <testsuite_hooks.h>
+
+void
+test01()
+{
+ bool test __attribute__((unused)) = true;
+ using namespace std::tr1;
+
+ const size_t len = 5;
+ typedef array<int, len> array_type;
+
+ {
+ array_type a = { { 0, 1, 2, 3, 4 } };
+ int& ri = get<0>(a);
+ VERIFY( ri == 0 );
+ }
+
+ {
+ const array_type a = { { 4, 3, 2, 1, 0 } };
+ const int& cri = get<1>(a);
+ VERIFY( cri == 3 );
+ }
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/tr1/6_containers/array/tuple_interface/tuple_element.cc b/libstdc++-v3/testsuite/tr1/6_containers/array/tuple_interface/tuple_element.cc
new file mode 100644
index 000000000..09de57dc5
--- /dev/null
+++ b/libstdc++-v3/testsuite/tr1/6_containers/array/tuple_interface/tuple_element.cc
@@ -0,0 +1,51 @@
+// 2005-08-26 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.2.2 Class template array
+
+#include <tr1/array>
+#include <tr1/type_traits>
+#include <testsuite_hooks.h>
+
+void
+test01()
+{
+ bool test __attribute__((unused)) = true;
+ using namespace std::tr1;
+
+ {
+ const size_t len = 3;
+ typedef array<int, len> array_type;
+ VERIFY( (is_same<tuple_element<0, array_type>::type, int>::value == true) );
+ VERIFY( (is_same<tuple_element<1, array_type>::type, int>::value == true) );
+ VERIFY( (is_same<tuple_element<2, array_type>::type, int>::value == true) );
+ }
+
+ {
+ const size_t len = 0;
+ typedef array<int, len> array_type;
+ VERIFY( (is_same<tuple_element<0, array_type>::type, int>::value == true) );
+ }
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/tr1/6_containers/array/tuple_interface/tuple_size.cc b/libstdc++-v3/testsuite/tr1/6_containers/array/tuple_interface/tuple_size.cc
new file mode 100644
index 000000000..99fcc7de0
--- /dev/null
+++ b/libstdc++-v3/testsuite/tr1/6_containers/array/tuple_interface/tuple_size.cc
@@ -0,0 +1,48 @@
+// 2005-08-26 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.2.2 Class template array
+
+#include <tr1/array>
+#include <testsuite_hooks.h>
+
+void
+test01()
+{
+ bool test __attribute__((unused)) = true;
+ using namespace std::tr1;
+
+ {
+ const size_t len = 5;
+ typedef array<int, len> array_type;
+ VERIFY( tuple_size<array_type>::value == 5 );
+ }
+
+ {
+ const size_t len = 0;
+ typedef array<float, len> array_type;
+ VERIFY( tuple_size<array_type>::value == 0 );
+ }
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/tr1/6_containers/hash/24799.cc b/libstdc++-v3/testsuite/tr1/6_containers/hash/24799.cc
new file mode 100644
index 000000000..374651001
--- /dev/null
+++ b/libstdc++-v3/testsuite/tr1/6_containers/hash/24799.cc
@@ -0,0 +1,73 @@
+// 2005-11-11 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.3 Class template hash
+
+#include <tr1/functional>
+#include <string>
+#include <tr1/type_traits>
+#include <testsuite_tr1.h>
+#include <testsuite_hooks.h>
+
+template<typename T>
+ void
+ do_test()
+ {
+ bool test __attribute__((unused)) = true;
+
+ using std::tr1::is_same;
+ using __gnu_test::test_relationship;
+
+ typedef typename std::tr1::hash<T>::argument_type argument_type;
+ typedef typename std::tr1::hash<T>::result_type result_type;
+
+ VERIFY( (test_relationship<is_same, argument_type, T>(true)) );
+ VERIFY( (test_relationship<is_same, result_type, std::size_t>(true)) );
+ }
+
+// libstdc++/24799
+void test01()
+{
+ do_test<bool>();
+ do_test<char>();
+ do_test<signed char>();
+ do_test<unsigned char>();
+ do_test<short>();
+ do_test<int>();
+ do_test<long>();
+ do_test<unsigned short>();
+ do_test<unsigned int>();
+ do_test<unsigned long>();
+ do_test<int*>();
+ do_test<std::string>();
+ do_test<float>();
+ do_test<double>();
+ do_test<long double>();
+
+#ifdef _GLIBCXX_USE_WCHAR_T
+ do_test<wchar_t>();
+ do_test<std::wstring>();
+#endif
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/tr1/6_containers/hash/operators/size_t.cc b/libstdc++-v3/testsuite/tr1/6_containers/hash/operators/size_t.cc
new file mode 100644
index 000000000..9013a04bf
--- /dev/null
+++ b/libstdc++-v3/testsuite/tr1/6_containers/hash/operators/size_t.cc
@@ -0,0 +1,75 @@
+// 2007-08-20 <benjamin@redhat.com>
+//
+// Copyright (C) 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.3 Class template hash
+
+#include <tr1/functional>
+#include <string>
+#include <testsuite_hooks.h>
+
+template<typename T>
+ void
+ do_test()
+ {
+ bool test __attribute__((unused)) = true;
+
+ typedef T value_type;
+ typedef std::tr1::hash<value_type> hash_type;
+ using std::size_t;
+
+ value_type v = T(); // default initialized is fine, same value all
+ // that matters.
+ hash_type h1;
+ size_t r1 = size_t(h1(v));
+
+ hash_type h2;
+ size_t r2 = size_t(h2(v));
+
+ VERIFY( r1 == r2 );
+ }
+
+void test01()
+{
+ do_test<bool>();
+ do_test<char>();
+ do_test<signed char>();
+ do_test<unsigned char>();
+ do_test<short>();
+ do_test<int>();
+ do_test<long>();
+ do_test<unsigned short>();
+ do_test<unsigned int>();
+ do_test<unsigned long>();
+ do_test<int*>();
+ do_test<std::string>();
+ do_test<float>();
+ do_test<double>();
+ do_test<long double>();
+
+#ifdef _GLIBCXX_USE_WCHAR_T
+ do_test<wchar_t>();
+ do_test<std::wstring>();
+#endif
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/tr1/6_containers/hash/requirements/base_classes.cc b/libstdc++-v3/testsuite/tr1/6_containers/hash/requirements/base_classes.cc
new file mode 100644
index 000000000..f5883786c
--- /dev/null
+++ b/libstdc++-v3/testsuite/tr1/6_containers/hash/requirements/base_classes.cc
@@ -0,0 +1,32 @@
+// { dg-do compile }
+
+// 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/>.
+
+#include <tr1/functional>
+
+void test01()
+{
+ // Check for required base class.
+ typedef long value_type;
+ typedef std::tr1::hash<value_type> test_type;
+ typedef std::unary_function<value_type, std::size_t> base_type;
+
+ test_type b;
+ const test_type& obj = b;
+ const base_type* base __attribute__((unused)) = &obj;
+}
diff --git a/libstdc++-v3/testsuite/tr1/6_containers/hash/requirements/explicit_instantiation.cc b/libstdc++-v3/testsuite/tr1/6_containers/hash/requirements/explicit_instantiation.cc
new file mode 100644
index 000000000..462e929df
--- /dev/null
+++ b/libstdc++-v3/testsuite/tr1/6_containers/hash/requirements/explicit_instantiation.cc
@@ -0,0 +1,50 @@
+// { dg-do compile }
+
+// 2005-02-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.3 class template hash
+
+#include <string>
+#include <tr1/functional>
+
+using namespace std::tr1;
+
+// Verify that we can instantiate hash for every required type.
+template class hash<bool>;
+template class hash<char>;
+template class hash<signed char>;
+template class hash<unsigned char>;
+template class hash<short>;
+template class hash<int>;
+template class hash<long>;
+template class hash<unsigned short>;
+template class hash<unsigned int>;
+template class hash<unsigned long>;
+template class hash<float>;
+template class hash<double>;
+template class hash<long double>;
+template class hash<void*>;
+template class hash<std::string>;
+
+#ifdef _GLIBCXX_USE_WCHAR_T
+template class hash<wchar_t>;
+template class hash<std::wstring>;
+#endif
+
diff --git a/libstdc++-v3/testsuite/tr1/6_containers/headers/array/synopsis.cc b/libstdc++-v3/testsuite/tr1/6_containers/headers/array/synopsis.cc
new file mode 100644
index 000000000..778bf0730
--- /dev/null
+++ b/libstdc++-v3/testsuite/tr1/6_containers/headers/array/synopsis.cc
@@ -0,0 +1,51 @@
+// { dg-do compile }
+
+// 2007-02-04 Benjamin Kosnik <bkoz@redhat.com>
+//
+// 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/>.
+
+#include <tr1/array>
+
+namespace std {
+namespace tr1 {
+
+ // [6.2.2] Class template array
+ template <class T, size_t N > struct array;
+
+ // Array comparisons
+ template <class T, size_t N> bool operator==(const array<T,N>& x, const array<T,N>& y);
+ template <class T, size_t N> bool operator!=(const array<T,N>& x, const array<T,N>& y);
+ template <class T, size_t N> bool operator<(const array<T,N>& x, const array<T,N>& y);
+ template <class T, size_t N> bool operator>(const array<T,N>& x, const array<T,N>& y);
+ template <class T, size_t N> bool operator<=(const array<T,N>& x, const array<T,N>& y);
+ template <class T, size_t N> bool operator>=(const array<T,N>& x, const array<T,N>& y);
+
+ // [6.2.2.2] Specialized algorithms
+ template <class T, size_t N > void swap(array<T,N>& x, array<T,N>& y);
+
+ // [6.2.2.5] Tuple interface to class template array
+ template <class T> class tuple_size; // forward declaration
+ template <int I, class T> class tuple_element; // forward declaration
+ template <class T, size_t N> struct tuple_size<array<T, N> >;
+ template <int I, class T, size_t N> struct tuple_element<I, array<T, N> >;
+ template <int I, class T, size_t N> T& get(array<T, N>&);
+ template <int I, class T, size_t N> const T& get(const array<T, N>&);
+
+} // namespace tr1
+} // namespace std
+
diff --git a/libstdc++-v3/testsuite/tr1/6_containers/headers/functional/synopsis.cc b/libstdc++-v3/testsuite/tr1/6_containers/headers/functional/synopsis.cc
new file mode 100644
index 000000000..a64979145
--- /dev/null
+++ b/libstdc++-v3/testsuite/tr1/6_containers/headers/functional/synopsis.cc
@@ -0,0 +1,32 @@
+// { dg-do compile }
+// { dg-require-c-std "" }
+
+// 2007-02-04 Benjamin Kosnik <bkoz@redhat.com>
+//
+// 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/>.
+
+#include <tr1/functional>
+
+namespace std {
+namespace tr1 {
+
+ // [6.3.3] Hash function base template
+ template <class T> struct hash;
+
+} // namespace tr1
+} // namespace std
diff --git a/libstdc++-v3/testsuite/tr1/6_containers/headers/tuple/synopsis.cc b/libstdc++-v3/testsuite/tr1/6_containers/headers/tuple/synopsis.cc
new file mode 100644
index 000000000..3d41b0a3b
--- /dev/null
+++ b/libstdc++-v3/testsuite/tr1/6_containers/headers/tuple/synopsis.cc
@@ -0,0 +1,70 @@
+// { dg-do compile }
+
+// 2007-02-04 Benjamin Kosnik <bkoz@redhat.com>
+//
+// 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/>.
+
+#include <tr1/tuple>
+
+namespace std {
+namespace tr1 {
+
+#if 0
+ // [6.1.3] Class template tuple
+ template <class T1 = unspecified ,
+ class T2 = unspecified ,
+ ...,
+ class TM = unspecified > class tuple;
+
+ // [6.1.3.2] Tuple creation functions
+ const unspecified ignore;
+ template<class T1, class T2, ..., class TN>
+ tuple<V1, V2, ..., VN> make_tuple(const T1&, const T2& , ..., const TN&);
+
+ template<class T1, class T2, ..., class TN>
+ tuple<T1&, T2&, ..., TN&> tie(T1&, T2& , ..., TN&);
+#endif
+
+ // [6.1.3.3] Tuple helper classes
+ template <class T> class tuple_size;
+ template <int I, class T> class tuple_element;
+
+#if 0
+ // [6.1.3.4] Element access
+ template <int I, class T1, class T2, ..., class TN>
+ RJ get(tuple<T1, T2, ..., TN>&);
+ template <int I, class T1, class T2, ..., class TN>
+ PJ get(const tuple<T1, T2, ..., TN>&);
+
+ // [6.1.3.5] relational operators
+ template<class T1, class T2, ..., class TM, class U1, class U2, ..., class UM>
+ bool operator==(const tuple<T1, T2, ..., TM>&, const tuple<U1, U2, ..., UM>&);
+ template<class T1, class T2, ..., class TM, class U1, class U2, ..., class UM>
+ bool operator<(const tuple<T1, T2, ..., TM>&, const tuple<U1, U2, ..., UM>&);
+ template<class T1, class T2, ..., class TM, class U1, class U2, ..., class UM>
+ bool operator!=(const tuple<T1, T2, ..., TM>&, const tuple<U1, U2, ..., UM>&);
+ template<class T1, class T2, ..., class TM, class U1, class U2, ..., class UM>
+ bool operator>(const tuple<T1, T2, ..., TM>&, const tuple<U1, U2, ..., UM>&);
+ template<class T1, class T2, ..., class TM, class U1, class U2, ..., class UM>
+ bool operator<=(const tuple<T1, T2, ..., TM>&, const tuple<U1, U2, ..., UM>&);
+ template<class T1, class T2, ..., class TM, class U1, class U2, ..., class UM>
+ bool operator>=(const tuple<T1, T2, ..., TM>&, const tuple<U1, U2, ..., UM>&);
+#endif
+
+} // namespace tr1
+} // namespace std
diff --git a/libstdc++-v3/testsuite/tr1/6_containers/headers/tuple/types_std_tr1.cc b/libstdc++-v3/testsuite/tr1/6_containers/headers/tuple/types_std_tr1.cc
new file mode 100644
index 000000000..3feb5b70f
--- /dev/null
+++ b/libstdc++-v3/testsuite/tr1/6_containers/headers/tuple/types_std_tr1.cc
@@ -0,0 +1,25 @@
+// { dg-do compile }
+
+// 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/>.
+
+#include <tr1/tuple>
+
+namespace gnu
+{
+ using std::tr1::ignore;
+}
diff --git a/libstdc++-v3/testsuite/tr1/6_containers/headers/unordered_map/synopsis.cc b/libstdc++-v3/testsuite/tr1/6_containers/headers/unordered_map/synopsis.cc
new file mode 100644
index 000000000..0555ece20
--- /dev/null
+++ b/libstdc++-v3/testsuite/tr1/6_containers/headers/unordered_map/synopsis.cc
@@ -0,0 +1,52 @@
+// { dg-do compile }
+
+// 2007-02-04 Benjamin Kosnik <bkoz@redhat.com>
+//
+// 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/>.
+
+#include <tr1/unordered_map>
+
+namespace std {
+namespace tr1 {
+
+ // [6.3.4.4] Class template unordered_map
+ template <class Key,
+ class T,
+ class Hash,
+ class Pred,
+ class Alloc>
+ class unordered_map;
+
+ // [6.3.4.6] Class template unordered_multimap
+ template <class Key,
+ class T,
+ class Hash,
+ class Pred,
+ class Alloc>
+ class unordered_multimap;
+
+template <class Key, class T, class Hash, class Pred, class Alloc>
+ void swap(unordered_map<Key, T, Hash, Pred, Alloc>& x,
+ unordered_map<Key, T, Hash, Pred, Alloc>& y);
+template <class Key, class T, class Hash, class Pred, class Alloc>
+ void swap(unordered_multimap<Key, T, Hash, Pred, Alloc>& x,
+ unordered_multimap<Key, T, Hash, Pred, Alloc>& y);
+
+} // namespace tr1
+} // namespace std
+
diff --git a/libstdc++-v3/testsuite/tr1/6_containers/headers/unordered_set/synopsis.cc b/libstdc++-v3/testsuite/tr1/6_containers/headers/unordered_set/synopsis.cc
new file mode 100644
index 000000000..0facef6b8
--- /dev/null
+++ b/libstdc++-v3/testsuite/tr1/6_containers/headers/unordered_set/synopsis.cc
@@ -0,0 +1,51 @@
+// { dg-do compile }
+
+// 2007-02-04 Benjamin Kosnik <bkoz@redhat.com>
+//
+// 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/>.
+
+#include <tr1/unordered_set>
+
+namespace std {
+namespace tr1 {
+
+ // [6.3.4.3] Class template unordered_set
+ template <class Value,
+ class Hash,
+ class Pred,
+ class Alloc>
+ class unordered_set;
+
+ // [6.3.4.5] Class template unordered_multiset
+ template <class Value,
+ class Hash,
+ class Pred,
+ class Alloc>
+ class unordered_multiset;
+
+ template <class Value, class Hash, class Pred, class Alloc>
+ void swap(unordered_set<Value, Hash, Pred, Alloc>& x,
+ unordered_set<Value, Hash, Pred, Alloc>& y);
+
+ template <class Value, class Hash, class Pred, class Alloc>
+ void swap(unordered_multiset<Value, Hash, Pred, Alloc>& x,
+ unordered_multiset<Value, Hash, Pred, Alloc>& y);
+
+} // namespace tr1
+} // namespace std
+
diff --git a/libstdc++-v3/testsuite/tr1/6_containers/tuple/comparison_operators/35480_neg.cc b/libstdc++-v3/testsuite/tr1/6_containers/tuple/comparison_operators/35480_neg.cc
new file mode 100644
index 000000000..aff8e9a40
--- /dev/null
+++ b/libstdc++-v3/testsuite/tr1/6_containers/tuple/comparison_operators/35480_neg.cc
@@ -0,0 +1,32 @@
+// { dg-do compile }
+
+// Copyright (C) 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/>.
+
+// Tuple
+
+#include <tr1/tuple>
+
+// libstdc++/35480
+void test01()
+{
+ std::tr1::tuple<int> t1( 1 );
+ std::tr1::tuple<int, int> t2( 1, 2 );
+ if ( t1 < t2 ) {} // { dg-error "here" }
+ if ( t1 == t2 ) {} // { dg-error "here" }
+}
+// { dg-excess-errors "incomplete type" }
diff --git a/libstdc++-v3/testsuite/tr1/6_containers/tuple/comparison_operators/comparisons.cc b/libstdc++-v3/testsuite/tr1/6_containers/tuple/comparison_operators/comparisons.cc
new file mode 100644
index 000000000..b5ef96f41
--- /dev/null
+++ b/libstdc++-v3/testsuite/tr1/6_containers/tuple/comparison_operators/comparisons.cc
@@ -0,0 +1,50 @@
+// 2004-09-23 Chris Jefferson <chris@bubblescope.net>
+
+// Copyright (C) 2004, 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/>.
+
+// Tuple
+
+#include <tr1/tuple>
+#include <testsuite_hooks.h>
+
+using namespace std::tr1;
+
+bool test __attribute__((unused)) = true;
+
+#define TEST1(x) VERIFY( x == x && !(x != x) && x <= x && !(x < x) )
+
+int
+main()
+{
+ int i=0;
+ int j=0;
+ int k=2;
+ tuple<int, int, int> a(0, 0, 0);
+ tuple<int, int, int> b(0, 0, 1);
+ tuple<int& , int& , int&> c(i,j,k);
+ tuple<const int&, const int&, const int&> d(c);
+ TEST1(a);
+ TEST1(b);
+ TEST1(c);
+ TEST1(d);
+ VERIFY(!(a > a) && !(b > b));
+ VERIFY(a >= a && b >= b);
+ VERIFY(a < b && !(b < a) && a <= b && !(b <= a));
+ VERIFY(b > a && !(a > b) && b >= a && !(a >= b));
+}
+
diff --git a/libstdc++-v3/testsuite/tr1/6_containers/tuple/cons/assignment.cc b/libstdc++-v3/testsuite/tr1/6_containers/tuple/cons/assignment.cc
new file mode 100644
index 000000000..a2cf9181f
--- /dev/null
+++ b/libstdc++-v3/testsuite/tr1/6_containers/tuple/cons/assignment.cc
@@ -0,0 +1,53 @@
+// 2004-09-23 Chris Jefferson <chris@bubblescope.net>
+
+// Copyright (C) 2004, 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/>.
+
+// Tuple
+
+#include <tr1/tuple>
+#include <testsuite_hooks.h>
+
+using namespace std::tr1;
+
+int
+main()
+{
+ bool test __attribute__((unused)) = true;
+
+ tuple<> ta;
+ tuple<> tb;
+ ta = tb;
+
+ tuple<int> tc(1);
+ tuple<int> td(0);
+ td = tc;
+ VERIFY(get<0>(td) == 1);
+
+ int i=0;
+ tuple<int&> te(i);
+ te = tc;
+ VERIFY(i == 1);
+
+ tuple<const int&> tf(tc);
+
+ get<0>(tc) = 2;
+ VERIFY(get<0>(tf) == 2);
+ tuple<double> tg;
+ tg = tc;
+}
+
diff --git a/libstdc++-v3/testsuite/tr1/6_containers/tuple/cons/big_tuples.cc b/libstdc++-v3/testsuite/tr1/6_containers/tuple/cons/big_tuples.cc
new file mode 100644
index 000000000..51c6216a8
--- /dev/null
+++ b/libstdc++-v3/testsuite/tr1/6_containers/tuple/cons/big_tuples.cc
@@ -0,0 +1,108 @@
+// 2004-09-23 Chris Jefferson <chris@bubblescope.net>
+
+// Copyright (C) 2004, 2005, 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/>.
+
+// Tuple
+
+#include <tr1/tuple>
+#include <testsuite_hooks.h>
+
+using namespace std::tr1;
+using std::pair;
+
+// A simple class without conversions to check some things
+struct foo
+{ };
+
+void
+test_constructors()
+{
+ bool test __attribute__((unused)) = true;
+
+ int x1=0,x2=0;
+ const int &z1=x1;
+
+ // Test empty constructor
+ tuple<> ta __attribute__((unused));
+ tuple<int,int> tb;
+ // Test construction from values
+ tuple<int,int> tc(x1,x2);
+ tuple<int,int&> td(x1,x2);
+ tuple<const int&> te(z1);
+ x1=1;
+ x2=1;
+ VERIFY(get<0>(td) == 0 && get<1>(td) == 1 && get<0>(te) == 1);
+
+ // Test identical tuple copy constructor
+ tuple<int,int> tf(tc);
+ tuple<int,int> tg(td);
+ tuple<const int&> th(te);
+ // Test different tuple copy constructor
+ tuple<int,double> ti(tc);
+ tuple<int,double> tj(td);
+ // Test constructing from a pair
+ pair<int,int> pair1(1,1);
+ const pair<int,int> pair2(pair1);
+ tuple<int,int> tl(pair1);
+ tuple<int,const int&> tm(pair1);
+ tuple<int,int> tn(pair2);
+ tuple<int,const int&> to(pair2);
+}
+
+int
+main(void)
+{
+ //test construction
+ typedef tuple<int,int,int,int,int,int,int,int,int,int> type1;
+ type1 a(0, 0, 0, 0, 0, 0, 0, 0, 0, 1);
+ type1 b(0, 0, 0, 0, 0, 0, 0, 0, 0, 2);
+ type1 c(a);
+ typedef tuple<int,int,int,int,int,int,int,int,int,char> type2;
+ type2 d(0, 0, 0, 0, 0, 0, 0, 0, 0, 3);
+ type1 e(d);
+ typedef tuple<foo,int,int,int,int,int,int,int,int,foo> type3;
+ // get
+ VERIFY(get<9>(a)==1 && get<9>(b)==2);
+ // comparisons
+ VERIFY(a==a && !(a!=a) && a<=a && a>=a && !(a<a) && !(a>a));
+ VERIFY(!(a==b) && a!=b && a<=b && a<b && !(a>=b) && !(a>b));
+ //tie
+ {
+ int i = 0;
+ tie(ignore, ignore, ignore, ignore, ignore, ignore, ignore, ignore,
+ ignore, i) = a;
+ VERIFY(i == 1);
+ }
+ //test_assignment
+ a=d;
+ a=b;
+ //make_tuple
+ make_tuple(0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
+
+ //tuple_size
+ VERIFY(tuple_size<type3>::value == 10);
+ //tuple_element
+ {
+ foo q1;
+ tuple_element<0,type3>::type q2(q1);
+ tuple_element<9,type3>::type q3(q1);
+ }
+
+}
+
diff --git a/libstdc++-v3/testsuite/tr1/6_containers/tuple/cons/constructor.cc b/libstdc++-v3/testsuite/tr1/6_containers/tuple/cons/constructor.cc
new file mode 100644
index 000000000..2e862813b
--- /dev/null
+++ b/libstdc++-v3/testsuite/tr1/6_containers/tuple/cons/constructor.cc
@@ -0,0 +1,67 @@
+// 2004-09-23 Chris Jefferson <chris@bubblescope.net>
+
+// Copyright (C) 2004, 2005, 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/>.
+
+// Tuple
+
+#include <tr1/tuple>
+#include <testsuite_hooks.h>
+
+using namespace std::tr1;
+using std::pair;
+
+int
+main()
+{
+ bool test __attribute__((unused)) = true;
+
+ int x1=0,x2=0;
+ const int &z1=x1;
+
+ // Test empty constructor
+ tuple<> ta __attribute__((unused));
+ tuple<int,int> tb;
+ // Test construction from values
+ tuple<int,int> tc(x1,x2);
+ tuple<int,int&> td(x1,x2);
+ tuple<const int&> te(z1);
+ x1=1;
+ x2=1;
+ VERIFY(get<0>(td) == 0 && get<1>(td) == 1 && get<0>(te) == 1);
+
+ // Test identical tuple copy constructor
+ tuple<int,int> tf(tc);
+ tuple<int,int> tg(td);
+ tuple<const int&> th(te);
+ // Test different tuple copy constructor
+ tuple<int,double> ti(tc);
+ tuple<int,double> tj(td);
+ //tuple<int&, int&> tk(tc);
+ tuple<const int&, const int&> tl(tc);
+ tuple<const int&, const int&> tm(tl);
+ // Test constructing from a pair
+ pair<int,int> pair1(1,1);
+ const pair<int,int> pair2(pair1);
+ tuple<int,int> tn(pair1);
+ tuple<int,const int&> to(pair1);
+ tuple<int,int> tp(pair2);
+ tuple<int,const int&> tq(pair2);
+ return 0;
+}
+
diff --git a/libstdc++-v3/testsuite/tr1/6_containers/tuple/creation_functions/23978.cc b/libstdc++-v3/testsuite/tr1/6_containers/tuple/creation_functions/23978.cc
new file mode 100644
index 000000000..b4f928714
--- /dev/null
+++ b/libstdc++-v3/testsuite/tr1/6_containers/tuple/creation_functions/23978.cc
@@ -0,0 +1,46 @@
+// 2005-09-29 Chris Jefferson <chris@bubblescope.net>
+//
+// 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/>.
+
+// Tuple
+
+#include <tr1/tuple>
+#include <tr1/utility>
+#include <testsuite_hooks.h>
+
+using namespace std::tr1;
+using std::pair;
+
+// libstdc++/23978
+void test01()
+{
+ bool test __attribute__((unused)) = true;
+
+ pair<int, int> p(1, 2);
+ int x = 0;
+ int y = 0;
+ tie(x, y) = p;
+ VERIFY( x == 1 && y == 2 );
+}
+
+int
+main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/tr1/6_containers/tuple/creation_functions/make_tuple.cc b/libstdc++-v3/testsuite/tr1/6_containers/tuple/creation_functions/make_tuple.cc
new file mode 100644
index 000000000..0b6da3fee
--- /dev/null
+++ b/libstdc++-v3/testsuite/tr1/6_containers/tuple/creation_functions/make_tuple.cc
@@ -0,0 +1,38 @@
+// 2004-09-23 Chris Jefferson <chris@bubblescope.net>
+
+// Copyright (C) 2004, 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/>.
+
+// Tuple
+
+#include <tr1/tuple>
+#include <tr1/functional>
+#include <testsuite_hooks.h>
+
+using namespace std::tr1;
+
+int
+main()
+{
+ bool test __attribute__((unused)) = true;
+
+ int i=0;
+ make_tuple(1,2,4.0);
+ make_tuple(ref(i)) = tuple<int>(1);
+ VERIFY(i == 1);
+}
+
diff --git a/libstdc++-v3/testsuite/tr1/6_containers/tuple/creation_functions/tie.cc b/libstdc++-v3/testsuite/tr1/6_containers/tuple/creation_functions/tie.cc
new file mode 100644
index 000000000..419a7ad31
--- /dev/null
+++ b/libstdc++-v3/testsuite/tr1/6_containers/tuple/creation_functions/tie.cc
@@ -0,0 +1,43 @@
+// 2004-09-23 Chris Jefferson <chris@bubblescope.net>
+
+// Copyright (C) 2004, 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/>.
+
+// Tuple
+
+#include <tr1/tuple>
+#include <testsuite_hooks.h>
+
+using namespace std::tr1;
+
+int
+main()
+{
+ bool test __attribute__((unused)) = true;
+
+ int x1 = 0;
+ int x2 = 0;
+ int y1 = 0;
+ int y2 = 0;
+ tuple<int,int> ta(1,1);
+ tuple<const int&,const int&> tc(x1,x2);
+ tie(y1,y2)=ta;
+ VERIFY(y1 == 1 && y2 == 1);
+ tie(y1,y2)=tc;
+ VERIFY(y1 == 0 && y2 == 0);
+}
+
diff --git a/libstdc++-v3/testsuite/tr1/6_containers/tuple/creation_functions/tie2.cc b/libstdc++-v3/testsuite/tr1/6_containers/tuple/creation_functions/tie2.cc
new file mode 100644
index 000000000..7aea51643
--- /dev/null
+++ b/libstdc++-v3/testsuite/tr1/6_containers/tuple/creation_functions/tie2.cc
@@ -0,0 +1,36 @@
+// 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/>.
+
+// Tuple
+
+#include <tr1/tuple>
+#include <string>
+#include <testsuite_hooks.h>
+
+int
+main()
+{
+ bool test __attribute__((unused)) = true;
+ using namespace std::tr1;
+
+ int i;
+ std::string s;
+
+ tie(i, ignore, s) = make_tuple(42, 3.14, "C++");
+ VERIFY( i == 42 );
+ VERIFY( s == "C++" );
+}
diff --git a/libstdc++-v3/testsuite/tr1/6_containers/tuple/element_access/get.cc b/libstdc++-v3/testsuite/tr1/6_containers/tuple/element_access/get.cc
new file mode 100644
index 000000000..ebd3fd2bf
--- /dev/null
+++ b/libstdc++-v3/testsuite/tr1/6_containers/tuple/element_access/get.cc
@@ -0,0 +1,45 @@
+// 2004-09-23 Chris Jefferson <chris@bubblescope.net>
+
+// Copyright (C) 2004, 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/>.
+
+// Tuple
+
+#include <tr1/tuple>
+#include <testsuite_hooks.h>
+
+using namespace std::tr1;
+
+int
+main()
+{
+ bool test __attribute__((unused)) = true;
+
+ int j=1;
+ const int k=2;
+ tuple<int,int &,const int&> a(0,j,k);
+ const tuple<int,int &,const int&> b(1,j,k);
+ VERIFY(get<0>(a)==0 && get<1>(a)==1 && get<2>(a)==2);
+ get<0>(a)=3;
+ get<1>(a)=4;
+ VERIFY(get<0>(a)==3 && get<1>(a)==4);
+ VERIFY(j==4);
+ get<1>(b)=5;
+ VERIFY(get<0>(b)==1 && get<1>(b)==5 && get<2>(b)==2);
+ VERIFY(j==5);
+}
+
diff --git a/libstdc++-v3/testsuite/tr1/6_containers/tuple/requirements/explicit_instantiation.cc b/libstdc++-v3/testsuite/tr1/6_containers/tuple/requirements/explicit_instantiation.cc
new file mode 100644
index 000000000..72e710f57
--- /dev/null
+++ b/libstdc++-v3/testsuite/tr1/6_containers/tuple/requirements/explicit_instantiation.cc
@@ -0,0 +1,25 @@
+// { dg-do compile }
+
+// 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/>.
+
+
+// This file tests explicit instantiation of library containers.
+
+#include <tr1/tuple>
+
+template class std::tr1::tuple<short, int, double>;
diff --git a/libstdc++-v3/testsuite/tr1/6_containers/tuple/tuple_element.cc b/libstdc++-v3/testsuite/tr1/6_containers/tuple/tuple_element.cc
new file mode 100644
index 000000000..b41592105
--- /dev/null
+++ b/libstdc++-v3/testsuite/tr1/6_containers/tuple/tuple_element.cc
@@ -0,0 +1,39 @@
+// 2004-09-23 Chris Jefferson <chris@bubblescope.net>
+
+// Copyright (C) 2004, 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/>.
+
+// Tuple
+
+#include <tr1/tuple>
+#include <testsuite_hooks.h>
+
+using namespace std::tr1;
+
+struct foo
+{ };
+
+int
+main()
+{
+ // As foo isn't constructible from anything else, this
+ // lets us check if type is returning foo when it should
+ foo q1;
+ tuple_element<0,tuple<foo,void,int> >::type q2(q1);
+ tuple_element<2,tuple<void,int,foo> >::type q3(q1);
+}
+
diff --git a/libstdc++-v3/testsuite/tr1/6_containers/tuple/tuple_size.cc b/libstdc++-v3/testsuite/tr1/6_containers/tuple/tuple_size.cc
new file mode 100644
index 000000000..d15a3cc20
--- /dev/null
+++ b/libstdc++-v3/testsuite/tr1/6_containers/tuple/tuple_size.cc
@@ -0,0 +1,39 @@
+// 2004-09-23 Chris Jefferson <chris@bubblescope.net>
+
+// Copyright (C) 2004, 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/>.
+
+// Tuple
+
+#include <tr1/tuple>
+#include <testsuite_hooks.h>
+
+using namespace std::tr1;
+
+int
+main()
+{
+ bool test __attribute__((unused)) = true;
+
+ VERIFY(tuple_size<tuple<> >::value == 0);
+ VERIFY(tuple_size<tuple<int> >::value == 1);
+ VERIFY(tuple_size<tuple<void> >::value == 1);
+ typedef tuple<int,const int&,void> test_tuple1;
+ VERIFY(tuple_size<test_tuple1>::value == 3);
+ VERIFY(tuple_size<tuple<tuple<void> > >::value == 1);
+}
+
diff --git a/libstdc++-v3/testsuite/tr1/6_containers/unordered_map/24064.cc b/libstdc++-v3/testsuite/tr1/6_containers/unordered_map/24064.cc
new file mode 100644
index 000000000..d94351fa9
--- /dev/null
+++ b/libstdc++-v3/testsuite/tr1/6_containers/unordered_map/24064.cc
@@ -0,0 +1,47 @@
+// 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 Unordered associative containers
+
+#include <tr1/unordered_map>
+#include <testsuite_hooks.h>
+
+// libstdc++/24064
+void test01()
+{
+ bool test __attribute__((unused)) = true;
+
+ using namespace std::tr1;
+ using std::allocator;
+ using std::pair;
+ using std::equal_to;
+
+ __unordered_map<int, char, hash<int>, equal_to<int>,
+ allocator<pair<const int, char> >, true> m;
+
+ for (int i = 0; i < 1000; ++i)
+ m[i] = '0' + i % 9;
+
+ for (int i = 0; i < 1000; ++i)
+ VERIFY( ++m.find(i)->second == '1' + i % 9 );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/tr1/6_containers/unordered_map/capacity/29134-map.cc b/libstdc++-v3/testsuite/tr1/6_containers/unordered_map/capacity/29134-map.cc
new file mode 100644
index 000000000..08d87f2df
--- /dev/null
+++ b/libstdc++-v3/testsuite/tr1/6_containers/unordered_map/capacity/29134-map.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.4 Class template unordered_map
+
+#include <tr1/unordered_map>
+#include <testsuite_hooks.h>
+
+// libstdc++/29134
+void test01()
+{
+ bool test __attribute__((unused)) = true;
+
+ std::tr1::unordered_map<int, int> um;
+
+ VERIFY( (um.max_size() == std::allocator<std::tr1::__detail::_Hash_node<
+ std::pair<const int, int>, false> >().max_size()));
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/tr1/6_containers/unordered_map/erase/1.cc b/libstdc++-v3/testsuite/tr1/6_containers/unordered_map/erase/1.cc
new file mode 100644
index 000000000..68236032f
--- /dev/null
+++ b/libstdc++-v3/testsuite/tr1/6_containers/unordered_map/erase/1.cc
@@ -0,0 +1,130 @@
+// 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.4 Class template unordered_map
+
+#include <tr1/unordered_map>
+#include <string>
+#include <testsuite_hooks.h>
+
+// In the occasion of libstdc++/25896
+void test01()
+{
+ bool test __attribute__((unused)) = true;
+
+ typedef std::tr1::unordered_map<std::string, int> Map;
+ typedef Map::iterator iterator;
+ typedef Map::const_iterator const_iterator;
+ typedef Map::value_type value_type;
+
+ Map m1;
+
+ m1.insert(value_type("because to why", 1));
+ m1.insert(value_type("the stockholm syndrome", 2));
+ m1.insert(value_type("a cereous night", 3));
+ m1.insert(value_type("eeilo", 4));
+ m1.insert(value_type("protean", 5));
+ m1.insert(value_type("the way you are when", 6));
+ m1.insert(value_type("tillsammans", 7));
+ m1.insert(value_type("umbra/penumbra", 8));
+ m1.insert(value_type("belonging (no longer mix)", 9));
+ m1.insert(value_type("one line behind", 10));
+ VERIFY( m1.size() == 10 );
+
+ VERIFY( m1.erase("eeilo") == 1 );
+ VERIFY( m1.size() == 9 );
+ iterator it1 = m1.find("eeilo");
+ VERIFY( it1 == m1.end() );
+
+ VERIFY( m1.erase("tillsammans") == 1 );
+ VERIFY( m1.size() == 8 );
+ iterator it2 = m1.find("tillsammans");
+ VERIFY( it2 == m1.end() );
+
+ // Must work (see DR 526)
+ iterator it3 = m1.find("belonging (no longer mix)");
+ VERIFY( it3 != m1.end() );
+ VERIFY( m1.erase(it3->first) == 1 );
+ VERIFY( m1.size() == 7 );
+ it3 = m1.find("belonging (no longer mix)");
+ VERIFY( it3 == m1.end() );
+
+ VERIFY( !m1.erase("abra") );
+ VERIFY( m1.size() == 7 );
+
+ VERIFY( !m1.erase("eeilo") );
+ VERIFY( m1.size() == 7 );
+
+ VERIFY( m1.erase("because to why") == 1 );
+ VERIFY( m1.size() == 6 );
+ iterator it4 = m1.find("because to why");
+ VERIFY( it4 == m1.end() );
+
+ iterator it5 = m1.find("umbra/penumbra");
+ iterator it6 = m1.find("one line behind");
+ VERIFY( it5 != m1.end() );
+ VERIFY( it6 != m1.end() );
+
+ VERIFY( m1.find("the stockholm syndrome") != m1.end() );
+ VERIFY( m1.find("a cereous night") != m1.end() );
+ VERIFY( m1.find("the way you are when") != m1.end() );
+ VERIFY( m1.find("a cereous night") != m1.end() );
+
+ VERIFY( m1.erase(it5->first) == 1 );
+ VERIFY( m1.size() == 5 );
+ it5 = m1.find("umbra/penumbra");
+ VERIFY( it5 == m1.end() );
+
+ VERIFY( m1.erase(it6->first) == 1 );
+ VERIFY( m1.size() == 4 );
+ it6 = m1.find("one line behind");
+ VERIFY( it6 == m1.end() );
+
+ iterator it7 = m1.begin();
+ iterator it8 = it7;
+ ++it8;
+ iterator it9 = it8;
+ ++it9;
+
+ VERIFY( m1.erase(it8->first) == 1 );
+ VERIFY( m1.size() == 3 );
+ VERIFY( ++it7 == it9 );
+
+ iterator it10 = it9;
+ ++it10;
+ iterator it11 = it10;
+
+ VERIFY( m1.erase(it9->first) == 1 );
+ VERIFY( m1.size() == 2 );
+ VERIFY( ++it10 == m1.end() );
+
+ VERIFY( m1.erase(m1.begin()) != m1.end() );
+ VERIFY( m1.size() == 1 );
+ VERIFY( m1.begin() == it11 );
+
+ VERIFY( m1.erase(m1.begin()->first) == 1 );
+ VERIFY( m1.size() == 0 );
+ VERIFY( m1.begin() == m1.end() );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/tr1/6_containers/unordered_map/erase/24061-map.cc b/libstdc++-v3/testsuite/tr1/6_containers/unordered_map/erase/24061-map.cc
new file mode 100644
index 000000000..86f0e26cc
--- /dev/null
+++ b/libstdc++-v3/testsuite/tr1/6_containers/unordered_map/erase/24061-map.cc
@@ -0,0 +1,105 @@
+// 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.4 Class template unordered_map
+
+#include <tr1/unordered_map>
+#include <string>
+#include <testsuite_hooks.h>
+
+// libstdc++/24061
+void test01()
+{
+ bool test __attribute__((unused)) = true;
+
+ typedef std::tr1::unordered_map<std::string, int> Map;
+ typedef Map::iterator iterator;
+ typedef Map::const_iterator const_iterator;
+ typedef Map::value_type value_type;
+
+ Map m1;
+
+ m1.insert(value_type("all the love in the world", 1));
+ m1.insert(value_type("you know what you are?", 2));
+ m1.insert(value_type("the collector", 3));
+ m1.insert(value_type("the hand that feeds", 4));
+ m1.insert(value_type("love is not enough", 5));
+ m1.insert(value_type("every day is exactly the same", 6));
+ m1.insert(value_type("with teeth", 7));
+ m1.insert(value_type("only", 8));
+ m1.insert(value_type("getting smaller", 9));
+ m1.insert(value_type("sunspots", 10));
+ VERIFY( m1.size() == 10 );
+
+ iterator it1 = m1.begin();
+ ++it1;
+ iterator it2 = it1;
+ ++it2;
+ iterator it3 = m1.erase(it1);
+ VERIFY( m1.size() == 9 );
+ VERIFY( it3 == it2 );
+ VERIFY( *it3 == *it2 );
+
+ iterator it4 = m1.begin();
+ ++it4;
+ ++it4;
+ ++it4;
+ iterator it5 = it4;
+ ++it5;
+ ++it5;
+ iterator it6 = m1.erase(it4, it5);
+ VERIFY( m1.size() == 7 );
+ VERIFY( it6 == it5 );
+ VERIFY( *it6 == *it5 );
+
+ const_iterator it7 = m1.begin();
+ ++it7;
+ ++it7;
+ ++it7;
+ const_iterator it8 = it7;
+ ++it8;
+ const_iterator it9 = m1.erase(it7);
+ VERIFY( m1.size() == 6 );
+ VERIFY( it9 == it8 );
+ VERIFY( *it9 == *it8 );
+
+ const_iterator it10 = m1.begin();
+ ++it10;
+ const_iterator it11 = it10;
+ ++it11;
+ ++it11;
+ ++it11;
+ ++it11;
+ const_iterator it12 = m1.erase(it10, it11);
+ VERIFY( m1.size() == 2 );
+ VERIFY( it12 == it11 );
+ VERIFY( *it12 == *it11 );
+ VERIFY( ++it12 == m1.end() );
+
+ iterator it13 = m1.erase(m1.begin(), m1.end());
+ VERIFY( m1.size() == 0 );
+ VERIFY( it13 == it12 );
+ VERIFY( it13 == m1.begin() );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/tr1/6_containers/unordered_map/find/map1.cc b/libstdc++-v3/testsuite/tr1/6_containers/unordered_map/find/map1.cc
new file mode 100644
index 000000000..906c32628
--- /dev/null
+++ b/libstdc++-v3/testsuite/tr1/6_containers/unordered_map/find/map1.cc
@@ -0,0 +1,70 @@
+// { 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.4 unordered_map
+// find, equal_range, count
+
+#include <string>
+#include <iterator>
+#include <algorithm>
+#include <utility>
+#include <tr1/unordered_map>
+#include "testsuite_hooks.h"
+
+bool test __attribute__((unused)) = true;
+
+void test01()
+{
+ typedef std::tr1::unordered_map<std::string, int> Map;
+ typedef std::pair<const std::string, int> Pair;
+
+ Map m;
+ VERIFY(m.empty());
+
+ std::pair<Map::iterator, bool> tmp = m.insert(Pair("grape", 3));
+ Map::iterator i = tmp.first;
+ VERIFY(tmp.second);
+
+ Map::iterator i2 = m.find("grape");
+ VERIFY(i2 != m.end());
+ VERIFY(i2 == i);
+ VERIFY(i2->first == "grape");
+ VERIFY(i2->second == 3);
+
+ Map::iterator i3 = m.find("lime");
+ VERIFY(i3 == m.end());
+
+ std::pair<Map::iterator, Map::iterator> p = m.equal_range("grape");
+ VERIFY(std::distance(p.first, p.second) == 1);
+ VERIFY(p.first == i2);
+
+ std::pair<Map::iterator, Map::iterator> p2 = m.equal_range("lime");
+ VERIFY(p2.first == p2.second);
+
+ VERIFY(m.count("grape") == 1);
+ VERIFY(m.count("lime") == 0);
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/tr1/6_containers/unordered_map/insert/24061-map.cc b/libstdc++-v3/testsuite/tr1/6_containers/unordered_map/insert/24061-map.cc
new file mode 100644
index 000000000..808818048
--- /dev/null
+++ b/libstdc++-v3/testsuite/tr1/6_containers/unordered_map/insert/24061-map.cc
@@ -0,0 +1,60 @@
+// 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.4 Class template unordered_map
+
+#include <tr1/unordered_map>
+#include <string>
+#include <testsuite_hooks.h>
+
+// libstdc++/24061
+void test01()
+{
+ bool test __attribute__((unused)) = true;
+
+ typedef std::tr1::unordered_map<std::string, int> Map;
+ typedef Map::iterator iterator;
+ typedef Map::const_iterator const_iterator;
+ typedef Map::value_type value_type;
+
+ Map m1;
+
+ iterator it1 = m1.insert(m1.begin(),
+ value_type("all the love in the world", 1));
+ VERIFY( m1.size() == 1 );
+ VERIFY( *it1 == value_type("all the love in the world", 1) );
+
+ const_iterator cit1(it1);
+ const_iterator cit2 = m1.insert(cit1,
+ value_type("you know what you are?", 2));
+ VERIFY( m1.size() == 2 );
+ VERIFY( cit2 != cit1 );
+ VERIFY( *cit2 == value_type("you know what you are?", 2) );
+
+ iterator it2 = m1.insert(it1, value_type("all the love in the world", 3));
+ VERIFY( m1.size() == 2 );
+ VERIFY( it2 == it1 );
+ VERIFY( *it2 == value_type("all the love in the world", 1) );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/tr1/6_containers/unordered_map/insert/array_syntax.cc b/libstdc++-v3/testsuite/tr1/6_containers/unordered_map/insert/array_syntax.cc
new file mode 100644
index 000000000..e1f894d60
--- /dev/null
+++ b/libstdc++-v3/testsuite/tr1/6_containers/unordered_map/insert/array_syntax.cc
@@ -0,0 +1,60 @@
+// { 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.4 unordered_map
+// Array version of insert
+
+#include <string>
+#include <iterator>
+#include <tr1/unordered_map>
+#include "testsuite_hooks.h"
+
+bool test __attribute__((unused)) = true;
+
+void test01()
+{
+ typedef std::tr1::unordered_map<std::string, int> Map;
+ typedef std::pair<const std::string, int> Pair;
+
+ Map m;
+ VERIFY(m.empty());
+
+ m["red"] = 17;
+ VERIFY(m.size() == 1);
+ VERIFY(m.begin()->first == "red");
+ VERIFY(m.begin()->second == 17);
+ VERIFY(m["red"] == 17);
+
+ m["blue"] = 9;
+ VERIFY(m.size() == 2);
+ VERIFY(m["blue"] == 9);
+
+ m["red"] = 5;
+ VERIFY(m.size() == 2);
+ VERIFY(m["red"] == 5);
+ VERIFY(m["blue"] == 9);
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/tr1/6_containers/unordered_map/insert/map_range.cc b/libstdc++-v3/testsuite/tr1/6_containers/unordered_map/insert/map_range.cc
new file mode 100644
index 000000000..5388a42a4
--- /dev/null
+++ b/libstdc++-v3/testsuite/tr1/6_containers/unordered_map/insert/map_range.cc
@@ -0,0 +1,98 @@
+// { 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.4 unordered_map
+// range insert
+
+#include <string>
+#include <iterator>
+#include <algorithm>
+#include <tr1/unordered_map>
+#include "testsuite_hooks.h"
+
+bool test __attribute__((unused)) = true;
+
+void test01()
+{
+ typedef std::tr1::unordered_map<std::string, int> Map;
+ typedef std::pair<const std::string, int> Pair;
+
+ Map m;
+ VERIFY(m.empty());
+
+ Pair A[5] =
+ {
+ Pair("red", 5),
+ Pair("green", 9),
+ Pair("blue", 3),
+ Pair("cyan", 8),
+ Pair("magenta", 7)
+ };
+
+ m.insert(A+0, A+5);
+ VERIFY(m.size() == 5);
+ VERIFY(std::distance(m.begin(), m.end()) == 5);
+
+ VERIFY(m["red"] == 5);
+ VERIFY(m["green"] == 9);
+ VERIFY(m["blue"] == 3);
+ VERIFY(m["cyan"] == 8);
+ VERIFY(m["magenta"] == 7);
+}
+
+void test02()
+{
+ typedef std::tr1::unordered_map<std::string, int> Map;
+ typedef std::pair<const std::string, int> Pair;
+
+ Map m;
+ VERIFY(m.empty());
+
+ Pair A[9] =
+ {
+ Pair("red", 5),
+ Pair("green", 9),
+ Pair("red", 19),
+ Pair("blue", 3),
+ Pair("blue", 60),
+ Pair("cyan", 8),
+ Pair("magenta", 7),
+ Pair("blue", 99),
+ Pair("green", 33)
+ };
+
+ m.insert(A+0, A+9);
+ VERIFY(m.size() == 5);
+ VERIFY(std::distance(m.begin(), m.end()) == 5);
+
+ VERIFY(m["red"] == 5);
+ VERIFY(m["green"] == 9);
+ VERIFY(m["blue"] == 3);
+ VERIFY(m["cyan"] == 8);
+ VERIFY(m["magenta"] == 7);
+}
+
+int main()
+{
+ test01();
+ test02();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/tr1/6_containers/unordered_map/insert/map_single.cc b/libstdc++-v3/testsuite/tr1/6_containers/unordered_map/insert/map_single.cc
new file mode 100644
index 000000000..023c46caf
--- /dev/null
+++ b/libstdc++-v3/testsuite/tr1/6_containers/unordered_map/insert/map_single.cc
@@ -0,0 +1,73 @@
+// { 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.4 unordered_map
+// Single-element insert
+
+#include <string>
+#include <iterator>
+#include <tr1/unordered_map>
+#include "testsuite_hooks.h"
+
+bool test __attribute__((unused)) = true;
+
+void test01()
+{
+ typedef std::tr1::unordered_map<std::string, int> Map;
+ typedef std::pair<const std::string, int> Pair;
+
+ Map m;
+ VERIFY(m.empty());
+
+ std::pair<Map::iterator, bool> p = m.insert(Pair("abcde", 3));
+ VERIFY(p.second);
+ VERIFY(m.size() == 1);
+ VERIFY(std::distance(m.begin(), m.end()) == 1);
+ VERIFY(p.first == m.begin());
+ VERIFY(p.first->first == "abcde");
+ VERIFY(p.first->second == 3);
+}
+
+void test02()
+{
+ typedef std::tr1::unordered_map<std::string, int> Map;
+ typedef std::pair<const std::string, int> Pair;
+
+ Map m;
+ VERIFY(m.empty());
+
+ std::pair<Map::iterator, bool> p1 = m.insert(Pair("abcde", 3));
+ std::pair<Map::iterator, bool> p2 = m.insert(Pair("abcde", 7));
+
+ VERIFY(p1.second);
+ VERIFY(!p2.second);
+ VERIFY(m.size() == 1);
+ VERIFY(p1.first == p2.first);
+ VERIFY(p1.first->first == "abcde");
+ VERIFY(p2.first->second == 3);
+}
+
+int main()
+{
+ test01();
+ test02();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/tr1/6_containers/unordered_map/requirements/explicit_instantiation.cc b/libstdc++-v3/testsuite/tr1/6_containers/unordered_map/requirements/explicit_instantiation.cc
new file mode 100644
index 000000000..37c15e5ed
--- /dev/null
+++ b/libstdc++-v3/testsuite/tr1/6_containers/unordered_map/requirements/explicit_instantiation.cc
@@ -0,0 +1,42 @@
+// { dg-do compile }
+
+// 2005-02-17 Matt Austern <austern@apple.com>
+//
+// Copyright (C) 2004, 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.4 unordered_map
+
+#include <string>
+#include <tr1/unordered_map>
+
+using namespace std::tr1;
+using std::string;
+using std::allocator;
+using std::pair;
+using std::equal_to;
+
+template class unordered_map<string, float>;
+template class unordered_map<string, int,
+ hash<string>, equal_to<string>,
+ allocator<pair<const string, int> > >;
+template class unordered_map<string, float,
+ hash<string>, equal_to<string>,
+ allocator<char> >;
+template class __unordered_map<string, int,
+ hash<string>, equal_to<string>,
+ allocator<pair<const string, int> >, true>;
diff --git a/libstdc++-v3/testsuite/tr1/6_containers/unordered_map/requirements/iterator_neg.cc b/libstdc++-v3/testsuite/tr1/6_containers/unordered_map/requirements/iterator_neg.cc
new file mode 100644
index 000000000..bc5881242
--- /dev/null
+++ b/libstdc++-v3/testsuite/tr1/6_containers/unordered_map/requirements/iterator_neg.cc
@@ -0,0 +1,40 @@
+// 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_map>
+
+void test01()
+{
+ typedef std::tr1::unordered_map<int, int> Map;
+
+ Map m;
+
+ Map::const_iterator cit = m.begin();
+ (*cit).second = 0; // { dg-error "read-only" }
+
+ Map::const_local_iterator clit = m.begin(0);
+ (*clit).second = 0; // { dg-error "read-only" }
+
+ Map::iterator it = cit; // { dg-error "conversion" }
+
+ Map::local_iterator lit = clit; // { dg-error "conversion" }
+}
diff --git a/libstdc++-v3/testsuite/tr1/6_containers/unordered_map/requirements/iterator_null_neg.cc b/libstdc++-v3/testsuite/tr1/6_containers/unordered_map/requirements/iterator_null_neg.cc
new file mode 100644
index 000000000..882ca3643
--- /dev/null
+++ b/libstdc++-v3/testsuite/tr1/6_containers/unordered_map/requirements/iterator_null_neg.cc
@@ -0,0 +1,28 @@
+// 2005-09-10 Paolo Carlini <pcarlini@suse.de>
+//
+// Copyright (C) 2005, 2009, 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/>.
+//
+
+// { dg-do compile }
+
+// libstdc++/23781
+#include <tr1/unordered_map>
+#include <cstddef>
+
+std::tr1::unordered_map<int, int>::iterator it1 = NULL; // { dg-error "conversion" }
+std::tr1::unordered_map<int, int>::const_iterator cit1 = NULL; // { dg-error "conversion" }
diff --git a/libstdc++-v3/testsuite/tr1/6_containers/unordered_map/requirements/typedefs.cc b/libstdc++-v3/testsuite/tr1/6_containers/unordered_map/requirements/typedefs.cc
new file mode 100644
index 000000000..00bd29053
--- /dev/null
+++ b/libstdc++-v3/testsuite/tr1/6_containers/unordered_map/requirements/typedefs.cc
@@ -0,0 +1,46 @@
+// { 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.4 unordered_map
+
+#include <tr1/unordered_map>
+
+void test01()
+{
+ // Check for required typedefs
+ typedef std::tr1::unordered_map<int, int> test_type;
+
+ typedef test_type::key_type key_type;
+ typedef test_type::value_type value_type;
+ typedef test_type::mapped_type mapped_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_map/swap/1.cc b/libstdc++-v3/testsuite/tr1/6_containers/unordered_map/swap/1.cc
new file mode 100644
index 000000000..64c730d18
--- /dev/null
+++ b/libstdc++-v3/testsuite/tr1/6_containers/unordered_map/swap/1.cc
@@ -0,0 +1,163 @@
+// 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.4 unordered_map::swap
+
+#include <tr1/unordered_map>
+#include <map>
+#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::pair;
+ using std::equal_to;
+ using std::map;
+
+ typedef pair<const char, int> my_pair;
+ typedef __gnu_test::uneq_allocator<my_pair> my_alloc;
+ typedef unordered_map<char, int, hash<char>, equal_to<char>, my_alloc>
+ my_umap;
+
+ 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 map<char, int> my_map;
+ my_map map01_ref;
+ for (size_t i = 0; i < N1; ++i)
+ map01_ref.insert(my_pair(title01[i], i));
+ my_map map02_ref;
+ for (size_t i = 0; i < N2; ++i)
+ map02_ref.insert(my_pair(title02[i], i));
+ my_map map03_ref;
+ for (size_t i = 0; i < N3; ++i)
+ map03_ref.insert(my_pair(title03[i], i));
+ my_map map04_ref;
+ for (size_t i = 0; i < N4; ++i)
+ map04_ref.insert(my_pair(title04[i], i));
+
+ my_umap::size_type size01, size02;
+
+ my_alloc alloc01(1);
+
+ my_umap umap01(10, hash<char>(), equal_to<char>(), alloc01);
+ size01 = umap01.size();
+ my_umap umap02(10, hash<char>(), equal_to<char>(), alloc01);
+ size02 = umap02.size();
+
+ umap01.swap(umap02);
+ VERIFY( umap01.size() == size02 );
+ VERIFY( umap01.empty() );
+ VERIFY( umap02.size() == size01 );
+ VERIFY( umap02.empty() );
+
+ my_umap umap03(10, hash<char>(), equal_to<char>(), alloc01);
+ size01 = umap03.size();
+ my_umap umap04(map02_ref.begin(), map02_ref.end(), 10, hash<char>(),
+ equal_to<char>(), alloc01);
+ size02 = umap04.size();
+
+ umap03.swap(umap04);
+ VERIFY( umap03.size() == size02 );
+ VERIFY( my_map(umap03.begin(), umap03.end()) == map02_ref );
+ VERIFY( umap04.size() == size01 );
+ VERIFY( umap04.empty() );
+
+ my_umap umap05(map01_ref.begin(), map01_ref.end(), 10, hash<char>(),
+ equal_to<char>(), alloc01);
+ size01 = umap05.size();
+ my_umap umap06(map02_ref.begin(), map02_ref.end(), 10, hash<char>(),
+ equal_to<char>(), alloc01);
+ size02 = umap06.size();
+
+ umap05.swap(umap06);
+ VERIFY( umap05.size() == size02 );
+ VERIFY( my_map(umap05.begin(), umap05.end()) == map02_ref );
+ VERIFY( umap06.size() == size01 );
+ VERIFY( my_map(umap06.begin(), umap06.end()) == map01_ref );
+
+ my_umap umap07(map01_ref.begin(), map01_ref.end(), 10, hash<char>(),
+ equal_to<char>(), alloc01);
+ size01 = umap07.size();
+ my_umap umap08(map03_ref.begin(), map03_ref.end(), 10, hash<char>(),
+ equal_to<char>(), alloc01);
+ size02 = umap08.size();
+
+ umap07.swap(umap08);
+ VERIFY( umap07.size() == size02 );
+ VERIFY( my_map(umap07.begin(), umap07.end()) == map03_ref );
+ VERIFY( umap08.size() == size01 );
+ VERIFY( my_map(umap08.begin(), umap08.end()) == map01_ref );
+
+ my_umap umap09(map03_ref.begin(), map03_ref.end(), 10, hash<char>(),
+ equal_to<char>(), alloc01);
+ size01 = umap09.size();
+ my_umap umap10(map04_ref.begin(), map04_ref.end(), 10, hash<char>(),
+ equal_to<char>(), alloc01);
+ size02 = umap10.size();
+
+ umap09.swap(umap10);
+ VERIFY( umap09.size() == size02 );
+ VERIFY( my_map(umap09.begin(), umap09.end()) == map04_ref );
+ VERIFY( umap10.size() == size01 );
+ VERIFY( my_map(umap10.begin(), umap10.end()) == map03_ref );
+
+ my_umap umap11(map04_ref.begin(), map04_ref.end(), 10, hash<char>(),
+ equal_to<char>(), alloc01);
+ size01 = umap11.size();
+ my_umap umap12(map01_ref.begin(), map01_ref.end(), 10, hash<char>(),
+ equal_to<char>(), alloc01);
+ size02 = umap12.size();
+
+ umap11.swap(umap12);
+ VERIFY( umap11.size() == size02 );
+ VERIFY( my_map(umap11.begin(), umap11.end()) == map01_ref );
+ VERIFY( umap12.size() == size01 );
+ VERIFY( my_map(umap12.begin(), umap12.end()) == map04_ref );
+
+ my_umap umap13(map03_ref.begin(), map03_ref.end(), 10, hash<char>(),
+ equal_to<char>(), alloc01);
+ size01 = umap13.size();
+ my_umap umap14(map03_ref.begin(), map03_ref.end(), 10, hash<char>(),
+ equal_to<char>(), alloc01);
+ size02 = umap14.size();
+
+ umap13.swap(umap14);
+ VERIFY( umap13.size() == size02 );
+ VERIFY( my_map(umap13.begin(), umap13.end()) == map03_ref );
+ VERIFY( umap14.size() == size01 );
+ VERIFY( my_map(umap14.begin(), umap14.end()) == map03_ref );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/tr1/6_containers/unordered_map/swap/2.cc b/libstdc++-v3/testsuite/tr1/6_containers/unordered_map/swap/2.cc
new file mode 100644
index 000000000..cac4090c0
--- /dev/null
+++ b/libstdc++-v3/testsuite/tr1/6_containers/unordered_map/swap/2.cc
@@ -0,0 +1,192 @@
+// 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.4 unordered_map::swap
+
+#include <tr1/unordered_map>
+#include <map>
+#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::pair;
+ using std::equal_to;
+ using std::map;
+
+ typedef pair<const char, int> my_pair;
+ typedef __gnu_test::uneq_allocator<my_pair> my_alloc;
+ typedef unordered_map<char, int, hash<char>, equal_to<char>, my_alloc>
+ my_umap;
+
+ 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 map<char, int> my_map;
+ my_map map01_ref;
+ for (size_t i = 0; i < N1; ++i)
+ map01_ref.insert(my_pair(title01[i], i));
+ my_map map02_ref;
+ for (size_t i = 0; i < N2; ++i)
+ map02_ref.insert(my_pair(title02[i], i));
+ my_map map03_ref;
+ for (size_t i = 0; i < N3; ++i)
+ map03_ref.insert(my_pair(title03[i], i));
+ my_map map04_ref;
+ for (size_t i = 0; i < N4; ++i)
+ map04_ref.insert(my_pair(title04[i], i));
+
+ my_umap::size_type size01, size02;
+
+ my_alloc alloc01(1), alloc02(2);
+ int personality01, personality02;
+
+ my_umap umap01(10, hash<char>(), equal_to<char>(), alloc01);
+ size01 = umap01.size();
+ personality01 = umap01.get_allocator().get_personality();
+ my_umap umap02(10, hash<char>(), equal_to<char>(), alloc02);
+ size02 = umap02.size();
+ personality02 = umap02.get_allocator().get_personality();
+
+ umap01.swap(umap02);
+ VERIFY( umap01.size() == size02 );
+ VERIFY( umap01.empty() );
+ VERIFY( umap02.size() == size01 );
+ VERIFY( umap02.empty() );
+ VERIFY( umap01.get_allocator().get_personality() == personality02 );
+ VERIFY( umap02.get_allocator().get_personality() == personality01 );
+
+ my_umap umap03(10, hash<char>(), equal_to<char>(), alloc02);
+ size01 = umap03.size();
+ personality01 = umap03.get_allocator().get_personality();
+ my_umap umap04(map02_ref.begin(), map02_ref.end(), 10, hash<char>(),
+ equal_to<char>(), alloc01);
+ size02 = umap04.size();
+ personality02 = umap04.get_allocator().get_personality();
+
+ umap03.swap(umap04);
+ VERIFY( umap03.size() == size02 );
+ VERIFY( my_map(umap03.begin(), umap03.end()) == map02_ref );
+ VERIFY( umap04.size() == size01 );
+ VERIFY( umap04.empty() );
+ VERIFY( umap03.get_allocator().get_personality() == personality02 );
+ VERIFY( umap04.get_allocator().get_personality() == personality01 );
+
+ my_umap umap05(map01_ref.begin(), map01_ref.end(), 10, hash<char>(),
+ equal_to<char>(), alloc01);
+ size01 = umap05.size();
+ personality01 = umap05.get_allocator().get_personality();
+ my_umap umap06(map02_ref.begin(), map02_ref.end(), 10, hash<char>(),
+ equal_to<char>(), alloc02);
+ size02 = umap06.size();
+ personality02 = umap06.get_allocator().get_personality();
+
+ umap05.swap(umap06);
+ VERIFY( umap05.size() == size02 );
+ VERIFY( my_map(umap05.begin(), umap05.end()) == map02_ref );
+ VERIFY( umap06.size() == size01 );
+ VERIFY( my_map(umap06.begin(), umap06.end()) == map01_ref );
+ VERIFY( umap05.get_allocator().get_personality() == personality02 );
+ VERIFY( umap06.get_allocator().get_personality() == personality01 );
+
+ my_umap umap07(map01_ref.begin(), map01_ref.end(), 10, hash<char>(),
+ equal_to<char>(), alloc02);
+ size01 = umap07.size();
+ personality01 = umap07.get_allocator().get_personality();
+ my_umap umap08(map03_ref.begin(), map03_ref.end(), 10, hash<char>(),
+ equal_to<char>(), alloc01);
+ size02 = umap08.size();
+ personality02 = umap08.get_allocator().get_personality();
+
+ umap07.swap(umap08);
+ VERIFY( umap07.size() == size02 );
+ VERIFY( my_map(umap07.begin(), umap07.end()) == map03_ref );
+ VERIFY( umap08.size() == size01 );
+ VERIFY( my_map(umap08.begin(), umap08.end()) == map01_ref );
+ VERIFY( umap07.get_allocator().get_personality() == personality02 );
+ VERIFY( umap08.get_allocator().get_personality() == personality01 );
+
+ my_umap umap09(map03_ref.begin(), map03_ref.end(), 10, hash<char>(),
+ equal_to<char>(), alloc01);
+ size01 = umap09.size();
+ personality01 = umap09.get_allocator().get_personality();
+ my_umap umap10(map04_ref.begin(), map04_ref.end(), 10, hash<char>(),
+ equal_to<char>(), alloc02);
+ size02 = umap10.size();
+ personality02 = umap10.get_allocator().get_personality();
+
+ umap09.swap(umap10);
+ VERIFY( umap09.size() == size02 );
+ VERIFY( my_map(umap09.begin(), umap09.end()) == map04_ref );
+ VERIFY( umap10.size() == size01 );
+ VERIFY( my_map(umap10.begin(), umap10.end()) == map03_ref );
+ VERIFY( umap09.get_allocator().get_personality() == personality02 );
+ VERIFY( umap10.get_allocator().get_personality() == personality01 );
+
+ my_umap umap11(map04_ref.begin(), map04_ref.end(), 10, hash<char>(),
+ equal_to<char>(), alloc02);
+ size01 = umap11.size();
+ personality01 = umap11.get_allocator().get_personality();
+ my_umap umap12(map01_ref.begin(), map01_ref.end(), 10, hash<char>(),
+ equal_to<char>(), alloc01);
+ size02 = umap12.size();
+ personality02 = umap12.get_allocator().get_personality();
+
+ umap11.swap(umap12);
+ VERIFY( umap11.size() == size02 );
+ VERIFY( my_map(umap11.begin(), umap11.end()) == map01_ref );
+ VERIFY( umap12.size() == size01 );
+ VERIFY( my_map(umap12.begin(), umap12.end()) == map04_ref );
+ VERIFY( umap11.get_allocator().get_personality() == personality02 );
+ VERIFY( umap12.get_allocator().get_personality() == personality01 );
+
+ my_umap umap13(map03_ref.begin(), map03_ref.end(), 10, hash<char>(),
+ equal_to<char>(), alloc01);
+ size01 = umap13.size();
+ personality01 = umap13.get_allocator().get_personality();
+ my_umap umap14(map03_ref.begin(), map03_ref.end(), 10, hash<char>(),
+ equal_to<char>(), alloc02);
+ size02 = umap14.size();
+ personality02 = umap14.get_allocator().get_personality();
+
+ umap13.swap(umap14);
+ VERIFY( umap13.size() == size02 );
+ VERIFY( my_map(umap13.begin(), umap13.end()) == map03_ref );
+ VERIFY( umap14.size() == size01 );
+ VERIFY( my_map(umap14.begin(), umap14.end()) == map03_ref );
+ VERIFY( umap13.get_allocator().get_personality() == personality02 );
+ VERIFY( umap14.get_allocator().get_personality() == personality01 );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/tr1/6_containers/unordered_multimap/capacity/29134-multimap.cc b/libstdc++-v3/testsuite/tr1/6_containers/unordered_multimap/capacity/29134-multimap.cc
new file mode 100644
index 000000000..970593e0d
--- /dev/null
+++ b/libstdc++-v3/testsuite/tr1/6_containers/unordered_multimap/capacity/29134-multimap.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.6 Class template unordered_multimap
+
+#include <tr1/unordered_map>
+#include <testsuite_hooks.h>
+
+// libstdc++/29134
+void test01()
+{
+ bool test __attribute__((unused)) = true;
+
+ std::tr1::unordered_multimap<int, int> umm;
+
+ VERIFY( (umm.max_size() == std::allocator<std::tr1::__detail::_Hash_node<
+ std::pair<const int, int>, false> >().max_size()) );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/tr1/6_containers/unordered_multimap/erase/1.cc b/libstdc++-v3/testsuite/tr1/6_containers/unordered_multimap/erase/1.cc
new file mode 100644
index 000000000..ef2c18e09
--- /dev/null
+++ b/libstdc++-v3/testsuite/tr1/6_containers/unordered_multimap/erase/1.cc
@@ -0,0 +1,130 @@
+// 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.6 Class template unordered_multimap
+
+#include <tr1/unordered_map>
+#include <string>
+#include <testsuite_hooks.h>
+
+// In the occasion of libstdc++/25896
+void test01()
+{
+ bool test __attribute__((unused)) = true;
+
+ typedef std::tr1::unordered_multimap<std::string, int> Mmap;
+ typedef Mmap::iterator iterator;
+ typedef Mmap::const_iterator const_iterator;
+ typedef Mmap::value_type value_type;
+
+ Mmap mm1;
+
+ mm1.insert(value_type("because to why", 1));
+ mm1.insert(value_type("the stockholm syndrome", 2));
+ mm1.insert(value_type("a cereous night", 3));
+ mm1.insert(value_type("eeilo", 4));
+ mm1.insert(value_type("protean", 5));
+ mm1.insert(value_type("the way you are when", 6));
+ mm1.insert(value_type("tillsammans", 7));
+ mm1.insert(value_type("umbra/penumbra", 8));
+ mm1.insert(value_type("belonging (no longer mix)", 9));
+ mm1.insert(value_type("one line behind", 10));
+ VERIFY( mm1.size() == 10 );
+
+ VERIFY( mm1.erase("eeilo") == 1 );
+ VERIFY( mm1.size() == 9 );
+ iterator it1 = mm1.find("eeilo");
+ VERIFY( it1 == mm1.end() );
+
+ VERIFY( mm1.erase("tillsammans") == 1 );
+ VERIFY( mm1.size() == 8 );
+ iterator it2 = mm1.find("tillsammans");
+ VERIFY( it2 == mm1.end() );
+
+ // Must work (see DR 526)
+ iterator it3 = mm1.find("belonging (no longer mix)");
+ VERIFY( it3 != mm1.end() );
+ VERIFY( mm1.erase(it3->first) == 1 );
+ VERIFY( mm1.size() == 7 );
+ it3 = mm1.find("belonging (no longer mix)");
+ VERIFY( it3 == mm1.end() );
+
+ VERIFY( !mm1.erase("abra") );
+ VERIFY( mm1.size() == 7 );
+
+ VERIFY( !mm1.erase("eeilo") );
+ VERIFY( mm1.size() == 7 );
+
+ VERIFY( mm1.erase("because to why") == 1 );
+ VERIFY( mm1.size() == 6 );
+ iterator it4 = mm1.find("because to why");
+ VERIFY( it4 == mm1.end() );
+
+ iterator it5 = mm1.find("umbra/penumbra");
+ iterator it6 = mm1.find("one line behind");
+ VERIFY( it5 != mm1.end() );
+ VERIFY( it6 != mm1.end() );
+
+ VERIFY( mm1.find("the stockholm syndrome") != mm1.end() );
+ VERIFY( mm1.find("a cereous night") != mm1.end() );
+ VERIFY( mm1.find("the way you are when") != mm1.end() );
+ VERIFY( mm1.find("a cereous night") != mm1.end() );
+
+ VERIFY( mm1.erase(it5->first) == 1 );
+ VERIFY( mm1.size() == 5 );
+ it5 = mm1.find("umbra/penumbra");
+ VERIFY( it5 == mm1.end() );
+
+ VERIFY( mm1.erase(it6->first) == 1 );
+ VERIFY( mm1.size() == 4 );
+ it6 = mm1.find("one line behind");
+ VERIFY( it6 == mm1.end() );
+
+ iterator it7 = mm1.begin();
+ iterator it8 = it7;
+ ++it8;
+ iterator it9 = it8;
+ ++it9;
+
+ VERIFY( mm1.erase(it8->first) == 1 );
+ VERIFY( mm1.size() == 3 );
+ VERIFY( ++it7 == it9 );
+
+ iterator it10 = it9;
+ ++it10;
+ iterator it11 = it10;
+
+ VERIFY( mm1.erase(it9->first) == 1 );
+ VERIFY( mm1.size() == 2 );
+ VERIFY( ++it10 == mm1.end() );
+
+ VERIFY( mm1.erase(mm1.begin()) != mm1.end() );
+ VERIFY( mm1.size() == 1 );
+ VERIFY( mm1.begin() == it11 );
+
+ VERIFY( mm1.erase(mm1.begin()->first) == 1 );
+ VERIFY( mm1.size() == 0 );
+ VERIFY( mm1.begin() == mm1.end() );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/tr1/6_containers/unordered_multimap/erase/24061-multimap.cc b/libstdc++-v3/testsuite/tr1/6_containers/unordered_multimap/erase/24061-multimap.cc
new file mode 100644
index 000000000..3a14f26b2
--- /dev/null
+++ b/libstdc++-v3/testsuite/tr1/6_containers/unordered_multimap/erase/24061-multimap.cc
@@ -0,0 +1,108 @@
+// 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.6 Class template unordered_multimap
+
+#include <tr1/unordered_map>
+#include <string>
+#include <testsuite_hooks.h>
+
+// libstdc++/24061
+void test01()
+{
+ bool test __attribute__((unused)) = true;
+
+ typedef std::tr1::unordered_multimap<std::string, int> Mmap;
+ typedef Mmap::iterator iterator;
+ typedef Mmap::const_iterator const_iterator;
+ typedef Mmap::value_type value_type;
+
+ Mmap mm1;
+
+ mm1.insert(value_type("all the love in the world", 1));
+ mm1.insert(value_type("you know what you are?", 2));
+ mm1.insert(value_type("the collector", 3));
+ mm1.insert(value_type("the hand that feeds", 4));
+ mm1.insert(value_type("love is not enough", 5));
+ mm1.insert(value_type("every day is exactly the same", 6));
+ mm1.insert(value_type("with teeth", 7));
+ mm1.insert(value_type("only", 8));
+ mm1.insert(value_type("getting smaller", 9));
+ mm1.insert(value_type("sunspots", 10));
+
+ mm1.insert(value_type("you know what you are?", 5));
+ mm1.insert(value_type("the collector", 6));
+ mm1.insert(value_type("the hand that feeds", 7));
+ VERIFY( mm1.size() == 13 );
+
+ iterator it1 = mm1.begin();
+ ++it1;
+ iterator it2 = it1;
+ ++it2;
+ iterator it3 = mm1.erase(it1);
+ VERIFY( mm1.size() == 12 );
+ VERIFY( it3 == it2 );
+ VERIFY( *it3 == *it2 );
+
+ iterator it4 = mm1.begin();
+ ++it4;
+ ++it4;
+ ++it4;
+ iterator it5 = it4;
+ ++it5;
+ ++it5;
+ iterator it6 = mm1.erase(it4, it5);
+ VERIFY( mm1.size() == 10 );
+ VERIFY( it6 == it5 );
+ VERIFY( *it6 == *it5 );
+
+ const_iterator it7 = mm1.begin();
+ ++it7;
+ ++it7;
+ ++it7;
+ const_iterator it8 = it7;
+ ++it8;
+ const_iterator it9 = mm1.erase(it7);
+ VERIFY( mm1.size() == 9 );
+ VERIFY( it9 == it8 );
+ VERIFY( *it9 == *it8 );
+
+ const_iterator it10 = mm1.begin();
+ ++it10;
+ const_iterator it11 = it10;
+ ++it11;
+ ++it11;
+ ++it11;
+ ++it11;
+ const_iterator it12 = mm1.erase(it10, it11);
+ VERIFY( mm1.size() == 5 );
+ VERIFY( it12 == it11 );
+ VERIFY( *it12 == *it11 );
+
+ iterator it13 = mm1.erase(mm1.begin(), mm1.end());
+ VERIFY( mm1.size() == 0 );
+ VERIFY( it13 == mm1.end() );
+ VERIFY( it13 == mm1.begin() );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/tr1/6_containers/unordered_multimap/find/multimap1.cc b/libstdc++-v3/testsuite/tr1/6_containers/unordered_multimap/find/multimap1.cc
new file mode 100644
index 000000000..c1255c10e
--- /dev/null
+++ b/libstdc++-v3/testsuite/tr1/6_containers/unordered_multimap/find/multimap1.cc
@@ -0,0 +1,84 @@
+// { 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.6 unordered_multimap
+// find, equal_range, count
+
+#include <string>
+#include <iterator>
+#include <algorithm>
+#include <utility>
+#include <tr1/unordered_map>
+#include "testsuite_hooks.h"
+
+bool test __attribute__((unused)) = true;
+
+void test01()
+{
+ typedef std::tr1::unordered_multimap<std::string, int> Map;
+ typedef std::pair<const std::string, int> Pair;
+
+ Map m;
+ VERIFY(m.empty());
+
+ m.insert(Pair("grape", 3));
+ m.insert(Pair("durian", 8));
+ m.insert(Pair("grape", 7));
+
+ Map::iterator i1 = m.find("grape");
+ Map::iterator i2 = m.find("durian");
+ Map::iterator i3 = m.find("kiwi");
+
+ VERIFY(i1 != m.end());
+ VERIFY(i1->first == "grape");
+ VERIFY(i1->second == 3 || i2->second == 7);
+ VERIFY(i2 != m.end());
+ VERIFY(i2->first == "durian");
+ VERIFY(i2->second == 8);
+ VERIFY(i3 == m.end());
+
+ std::pair<Map::iterator, Map::iterator> p1 = m.equal_range("grape");
+ VERIFY(std::distance(p1.first, p1.second) == 2);
+ Map::iterator tmp = p1.first;
+ ++tmp;
+ VERIFY(p1.first->first == "grape");
+ VERIFY(tmp->first == "grape");
+ VERIFY((p1.first->second == 3 && tmp->second == 7) ||
+ (p1.first->second == 7 && tmp->second == 3));
+
+ std::pair<Map::iterator, Map::iterator> p2 = m.equal_range("durian");
+ VERIFY(std::distance(p2.first, p2.second) == 1);
+ VERIFY(p2.first->first == "durian");
+ VERIFY(p2.first->second == 8);
+
+ std::pair<Map::iterator, Map::iterator> p3 = m.equal_range("kiwi");
+ VERIFY(p3.first == p3.second);
+
+ VERIFY(m.count("grape") == 2);
+ VERIFY(m.count("durian") == 1);
+ VERIFY(m.count("kiwi") == 0);
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/tr1/6_containers/unordered_multimap/insert/24061-multimap.cc b/libstdc++-v3/testsuite/tr1/6_containers/unordered_multimap/insert/24061-multimap.cc
new file mode 100644
index 000000000..be3e077d8
--- /dev/null
+++ b/libstdc++-v3/testsuite/tr1/6_containers/unordered_multimap/insert/24061-multimap.cc
@@ -0,0 +1,60 @@
+// 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.6 Class template unordered_multimap
+
+#include <tr1/unordered_map>
+#include <string>
+#include <testsuite_hooks.h>
+
+// libstdc++/24061
+void test01()
+{
+ bool test __attribute__((unused)) = true;
+
+ typedef std::tr1::unordered_multimap<std::string, int> Mmap;
+ typedef Mmap::iterator iterator;
+ typedef Mmap::const_iterator const_iterator;
+ typedef Mmap::value_type value_type;
+
+ Mmap mm1;
+
+ iterator it1 = mm1.insert(mm1.begin(),
+ value_type("all the love in the world", 1));
+ VERIFY( mm1.size() == 1 );
+ VERIFY( *it1 == value_type("all the love in the world", 1) );
+
+ const_iterator cit1(it1);
+ const_iterator cit2 = mm1.insert(cit1,
+ value_type("you know what you are?", 2));
+ VERIFY( mm1.size() == 2 );
+ VERIFY( cit2 != cit1 );
+ VERIFY( *cit2 == value_type("you know what you are?", 2) );
+
+ iterator it2 = mm1.insert(it1, value_type("all the love in the world", 3));
+ VERIFY( mm1.size() == 3 );
+ VERIFY( it2 != it1 );
+ VERIFY( *it2 == value_type("all the love in the world", 3) );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/tr1/6_containers/unordered_multimap/insert/multimap_range.cc b/libstdc++-v3/testsuite/tr1/6_containers/unordered_multimap/insert/multimap_range.cc
new file mode 100644
index 000000000..0c1d1cec4
--- /dev/null
+++ b/libstdc++-v3/testsuite/tr1/6_containers/unordered_multimap/insert/multimap_range.cc
@@ -0,0 +1,92 @@
+// { 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.6 unordered_multimap
+// range insert
+
+#include <string>
+#include <iterator>
+#include <algorithm>
+#include <tr1/unordered_map>
+#include "testsuite_hooks.h"
+
+bool test __attribute__((unused)) = true;
+
+void test01()
+{
+ typedef std::tr1::unordered_multimap<std::string, int> Map;
+ typedef std::pair<const std::string, int> Pair;
+
+ Map m;
+ VERIFY(m.empty());
+
+ Pair A[5] =
+ {
+ Pair("red", 5),
+ Pair("green", 9),
+ Pair("blue", 3),
+ Pair("cyan", 8),
+ Pair("magenta", 7)
+ };
+
+ m.insert(A+0, A+5);
+ VERIFY(m.size() == 5);
+ VERIFY(std::distance(m.begin(), m.end()) == 5);
+
+ for (int i = 0; i < 5; ++i)
+ VERIFY(std::find(m.begin(), m.end(), A[i]) != m.end());
+}
+
+void test02()
+{
+ typedef std::tr1::unordered_multimap<std::string, int> Map;
+ typedef std::pair<const std::string, int> Pair;
+
+ Map m;
+ VERIFY(m.empty());
+
+ Pair A[9] =
+ {
+ Pair("red", 5),
+ Pair("green", 9),
+ Pair("red", 19),
+ Pair("blue", 3),
+ Pair("blue", 60),
+ Pair("cyan", 8),
+ Pair("magenta", 7),
+ Pair("blue", 99),
+ Pair("green", 33)
+ };
+
+ m.insert(A+0, A+9);
+ VERIFY(m.size() == 9);
+ VERIFY(std::distance(m.begin(), m.end()) == 9);
+
+ for (int i = 0; i < 9; ++i)
+ VERIFY(std::find(m.begin(), m.end(), A[i]) != m.end());
+}
+
+int main()
+{
+ test01();
+ test02();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/tr1/6_containers/unordered_multimap/insert/multimap_single.cc b/libstdc++-v3/testsuite/tr1/6_containers/unordered_multimap/insert/multimap_single.cc
new file mode 100644
index 000000000..f4e1ab968
--- /dev/null
+++ b/libstdc++-v3/testsuite/tr1/6_containers/unordered_multimap/insert/multimap_single.cc
@@ -0,0 +1,77 @@
+// { 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.6 unordered_multimap
+// Single-element insert
+
+#include <string>
+#include <iterator>
+#include <tr1/unordered_map>
+#include "testsuite_hooks.h"
+
+bool test __attribute__((unused)) = true;
+
+void test01()
+{
+ typedef std::tr1::unordered_multimap<std::string, int> Map;
+ typedef std::pair<const std::string, int> Pair;
+
+ Map m;
+ VERIFY(m.empty());
+
+ Map::iterator i = m.insert(Pair("abcde", 3));
+ VERIFY(m.size() == 1);
+ VERIFY(std::distance(m.begin(), m.end()) == 1);
+ VERIFY(i == m.begin());
+ VERIFY(i->first == "abcde");
+ VERIFY(i->second == 3);
+}
+
+void test02()
+{
+ typedef std::tr1::unordered_multimap<std::string, int> Map;
+ typedef std::pair<const std::string, int> Pair;
+
+ Map m;
+ VERIFY(m.empty());
+
+ m.insert(Pair("abcde", 3));
+ m.insert(Pair("abcde", 7));
+
+ VERIFY(m.size() == 2);
+ VERIFY(std::distance(m.begin(), m.end()) == 2);
+
+ Map::iterator i1 = m.begin();
+ Map::iterator i2 = i1;
+ ++i2;
+
+ VERIFY(i1->first == "abcde");
+ VERIFY(i2->first == "abcde");
+ VERIFY((i1->second == 3 && i2->second == 7) ||
+ (i1->second == 7 && i2->second == 3));
+}
+
+int main()
+{
+ test01();
+ test02();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/tr1/6_containers/unordered_multimap/requirements/explicit_instantiation.cc b/libstdc++-v3/testsuite/tr1/6_containers/unordered_multimap/requirements/explicit_instantiation.cc
new file mode 100644
index 000000000..0eec033ce
--- /dev/null
+++ b/libstdc++-v3/testsuite/tr1/6_containers/unordered_multimap/requirements/explicit_instantiation.cc
@@ -0,0 +1,42 @@
+// { 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.6 unordered_multimap
+
+#include <string>
+#include <tr1/unordered_map>
+
+using namespace std::tr1;
+using std::string;
+using std::equal_to;
+using std::allocator;
+using std::pair;
+
+template class unordered_multimap<string, float>;
+template class unordered_multimap<string, int,
+ hash<string>, equal_to<string>,
+ allocator<pair<const string, int> > >;
+template class unordered_multimap<string, float,
+ hash<string>, equal_to<string>,
+ allocator<char> >;
+template class __unordered_multimap<string, int,
+ hash<string>, equal_to<string>,
+ allocator<pair<const string, int> >, true>;
diff --git a/libstdc++-v3/testsuite/tr1/6_containers/unordered_multimap/requirements/iterator_neg.cc b/libstdc++-v3/testsuite/tr1/6_containers/unordered_multimap/requirements/iterator_neg.cc
new file mode 100644
index 000000000..fb0db99cf
--- /dev/null
+++ b/libstdc++-v3/testsuite/tr1/6_containers/unordered_multimap/requirements/iterator_neg.cc
@@ -0,0 +1,40 @@
+// 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_map>
+
+void test01()
+{
+ typedef std::tr1::unordered_multimap<int, int> Mmap;
+
+ Mmap mm;
+
+ Mmap::const_iterator cit = mm.begin();
+ (*cit).second = 0; // { dg-error "read-only" }
+
+ Mmap::const_local_iterator clit = mm.begin(0);
+ (*clit).second = 0; // { dg-error "read-only" }
+
+ Mmap::iterator it = cit; // { dg-error "conversion" }
+
+ Mmap::local_iterator lit = clit; // { dg-error "conversion" }
+}
diff --git a/libstdc++-v3/testsuite/tr1/6_containers/unordered_multimap/requirements/iterator_null_neg.cc b/libstdc++-v3/testsuite/tr1/6_containers/unordered_multimap/requirements/iterator_null_neg.cc
new file mode 100644
index 000000000..1709816c3
--- /dev/null
+++ b/libstdc++-v3/testsuite/tr1/6_containers/unordered_multimap/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_map>
+#include <cstddef>
+
+std::tr1::unordered_multimap<int, int>::iterator it2 = NULL; // { dg-error "conversion" }
+std::tr1::unordered_multimap<int, int>::const_iterator cit2 = NULL; // { dg-error "conversion" }
diff --git a/libstdc++-v3/testsuite/tr1/6_containers/unordered_multimap/requirements/typedefs.cc b/libstdc++-v3/testsuite/tr1/6_containers/unordered_multimap/requirements/typedefs.cc
new file mode 100644
index 000000000..54ae610e6
--- /dev/null
+++ b/libstdc++-v3/testsuite/tr1/6_containers/unordered_multimap/requirements/typedefs.cc
@@ -0,0 +1,46 @@
+// { 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.6 unordered_multimap
+
+#include <tr1/unordered_map>
+
+void test01()
+{
+ // Check for required typedefs
+ typedef std::tr1::unordered_multimap<int, int> test_type;
+
+ typedef test_type::key_type key_type;
+ typedef test_type::value_type value_type;
+ typedef test_type::mapped_type mapped_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_multimap/swap/1.cc b/libstdc++-v3/testsuite/tr1/6_containers/unordered_multimap/swap/1.cc
new file mode 100644
index 000000000..590e85ec8
--- /dev/null
+++ b/libstdc++-v3/testsuite/tr1/6_containers/unordered_multimap/swap/1.cc
@@ -0,0 +1,177 @@
+// 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.6 unordered_multimap::swap
+
+#include <tr1/unordered_map>
+#include <map>
+#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::pair;
+ using std::equal_to;
+ using std::map;
+ using std::multimap;
+
+ typedef pair<const char, int> my_pair;
+ typedef __gnu_test::uneq_allocator<my_pair> my_alloc;
+ typedef unordered_multimap<char, int, hash<char>, equal_to<char>, my_alloc>
+ my_ummap;
+
+ 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 multimap<char, int> my_mmap;
+ my_mmap mmap01_ref;
+ for (size_t i = 0; i < N1; ++i)
+ mmap01_ref.insert(my_pair(title01[i], i));
+ my_mmap mmap02_ref;
+ for (size_t i = 0; i < N2; ++i)
+ mmap02_ref.insert(my_pair(title02[i], i));
+ my_mmap mmap03_ref;
+ for (size_t i = 0; i < N3; ++i)
+ mmap03_ref.insert(my_pair(title03[i], i));
+ my_mmap mmap04_ref;
+ for (size_t i = 0; i < N4; ++i)
+ mmap04_ref.insert(my_pair(title04[i], i));
+
+ typedef map<char, int> my_map;
+
+ my_ummap::size_type size01, size02;
+
+ my_alloc alloc01(1);
+
+ my_ummap ummap01(10, hash<char>(), equal_to<char>(), alloc01);
+ size01 = ummap01.size();
+ my_ummap ummap02(10, hash<char>(), equal_to<char>(), alloc01);
+ size02 = ummap02.size();
+
+ ummap01.swap(ummap02);
+ VERIFY( ummap01.size() == size02 );
+ VERIFY( ummap01.empty() );
+ VERIFY( ummap02.size() == size01 );
+ VERIFY( ummap02.empty() );
+
+ my_ummap ummap03(10, hash<char>(), equal_to<char>(), alloc01);
+ size01 = ummap03.size();
+ my_ummap ummap04(mmap02_ref.begin(), mmap02_ref.end(), 10, hash<char>(),
+ equal_to<char>(), alloc01);
+ size02 = ummap04.size();
+
+ ummap03.swap(ummap04);
+ VERIFY( ummap03.size() == size02 );
+ VERIFY( my_map(ummap03.begin(), ummap03.end())
+ == my_map(mmap02_ref.begin(), mmap02_ref.end()) );
+ VERIFY( ummap04.size() == size01 );
+ VERIFY( ummap04.empty() );
+
+ my_ummap ummap05(mmap01_ref.begin(), mmap01_ref.end(), 10, hash<char>(),
+ equal_to<char>(), alloc01);
+ size01 = ummap05.size();
+ my_ummap ummap06(mmap02_ref.begin(), mmap02_ref.end(), 10, hash<char>(),
+ equal_to<char>(), alloc01);
+ size02 = ummap06.size();
+
+ ummap05.swap(ummap06);
+ VERIFY( ummap05.size() == size02 );
+ VERIFY( my_map(ummap05.begin(), ummap05.end())
+ == my_map(mmap02_ref.begin(), mmap02_ref.end()) );
+ VERIFY( ummap06.size() == size01 );
+ VERIFY( my_map(ummap06.begin(), ummap06.end())
+ == my_map(mmap01_ref.begin(), mmap01_ref.end()) );
+
+ my_ummap ummap07(mmap01_ref.begin(), mmap01_ref.end(), 10, hash<char>(),
+ equal_to<char>(), alloc01);
+ size01 = ummap07.size();
+ my_ummap ummap08(mmap03_ref.begin(), mmap03_ref.end(), 10, hash<char>(),
+ equal_to<char>(), alloc01);
+ size02 = ummap08.size();
+
+ ummap07.swap(ummap08);
+ VERIFY( ummap07.size() == size02 );
+ VERIFY( my_map(ummap07.begin(), ummap07.end())
+ == my_map(mmap03_ref.begin(), mmap03_ref.end()) );
+ VERIFY( ummap08.size() == size01 );
+ VERIFY( my_map(ummap08.begin(), ummap08.end())
+ == my_map(mmap01_ref.begin(), mmap01_ref.end()) );
+
+ my_ummap ummap09(mmap03_ref.begin(), mmap03_ref.end(), 10, hash<char>(),
+ equal_to<char>(), alloc01);
+ size01 = ummap09.size();
+ my_ummap ummap10(mmap04_ref.begin(), mmap04_ref.end(), 10, hash<char>(),
+ equal_to<char>(), alloc01);
+ size02 = ummap10.size();
+
+ ummap09.swap(ummap10);
+ VERIFY( ummap09.size() == size02 );
+ VERIFY( my_map(ummap09.begin(), ummap09.end())
+ == my_map(mmap04_ref.begin(), mmap04_ref.end()) );
+ VERIFY( ummap10.size() == size01 );
+ VERIFY( my_map(ummap10.begin(), ummap10.end())
+ == my_map(mmap03_ref.begin(), mmap03_ref.end()) );
+
+ my_ummap ummap11(mmap04_ref.begin(), mmap04_ref.end(), 10, hash<char>(),
+ equal_to<char>(), alloc01);
+ size01 = ummap11.size();
+ my_ummap ummap12(mmap01_ref.begin(), mmap01_ref.end(), 10, hash<char>(),
+ equal_to<char>(), alloc01);
+ size02 = ummap12.size();
+
+ ummap11.swap(ummap12);
+ VERIFY( ummap11.size() == size02 );
+ VERIFY( my_map(ummap11.begin(), ummap11.end())
+ == my_map(mmap01_ref.begin(), mmap01_ref.end()) );
+ VERIFY( ummap12.size() == size01 );
+ VERIFY( my_map(ummap12.begin(), ummap12.end())
+ == my_map(mmap04_ref.begin(), mmap04_ref.end()) );
+
+ my_ummap ummap13(mmap03_ref.begin(), mmap03_ref.end(), 10, hash<char>(),
+ equal_to<char>(), alloc01);
+ size01 = ummap13.size();
+ my_ummap ummap14(mmap03_ref.begin(), mmap03_ref.end(), 10, hash<char>(),
+ equal_to<char>(), alloc01);
+ size02 = ummap14.size();
+
+ ummap13.swap(ummap14);
+ VERIFY( ummap13.size() == size02 );
+ VERIFY( my_map(ummap13.begin(), ummap13.end())
+ == my_map(mmap03_ref.begin(), mmap03_ref.end()) );
+ VERIFY( ummap14.size() == size01 );
+ VERIFY( my_map(ummap14.begin(), ummap14.end())
+ == my_map(mmap03_ref.begin(), mmap03_ref.end()) );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/tr1/6_containers/unordered_multimap/swap/2.cc b/libstdc++-v3/testsuite/tr1/6_containers/unordered_multimap/swap/2.cc
new file mode 100644
index 000000000..56528b820
--- /dev/null
+++ b/libstdc++-v3/testsuite/tr1/6_containers/unordered_multimap/swap/2.cc
@@ -0,0 +1,206 @@
+// 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.6 unordered_multimap::swap
+
+#include <tr1/unordered_map>
+#include <map>
+#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::pair;
+ using std::equal_to;
+ using std::map;
+ using std::multimap;
+
+ typedef pair<const char, int> my_pair;
+ typedef __gnu_test::uneq_allocator<my_pair> my_alloc;
+ typedef unordered_multimap<char, int, hash<char>, equal_to<char>, my_alloc>
+ my_ummap;
+
+ 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 multimap<char, int> my_mmap;
+ my_mmap mmap01_ref;
+ for (size_t i = 0; i < N1; ++i)
+ mmap01_ref.insert(my_pair(title01[i], i));
+ my_mmap mmap02_ref;
+ for (size_t i = 0; i < N2; ++i)
+ mmap02_ref.insert(my_pair(title02[i], i));
+ my_mmap mmap03_ref;
+ for (size_t i = 0; i < N3; ++i)
+ mmap03_ref.insert(my_pair(title03[i], i));
+ my_mmap mmap04_ref;
+ for (size_t i = 0; i < N4; ++i)
+ mmap04_ref.insert(my_pair(title04[i], i));
+
+ typedef map<char, int> my_map;
+
+ my_ummap::size_type size01, size02;
+
+ my_alloc alloc01(1), alloc02(2);
+ int personality01, personality02;
+
+ my_ummap ummap01(10, hash<char>(), equal_to<char>(), alloc01);
+ size01 = ummap01.size();
+ personality01 = ummap01.get_allocator().get_personality();
+ my_ummap ummap02(10, hash<char>(), equal_to<char>(), alloc02);
+ size02 = ummap02.size();
+ personality02 = ummap02.get_allocator().get_personality();
+
+ ummap01.swap(ummap02);
+ VERIFY( ummap01.size() == size02 );
+ VERIFY( ummap01.empty() );
+ VERIFY( ummap02.size() == size01 );
+ VERIFY( ummap02.empty() );
+ VERIFY( ummap01.get_allocator().get_personality() == personality02 );
+ VERIFY( ummap02.get_allocator().get_personality() == personality01 );
+
+ my_ummap ummap03(10, hash<char>(), equal_to<char>(), alloc02);
+ size01 = ummap03.size();
+ personality01 = ummap03.get_allocator().get_personality();
+ my_ummap ummap04(mmap02_ref.begin(), mmap02_ref.end(), 10, hash<char>(),
+ equal_to<char>(), alloc01);
+ size02 = ummap04.size();
+ personality02 = ummap04.get_allocator().get_personality();
+
+ ummap03.swap(ummap04);
+ VERIFY( ummap03.size() == size02 );
+ VERIFY( my_map(ummap03.begin(), ummap03.end())
+ == my_map(mmap02_ref.begin(), mmap02_ref.end()) );
+ VERIFY( ummap04.size() == size01 );
+ VERIFY( ummap04.empty() );
+ VERIFY( ummap03.get_allocator().get_personality() == personality02 );
+ VERIFY( ummap04.get_allocator().get_personality() == personality01 );
+
+ my_ummap ummap05(mmap01_ref.begin(), mmap01_ref.end(), 10, hash<char>(),
+ equal_to<char>(), alloc01);
+ size01 = ummap05.size();
+ personality01 = ummap05.get_allocator().get_personality();
+ my_ummap ummap06(mmap02_ref.begin(), mmap02_ref.end(), 10, hash<char>(),
+ equal_to<char>(), alloc02);
+ size02 = ummap06.size();
+ personality02 = ummap06.get_allocator().get_personality();
+
+ ummap05.swap(ummap06);
+ VERIFY( ummap05.size() == size02 );
+ VERIFY( my_map(ummap05.begin(), ummap05.end())
+ == my_map(mmap02_ref.begin(), mmap02_ref.end()) );
+ VERIFY( ummap06.size() == size01 );
+ VERIFY( my_map(ummap06.begin(), ummap06.end())
+ == my_map(mmap01_ref.begin(), mmap01_ref.end()) );
+ VERIFY( ummap05.get_allocator().get_personality() == personality02 );
+ VERIFY( ummap06.get_allocator().get_personality() == personality01 );
+
+ my_ummap ummap07(mmap01_ref.begin(), mmap01_ref.end(), 10, hash<char>(),
+ equal_to<char>(), alloc02);
+ size01 = ummap07.size();
+ personality01 = ummap07.get_allocator().get_personality();
+ my_ummap ummap08(mmap03_ref.begin(), mmap03_ref.end(), 10, hash<char>(),
+ equal_to<char>(), alloc01);
+ size02 = ummap08.size();
+ personality02 = ummap08.get_allocator().get_personality();
+
+ ummap07.swap(ummap08);
+ VERIFY( ummap07.size() == size02 );
+ VERIFY( my_map(ummap07.begin(), ummap07.end())
+ == my_map(mmap03_ref.begin(), mmap03_ref.end()) );
+ VERIFY( ummap08.size() == size01 );
+ VERIFY( my_map(ummap08.begin(), ummap08.end())
+ == my_map(mmap01_ref.begin(), mmap01_ref.end()) );
+ VERIFY( ummap07.get_allocator().get_personality() == personality02 );
+ VERIFY( ummap08.get_allocator().get_personality() == personality01 );
+
+ my_ummap ummap09(mmap03_ref.begin(), mmap03_ref.end(), 10, hash<char>(),
+ equal_to<char>(), alloc01);
+ size01 = ummap09.size();
+ personality01 = ummap09.get_allocator().get_personality();
+ my_ummap ummap10(mmap04_ref.begin(), mmap04_ref.end(), 10, hash<char>(),
+ equal_to<char>(), alloc02);
+ size02 = ummap10.size();
+ personality02 = ummap10.get_allocator().get_personality();
+
+ ummap09.swap(ummap10);
+ VERIFY( ummap09.size() == size02 );
+ VERIFY( my_map(ummap09.begin(), ummap09.end())
+ == my_map(mmap04_ref.begin(), mmap04_ref.end()) );
+ VERIFY( ummap10.size() == size01 );
+ VERIFY( my_map(ummap10.begin(), ummap10.end())
+ == my_map(mmap03_ref.begin(), mmap03_ref.end()) );
+ VERIFY( ummap09.get_allocator().get_personality() == personality02 );
+ VERIFY( ummap10.get_allocator().get_personality() == personality01 );
+
+ my_ummap ummap11(mmap04_ref.begin(), mmap04_ref.end(), 10, hash<char>(),
+ equal_to<char>(), alloc02);
+ size01 = ummap11.size();
+ personality01 = ummap11.get_allocator().get_personality();
+ my_ummap ummap12(mmap01_ref.begin(), mmap01_ref.end(), 10, hash<char>(),
+ equal_to<char>(), alloc01);
+ size02 = ummap12.size();
+ personality02 = ummap12.get_allocator().get_personality();
+
+ ummap11.swap(ummap12);
+ VERIFY( ummap11.size() == size02 );
+ VERIFY( my_map(ummap11.begin(), ummap11.end())
+ == my_map(mmap01_ref.begin(), mmap01_ref.end()) );
+ VERIFY( ummap12.size() == size01 );
+ VERIFY( my_map(ummap12.begin(), ummap12.end())
+ == my_map(mmap04_ref.begin(), mmap04_ref.end()) );
+ VERIFY( ummap11.get_allocator().get_personality() == personality02 );
+ VERIFY( ummap12.get_allocator().get_personality() == personality01 );
+
+ my_ummap ummap13(mmap03_ref.begin(), mmap03_ref.end(), 10, hash<char>(),
+ equal_to<char>(), alloc01);
+ size01 = ummap13.size();
+ personality01 = ummap13.get_allocator().get_personality();
+ my_ummap ummap14(mmap03_ref.begin(), mmap03_ref.end(), 10, hash<char>(),
+ equal_to<char>(), alloc02);
+ size02 = ummap14.size();
+ personality02 = ummap14.get_allocator().get_personality();
+
+ ummap13.swap(ummap14);
+ VERIFY( ummap13.size() == size02 );
+ VERIFY( my_map(ummap13.begin(), ummap13.end())
+ == my_map(mmap03_ref.begin(), mmap03_ref.end()) );
+ VERIFY( ummap14.size() == size01 );
+ VERIFY( my_map(ummap14.begin(), ummap14.end())
+ == my_map(mmap03_ref.begin(), mmap03_ref.end()) );
+ VERIFY( ummap13.get_allocator().get_personality() == personality02 );
+ VERIFY( ummap14.get_allocator().get_personality() == personality01 );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
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;
+}
diff --git a/libstdc++-v3/testsuite/tr1/6_containers/unordered_set/23053.cc b/libstdc++-v3/testsuite/tr1/6_containers/unordered_set/23053.cc
new file mode 100644
index 000000000..b828c2799
--- /dev/null
+++ b/libstdc++-v3/testsuite/tr1/6_containers/unordered_set/23053.cc
@@ -0,0 +1,38 @@
+// { dg-do compile }
+
+// 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>
+
+// libstdc++/23053
+void test01()
+{
+ std::tr1::unordered_set<int> s;
+
+ const std::tr1::unordered_set<int> &s_ref = s;
+
+ s_ref.find(27);
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/tr1/6_containers/unordered_set/23465.cc b/libstdc++-v3/testsuite/tr1/6_containers/unordered_set/23465.cc
new file mode 100644
index 000000000..19bc2ff5b
--- /dev/null
+++ b/libstdc++-v3/testsuite/tr1/6_containers/unordered_set/23465.cc
@@ -0,0 +1,63 @@
+// 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 <testsuite_hooks.h>
+
+// libstdc++/23465
+void test01()
+{
+ bool test __attribute__((unused)) = true;
+
+ for (float lf = 0.1; lf < 101.0; lf *= 10.0)
+ for (int size = 1; size <= 6561; size *= 3)
+ {
+ std::tr1::unordered_set<int> us1, us2;
+ typedef std::tr1::unordered_set<int>::local_iterator local_iterator;
+ typedef std::tr1::unordered_set<int>::size_type size_type;
+
+ us1.max_load_factor(lf);
+
+ for (int i = 0; i < size; ++i)
+ us1.insert(i);
+
+ us2 = us1;
+
+ VERIFY( us2.size() == us1.size() );
+ VERIFY( us2.bucket_count() == us1.bucket_count() );
+
+ for (size_type b = 0; b < us1.bucket_count(); ++b)
+ {
+ size_type cnt = 0;
+ for (local_iterator it1 = us1.begin(b), it2 = us2.begin(b);
+ it1 != us1.end(b) && it2 != us2.end(b); ++it1, ++it2)
+ {
+ VERIFY( *it1 == *it2 );
+ ++cnt;
+ }
+ VERIFY( cnt == us1.bucket_size(b) );
+ }
+ }
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/tr1/6_containers/unordered_set/26127.cc b/libstdc++-v3/testsuite/tr1/6_containers/unordered_set/26127.cc
new file mode 100644
index 000000000..435418608
--- /dev/null
+++ b/libstdc++-v3/testsuite/tr1/6_containers/unordered_set/26127.cc
@@ -0,0 +1,38 @@
+// { dg-do compile }
+
+// Copyright (C) 2006, 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>
+
+// libstdc++/26127
+void test01()
+{
+ std::tr1::unordered_set<int> s;
+
+ s.bucket(42);
+ s.key_eq();
+ s.max_load_factor();
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/tr1/6_containers/unordered_set/26132.cc b/libstdc++-v3/testsuite/tr1/6_containers/unordered_set/26132.cc
new file mode 100644
index 000000000..8fd846410
--- /dev/null
+++ b/libstdc++-v3/testsuite/tr1/6_containers/unordered_set/26132.cc
@@ -0,0 +1,57 @@
+// 2006-02-22 Paolo Carlini <pcarlini@suse.de>
+//
+// Copyright (C) 2006, 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 <testsuite_hooks.h>
+
+// libstdc++/26132
+void test01()
+{
+ bool test __attribute__((unused)) = true;
+
+ for (float lf = 1.0; lf < 101.0; lf *= 10.0)
+ for (int size = 1; size <= 6561; size *= 3)
+ {
+ std::tr1::unordered_set<int> us1;
+ typedef std::tr1::unordered_set<int>::size_type size_type;
+
+ us1.max_load_factor(10.0);
+
+ for (int i = 0; i < size; ++i)
+ us1.insert(i);
+
+ us1.max_load_factor(lf);
+
+ for (int i = 1; i <= 6561; i *= 81)
+ {
+ const size_type n = size * 81 / i;
+ us1.rehash(n);
+ VERIFY( us1.bucket_count() > us1.size() / us1.max_load_factor() );
+ VERIFY( us1.bucket_count() >= n );
+ }
+ }
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/tr1/6_containers/unordered_set/capacity/29134-set.cc b/libstdc++-v3/testsuite/tr1/6_containers/unordered_set/capacity/29134-set.cc
new file mode 100644
index 000000000..63abcd41e
--- /dev/null
+++ b/libstdc++-v3/testsuite/tr1/6_containers/unordered_set/capacity/29134-set.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.3 Class template unordered_set
+
+#include <tr1/unordered_set>
+#include <testsuite_hooks.h>
+
+// libstdc++/29134
+void test01()
+{
+ bool test __attribute__((unused)) = true;
+
+ std::tr1::unordered_set<int> us;
+
+ VERIFY( (us.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_set/erase/1.cc b/libstdc++-v3/testsuite/tr1/6_containers/unordered_set/erase/1.cc
new file mode 100644
index 000000000..5eebef314
--- /dev/null
+++ b/libstdc++-v3/testsuite/tr1/6_containers/unordered_set/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.3 Class template unordered_set
+
+#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_set<std::string> Set;
+ typedef Set::iterator iterator;
+ typedef Set::const_iterator const_iterator;
+
+ Set s1;
+
+ s1.insert("because to why");
+ s1.insert("the stockholm syndrome");
+ s1.insert("a cereous night");
+ s1.insert("eeilo");
+ s1.insert("protean");
+ s1.insert("the way you are when");
+ s1.insert("tillsammans");
+ s1.insert("umbra/penumbra");
+ s1.insert("belonging (no longer mix)");
+ s1.insert("one line behind");
+ VERIFY( s1.size() == 10 );
+
+ VERIFY( s1.erase("eeilo") == 1 );
+ VERIFY( s1.size() == 9 );
+ iterator it1 = s1.find("eeilo");
+ VERIFY( it1 == s1.end() );
+
+ VERIFY( s1.erase("tillsammans") == 1 );
+ VERIFY( s1.size() == 8 );
+ iterator it2 = s1.find("tillsammans");
+ VERIFY( it2 == s1.end() );
+
+ // Must work (see DR 526)
+ iterator it3 = s1.find("belonging (no longer mix)");
+ VERIFY( it3 != s1.end() );
+ VERIFY( s1.erase(*it3) == 1 );
+ VERIFY( s1.size() == 7 );
+ it3 = s1.find("belonging (no longer mix)");
+ VERIFY( it3 == s1.end() );
+
+ VERIFY( !s1.erase("abra") );
+ VERIFY( s1.size() == 7 );
+
+ VERIFY( !s1.erase("eeilo") );
+ VERIFY( s1.size() == 7 );
+
+ VERIFY( s1.erase("because to why") == 1 );
+ VERIFY( s1.size() == 6 );
+ iterator it4 = s1.find("because to why");
+ VERIFY( it4 == s1.end() );
+
+ iterator it5 = s1.find("umbra/penumbra");
+ iterator it6 = s1.find("one line behind");
+ VERIFY( it5 != s1.end() );
+ VERIFY( it6 != s1.end() );
+
+ VERIFY( s1.find("the stockholm syndrome") != s1.end() );
+ VERIFY( s1.find("a cereous night") != s1.end() );
+ VERIFY( s1.find("the way you are when") != s1.end() );
+ VERIFY( s1.find("a cereous night") != s1.end() );
+
+ VERIFY( s1.erase(*it5) == 1 );
+ VERIFY( s1.size() == 5 );
+ it5 = s1.find("umbra/penumbra");
+ VERIFY( it5 == s1.end() );
+
+ VERIFY( s1.erase(*it6) == 1 );
+ VERIFY( s1.size() == 4 );
+ it6 = s1.find("one line behind");
+ VERIFY( it6 == s1.end() );
+
+ iterator it7 = s1.begin();
+ iterator it8 = it7;
+ ++it8;
+ iterator it9 = it8;
+ ++it9;
+
+ VERIFY( s1.erase(*it8) == 1 );
+ VERIFY( s1.size() == 3 );
+ VERIFY( ++it7 == it9 );
+
+ iterator it10 = it9;
+ ++it10;
+ iterator it11 = it10;
+
+ VERIFY( s1.erase(*it9) == 1 );
+ VERIFY( s1.size() == 2 );
+ VERIFY( ++it10 == s1.end() );
+
+ VERIFY( s1.erase(s1.begin()) != s1.end() );
+ VERIFY( s1.size() == 1 );
+ VERIFY( s1.begin() == it11 );
+
+ VERIFY( s1.erase(*s1.begin()) == 1 );
+ VERIFY( s1.size() == 0 );
+ VERIFY( s1.begin() == s1.end() );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/tr1/6_containers/unordered_set/erase/24061-set.cc b/libstdc++-v3/testsuite/tr1/6_containers/unordered_set/erase/24061-set.cc
new file mode 100644
index 000000000..8ff3cad55
--- /dev/null
+++ b/libstdc++-v3/testsuite/tr1/6_containers/unordered_set/erase/24061-set.cc
@@ -0,0 +1,104 @@
+// 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.3 Class template unordered_set
+
+#include <tr1/unordered_set>
+#include <string>
+#include <testsuite_hooks.h>
+
+// libstdc++/24061
+void test01()
+{
+ bool test __attribute__((unused)) = true;
+
+ typedef std::tr1::unordered_set<std::string> Set;
+ typedef Set::iterator iterator;
+ typedef Set::const_iterator const_iterator;
+
+ Set s1;
+
+ s1.insert("all the love in the world");
+ s1.insert("you know what you are?");
+ s1.insert("the collector");
+ s1.insert("the hand that feeds");
+ s1.insert("love is not enough");
+ s1.insert("every day is exactly the same");
+ s1.insert("with teeth");
+ s1.insert("only");
+ s1.insert("getting smaller");
+ s1.insert("sunspots");
+ VERIFY( s1.size() == 10 );
+
+ iterator it1 = s1.begin();
+ ++it1;
+ iterator it2 = it1;
+ ++it2;
+ iterator it3 = s1.erase(it1);
+ VERIFY( s1.size() == 9 );
+ VERIFY( it3 == it2 );
+ VERIFY( *it3 == *it2 );
+
+ iterator it4 = s1.begin();
+ ++it4;
+ ++it4;
+ ++it4;
+ iterator it5 = it4;
+ ++it5;
+ ++it5;
+ iterator it6 = s1.erase(it4, it5);
+ VERIFY( s1.size() == 7 );
+ VERIFY( it6 == it5 );
+ VERIFY( *it6 == *it5 );
+
+ const_iterator it7 = s1.begin();
+ ++it7;
+ ++it7;
+ ++it7;
+ const_iterator it8 = it7;
+ ++it8;
+ const_iterator it9 = s1.erase(it7);
+ VERIFY( s1.size() == 6 );
+ VERIFY( it9 == it8 );
+ VERIFY( *it9 == *it8 );
+
+ const_iterator it10 = s1.begin();
+ ++it10;
+ const_iterator it11 = it10;
+ ++it11;
+ ++it11;
+ ++it11;
+ ++it11;
+ const_iterator it12 = s1.erase(it10, it11);
+ VERIFY( s1.size() == 2 );
+ VERIFY( it12 == it11 );
+ VERIFY( *it12 == *it11 );
+ VERIFY( ++it12 == s1.end() );
+
+ iterator it13 = s1.erase(s1.begin(), s1.end());
+ VERIFY( s1.size() == 0 );
+ VERIFY( it13 == s1.end() );
+ VERIFY( it13 == s1.begin() );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/tr1/6_containers/unordered_set/find/set1.cc b/libstdc++-v3/testsuite/tr1/6_containers/unordered_set/find/set1.cc
new file mode 100644
index 000000000..67dd20546
--- /dev/null
+++ b/libstdc++-v3/testsuite/tr1/6_containers/unordered_set/find/set1.cc
@@ -0,0 +1,65 @@
+// { 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.3 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_set<std::string> Set;
+ Set s;
+ VERIFY(s.empty());
+
+ std::pair<Set::iterator, bool> tmp = s.insert("grape");
+ Set::iterator i = tmp.first;
+
+ Set::iterator i2 = s.find("grape");
+ VERIFY(i2 != s.end());
+ VERIFY(i2 == i);
+ VERIFY(*i2 == "grape");
+
+ std::pair<Set::iterator, Set::iterator> p = s.equal_range("grape");
+ VERIFY(p.first == i2);
+ VERIFY(std::distance(p.first, p.second) == 1);
+
+ Set::iterator i3 = s.find("lime");
+ VERIFY(i3 == s.end());
+
+ std::pair<Set::iterator, Set::iterator> p2 = s.equal_range("lime");
+ VERIFY(p2.first == p2.second);
+
+ VERIFY(s.count("grape") == 1);
+ VERIFY(s.count("lime") == 0);
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/tr1/6_containers/unordered_set/insert/24061-set.cc b/libstdc++-v3/testsuite/tr1/6_containers/unordered_set/insert/24061-set.cc
new file mode 100644
index 000000000..f5cb09938
--- /dev/null
+++ b/libstdc++-v3/testsuite/tr1/6_containers/unordered_set/insert/24061-set.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.3 Class template unordered_set
+
+#include <tr1/unordered_set>
+#include <string>
+#include <testsuite_hooks.h>
+
+// libstdc++/24061
+void test01()
+{
+ bool test __attribute__((unused)) = true;
+
+ typedef std::tr1::unordered_set<std::string> Set;
+ typedef Set::iterator iterator;
+ typedef Set::const_iterator const_iterator;
+
+ Set s1;
+
+ iterator it1 = s1.insert(s1.begin(), "all the love in the world");
+ VERIFY( s1.size() == 1 );
+ VERIFY( *it1 == "all the love in the world" );
+
+ const_iterator cit1(it1);
+ const_iterator cit2 = s1.insert(cit1, "you know what you are?");
+ VERIFY( s1.size() == 2 );
+ VERIFY( cit2 != cit1 );
+ VERIFY( *cit2 == "you know what you are?" );
+
+ iterator it2 = s1.insert(it1, "all the love in the world");
+ VERIFY( s1.size() == 2 );
+ 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_set/insert/set_range.cc b/libstdc++-v3/testsuite/tr1/6_containers/unordered_set/insert/set_range.cc
new file mode 100644
index 000000000..9d7bcbf8a
--- /dev/null
+++ b/libstdc++-v3/testsuite/tr1/6_containers/unordered_set/insert/set_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.3 unordered_set
+// 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_set<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_set<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() == 6);
+ VERIFY(std::distance(s.begin(), s.end()) == 6);
+
+ 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) == 1);
+ VERIFY(std::count(s.begin(), s.end(), 6) == 1);
+ VERIFY(std::count(s.begin(), s.end(), 7) == 1);
+ 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_set/insert/set_single.cc b/libstdc++-v3/testsuite/tr1/6_containers/unordered_set/insert/set_single.cc
new file mode 100644
index 000000000..d298b9e7a
--- /dev/null
+++ b/libstdc++-v3/testsuite/tr1/6_containers/unordered_set/insert/set_single.cc
@@ -0,0 +1,66 @@
+// { 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.3 unordered_set
+// 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_set<std::string> Set;
+ Set s;
+ VERIFY(s.empty());
+
+ std::pair<Set::iterator, bool> p = s.insert("abcde");
+ VERIFY(p.second);
+ VERIFY(s.size() == 1);
+ VERIFY(std::distance(s.begin(), s.end()) == 1);
+ VERIFY(p.first == s.begin());
+ VERIFY(*p.first == "abcde");
+}
+
+void test02()
+{
+ typedef std::tr1::unordered_set<std::string> Set;
+ Set s;
+ VERIFY(s.empty());
+
+ std::pair<Set::iterator, bool> p1 = s.insert("abcde");
+ std::pair<Set::iterator, bool> p2 = s.insert("abcde");
+ VERIFY(p1.second);
+ VERIFY(!p2.second);
+ VERIFY(s.size() == 1);
+ VERIFY(p1.first == p2.first);
+ VERIFY(*p1.first == "abcde");
+}
+
+int main()
+{
+ test01();
+ test02();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/tr1/6_containers/unordered_set/requirements/explicit_instantiation.cc b/libstdc++-v3/testsuite/tr1/6_containers/unordered_set/requirements/explicit_instantiation.cc
new file mode 100644
index 000000000..6c6ec2e17
--- /dev/null
+++ b/libstdc++-v3/testsuite/tr1/6_containers/unordered_set/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.3 unordered_set
+
+#include <tr1/unordered_set>
+
+using namespace std::tr1;
+using std::equal_to;
+using std::allocator;
+
+template class unordered_set<int>;
+template class unordered_set<float, hash<float>, equal_to<float>,
+ allocator<float> >;
+template class unordered_set<int, hash<int>, equal_to<int>,
+ allocator<char> >;
+template class __unordered_set<float, hash<float>, equal_to<float>,
+ allocator<float>, true>;
diff --git a/libstdc++-v3/testsuite/tr1/6_containers/unordered_set/requirements/iterator_neg.cc b/libstdc++-v3/testsuite/tr1/6_containers/unordered_set/requirements/iterator_neg.cc
new file mode 100644
index 000000000..b06ef15eb
--- /dev/null
+++ b/libstdc++-v3/testsuite/tr1/6_containers/unordered_set/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_set<int> Set;
+
+ Set s;
+
+ Set::const_iterator cit = s.begin();
+ *cit = 0; // { dg-error "read-only" }
+
+ Set::const_local_iterator clit = s.begin(0);
+ *clit = 0; // { dg-error "read-only" }
+}
diff --git a/libstdc++-v3/testsuite/tr1/6_containers/unordered_set/requirements/iterator_null_neg.cc b/libstdc++-v3/testsuite/tr1/6_containers/unordered_set/requirements/iterator_null_neg.cc
new file mode 100644
index 000000000..a0747ec47
--- /dev/null
+++ b/libstdc++-v3/testsuite/tr1/6_containers/unordered_set/requirements/iterator_null_neg.cc
@@ -0,0 +1,28 @@
+// 2005-09-10 Paolo Carlini <pcarlini@suse.de>
+//
+// Copyright (C) 2005, 2009, 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/>.
+//
+
+// { dg-do compile }
+
+// libstdc++/23781
+#include <tr1/unordered_set>
+#include <cstddef>
+
+std::tr1::unordered_set<int>::iterator it4 = NULL; // { dg-error "conversion" }
+std::tr1::unordered_set<int>::const_iterator cit4 = NULL; // { dg-error "conversion" }
diff --git a/libstdc++-v3/testsuite/tr1/6_containers/unordered_set/requirements/iterators_default_constructor.cc b/libstdc++-v3/testsuite/tr1/6_containers/unordered_set/requirements/iterators_default_constructor.cc
new file mode 100644
index 000000000..ecada3dd2
--- /dev/null
+++ b/libstdc++-v3/testsuite/tr1/6_containers/unordered_set/requirements/iterators_default_constructor.cc
@@ -0,0 +1,31 @@
+// { dg-do compile }
+
+// Copyright (C) 2006, 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>
+
+void
+test01()
+{
+ std::tr1::unordered_set<int>::iterator it;
+ std::tr1::unordered_set<int>::const_iterator cit;
+ std::tr1::unordered_set<int>::local_iterator lit;
+ std::tr1::unordered_set<int>::const_local_iterator clit;
+}
diff --git a/libstdc++-v3/testsuite/tr1/6_containers/unordered_set/requirements/typedefs.cc b/libstdc++-v3/testsuite/tr1/6_containers/unordered_set/requirements/typedefs.cc
new file mode 100644
index 000000000..a1f4a31f9
--- /dev/null
+++ b/libstdc++-v3/testsuite/tr1/6_containers/unordered_set/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.3 unordered_set
+
+#include <tr1/unordered_set>
+
+void test01()
+{
+ // Check for required typedefs
+ typedef std::tr1::unordered_set<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_set/swap/1.cc b/libstdc++-v3/testsuite/tr1/6_containers/unordered_set/swap/1.cc
new file mode 100644
index 000000000..d14be65de
--- /dev/null
+++ b/libstdc++-v3/testsuite/tr1/6_containers/unordered_set/swap/1.cc
@@ -0,0 +1,152 @@
+// 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.3 unordered_set::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::set;
+
+ typedef __gnu_test::uneq_allocator<char> my_alloc;
+ typedef unordered_set<char, hash<char>, equal_to<char>, my_alloc> my_uset;
+
+ 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 set<char> my_set;
+ const my_set set01_ref(title01, title01 + N1);
+ const my_set set02_ref(title02, title02 + N2);
+ const my_set set03_ref(title03, title03 + N3);
+ const my_set set04_ref(title04, title04 + N4);
+
+ my_uset::size_type size01, size02;
+
+ my_alloc alloc01(1);
+
+ my_uset uset01(10, hash<char>(), equal_to<char>(), alloc01);
+ size01 = uset01.size();
+ my_uset uset02(10, hash<char>(), equal_to<char>(), alloc01);
+ size02 = uset02.size();
+
+ uset01.swap(uset02);
+ VERIFY( uset01.size() == size02 );
+ VERIFY( uset01.empty() );
+ VERIFY( uset02.size() == size01 );
+ VERIFY( uset02.empty() );
+
+ my_uset uset03(10, hash<char>(), equal_to<char>(), alloc01);
+ size01 = uset03.size();
+ my_uset uset04(set02_ref.begin(), set02_ref.end(), 10, hash<char>(),
+ equal_to<char>(), alloc01);
+ size02 = uset04.size();
+
+ uset03.swap(uset04);
+ VERIFY( uset03.size() == size02 );
+ VERIFY( my_set(uset03.begin(), uset03.end()) == set02_ref );
+ VERIFY( uset04.size() == size01 );
+ VERIFY( uset04.empty() );
+
+ my_uset uset05(set01_ref.begin(), set01_ref.end(), 10, hash<char>(),
+ equal_to<char>(), alloc01);
+ size01 = uset05.size();
+ my_uset uset06(set02_ref.begin(), set02_ref.end(), 10, hash<char>(),
+ equal_to<char>(), alloc01);
+ size02 = uset06.size();
+
+ uset05.swap(uset06);
+ VERIFY( uset05.size() == size02 );
+ VERIFY( my_set(uset05.begin(), uset05.end()) == set02_ref );
+ VERIFY( uset06.size() == size01 );
+ VERIFY( my_set(uset06.begin(), uset06.end()) == set01_ref );
+
+ my_uset uset07(set01_ref.begin(), set01_ref.end(), 10, hash<char>(),
+ equal_to<char>(), alloc01);
+ size01 = uset07.size();
+ my_uset uset08(set03_ref.begin(), set03_ref.end(), 10, hash<char>(),
+ equal_to<char>(), alloc01);
+ size02 = uset08.size();
+
+ uset07.swap(uset08);
+ VERIFY( uset07.size() == size02 );
+ VERIFY( my_set(uset07.begin(), uset07.end()) == set03_ref );
+ VERIFY( uset08.size() == size01 );
+ VERIFY( my_set(uset08.begin(), uset08.end()) == set01_ref );
+
+ my_uset uset09(set03_ref.begin(), set03_ref.end(), 10, hash<char>(),
+ equal_to<char>(), alloc01);
+ size01 = uset09.size();
+ my_uset uset10(set04_ref.begin(), set04_ref.end(), 10, hash<char>(),
+ equal_to<char>(), alloc01);
+ size02 = uset10.size();
+
+ uset09.swap(uset10);
+ VERIFY( uset09.size() == size02 );
+ VERIFY( my_set(uset09.begin(), uset09.end()) == set04_ref );
+ VERIFY( uset10.size() == size01 );
+ VERIFY( my_set(uset10.begin(), uset10.end()) == set03_ref );
+
+ my_uset uset11(set04_ref.begin(), set04_ref.end(), 10, hash<char>(),
+ equal_to<char>(), alloc01);
+ size01 = uset11.size();
+ my_uset uset12(set01_ref.begin(), set01_ref.end(), 10, hash<char>(),
+ equal_to<char>(), alloc01);
+ size02 = uset12.size();
+
+ uset11.swap(uset12);
+ VERIFY( uset11.size() == size02 );
+ VERIFY( my_set(uset11.begin(), uset11.end()) == set01_ref );
+ VERIFY( uset12.size() == size01 );
+ VERIFY( my_set(uset12.begin(), uset12.end()) == set04_ref );
+
+ my_uset uset13(set03_ref.begin(), set03_ref.end(), 10, hash<char>(),
+ equal_to<char>(), alloc01);
+ size01 = uset13.size();
+ my_uset uset14(set03_ref.begin(), set03_ref.end(), 10, hash<char>(),
+ equal_to<char>(), alloc01);
+ size02 = uset14.size();
+
+ uset13.swap(uset14);
+ VERIFY( uset13.size() == size02 );
+ VERIFY( my_set(uset13.begin(), uset13.end()) == set03_ref );
+ VERIFY( uset14.size() == size01 );
+ VERIFY( my_set(uset14.begin(), uset14.end()) == set03_ref );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/tr1/6_containers/unordered_set/swap/2.cc b/libstdc++-v3/testsuite/tr1/6_containers/unordered_set/swap/2.cc
new file mode 100644
index 000000000..93477f615
--- /dev/null
+++ b/libstdc++-v3/testsuite/tr1/6_containers/unordered_set/swap/2.cc
@@ -0,0 +1,181 @@
+// 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.3 unordered_set::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::set;
+
+ typedef __gnu_test::uneq_allocator<char> my_alloc;
+ typedef unordered_set<char, hash<char>, equal_to<char>, my_alloc> my_uset;
+
+ 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 set<char> my_set;
+ const my_set set01_ref(title01, title01 + N1);
+ const my_set set02_ref(title02, title02 + N2);
+ const my_set set03_ref(title03, title03 + N3);
+ const my_set set04_ref(title04, title04 + N4);
+
+ my_uset::size_type size01, size02;
+
+ my_alloc alloc01(1), alloc02(2);
+ int personality01, personality02;
+
+ my_uset uset01(10, hash<char>(), equal_to<char>(), alloc01);
+ size01 = uset01.size();
+ personality01 = uset01.get_allocator().get_personality();
+ my_uset uset02(10, hash<char>(), equal_to<char>(), alloc02);
+ size02 = uset02.size();
+ personality02 = uset02.get_allocator().get_personality();
+
+ uset01.swap(uset02);
+ VERIFY( uset01.size() == size02 );
+ VERIFY( uset01.empty() );
+ VERIFY( uset02.size() == size01 );
+ VERIFY( uset02.empty() );
+ VERIFY( uset01.get_allocator().get_personality() == personality02 );
+ VERIFY( uset02.get_allocator().get_personality() == personality01 );
+
+ my_uset uset03(10, hash<char>(), equal_to<char>(), alloc02);
+ size01 = uset03.size();
+ personality01 = uset03.get_allocator().get_personality();
+ my_uset uset04(set02_ref.begin(), set02_ref.end(), 10, hash<char>(),
+ equal_to<char>(), alloc01);
+ size02 = uset04.size();
+ personality02 = uset04.get_allocator().get_personality();
+
+ uset03.swap(uset04);
+ VERIFY( uset03.size() == size02 );
+ VERIFY( my_set(uset03.begin(), uset03.end()) == set02_ref );
+ VERIFY( uset04.size() == size01 );
+ VERIFY( uset04.empty() );
+ VERIFY( uset03.get_allocator().get_personality() == personality02 );
+ VERIFY( uset04.get_allocator().get_personality() == personality01 );
+
+ my_uset uset05(set01_ref.begin(), set01_ref.end(), 10, hash<char>(),
+ equal_to<char>(), alloc01);
+ size01 = uset05.size();
+ personality01 = uset05.get_allocator().get_personality();
+ my_uset uset06(set02_ref.begin(), set02_ref.end(), 10, hash<char>(),
+ equal_to<char>(), alloc02);
+ size02 = uset06.size();
+ personality02 = uset06.get_allocator().get_personality();
+
+ uset05.swap(uset06);
+ VERIFY( uset05.size() == size02 );
+ VERIFY( my_set(uset05.begin(), uset05.end()) == set02_ref );
+ VERIFY( uset06.size() == size01 );
+ VERIFY( my_set(uset06.begin(), uset06.end()) == set01_ref );
+ VERIFY( uset05.get_allocator().get_personality() == personality02 );
+ VERIFY( uset06.get_allocator().get_personality() == personality01 );
+
+ my_uset uset07(set01_ref.begin(), set01_ref.end(), 10, hash<char>(),
+ equal_to<char>(), alloc02);
+ size01 = uset07.size();
+ personality01 = uset07.get_allocator().get_personality();
+ my_uset uset08(set03_ref.begin(), set03_ref.end(), 10, hash<char>(),
+ equal_to<char>(), alloc01);
+ size02 = uset08.size();
+ personality02 = uset08.get_allocator().get_personality();
+
+ uset07.swap(uset08);
+ VERIFY( uset07.size() == size02 );
+ VERIFY( my_set(uset07.begin(), uset07.end()) == set03_ref );
+ VERIFY( uset08.size() == size01 );
+ VERIFY( my_set(uset08.begin(), uset08.end()) == set01_ref );
+ VERIFY( uset07.get_allocator().get_personality() == personality02 );
+ VERIFY( uset08.get_allocator().get_personality() == personality01 );
+
+ my_uset uset09(set03_ref.begin(), set03_ref.end(), 10, hash<char>(),
+ equal_to<char>(), alloc01);
+ size01 = uset09.size();
+ personality01 = uset09.get_allocator().get_personality();
+ my_uset uset10(set04_ref.begin(), set04_ref.end(), 10, hash<char>(),
+ equal_to<char>(), alloc02);
+ size02 = uset10.size();
+ personality02 = uset10.get_allocator().get_personality();
+
+ uset09.swap(uset10);
+ VERIFY( uset09.size() == size02 );
+ VERIFY( my_set(uset09.begin(), uset09.end()) == set04_ref );
+ VERIFY( uset10.size() == size01 );
+ VERIFY( my_set(uset10.begin(), uset10.end()) == set03_ref );
+ VERIFY( uset09.get_allocator().get_personality() == personality02 );
+ VERIFY( uset10.get_allocator().get_personality() == personality01 );
+
+ my_uset uset11(set04_ref.begin(), set04_ref.end(), 10, hash<char>(),
+ equal_to<char>(), alloc02);
+ size01 = uset11.size();
+ personality01 = uset11.get_allocator().get_personality();
+ my_uset uset12(set01_ref.begin(), set01_ref.end(), 10, hash<char>(),
+ equal_to<char>(), alloc01);
+ size02 = uset12.size();
+ personality02 = uset12.get_allocator().get_personality();
+
+ uset11.swap(uset12);
+ VERIFY( uset11.size() == size02 );
+ VERIFY( my_set(uset11.begin(), uset11.end()) == set01_ref );
+ VERIFY( uset12.size() == size01 );
+ VERIFY( my_set(uset12.begin(), uset12.end()) == set04_ref );
+ VERIFY( uset11.get_allocator().get_personality() == personality02 );
+ VERIFY( uset12.get_allocator().get_personality() == personality01 );
+
+ my_uset uset13(set03_ref.begin(), set03_ref.end(), 10, hash<char>(),
+ equal_to<char>(), alloc01);
+ size01 = uset13.size();
+ personality01 = uset13.get_allocator().get_personality();
+ my_uset uset14(set03_ref.begin(), set03_ref.end(), 10, hash<char>(),
+ equal_to<char>(), alloc02);
+ size02 = uset14.size();
+ personality02 = uset14.get_allocator().get_personality();
+
+ uset13.swap(uset14);
+ VERIFY( uset13.size() == size02 );
+ VERIFY( my_set(uset13.begin(), uset13.end()) == set03_ref );
+ VERIFY( uset14.size() == size01 );
+ VERIFY( my_set(uset14.begin(), uset14.end()) == set03_ref );
+ VERIFY( uset13.get_allocator().get_personality() == personality02 );
+ VERIFY( uset14.get_allocator().get_personality() == personality01 );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/tr1/6_containers/utility/19535.cc b/libstdc++-v3/testsuite/tr1/6_containers/utility/19535.cc
new file mode 100644
index 000000000..82a3dbf3f
--- /dev/null
+++ b/libstdc++-v3/testsuite/tr1/6_containers/utility/19535.cc
@@ -0,0 +1,41 @@
+// 2005-01-19 Petur Runolfsson <peturr02@ru.is>
+
+// 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/>.
+
+// tr1 additions to pair
+
+#include <tr1/utility>
+
+struct A { };
+struct B { };
+
+// libstdc++/19535
+void test01()
+{
+ std::pair<A, B> p;
+ std::tr1::get<1>(p);
+
+ const std::pair<B, A> q;
+ std::tr1::get<1>(q);
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/tr1/6_containers/utility/pair.cc b/libstdc++-v3/testsuite/tr1/6_containers/utility/pair.cc
new file mode 100644
index 000000000..3189e7f81
--- /dev/null
+++ b/libstdc++-v3/testsuite/tr1/6_containers/utility/pair.cc
@@ -0,0 +1,55 @@
+// 2004-09-23 Chris Jefferson <chris@bubblescope.net>
+
+// Copyright (C) 2004, 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/>.
+
+// tr1 additions to pair
+
+#include <tr1/utility>
+#include <testsuite_hooks.h>
+
+using namespace std::tr1;
+using std::pair;
+
+struct blank_class
+{ };
+
+int
+main()
+{
+ bool test __attribute__((unused)) = true;
+ typedef pair<int,int> test_pair_type;
+ VERIFY(tuple_size<test_pair_type>::value == 2);
+ // Test if tuple_element::type returns the correct type
+ blank_class blank;
+ tuple_element<0, pair<blank_class, int> >::type
+ blank2 __attribute__((unused)) = blank;
+ tuple_element<1, pair<int ,blank_class> >::type
+ blank3 __attribute__((unused)) = blank;
+ pair<int,int> test_pair(1, 2);
+ VERIFY(get<0>(test_pair) == 1);
+ VERIFY(get<1>(test_pair) == 2);
+ get<0>(test_pair) = 3;
+ get<1>(test_pair) = 4;
+ VERIFY(get<0>(test_pair) == 3);
+ VERIFY(get<1>(test_pair) == 4);
+
+ const pair<int,int> test_pair2(1,2);
+ VERIFY(get<0>(test_pair2) == 1);
+ VERIFY(get<1>(test_pair2) == 2);
+}
+