diff options
Diffstat (limited to 'libstdc++-v3/testsuite/23_containers/unordered_multiset')
31 files changed, 1443 insertions, 0 deletions
diff --git a/libstdc++-v3/testsuite/23_containers/unordered_multiset/cons/moveable.cc b/libstdc++-v3/testsuite/23_containers/unordered_multiset/cons/moveable.cc new file mode 100644 index 000000000..93ae4e30b --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/unordered_multiset/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 +// <http://www.gnu.org/licenses/>. + + +// NOTE: This makes use of the fact that we know how moveable +// is implemented on set (via swap). If the implementation changed +// this test may begin to fail. + +#include <unordered_set> +#include <utility> +#include <testsuite_hooks.h> + +int main() +{ + bool test __attribute__((unused)) = true; + + std::unordered_multiset<int> a,b; + a.insert(2); + b.insert(1); + b = std::move(a); + VERIFY( b.find(2) != b.end() && a.find(1) == a.end() ); + + std::unordered_multiset<int> 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_multiset/debug/construct1_neg.cc b/libstdc++-v3/testsuite/23_containers/unordered_multiset/debug/construct1_neg.cc new file mode 100644 index 000000000..7d8989074 --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/unordered_multiset/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 +// <http://www.gnu.org/licenses/>. +// +// { dg-require-debug-mode "" } +// { dg-options "-std=gnu++0x" } +// { dg-do run { xfail *-*-* } } + +#include <unordered_set> +#include <debug/checks.h> + +void test01() +{ + __gnu_test::check_construct1<std::unordered_multiset<int> >(); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/23_containers/unordered_multiset/debug/construct2_neg.cc b/libstdc++-v3/testsuite/23_containers/unordered_multiset/debug/construct2_neg.cc new file mode 100644 index 000000000..ea6857aa2 --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/unordered_multiset/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 +// <http://www.gnu.org/licenses/>. +// +// { dg-require-debug-mode "" } +// { dg-options "-std=gnu++0x" } +// { dg-do run { xfail *-*-* } } + +#include <unordered_set> +#include <debug/checks.h> + +void test01() +{ + __gnu_test::check_construct2<std::unordered_multiset<int> >(); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/23_containers/unordered_multiset/debug/construct3_neg.cc b/libstdc++-v3/testsuite/23_containers/unordered_multiset/debug/construct3_neg.cc new file mode 100644 index 000000000..20a465962 --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/unordered_multiset/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 +// <http://www.gnu.org/licenses/>. +// +// { dg-require-debug-mode "" } +// { dg-options "-std=gnu++0x" } +// { dg-do run { xfail *-*-* } } + +#include <unordered_set> +#include <debug/checks.h> + +void test01() +{ + __gnu_test::check_construct3<std::unordered_multiset<int> >(); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/23_containers/unordered_multiset/debug/construct4_neg.cc b/libstdc++-v3/testsuite/23_containers/unordered_multiset/debug/construct4_neg.cc new file mode 100644 index 000000000..4fbb4fad6 --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/unordered_multiset/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 +// <http://www.gnu.org/licenses/>. +// +// { dg-options "-std=gnu++0x" } +// { dg-do run { xfail *-*-* } } + +#include <debug/unordered_set> +#include <debug/checks.h> + +void test01() +{ + __gnu_test::check_construct1<__gnu_debug::unordered_multiset<int> >(); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/23_containers/unordered_multiset/debug/insert1_neg.cc b/libstdc++-v3/testsuite/23_containers/unordered_multiset/debug/insert1_neg.cc new file mode 100644 index 000000000..c65c6083d --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/unordered_multiset/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 +// <http://www.gnu.org/licenses/>. +// +// { dg-require-debug-mode "" } +// { dg-options "-std=gnu++0x" } +// { dg-do run { xfail *-*-* } } + +#include <unordered_set> +#include <debug/checks.h> + +void test01() +{ + __gnu_test::check_insert1<std::unordered_multiset<int> >(); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/23_containers/unordered_multiset/debug/insert2_neg.cc b/libstdc++-v3/testsuite/23_containers/unordered_multiset/debug/insert2_neg.cc new file mode 100644 index 000000000..6496624ee --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/unordered_multiset/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 +// <http://www.gnu.org/licenses/>. +// +// { dg-require-debug-mode "" } +// { dg-options "-std=gnu++0x" } +// { dg-do run { xfail *-*-* } } + +#include <unordered_set> +#include <debug/checks.h> + +void test01() +{ + __gnu_test::check_insert2<std::unordered_multiset<int> >(); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/23_containers/unordered_multiset/debug/insert3_neg.cc b/libstdc++-v3/testsuite/23_containers/unordered_multiset/debug/insert3_neg.cc new file mode 100644 index 000000000..b12fe5764 --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/unordered_multiset/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 +// <http://www.gnu.org/licenses/>. +// +// { dg-require-debug-mode "" } +// { dg-options "-std=gnu++0x" } +// { dg-do run { xfail *-*-* } } + +#include <unordered_set> +#include <debug/checks.h> + +void test01() +{ + __gnu_test::check_insert3<std::unordered_multiset<int> >(); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/23_containers/unordered_multiset/debug/insert4_neg.cc b/libstdc++-v3/testsuite/23_containers/unordered_multiset/debug/insert4_neg.cc new file mode 100644 index 000000000..0f2acea40 --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/unordered_multiset/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 +// <http://www.gnu.org/licenses/>. +// +// { dg-options "-std=gnu++0x" } +// { dg-do run { xfail *-*-* } } + +#include <debug/unordered_set> +#include <debug/checks.h> + +void test01() +{ + __gnu_test::check_insert1<__gnu_debug::unordered_multiset<int> >(); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/23_containers/unordered_multiset/erase/1.cc b/libstdc++-v3/testsuite/23_containers/unordered_multiset/erase/1.cc new file mode 100644 index 000000000..327dc4bd0 --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/unordered_multiset/erase/1.cc @@ -0,0 +1,129 @@ +// { dg-options "-std=gnu++0x" } + +// 2010-02-10 Paolo Carlini <paolo.carlini@oracle.com> +// +// 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 +// <http://www.gnu.org/licenses/>. + +#include <unordered_set> +#include <string> +#include <testsuite_hooks.h> + +void test01() +{ + bool test __attribute__((unused)) = true; + + typedef std::unordered_multiset<std::string> Mset; + typedef Mset::iterator iterator; + typedef Mset::const_iterator const_iterator; + + Mset ms1; + + ms1.insert("because to why"); + ms1.insert("the stockholm syndrome"); + ms1.insert("a cereous night"); + ms1.insert("eeilo"); + ms1.insert("protean"); + ms1.insert("the way you are when"); + ms1.insert("tillsammans"); + ms1.insert("umbra/penumbra"); + ms1.insert("belonging (no longer mix)"); + ms1.insert("one line behind"); + ms1.insert("because to why"); + VERIFY( ms1.size() == 11 ); + + VERIFY( ms1.erase("eeilo") == 1 ); + VERIFY( ms1.size() == 10 ); + iterator it1 = ms1.find("eeilo"); + VERIFY( it1 == ms1.end() ); + + VERIFY( ms1.erase("tillsammans") == 1 ); + VERIFY( ms1.size() == 9 ); + iterator it2 = ms1.find("tillsammans"); + VERIFY( it2 == ms1.end() ); + + // Must work (see DR 526) + iterator it3 = ms1.find("belonging (no longer mix)"); + VERIFY( it3 != ms1.end() ); + VERIFY( ms1.erase(*it3) == 1 ); + VERIFY( ms1.size() == 8 ); + it3 = ms1.find("belonging (no longer mix)"); + VERIFY( it3 == ms1.end() ); + + VERIFY( !ms1.erase("abra") ); + VERIFY( ms1.size() == 8 ); + + VERIFY( !ms1.erase("eeilo") ); + VERIFY( ms1.size() == 8 ); + + VERIFY( ms1.erase("because to why") == 2 ); + VERIFY( ms1.size() == 6 ); + iterator it4 = ms1.find("because to why"); + VERIFY( it4 == ms1.end() ); + + iterator it5 = ms1.find("umbra/penumbra"); + iterator it6 = ms1.find("one line behind"); + VERIFY( it5 != ms1.end() ); + VERIFY( it6 != ms1.end() ); + + VERIFY( ms1.find("the stockholm syndrome") != ms1.end() ); + VERIFY( ms1.find("a cereous night") != ms1.end() ); + VERIFY( ms1.find("the way you are when") != ms1.end() ); + VERIFY( ms1.find("a cereous night") != ms1.end() ); + + VERIFY( ms1.erase(*it5) == 1 ); + VERIFY( ms1.size() == 5 ); + it5 = ms1.find("umbra/penumbra"); + VERIFY( it5 == ms1.end() ); + + VERIFY( ms1.erase(*it6) == 1 ); + VERIFY( ms1.size() == 4 ); + it6 = ms1.find("one line behind"); + VERIFY( it6 == ms1.end() ); + + iterator it7 = ms1.begin(); + iterator it8 = it7; + ++it8; + iterator it9 = it8; + ++it9; + + VERIFY( ms1.erase(*it8) == 1 ); + VERIFY( ms1.size() == 3 ); + VERIFY( ++it7 == it9 ); + + iterator it10 = it9; + ++it10; + iterator it11 = it10; + + VERIFY( ms1.erase(*it9) == 1 ); + VERIFY( ms1.size() == 2 ); + VERIFY( ++it10 == ms1.end() ); + + VERIFY( ms1.erase(ms1.begin()) != ms1.end() ); + VERIFY( ms1.size() == 1 ); + VERIFY( ms1.begin() == it11 ); + + VERIFY( ms1.erase(*ms1.begin()) == 1 ); + VERIFY( ms1.size() == 0 ); + VERIFY( ms1.begin() == ms1.end() ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/23_containers/unordered_multiset/erase/24061-multiset.cc b/libstdc++-v3/testsuite/23_containers/unordered_multiset/erase/24061-multiset.cc new file mode 100644 index 000000000..c5eea6eee --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/unordered_multiset/erase/24061-multiset.cc @@ -0,0 +1,107 @@ +// { dg-options "-std=gnu++0x" } + +// 2010-02-10 Paolo Carlini <paolo.carlini@oracle.com> +// +// 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 +// <http://www.gnu.org/licenses/>. + +#include <unordered_set> +#include <string> +#include <testsuite_hooks.h> + +// libstdc++/24061 +void test01() +{ + bool test __attribute__((unused)) = true; + + typedef std::unordered_multiset<std::string> Mset; + typedef Mset::iterator iterator; + typedef Mset::const_iterator const_iterator; + + Mset ms1; + + ms1.insert("all the love in the world"); + ms1.insert("you know what you are?"); + ms1.insert("the collector"); + ms1.insert("the hand that feeds"); + ms1.insert("love is not enough"); + ms1.insert("every day is exactly the same"); + ms1.insert("with teeth"); + ms1.insert("only"); + ms1.insert("getting smaller"); + ms1.insert("sunspots"); + + ms1.insert("the hand that feeds"); + ms1.insert("love is not enough"); + ms1.insert("every day is exactly the same"); + VERIFY( ms1.size() == 13 ); + + iterator it1 = ms1.begin(); + ++it1; + iterator it2 = it1; + ++it2; + iterator it3 = ms1.erase(it1); + VERIFY( ms1.size() == 12 ); + VERIFY( it3 == it2 ); + VERIFY( *it3 == *it2 ); + + iterator it4 = ms1.begin(); + ++it4; + ++it4; + ++it4; + iterator it5 = it4; + ++it5; + ++it5; + iterator it6 = ms1.erase(it4, it5); + VERIFY( ms1.size() == 10 ); + VERIFY( it6 == it5 ); + VERIFY( *it6 == *it5 ); + + const_iterator it7 = ms1.begin(); + ++it7; + ++it7; + ++it7; + const_iterator it8 = it7; + ++it8; + const_iterator it9 = ms1.erase(it7); + VERIFY( ms1.size() == 9 ); + VERIFY( it9 == it8 ); + VERIFY( *it9 == *it8 ); + + const_iterator it10 = ms1.begin(); + ++it10; + const_iterator it11 = it10; + ++it11; + ++it11; + ++it11; + ++it11; + const_iterator it12 = ms1.erase(it10, it11); + VERIFY( ms1.size() == 5 ); + VERIFY( it12 == it11 ); + VERIFY( *it12 == *it11 ); + + iterator it13 = ms1.erase(ms1.begin(), ms1.end()); + VERIFY( ms1.size() == 0 ); + VERIFY( it13 == ms1.end() ); + VERIFY( it13 == ms1.begin() ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/23_containers/unordered_multiset/erase/51142.cc b/libstdc++-v3/testsuite/23_containers/unordered_multiset/erase/51142.cc new file mode 100644 index 000000000..4db6af0fa --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/unordered_multiset/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 +// <http://www.gnu.org/licenses/>. +// + +// { dg-do compile } +// { dg-options "-std=gnu++0x" } + +#include <unordered_set> + +struct X +{ + template<typename T> + X(T&) {} +}; + +bool operator==(const X&, const X&) { return false; } + +// LWG 2059. +void erasor(std::unordered_multiset<X>& s, X x) +{ + std::unordered_multiset<X>::iterator it = s.find(x); + if (it != s.end()) + s.erase(it); +} diff --git a/libstdc++-v3/testsuite/23_containers/unordered_multiset/hash_policy/dr1189.cc b/libstdc++-v3/testsuite/23_containers/unordered_multiset/hash_policy/dr1189.cc new file mode 100644 index 000000000..59232a35a --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/unordered_multiset/hash_policy/dr1189.cc @@ -0,0 +1,48 @@ +// { dg-options "-std=gnu++0x" } +// 2010-03-10 Paolo Carlini <paolo.carlini@oracle.com> +// +// 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 +// <http://www.gnu.org/licenses/>. + +#include <unordered_set> +#include <testsuite_hooks.h> + +// DR 1189. Awkward interface for changing the number of buckets +// in an unordered associative container +void test01() +{ + bool test __attribute__((unused)) = true; + + std::unordered_multiset<int> ms1; + ms1.reserve(10); + VERIFY( ms1.bucket_count() >= 10 ); + + ms1.reserve(100); + VERIFY( ms1.bucket_count() >= 100 ); + + std::unordered_multiset<int> ms2(100); + VERIFY( ms2.bucket_count() >= 100 ); + + ms2.reserve(1000); + VERIFY( ms2.bucket_count() >= 1000 ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/23_containers/unordered_multiset/init-list.cc b/libstdc++-v3/testsuite/23_containers/unordered_multiset/init-list.cc new file mode 100644 index 000000000..41c7ac712 --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/unordered_multiset/init-list.cc @@ -0,0 +1,59 @@ +// Copyright (C) 2008, 2009 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// <http://www.gnu.org/licenses/>. +// + +// { dg-options "-std=gnu++0x" } + +#include <unordered_set> +#include <testsuite_hooks.h> + +using namespace std; + +int test01() +{ + bool test __attribute__((unused)) = true; + + unordered_multiset<int> m({ 1, 5, 5, 37 }); + VERIFY(m.size() == 4); + VERIFY(m.count(1) == 1); + VERIFY(m.count(5) == 2); + VERIFY(m.count(37) == 1); + VERIFY(m.count(42) == 0); + + m = { 28, 37, 37, 37, 102 }; + VERIFY(m.size() == 5); + VERIFY(m.count(28) == 1); + VERIFY(m.count(37) == 3); + VERIFY(m.count(102) == 1); + VERIFY(m.count(1) == 0); + + m.insert({ 42, 42 }); + VERIFY(m.size() == 7); + VERIFY(m.count(28) == 1); + VERIFY(m.count(37) == 3); + VERIFY(m.count(102) == 1); + VERIFY(m.count(42) == 2); + VERIFY(m.count(1) == 0); + + return test; +} + +int main() +{ + __gnu_test::set_memory_limits(); + test01(); +} diff --git a/libstdc++-v3/testsuite/23_containers/unordered_multiset/insert/24061-multiset.cc b/libstdc++-v3/testsuite/23_containers/unordered_multiset/insert/24061-multiset.cc new file mode 100644 index 000000000..6d8b34d3e --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/unordered_multiset/insert/24061-multiset.cc @@ -0,0 +1,57 @@ +// { dg-options "-std=gnu++0x" } + +// 2010-02-10 Paolo Carlini <paolo.carlini@oracle.com> +// +// 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 +// <http://www.gnu.org/licenses/>. + +#include <unordered_set> +#include <string> +#include <testsuite_hooks.h> + +// libstdc++/24061 +void test01() +{ + bool test __attribute__((unused)) = true; + + typedef std::unordered_multiset<std::string> Mset; + typedef Mset::iterator iterator; + typedef Mset::const_iterator const_iterator; + + Mset ms1; + + iterator it1 = ms1.insert(ms1.begin(), "all the love in the world"); + VERIFY( ms1.size() == 1 ); + VERIFY( *it1 == "all the love in the world" ); + + const_iterator cit1(it1); + const_iterator cit2 = ms1.insert(cit1, "you know what you are?"); + VERIFY( ms1.size() == 2 ); + VERIFY( cit2 != cit1 ); + VERIFY( *cit2 == "you know what you are?" ); + + iterator it2 = ms1.insert(it1, "all the love in the world"); + VERIFY( ms1.size() == 3 ); + VERIFY( it2 != it1 ); + VERIFY( *it2 == "all the love in the world" ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/23_containers/unordered_multiset/insert/multiset_range.cc b/libstdc++-v3/testsuite/23_containers/unordered_multiset/insert/multiset_range.cc new file mode 100644 index 000000000..571346fd5 --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/unordered_multiset/insert/multiset_range.cc @@ -0,0 +1,79 @@ +// { 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 +// <http://www.gnu.org/licenses/>. + +// range insert + +#include <string> +#include <iterator> +#include <algorithm> +#include <unordered_set> +#include <testsuite_hooks.h> + +void test01() +{ + bool test __attribute__((unused)) = true; + + typedef std::unordered_multiset<std::string> Set; + Set s; + VERIFY(s.empty()); + + const int N = 10; + const std::string A[N] = { "red", "green", "blue", "violet", "cyan", + "magenta", "yellow", "orange", "pink", "gray" }; + + s.insert(A+0, A+N); + VERIFY(s.size() == static_cast<unsigned int>(N)); + VERIFY(std::distance(s.begin(), s.end()) == N); + + for (int i = 0; i < N; ++i) { + std::string str = A[i]; + Set::iterator it = std::find(s.begin(), s.end(), str); + VERIFY(it != s.end()); + } +} + +void test02() +{ + bool test __attribute__((unused)) = true; + + typedef std::unordered_multiset<int> Set; + Set s; + VERIFY(s.empty()); + + const int N = 8; + const int A[N] = { 3, 7, 4, 8, 2, 4, 6, 7 }; + + s.insert(A+0, A+N); + VERIFY(s.size() == static_cast<unsigned int>(N)); + VERIFY(std::distance(s.begin(), s.end()) == N); + + VERIFY(std::count(s.begin(), s.end(), 2) == 1); + VERIFY(std::count(s.begin(), s.end(), 3) == 1); + VERIFY(std::count(s.begin(), s.end(), 4) == 2); + VERIFY(std::count(s.begin(), s.end(), 6) == 1); + VERIFY(std::count(s.begin(), s.end(), 7) == 2); + VERIFY(std::count(s.begin(), s.end(), 8) == 1); +} + +int main() +{ + test01(); + test02(); + return 0; +} diff --git a/libstdc++-v3/testsuite/23_containers/unordered_multiset/insert/multiset_single.cc b/libstdc++-v3/testsuite/23_containers/unordered_multiset/insert/multiset_single.cc new file mode 100644 index 000000000..f275e9a9b --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/unordered_multiset/insert/multiset_single.cc @@ -0,0 +1,67 @@ +// { 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 +// <http://www.gnu.org/licenses/>. + +// Single-element insert + +#include <string> +#include <iterator> +#include <unordered_set> +#include <testsuite_hooks.h> + +void test01() +{ + bool test __attribute__((unused)) = true; + + typedef std::unordered_multiset<std::string> Set; + Set s; + VERIFY(s.empty()); + + Set::iterator i = s.insert("abcde"); + VERIFY(s.size() == 1); + VERIFY(std::distance(s.begin(), s.end()) == 1); + VERIFY(i == s.begin()); + VERIFY(*i == "abcde"); +} + +void test02() +{ + bool test __attribute__((unused)) = true; + + typedef std::unordered_multiset<std::string> Set; + Set s; + VERIFY(s.empty()); + + s.insert("abcde"); + Set::iterator i = s.insert("abcde"); + VERIFY(s.size() == 2); + VERIFY(std::distance(s.begin(), s.end()) == 2); + VERIFY(*i == "abcde"); + + Set::iterator i2 = s.begin(); + ++i2; + VERIFY(i == s.begin() || i == i2); + VERIFY(*(s.begin()) == "abcde" && *i2 == "abcde"); +} + +int main() +{ + test01(); + test02(); + return 0; +} diff --git a/libstdc++-v3/testsuite/23_containers/unordered_multiset/insert/multiset_single_move.cc b/libstdc++-v3/testsuite/23_containers/unordered_multiset/insert/multiset_single_move.cc new file mode 100644 index 000000000..14b8e1681 --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/unordered_multiset/insert/multiset_single_move.cc @@ -0,0 +1,71 @@ +// { dg-options "-std=gnu++0x" } + +// 2010-10-27 Paolo Carlini <paolo.carlini@oracle.com> +// +// 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 +// <http://www.gnu.org/licenses/>. + +// Single-element insert + +#include <iterator> +#include <unordered_set> +#include <testsuite_hooks.h> +#include <testsuite_rvalref.h> + +void test01() +{ + bool test __attribute__((unused)) = true; + using __gnu_test::rvalstruct; + + typedef std::unordered_multiset<rvalstruct> Set; + Set s; + VERIFY( s.empty() ); + + Set::iterator i = s.insert(rvalstruct(1)); + VERIFY( s.size() == 1 ); + VERIFY( std::distance(s.begin(), s.end()) == 1 ); + VERIFY( i == s.begin() ); + VERIFY( (*i).val == 1 ); +} + +void test02() +{ + bool test __attribute__((unused)) = true; + using __gnu_test::rvalstruct; + + typedef std::unordered_multiset<rvalstruct> Set; + Set s; + VERIFY( s.empty() ); + + s.insert(rvalstruct(2)); + Set::iterator i = s.insert(rvalstruct(2)); + VERIFY( s.size() == 2 ); + VERIFY( std::distance(s.begin(), s.end()) == 2 ); + VERIFY( (*i).val == 2 ); + + Set::iterator i2 = s.begin(); + ++i2; + VERIFY( i == s.begin() || i == i2 ); + VERIFY( (*(s.begin())).val == 2 && (*i2).val == 2 ); +} + +int main() +{ + test01(); + test02(); + return 0; +} diff --git a/libstdc++-v3/testsuite/23_containers/unordered_multiset/operators/1.cc b/libstdc++-v3/testsuite/23_containers/unordered_multiset/operators/1.cc new file mode 100644 index 000000000..3e3b1c762 --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/unordered_multiset/operators/1.cc @@ -0,0 +1,108 @@ +// { dg-options "-std=gnu++0x" } + +// 2010-03-25 Paolo Carlini <paolo.carlini@oracle.com> + +// 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 +// <http://www.gnu.org/licenses/>. + +#include <unordered_set> +#include <testsuite_hooks.h> + +void test01() +{ + bool test __attribute__((unused)) = true; + + std::unordered_multiset<int> ums1, ums2; + VERIFY( ums1 == ums2 ); + VERIFY( !(ums1 != ums2) ); + + ums1.insert(1); + ums2.insert(1); + VERIFY( ums1 == ums2 ); + VERIFY( !(ums1 != ums2) ); + + ums1.insert(2); + ums2.insert(2); + VERIFY( ums1 == ums2 ); + VERIFY( !(ums1 != ums2) ); + + ums1.insert(1); + ums2.insert(1); + VERIFY( ums1 == ums2 ); + VERIFY( !(ums1 != ums2) ); + + ums1.insert(3); + VERIFY( ums1 != ums2 ); + VERIFY( !(ums1 == ums2) ); + + ums2.insert(3); + VERIFY( (ums1 == ums2) ); + VERIFY( !(ums1 != ums2) ); + + ums2.clear(); + VERIFY( ums1 != ums2 ); + VERIFY( !(ums1 == ums2) ); + + ums1.clear(); + VERIFY( ums1 == ums2 ); + VERIFY( !(ums1 != ums2) ); + + ums1.insert(1); + ums2.insert(2); + VERIFY( ums1 != ums2 ); + VERIFY( !(ums1 == ums2) ); + + ums1.insert(2); + ums2.insert(1); + VERIFY( ums1 == ums2 ); + VERIFY( !(ums1 != ums2) ); + + ums1.insert(3); + ums2.insert(4); + VERIFY( ums1 != ums2 ); + VERIFY( !(ums1 == ums2) ); + + ums1.insert(4); + VERIFY( ums1 != ums2 ); + VERIFY( !(ums1 == ums2) ); + + ums2.insert(3); + VERIFY( ums1 == ums2 ); + VERIFY( !(ums1 != ums2) ); + + ums1.insert(1); + ums2.insert(1); + VERIFY( ums1 == ums2 ); + VERIFY( !(ums1 != ums2) ); + + ums1.insert(4); + ums2.insert(4); + VERIFY( ums1 == ums2 ); + VERIFY( !(ums1 != ums2) ); + + const std::unordered_multiset<int> cums1(ums1), cums2(ums2); + VERIFY( cums1 == cums2 ); + VERIFY( !(cums1 != cums2) ); + VERIFY( cums1 == ums2 ); + VERIFY( !(ums1 != cums2) ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/23_containers/unordered_multiset/range_access.cc b/libstdc++-v3/testsuite/23_containers/unordered_multiset/range_access.cc new file mode 100644 index 000000000..ac0fdaa2c --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/unordered_multiset/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 +// <http://www.gnu.org/licenses/>. + +// 24.6.5, range access [iterator.range] + +#include <unordered_set> + +void +test01() +{ + std::unordered_multiset<int> ums{1, 2, 3}; + std::begin(ums); + std::end(ums); +} diff --git a/libstdc++-v3/testsuite/23_containers/unordered_multiset/requirements/citerators.cc b/libstdc++-v3/testsuite/23_containers/unordered_multiset/requirements/citerators.cc new file mode 100644 index 000000000..6731848fe --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/unordered_multiset/requirements/citerators.cc @@ -0,0 +1,30 @@ +// { dg-options "-std=gnu++0x" } + +// 2007-10-15 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/>. + +#include <unordered_set> +#include <testsuite_containers.h> + +int main() +{ + typedef std::unordered_multiset<int> test_type; + __gnu_test::citerator<test_type> test; + return 0; +} diff --git a/libstdc++-v3/testsuite/23_containers/unordered_multiset/requirements/cliterators.cc b/libstdc++-v3/testsuite/23_containers/unordered_multiset/requirements/cliterators.cc new file mode 100644 index 000000000..c9db47ce5 --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/unordered_multiset/requirements/cliterators.cc @@ -0,0 +1,32 @@ +// { dg-options "-std=gnu++0x" } + +// 2008-06-11 Paolo Carlini <paolo.carlini@oracle.com> + +// Copyright (C) 2008, 2009 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// <http://www.gnu.org/licenses/>. + +#include <unordered_set> +#include <testsuite_containers.h> + +int main() +{ + typedef std::unordered_multiset<int> test_type; + typedef typename test_type::value_type value_type; + value_type v(1); + __gnu_test::forward_members_unordered<test_type> test(v); + return 0; +} diff --git a/libstdc++-v3/testsuite/23_containers/unordered_multiset/requirements/debug.cc b/libstdc++-v3/testsuite/23_containers/unordered_multiset/requirements/debug.cc new file mode 100644 index 000000000..f7774948d --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/unordered_multiset/requirements/debug.cc @@ -0,0 +1,26 @@ +// { 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 +// <http://www.gnu.org/licenses/>. + +#include <string> +#include <debug/unordered_set> + +using namespace __gnu_debug; + +template class unordered_multiset<int>; diff --git a/libstdc++-v3/testsuite/23_containers/unordered_multiset/requirements/exception/basic.cc b/libstdc++-v3/testsuite/23_containers/unordered_multiset/requirements/exception/basic.cc new file mode 100644 index 000000000..b0344e844 --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/unordered_multiset/requirements/exception/basic.cc @@ -0,0 +1,42 @@ +// { dg-options "-std=gnu++0x" } +// { dg-require-cstdint "" } + +// 2009-11-30 Benjamin Kosnik <benjamin@redhat.com> + +// 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 +// <http://www.gnu.org/licenses/>. + +#include <unordered_set> +#include <exception/safety.h> + +void +value() +{ + typedef __gnu_cxx::throw_value_limit value_type; + typedef __gnu_cxx::throw_allocator_limit<value_type> allocator_type; + typedef std::hash<value_type> hash_type; + typedef std::equal_to<value_type> pred_type; + typedef std::unordered_multiset<value_type, hash_type, pred_type, allocator_type> test_type; + __gnu_test::basic_safety<test_type> test; +} + +// Container requirement testing, exceptional behavior +int main() +{ + value(); + return 0; +} diff --git a/libstdc++-v3/testsuite/23_containers/unordered_multiset/requirements/exception/generation_prohibited.cc b/libstdc++-v3/testsuite/23_containers/unordered_multiset/requirements/exception/generation_prohibited.cc new file mode 100644 index 000000000..a0d8abb54 --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/unordered_multiset/requirements/exception/generation_prohibited.cc @@ -0,0 +1,36 @@ +// { dg-options "-std=gnu++0x" } +// { dg-require-cstdint "" } + +// 2009-09-09 Benjamin Kosnik <benjamin@redhat.com> + +// 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 +// <http://www.gnu.org/licenses/>. + +#include <unordered_set> +#include <exception/safety.h> + +// Container requirement testing, exceptional behavior +int main() +{ + typedef __gnu_cxx::throw_value_random value_type; + typedef __gnu_cxx::throw_allocator_random<value_type> allocator_type; + typedef std::hash<value_type> hash_type; + typedef std::equal_to<value_type> pred_type; + typedef std::unordered_multiset<value_type, hash_type, pred_type, allocator_type> test_type; + __gnu_test::generation_prohibited<test_type> test; + return 0; +} diff --git a/libstdc++-v3/testsuite/23_containers/unordered_multiset/requirements/exception/propagation_consistent.cc b/libstdc++-v3/testsuite/23_containers/unordered_multiset/requirements/exception/propagation_consistent.cc new file mode 100644 index 000000000..b0303c14d --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/unordered_multiset/requirements/exception/propagation_consistent.cc @@ -0,0 +1,36 @@ +// { dg-options "-std=gnu++0x" } +// { dg-require-cstdint "" } + +// 2009-09-09 Benjamin Kosnik <benjamin@redhat.com> + +// 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 +// <http://www.gnu.org/licenses/>. + +#include <unordered_set> +#include <exception/safety.h> + +// Container requirement testing, exceptional behavior +int main() +{ + typedef __gnu_cxx::throw_value_limit value_type; + typedef __gnu_cxx::throw_allocator_limit<value_type> allocator_type; + typedef std::hash<value_type> hash_type; + typedef std::equal_to<value_type> pred_type; + typedef std::unordered_multiset<value_type, hash_type, pred_type, allocator_type> test_type; + __gnu_test::propagation_consistent<test_type> test; + return 0; +} diff --git a/libstdc++-v3/testsuite/23_containers/unordered_multiset/requirements/explicit_instantiation/1.cc b/libstdc++-v3/testsuite/23_containers/unordered_multiset/requirements/explicit_instantiation/1.cc new file mode 100644 index 000000000..a8fbbd081 --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/unordered_multiset/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 +// <http://www.gnu.org/licenses/>. + +#include <unordered_set> + +template class std::unordered_multiset<int>; diff --git a/libstdc++-v3/testsuite/23_containers/unordered_multiset/requirements/explicit_instantiation/2.cc b/libstdc++-v3/testsuite/23_containers/unordered_multiset/requirements/explicit_instantiation/2.cc new file mode 100644 index 000000000..5764e924e --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/unordered_multiset/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 +// <http://www.gnu.org/licenses/>. + +// This file tests explicit instantiation of library containers + +#include <unordered_set> +#include <testsuite_hooks.h> +#include <testsuite_api.h> + +typedef __gnu_test::NonDefaultConstructible inst_type; +typedef __gnu_test::NonDefaultConstructible_hash hash_type; +template class std::unordered_multiset<inst_type, hash_type>; diff --git a/libstdc++-v3/testsuite/23_containers/unordered_multiset/requirements/explicit_instantiation/3.cc b/libstdc++-v3/testsuite/23_containers/unordered_multiset/requirements/explicit_instantiation/3.cc new file mode 100644 index 000000000..faf119ca2 --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/unordered_multiset/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 +// <http://www.gnu.org/licenses/>. + +#include <unordered_set> + +using namespace std; +template class unordered_multiset<int, hash<int>, equal_to<int>, allocator<char>>; diff --git a/libstdc++-v3/testsuite/23_containers/unordered_multiset/requirements/explicit_instantiation/4.cc b/libstdc++-v3/testsuite/23_containers/unordered_multiset/requirements/explicit_instantiation/4.cc new file mode 100644 index 000000000..618402643 --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/unordered_multiset/requirements/explicit_instantiation/4.cc @@ -0,0 +1,33 @@ +// { dg-options "-std=gnu++0x" } +// { dg-do compile } + +// 2010-05-20 Paolo Carlini <paolo.carlini@oracle.com> +// +// 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 +// <http://www.gnu.org/licenses/>. + +// This file tests explicit instantiation of library containers + +#include <unordered_set> +#include <testsuite_hooks.h> +#include <testsuite_api.h> + +typedef __gnu_test::OverloadedAddress inst_type; +typedef __gnu_test::OverloadedAddress_hash hash_type; + +// libstdc++/41792 +template class std::unordered_multiset<inst_type, hash_type>; diff --git a/libstdc++-v3/testsuite/23_containers/unordered_multiset/requirements/typedefs.cc b/libstdc++-v3/testsuite/23_containers/unordered_multiset/requirements/typedefs.cc new file mode 100644 index 000000000..7e65e3a21 --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/unordered_multiset/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 +// <http://www.gnu.org/licenses/>. + +#include <testsuite_containers.h> +#include <unordered_set> + +// Check container for required typedefs. +__gnu_test::types<std::unordered_multiset<int> > t; |