From 554fd8c5195424bdbcabf5de30fdc183aba391bd Mon Sep 17 00:00:00 2001 From: upstream source tree Date: Sun, 15 Mar 2015 20:14:05 -0400 Subject: obtained gcc-4.6.4.tar.bz2 from upstream website; verified gcc-4.6.4.tar.bz2.sig; imported gcc-4.6.4 source tree from verified upstream tarball. downloading a git-generated archive based on the 'upstream' tag should provide you with a source tree that is binary identical to the one extracted from the above tarball. if you have obtained the source via the command 'git clone', however, do note that line-endings of files in your working directory might differ from line-endings of the respective files in the upstream repository. --- .../unordered_multimap/cons/moveable.cc | 43 +++++ .../unordered_multimap/debug/construct1_neg.cc | 34 ++++ .../unordered_multimap/debug/construct2_neg.cc | 34 ++++ .../unordered_multimap/debug/construct3_neg.cc | 34 ++++ .../unordered_multimap/debug/construct4_neg.cc | 33 ++++ .../unordered_multimap/debug/insert1_neg.cc | 34 ++++ .../unordered_multimap/debug/insert2_neg.cc | 34 ++++ .../unordered_multimap/debug/insert3_neg.cc | 34 ++++ .../unordered_multimap/debug/insert4_neg.cc | 33 ++++ .../23_containers/unordered_multimap/erase/1.cc | 130 ++++++++++++++ .../unordered_multimap/erase/24061-multimap.cc | 108 ++++++++++++ .../unordered_multimap/erase/51142.cc | 38 ++++ .../unordered_multimap/hash_policy/dr1189.cc | 48 ++++++ .../23_containers/unordered_multimap/init-list.cc | 66 +++++++ .../unordered_multimap/insert/24061-multimap.cc | 60 +++++++ .../unordered_multimap/insert/multimap_range.cc | 91 ++++++++++ .../unordered_multimap/insert/multimap_single.cc | 76 ++++++++ .../insert/multimap_single_move-1.cc | 80 +++++++++ .../insert/multimap_single_move-2.cc | 80 +++++++++ .../unordered_multimap/operators/1.cc | 192 +++++++++++++++++++++ .../unordered_multimap/operators/2.cc | 63 +++++++ .../unordered_multimap/range_access.cc | 31 ++++ .../unordered_multimap/requirements/citerators.cc | 30 ++++ .../unordered_multimap/requirements/cliterators.cc | 32 ++++ .../unordered_multimap/requirements/debug.cc | 28 +++ .../requirements/exception/basic.cc | 42 +++++ .../exception/generation_prohibited.cc | 36 ++++ .../exception/propagation_consistent.cc | 36 ++++ .../requirements/explicit_instantiation/1.cc | 23 +++ .../requirements/explicit_instantiation/2.cc | 29 ++++ .../requirements/explicit_instantiation/3.cc | 24 +++ .../requirements/explicit_instantiation/4.cc | 33 ++++ .../unordered_multimap/requirements/typedefs.cc | 25 +++ 33 files changed, 1714 insertions(+) create mode 100644 libstdc++-v3/testsuite/23_containers/unordered_multimap/cons/moveable.cc create mode 100644 libstdc++-v3/testsuite/23_containers/unordered_multimap/debug/construct1_neg.cc create mode 100644 libstdc++-v3/testsuite/23_containers/unordered_multimap/debug/construct2_neg.cc create mode 100644 libstdc++-v3/testsuite/23_containers/unordered_multimap/debug/construct3_neg.cc create mode 100644 libstdc++-v3/testsuite/23_containers/unordered_multimap/debug/construct4_neg.cc create mode 100644 libstdc++-v3/testsuite/23_containers/unordered_multimap/debug/insert1_neg.cc create mode 100644 libstdc++-v3/testsuite/23_containers/unordered_multimap/debug/insert2_neg.cc create mode 100644 libstdc++-v3/testsuite/23_containers/unordered_multimap/debug/insert3_neg.cc create mode 100644 libstdc++-v3/testsuite/23_containers/unordered_multimap/debug/insert4_neg.cc create mode 100644 libstdc++-v3/testsuite/23_containers/unordered_multimap/erase/1.cc create mode 100644 libstdc++-v3/testsuite/23_containers/unordered_multimap/erase/24061-multimap.cc create mode 100644 libstdc++-v3/testsuite/23_containers/unordered_multimap/erase/51142.cc create mode 100644 libstdc++-v3/testsuite/23_containers/unordered_multimap/hash_policy/dr1189.cc create mode 100644 libstdc++-v3/testsuite/23_containers/unordered_multimap/init-list.cc create mode 100644 libstdc++-v3/testsuite/23_containers/unordered_multimap/insert/24061-multimap.cc create mode 100644 libstdc++-v3/testsuite/23_containers/unordered_multimap/insert/multimap_range.cc create mode 100644 libstdc++-v3/testsuite/23_containers/unordered_multimap/insert/multimap_single.cc create mode 100644 libstdc++-v3/testsuite/23_containers/unordered_multimap/insert/multimap_single_move-1.cc create mode 100644 libstdc++-v3/testsuite/23_containers/unordered_multimap/insert/multimap_single_move-2.cc create mode 100644 libstdc++-v3/testsuite/23_containers/unordered_multimap/operators/1.cc create mode 100644 libstdc++-v3/testsuite/23_containers/unordered_multimap/operators/2.cc create mode 100644 libstdc++-v3/testsuite/23_containers/unordered_multimap/range_access.cc create mode 100644 libstdc++-v3/testsuite/23_containers/unordered_multimap/requirements/citerators.cc create mode 100644 libstdc++-v3/testsuite/23_containers/unordered_multimap/requirements/cliterators.cc create mode 100644 libstdc++-v3/testsuite/23_containers/unordered_multimap/requirements/debug.cc create mode 100644 libstdc++-v3/testsuite/23_containers/unordered_multimap/requirements/exception/basic.cc create mode 100644 libstdc++-v3/testsuite/23_containers/unordered_multimap/requirements/exception/generation_prohibited.cc create mode 100644 libstdc++-v3/testsuite/23_containers/unordered_multimap/requirements/exception/propagation_consistent.cc create mode 100644 libstdc++-v3/testsuite/23_containers/unordered_multimap/requirements/explicit_instantiation/1.cc create mode 100644 libstdc++-v3/testsuite/23_containers/unordered_multimap/requirements/explicit_instantiation/2.cc create mode 100644 libstdc++-v3/testsuite/23_containers/unordered_multimap/requirements/explicit_instantiation/3.cc create mode 100644 libstdc++-v3/testsuite/23_containers/unordered_multimap/requirements/explicit_instantiation/4.cc create mode 100644 libstdc++-v3/testsuite/23_containers/unordered_multimap/requirements/typedefs.cc (limited to 'libstdc++-v3/testsuite/23_containers/unordered_multimap') diff --git a/libstdc++-v3/testsuite/23_containers/unordered_multimap/cons/moveable.cc b/libstdc++-v3/testsuite/23_containers/unordered_multimap/cons/moveable.cc new file mode 100644 index 000000000..145054b8f --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/unordered_multimap/cons/moveable.cc @@ -0,0 +1,43 @@ +// { dg-options "-std=gnu++0x" } + +// 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 +// . + + +// NOTE: This makes use of the fact that we know how moveable +// is implemented on multimap (via swap). If the implementation changed +// this test may begin to fail. + +#include +#include +#include + +int main() +{ + bool test __attribute__((unused)) = true; + + std::unordered_multimap a,b; + a.insert(std::make_pair(2,0)); + b.insert(std::make_pair(1,0)); + b = std::move(a); + VERIFY( b.find(2) != b.end() && a.find(1) == a.end() ); + + std::unordered_multimap c(std::move(b)); + VERIFY( c.find(2) != c.end() ); + VERIFY( b.find(2) == b.end() ); + return 0; +} diff --git a/libstdc++-v3/testsuite/23_containers/unordered_multimap/debug/construct1_neg.cc b/libstdc++-v3/testsuite/23_containers/unordered_multimap/debug/construct1_neg.cc new file mode 100644 index 000000000..7a17e4c0e --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/unordered_multimap/debug/construct1_neg.cc @@ -0,0 +1,34 @@ +// Copyright (C) 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 +// . +// +// { dg-require-debug-mode "" } +// { dg-options "-std=gnu++0x" } +// { dg-do run { xfail *-*-* } } + +#include +#include + +void test01() +{ + __gnu_test::check_construct1 >(); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/23_containers/unordered_multimap/debug/construct2_neg.cc b/libstdc++-v3/testsuite/23_containers/unordered_multimap/debug/construct2_neg.cc new file mode 100644 index 000000000..8f2c1a6d9 --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/unordered_multimap/debug/construct2_neg.cc @@ -0,0 +1,34 @@ +// Copyright (C) 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 +// . +// +// { dg-require-debug-mode "" } +// { dg-options "-std=gnu++0x" } +// { dg-do run { xfail *-*-* } } + +#include +#include + +void test01() +{ + __gnu_test::check_construct2 >(); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/23_containers/unordered_multimap/debug/construct3_neg.cc b/libstdc++-v3/testsuite/23_containers/unordered_multimap/debug/construct3_neg.cc new file mode 100644 index 000000000..3fb4be737 --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/unordered_multimap/debug/construct3_neg.cc @@ -0,0 +1,34 @@ +// Copyright (C) 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 +// . +// +// { dg-require-debug-mode "" } +// { dg-options "-std=gnu++0x" } +// { dg-do run { xfail *-*-* } } + +#include +#include + +void test01() +{ + __gnu_test::check_construct3 >(); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/23_containers/unordered_multimap/debug/construct4_neg.cc b/libstdc++-v3/testsuite/23_containers/unordered_multimap/debug/construct4_neg.cc new file mode 100644 index 000000000..000745e75 --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/unordered_multimap/debug/construct4_neg.cc @@ -0,0 +1,33 @@ +// Copyright (C) 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 +// . +// +// { dg-options "-std=gnu++0x" } +// { dg-do run { xfail *-*-* } } + +#include +#include + +void test01() +{ + __gnu_test::check_construct1<__gnu_debug::unordered_multimap >(); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/23_containers/unordered_multimap/debug/insert1_neg.cc b/libstdc++-v3/testsuite/23_containers/unordered_multimap/debug/insert1_neg.cc new file mode 100644 index 000000000..e36a0a170 --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/unordered_multimap/debug/insert1_neg.cc @@ -0,0 +1,34 @@ +// Copyright (C) 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 +// . +// +// { dg-require-debug-mode "" } +// { dg-options "-std=gnu++0x" } +// { dg-do run { xfail *-*-* } } + +#include +#include + +void test01() +{ + __gnu_test::check_insert1 >(); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/23_containers/unordered_multimap/debug/insert2_neg.cc b/libstdc++-v3/testsuite/23_containers/unordered_multimap/debug/insert2_neg.cc new file mode 100644 index 000000000..04a488be1 --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/unordered_multimap/debug/insert2_neg.cc @@ -0,0 +1,34 @@ +// Copyright (C) 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 +// . +// +// { dg-require-debug-mode "" } +// { dg-options "-std=gnu++0x" } +// { dg-do run { xfail *-*-* } } + +#include +#include + +void test01() +{ + __gnu_test::check_insert2 >(); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/23_containers/unordered_multimap/debug/insert3_neg.cc b/libstdc++-v3/testsuite/23_containers/unordered_multimap/debug/insert3_neg.cc new file mode 100644 index 000000000..1c7f60f93 --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/unordered_multimap/debug/insert3_neg.cc @@ -0,0 +1,34 @@ +// Copyright (C) 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 +// . +// +// { dg-require-debug-mode "" } +// { dg-options "-std=gnu++0x" } +// { dg-do run { xfail *-*-* } } + +#include +#include + +void test01() +{ + __gnu_test::check_insert3 >(); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/23_containers/unordered_multimap/debug/insert4_neg.cc b/libstdc++-v3/testsuite/23_containers/unordered_multimap/debug/insert4_neg.cc new file mode 100644 index 000000000..988c31293 --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/unordered_multimap/debug/insert4_neg.cc @@ -0,0 +1,33 @@ +// Copyright (C) 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 +// . +// +// { dg-options "-std=gnu++0x" } +// { dg-do run { xfail *-*-* } } + +#include +#include + +void test01() +{ + __gnu_test::check_insert1<__gnu_debug::unordered_multimap >(); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/23_containers/unordered_multimap/erase/1.cc b/libstdc++-v3/testsuite/23_containers/unordered_multimap/erase/1.cc new file mode 100644 index 000000000..095157265 --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/unordered_multimap/erase/1.cc @@ -0,0 +1,130 @@ +// { dg-options "-std=gnu++0x" } + +// 2010-02-10 Paolo Carlini +// +// Copyright (C) 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 +// . + +#include +#include +#include + +void test01() +{ + bool test __attribute__((unused)) = true; + + typedef std::unordered_multimap 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)); + mm1.insert(value_type("because to why", 11)); + VERIFY( mm1.size() == 11 ); + + VERIFY( mm1.erase("eeilo") == 1 ); + VERIFY( mm1.size() == 10 ); + iterator it1 = mm1.find("eeilo"); + VERIFY( it1 == mm1.end() ); + + VERIFY( mm1.erase("tillsammans") == 1 ); + VERIFY( mm1.size() == 9 ); + 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() == 8 ); + it3 = mm1.find("belonging (no longer mix)"); + VERIFY( it3 == mm1.end() ); + + VERIFY( !mm1.erase("abra") ); + VERIFY( mm1.size() == 8 ); + + VERIFY( !mm1.erase("eeilo") ); + VERIFY( mm1.size() == 8 ); + + VERIFY( mm1.erase("because to why") == 2 ); + 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/23_containers/unordered_multimap/erase/24061-multimap.cc b/libstdc++-v3/testsuite/23_containers/unordered_multimap/erase/24061-multimap.cc new file mode 100644 index 000000000..545d08278 --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/unordered_multimap/erase/24061-multimap.cc @@ -0,0 +1,108 @@ +// { dg-options "-std=gnu++0x" } + +// 2010-02-10 Paolo Carlini +// +// Copyright (C) 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 +// . + +#include +#include +#include + +// libstdc++/24061 +void test01() +{ + bool test __attribute__((unused)) = true; + + typedef std::unordered_multimap 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/23_containers/unordered_multimap/erase/51142.cc b/libstdc++-v3/testsuite/23_containers/unordered_multimap/erase/51142.cc new file mode 100644 index 000000000..678aa5dd9 --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/unordered_multimap/erase/51142.cc @@ -0,0 +1,38 @@ +// Copyright (C) 2011 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . +// + +// { dg-do compile } +// { dg-options "-std=gnu++0x" } + +#include + +struct X +{ + template + X(T&) {} +}; + +bool operator==(const X&, const X&) { return false; } + +// LWG 2059. +void erasor(std::unordered_multimap& s, X x) +{ + std::unordered_multimap::iterator it = s.find(x); + if (it != s.end()) + s.erase(it); +} diff --git a/libstdc++-v3/testsuite/23_containers/unordered_multimap/hash_policy/dr1189.cc b/libstdc++-v3/testsuite/23_containers/unordered_multimap/hash_policy/dr1189.cc new file mode 100644 index 000000000..57e5f7da7 --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/unordered_multimap/hash_policy/dr1189.cc @@ -0,0 +1,48 @@ +// { dg-options "-std=gnu++0x" } +// 2010-03-10 Paolo Carlini +// +// Copyright (C) 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 +// . + +#include +#include + +// DR 1189. Awkward interface for changing the number of buckets +// in an unordered associative container +void test01() +{ + bool test __attribute__((unused)) = true; + + std::unordered_multimap mm1; + mm1.reserve(10); + VERIFY( mm1.bucket_count() >= 10 ); + + mm1.reserve(100); + VERIFY( mm1.bucket_count() >= 100 ); + + std::unordered_map mm2(100); + VERIFY( mm2.bucket_count() >= 100 ); + + mm2.reserve(1000); + VERIFY( mm2.bucket_count() >= 1000 ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/23_containers/unordered_multimap/init-list.cc b/libstdc++-v3/testsuite/23_containers/unordered_multimap/init-list.cc new file mode 100644 index 000000000..d7ebbf16d --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/unordered_multimap/init-list.cc @@ -0,0 +1,66 @@ +// 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 +// . +// + +// { dg-options "-std=gnu++0x" } + +#include +#include +#include + +using namespace std; + +int test01() +{ + bool test __attribute__((unused)) = true; + + typedef unordered_multimap Container; + typedef Container::const_iterator iterator; + typedef pair itpair; + + Container m({ { 1, 1.0 }, { 1, 2.0 }, { 1, 237.0 } }); + VERIFY(m.size() == 3); + itpair ip = m.equal_range(1); + VERIFY(distance(ip.first, ip.second) == 3); + set s = { 1.0, 2.0, 237.0 }; + for (iterator i = ip.first; i != ip.second; ++i) + s.erase (i->second); + VERIFY(s.empty()); + + m = { {5, 55.0}, { 5, 66.0 }, { 42, 4242.0 } }; + VERIFY(m.size() == 3); + ip = m.equal_range(5); + VERIFY(distance(ip.first, ip.second) == 2); + s = { 55.0, 66.0 }; + for (iterator i = ip.first; i != ip.second; ++i) + s.erase (i->second); + VERIFY(s.empty()); + + m.insert({ { 7, 77.0 }, { 7, 88.0 } }); + VERIFY(m.size() == 5); + VERIFY(m.count(5) == 2); + VERIFY(m.count(42) == 1); + VERIFY(m.count(7) == 2); + + return test; +} + +int main() +{ + __gnu_test::set_memory_limits(); + test01(); +} diff --git a/libstdc++-v3/testsuite/23_containers/unordered_multimap/insert/24061-multimap.cc b/libstdc++-v3/testsuite/23_containers/unordered_multimap/insert/24061-multimap.cc new file mode 100644 index 000000000..136580662 --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/unordered_multimap/insert/24061-multimap.cc @@ -0,0 +1,60 @@ +// { dg-options "-std=gnu++0x" } + +// 2010-02-10 Paolo Carlini +// +// Copyright (C) 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 +// . + +#include +#include +#include + +// libstdc++/24061 +void test01() +{ + bool test __attribute__((unused)) = true; + + typedef std::unordered_multimap 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/23_containers/unordered_multimap/insert/multimap_range.cc b/libstdc++-v3/testsuite/23_containers/unordered_multimap/insert/multimap_range.cc new file mode 100644 index 000000000..b7f405b76 --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/unordered_multimap/insert/multimap_range.cc @@ -0,0 +1,91 @@ +// { dg-options "-std=gnu++0x" } + +// Copyright (C) 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 +// . + +// range insert + +#include +#include +#include +#include +#include + +void test01() +{ + bool test __attribute__((unused)) = true; + + typedef std::unordered_multimap Map; + typedef std::pair 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() +{ + bool test __attribute__((unused)) = true; + + typedef std::unordered_multimap Map; + typedef std::pair 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/23_containers/unordered_multimap/insert/multimap_single.cc b/libstdc++-v3/testsuite/23_containers/unordered_multimap/insert/multimap_single.cc new file mode 100644 index 000000000..1864098f5 --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/unordered_multimap/insert/multimap_single.cc @@ -0,0 +1,76 @@ +// { dg-options "-std=gnu++0x" } + +// Copyright (C) 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 +// . + +// Single-element insert + +#include +#include +#include +#include + +void test01() +{ + bool test __attribute__((unused)) = true; + + typedef std::unordered_multimap Map; + typedef std::pair 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() +{ + bool test __attribute__((unused)) = true; + + typedef std::unordered_multimap Map; + typedef std::pair 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/23_containers/unordered_multimap/insert/multimap_single_move-1.cc b/libstdc++-v3/testsuite/23_containers/unordered_multimap/insert/multimap_single_move-1.cc new file mode 100644 index 000000000..4c933069c --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/unordered_multimap/insert/multimap_single_move-1.cc @@ -0,0 +1,80 @@ +// { dg-options "-std=gnu++0x" } + +// 2010-10-27 Paolo Carlini +// +// Copyright (C) 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 +// . + +// Single-element insert + +#include +#include +#include +#include + +void test01() +{ + bool test __attribute__((unused)) = true; + using __gnu_test::rvalstruct; + + typedef std::unordered_multimap Map; + typedef std::pair Pair; + + Map m; + VERIFY( m.empty() ); + + Map::iterator i = m.insert(Pair(1, rvalstruct(3))); + VERIFY( m.size() == 1 ); + VERIFY( std::distance(m.begin(), m.end()) == 1 ); + VERIFY( i == m.begin() ); + VERIFY( i->first == 1 ); + VERIFY( (i->second).val == 3 ); +} + +void test02() +{ + bool test __attribute__((unused)) = true; + using __gnu_test::rvalstruct; + + typedef std::unordered_multimap Map; + typedef std::pair Pair; + + Map m; + VERIFY( m.empty() ); + + m.insert(Pair(2, rvalstruct(3))); + m.insert(Pair(2, rvalstruct(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 == 2 ); + VERIFY( i2->first == 2 ); + VERIFY( ((i1->second).val == 3 && (i2->second).val == 7) + || ((i1->second).val == 7 && (i2->second).val == 3) ); +} + +int main() +{ + test01(); + test02(); + return 0; +} diff --git a/libstdc++-v3/testsuite/23_containers/unordered_multimap/insert/multimap_single_move-2.cc b/libstdc++-v3/testsuite/23_containers/unordered_multimap/insert/multimap_single_move-2.cc new file mode 100644 index 000000000..e9008b461 --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/unordered_multimap/insert/multimap_single_move-2.cc @@ -0,0 +1,80 @@ +// { dg-options "-std=gnu++0x" } + +// 2010-10-27 Paolo Carlini +// +// Copyright (C) 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 +// . + +// Single-element insert + +#include +#include +#include +#include + +void test01() +{ + bool test __attribute__((unused)) = true; + using __gnu_test::rvalstruct; + + typedef std::unordered_multimap Map; + typedef std::pair Pair; + + Map m; + VERIFY( m.empty() ); + + Map::iterator i = m.insert(Pair(rvalstruct(1), rvalstruct(3))); + VERIFY( m.size() == 1 ); + VERIFY( std::distance(m.begin(), m.end()) == 1 ); + VERIFY( i == m.begin() ); + VERIFY( (i->first).val == 1 ); + VERIFY( (i->second).val == 3 ); +} + +void test02() +{ + bool test __attribute__((unused)) = true; + using __gnu_test::rvalstruct; + + typedef std::unordered_multimap Map; + typedef std::pair Pair; + + Map m; + VERIFY( m.empty() ); + + m.insert(Pair(rvalstruct(2), rvalstruct(3))); + m.insert(Pair(rvalstruct(2), rvalstruct(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).val == 2 ); + VERIFY( (i2->first).val == 2 ); + VERIFY( ((i1->second).val == 3 && (i2->second).val == 7) + || ((i1->second).val == 7 && (i2->second).val == 3) ); +} + +int main() +{ + test01(); + test02(); + return 0; +} diff --git a/libstdc++-v3/testsuite/23_containers/unordered_multimap/operators/1.cc b/libstdc++-v3/testsuite/23_containers/unordered_multimap/operators/1.cc new file mode 100644 index 000000000..f6e21f8b8 --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/unordered_multimap/operators/1.cc @@ -0,0 +1,192 @@ +// { dg-options "-std=gnu++0x" } + +// 2010-03-25 Paolo Carlini + +// Copyright (C) 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 +// . + +#include +#include + +void test01() +{ + bool test __attribute__((unused)) = true; + + typedef std::pair Pair; + std::unordered_multimap umm1, umm2; + VERIFY( umm1 == umm2 ); + VERIFY( !(umm1 != umm2) ); + + umm1.insert(Pair(1, -1)); + umm2.insert(Pair(1, -1)); + VERIFY( umm1 == umm2 ); + VERIFY( !(umm1 != umm2) ); + + umm1.insert(Pair(2, -1)); + umm2.insert(Pair(2, -1)); + VERIFY( umm1 == umm2 ); + VERIFY( !(umm1 != umm2) ); + + umm1.insert(Pair(1, -1)); + umm2.insert(Pair(1, -1)); + VERIFY( umm1 == umm2 ); + VERIFY( !(umm1 != umm2) ); + + umm1.insert(Pair(3, -3)); + VERIFY( umm1 != umm2 ); + VERIFY( !(umm1 == umm2) ); + + umm2.insert(Pair(3, -3)); + VERIFY( (umm1 == umm2) ); + VERIFY( !(umm1 != umm2) ); + + umm2.clear(); + VERIFY( umm1 != umm2 ); + VERIFY( !(umm1 == umm2) ); + + umm1.clear(); + VERIFY( umm1 == umm2 ); + VERIFY( !(umm1 != umm2) ); + + umm1.insert(Pair(1, -1)); + umm2.insert(Pair(2, -2)); + VERIFY( umm1 != umm2 ); + VERIFY( !(umm1 == umm2) ); + + umm1.insert(Pair(2, -2)); + umm2.insert(Pair(1, -1)); + VERIFY( umm1 == umm2 ); + VERIFY( !(umm1 != umm2) ); + + umm1.insert(Pair(3, -3)); + umm2.insert(Pair(4, -4)); + VERIFY( umm1 != umm2 ); + VERIFY( !(umm1 == umm2) ); + + umm1.insert(Pair(4, -4)); + VERIFY( umm1 != umm2 ); + VERIFY( !(umm1 == umm2) ); + + umm2.insert(Pair(3, -3)); + VERIFY( umm1 == umm2 ); + VERIFY( !(umm1 != umm2) ); + + umm1.insert(Pair(1, -1)); + umm2.insert(Pair(1, -1)); + VERIFY( umm1 == umm2 ); + VERIFY( !(umm1 != umm2) ); + + umm1.insert(Pair(4, -4)); + umm2.insert(Pair(4, -4)); + VERIFY( umm1 == umm2 ); + VERIFY( !(umm1 != umm2) ); + + umm1.clear(); + umm2.clear(); + VERIFY( umm1 == umm2 ); + VERIFY( !(umm1 != umm2) ); + + umm1.insert(Pair(1, -1)); + umm2.insert(Pair(1, -2)); + VERIFY( umm1 != umm2 ); + VERIFY( !(umm1 == umm2) ); + + umm1.clear(); + umm2.clear(); + VERIFY( umm1 == umm2 ); + VERIFY( !(umm1 != umm2) ); + + umm1.insert(Pair(1, -1)); + umm2.insert(Pair(1, -1)); + VERIFY( umm1 == umm2 ); + VERIFY( !(umm1 != umm2) ); + + umm1.insert(Pair(2, -2)); + umm2.insert(Pair(2, -3)); + VERIFY( umm1 != umm2 ); + VERIFY( !(umm1 == umm2) ); + + umm1.insert(Pair(2, -3)); + umm2.insert(Pair(2, -2)); + VERIFY( umm1 == umm2 ); + VERIFY( !(umm1 != umm2) ); + + umm1.clear(); + umm2.clear(); + VERIFY( umm1 == umm2 ); + VERIFY( !(umm1 != umm2) ); + + umm1.insert(Pair(2, -2)); + umm2.insert(Pair(2, -3)); + VERIFY( umm1 != umm2 ); + VERIFY( !(umm1 == umm2) ); + + umm1.insert(Pair(1, -1)); + umm2.insert(Pair(1, -1)); + VERIFY( umm1 != umm2 ); + VERIFY( !(umm1 == umm2) ); + + umm1.insert(Pair(2, -3)); + umm2.insert(Pair(2, -2)); + VERIFY( umm1 == umm2 ); + VERIFY( !(umm1 != umm2) ); + + umm1.insert(Pair(1, -1)); + umm2.insert(Pair(1, -1)); + VERIFY( umm1 == umm2 ); + VERIFY( !(umm1 != umm2) ); + + umm1.insert(Pair(1, -1)); + umm2.insert(Pair(1, -2)); + VERIFY( umm1 != umm2 ); + VERIFY( !(umm1 == umm2) ); + + umm1.insert(Pair(3, -3)); + umm2.insert(Pair(3, -3)); + VERIFY( umm1 != umm2 ); + VERIFY( !(umm1 == umm2) ); + + umm1.insert(Pair(3, -4)); + umm2.insert(Pair(3, -3)); + VERIFY( umm1 != umm2 ); + VERIFY( !(umm1 == umm2) ); + + umm1.insert(Pair(3, -3)); + VERIFY( umm1 != umm2 ); + VERIFY( !(umm1 == umm2) ); + + umm1.insert(Pair(1, -2)); + umm2.insert(Pair(1, -1)); + VERIFY( umm1 != umm2 ); + VERIFY( !(umm1 == umm2) ); + + umm2.insert(Pair(3, -4)); + VERIFY( umm1 == umm2 ); + VERIFY( !(umm1 != umm2) ); + + const std::unordered_multimap cumm1(umm1), cumm2(umm2); + VERIFY( cumm1 == cumm2 ); + VERIFY( !(cumm1 != cumm2) ); + VERIFY( cumm1 == umm2 ); + VERIFY( !(umm1 != cumm2) ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/23_containers/unordered_multimap/operators/2.cc b/libstdc++-v3/testsuite/23_containers/unordered_multimap/operators/2.cc new file mode 100644 index 000000000..1121dbc52 --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/unordered_multimap/operators/2.cc @@ -0,0 +1,63 @@ +// { dg-options "-std=gnu++0x" } + +// 2010-03-25 Paolo Carlini + +// Copyright (C) 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 +// . + +#include +#include +#include + +void test01() +{ + bool test __attribute__((unused)) = true; + + typedef std::pair Pair; + std::unordered_multimap umm1, umm2; + VERIFY( umm1 == umm2 ); + VERIFY( !(umm1 != umm2) ); + + int second1[] = { -1, -2, -3, -4, -5 }; + int second2[] = { -1, -2, -3, -4, -5 }; + const unsigned size = sizeof(second1) / sizeof(int); + + for (unsigned perm1 = 0; perm1 < 120; ++perm1) + { + umm1.clear(); + std::next_permutation(second1, second1 + size); + for (unsigned i1 = 0; i1 < size; ++i1) + umm1.insert(Pair(0, second1[i1])); + + for (unsigned perm2 = 0; perm2 < 120; ++perm2) + { + umm2.clear(); + std::next_permutation(second2, second2 + size); + for (unsigned i2 = 0; i2 < size; ++i2) + umm2.insert(Pair(0, second2[i2])); + + VERIFY( umm1 == umm2 ); + VERIFY( !(umm1 != umm2) ); + } + } +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/23_containers/unordered_multimap/range_access.cc b/libstdc++-v3/testsuite/23_containers/unordered_multimap/range_access.cc new file mode 100644 index 000000000..bfc8ac1c4 --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/unordered_multimap/range_access.cc @@ -0,0 +1,31 @@ +// { dg-do compile } +// { dg-options "-std=gnu++0x" } + +// Copyright (C) 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 +// . + +// 24.6.5, range access [iterator.range] + +#include + +void +test01() +{ + std::unordered_multimap umm{{1, 1.0}, {2, 2.0}, {3, 3.0}}; + std::begin(umm); + std::end(umm); +} diff --git a/libstdc++-v3/testsuite/23_containers/unordered_multimap/requirements/citerators.cc b/libstdc++-v3/testsuite/23_containers/unordered_multimap/requirements/citerators.cc new file mode 100644 index 000000000..736220b73 --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/unordered_multimap/requirements/citerators.cc @@ -0,0 +1,30 @@ +// { dg-options "-std=gnu++0x" } + +// 2007-10-15 Paolo Carlini + +// 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 +// . + +#include +#include + +int main() +{ + typedef std::unordered_multimap test_type; + __gnu_test::citerator test; + return 0; +} diff --git a/libstdc++-v3/testsuite/23_containers/unordered_multimap/requirements/cliterators.cc b/libstdc++-v3/testsuite/23_containers/unordered_multimap/requirements/cliterators.cc new file mode 100644 index 000000000..612787cc7 --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/unordered_multimap/requirements/cliterators.cc @@ -0,0 +1,32 @@ +// { dg-options "-std=gnu++0x" } + +// 2008-06-11 Paolo Carlini + +// 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 +// . + +#include +#include + +int main() +{ + typedef std::unordered_multimap test_type; + typedef typename test_type::value_type value_type; + value_type v(1, 1); + __gnu_test::forward_members_unordered test(v); + return 0; +} diff --git a/libstdc++-v3/testsuite/23_containers/unordered_multimap/requirements/debug.cc b/libstdc++-v3/testsuite/23_containers/unordered_multimap/requirements/debug.cc new file mode 100644 index 000000000..95814ca7b --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/unordered_multimap/requirements/debug.cc @@ -0,0 +1,28 @@ +// { dg-options "-std=gnu++0x" } +// { 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 +// . + +#include +#include + +using namespace __gnu_debug; + +using std::string; + +template class unordered_multimap; diff --git a/libstdc++-v3/testsuite/23_containers/unordered_multimap/requirements/exception/basic.cc b/libstdc++-v3/testsuite/23_containers/unordered_multimap/requirements/exception/basic.cc new file mode 100644 index 000000000..c695f9c1a --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/unordered_multimap/requirements/exception/basic.cc @@ -0,0 +1,42 @@ +// { dg-options "-std=gnu++0x" } +// { dg-require-cstdint "" } + +// 2009-11-30 Benjamin Kosnik + +// Copyright (C) 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 +// . + +#include +#include + +void +value() +{ + typedef __gnu_cxx::throw_value_limit value_type; + typedef __gnu_cxx::throw_allocator_limit allocator_type; + typedef std::hash hash_type; + typedef std::equal_to pred_type; + typedef std::unordered_multimap test_type; + __gnu_test::basic_safety test; +} + +// Container requirement testing, exceptional behavior +int main() +{ + value(); + return 0; +} diff --git a/libstdc++-v3/testsuite/23_containers/unordered_multimap/requirements/exception/generation_prohibited.cc b/libstdc++-v3/testsuite/23_containers/unordered_multimap/requirements/exception/generation_prohibited.cc new file mode 100644 index 000000000..9426e9d44 --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/unordered_multimap/requirements/exception/generation_prohibited.cc @@ -0,0 +1,36 @@ +// { dg-options "-std=gnu++0x" } +// { dg-require-cstdint "" } + +// 2009-09-09 Benjamin Kosnik + +// Copyright (C) 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 +// . + +#include +#include + +// Container requirement testing, exceptional behavior +int main() +{ + typedef __gnu_cxx::throw_value_random value_type; + typedef __gnu_cxx::throw_allocator_random allocator_type; + typedef std::hash hash_type; + typedef std::equal_to pred_type; + typedef std::unordered_multimap test_type; + __gnu_test::generation_prohibited test; + return 0; +} diff --git a/libstdc++-v3/testsuite/23_containers/unordered_multimap/requirements/exception/propagation_consistent.cc b/libstdc++-v3/testsuite/23_containers/unordered_multimap/requirements/exception/propagation_consistent.cc new file mode 100644 index 000000000..921c54812 --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/unordered_multimap/requirements/exception/propagation_consistent.cc @@ -0,0 +1,36 @@ +// { dg-options "-std=gnu++0x" } +// { dg-require-cstdint "" } + +// 2009-09-09 Benjamin Kosnik + +// Copyright (C) 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 +// . + +#include +#include + +// Container requirement testing, exceptional behavior +int main() +{ + typedef __gnu_cxx::throw_value_limit value_type; + typedef __gnu_cxx::throw_allocator_random allocator_type; + typedef std::hash hash_type; + typedef std::equal_to pred_type; + typedef std::unordered_multimap test_type; + __gnu_test::propagation_consistent test; + return 0; +} diff --git a/libstdc++-v3/testsuite/23_containers/unordered_multimap/requirements/explicit_instantiation/1.cc b/libstdc++-v3/testsuite/23_containers/unordered_multimap/requirements/explicit_instantiation/1.cc new file mode 100644 index 000000000..863562db8 --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/unordered_multimap/requirements/explicit_instantiation/1.cc @@ -0,0 +1,23 @@ +// { dg-options "-std=gnu++0x" } +// { 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 +// . + +#include + +template class std::unordered_multimap; diff --git a/libstdc++-v3/testsuite/23_containers/unordered_multimap/requirements/explicit_instantiation/2.cc b/libstdc++-v3/testsuite/23_containers/unordered_multimap/requirements/explicit_instantiation/2.cc new file mode 100644 index 000000000..2eef3715d --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/unordered_multimap/requirements/explicit_instantiation/2.cc @@ -0,0 +1,29 @@ +// { dg-options "-std=gnu++0x" } +// { dg-do compile } + +// Copyright (C) 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 +// . + +// This file tests explicit instantiation of library containers + +#include +#include +#include + +typedef __gnu_test::NonDefaultConstructible inst_type; +typedef __gnu_test::NonDefaultConstructible_hash hash_type; +template class std::unordered_multimap; diff --git a/libstdc++-v3/testsuite/23_containers/unordered_multimap/requirements/explicit_instantiation/3.cc b/libstdc++-v3/testsuite/23_containers/unordered_multimap/requirements/explicit_instantiation/3.cc new file mode 100644 index 000000000..5085f6110 --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/unordered_multimap/requirements/explicit_instantiation/3.cc @@ -0,0 +1,24 @@ +// { dg-options "-std=gnu++0x" } +// { 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 +// . + +#include + +using namespace std; +template class unordered_multimap, equal_to, allocator>; diff --git a/libstdc++-v3/testsuite/23_containers/unordered_multimap/requirements/explicit_instantiation/4.cc b/libstdc++-v3/testsuite/23_containers/unordered_multimap/requirements/explicit_instantiation/4.cc new file mode 100644 index 000000000..d92fdc5b3 --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/unordered_multimap/requirements/explicit_instantiation/4.cc @@ -0,0 +1,33 @@ +// { dg-options "-std=gnu++0x" } +// { dg-do compile } + +// 2010-05-20 Paolo Carlini +// +// Copyright (C) 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 +// . + +// This file tests explicit instantiation of library containers + +#include +#include +#include + +typedef __gnu_test::OverloadedAddress inst_type; +typedef __gnu_test::OverloadedAddress_hash hash_type; + +// libstdc++/41792 +template class std::unordered_multimap; diff --git a/libstdc++-v3/testsuite/23_containers/unordered_multimap/requirements/typedefs.cc b/libstdc++-v3/testsuite/23_containers/unordered_multimap/requirements/typedefs.cc new file mode 100644 index 000000000..eb1b9157a --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/unordered_multimap/requirements/typedefs.cc @@ -0,0 +1,25 @@ +// { dg-options "-std=gnu++0x" } +// { dg-do compile } + +// Copyright (C) 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 +// . + +#include +#include + +// Check container for required typedefs. +__gnu_test::types > t; -- cgit v1.2.3