summaryrefslogtreecommitdiff
path: root/libstdc++-v3/testsuite/tr1/6_containers/unordered_map
diff options
context:
space:
mode:
Diffstat (limited to 'libstdc++-v3/testsuite/tr1/6_containers/unordered_map')
-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
15 files changed, 1192 insertions, 0 deletions
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;
+}