summaryrefslogtreecommitdiff
path: root/libstdc++-v3/testsuite/23_containers/bitset
diff options
context:
space:
mode:
authorupstream source tree <ports@midipix.org>2015-03-15 20:14:05 -0400
committerupstream source tree <ports@midipix.org>2015-03-15 20:14:05 -0400
commit554fd8c5195424bdbcabf5de30fdc183aba391bd (patch)
tree976dc5ab7fddf506dadce60ae936f43f58787092 /libstdc++-v3/testsuite/23_containers/bitset
downloadcbb-gcc-4.6.4-554fd8c5195424bdbcabf5de30fdc183aba391bd.tar.bz2
cbb-gcc-4.6.4-554fd8c5195424bdbcabf5de30fdc183aba391bd.tar.xz
obtained gcc-4.6.4.tar.bz2 from upstream website;upstream
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.
Diffstat (limited to 'libstdc++-v3/testsuite/23_containers/bitset')
-rw-r--r--libstdc++-v3/testsuite/23_containers/bitset/18604.cc42
-rw-r--r--libstdc++-v3/testsuite/23_containers/bitset/45713.cc25
-rw-r--r--libstdc++-v3/testsuite/23_containers/bitset/all/1.cc80
-rw-r--r--libstdc++-v3/testsuite/23_containers/bitset/cons/1.cc84
-rw-r--r--libstdc++-v3/testsuite/23_containers/bitset/cons/16020.cc41
-rw-r--r--libstdc++-v3/testsuite/23_containers/bitset/cons/2.cc46
-rw-r--r--libstdc++-v3/testsuite/23_containers/bitset/cons/3.cc62
-rw-r--r--libstdc++-v3/testsuite/23_containers/bitset/cons/38244.cc43
-rw-r--r--libstdc++-v3/testsuite/23_containers/bitset/cons/50268.cc84
-rw-r--r--libstdc++-v3/testsuite/23_containers/bitset/cons/6282.cc63
-rw-r--r--libstdc++-v3/testsuite/23_containers/bitset/cons/constexpr.cc37
-rw-r--r--libstdc++-v3/testsuite/23_containers/bitset/cons/dr1325-1.cc26
-rw-r--r--libstdc++-v3/testsuite/23_containers/bitset/cons/dr1325-2.cc80
-rw-r--r--libstdc++-v3/testsuite/23_containers/bitset/cons/dr396.cc51
-rw-r--r--libstdc++-v3/testsuite/23_containers/bitset/count/6124.cc38
-rw-r--r--libstdc++-v3/testsuite/23_containers/bitset/debug/invalidation/1.cc47
-rw-r--r--libstdc++-v3/testsuite/23_containers/bitset/ext/15361.cc39
-rw-r--r--libstdc++-v3/testsuite/23_containers/bitset/hash/1.cc45
-rw-r--r--libstdc++-v3/testsuite/23_containers/bitset/input/1.cc49
-rw-r--r--libstdc++-v3/testsuite/23_containers/bitset/operations/1.cc108
-rw-r--r--libstdc++-v3/testsuite/23_containers/bitset/operations/13838.cc46
-rw-r--r--libstdc++-v3/testsuite/23_containers/bitset/operations/2.cc41
-rw-r--r--libstdc++-v3/testsuite/23_containers/bitset/requirements/constexpr_functions.cc55
-rw-r--r--libstdc++-v3/testsuite/23_containers/bitset/requirements/explicit_instantiation/1.cc25
-rw-r--r--libstdc++-v3/testsuite/23_containers/bitset/requirements/explicit_instantiation/1_c++0x.cc25
-rw-r--r--libstdc++-v3/testsuite/23_containers/bitset/test/1.cc52
-rw-r--r--libstdc++-v3/testsuite/23_containers/bitset/to_string/1.cc52
-rw-r--r--libstdc++-v3/testsuite/23_containers/bitset/to_string/dr396.cc64
-rw-r--r--libstdc++-v3/testsuite/23_containers/bitset/to_ullong/1.cc44
-rw-r--r--libstdc++-v3/testsuite/23_containers/bitset/to_ulong/1.cc47
30 files changed, 1541 insertions, 0 deletions
diff --git a/libstdc++-v3/testsuite/23_containers/bitset/18604.cc b/libstdc++-v3/testsuite/23_containers/bitset/18604.cc
new file mode 100644
index 000000000..f0c06aa62
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/bitset/18604.cc
@@ -0,0 +1,42 @@
+// 2005-05-09 Paolo Carlini <pcarlini@suse.de>
+
+// Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// NB: This issue affected only debug-mode.
+
+// { dg-do compile }
+
+// libstdc++/18604
+struct less;
+struct allocator;
+struct pair;
+struct binary_function;
+struct iterator;
+struct iterator_traits;
+struct bidirectional_iterator_tag;
+struct forward_iterator_tag;
+struct input_iterator_tag;
+struct random_access_iterator_tag;
+struct ios_base;
+struct basic_string;
+struct basic_istream;
+struct basic_ostream;
+struct char_traits;
+
+#include <bitset>
diff --git a/libstdc++-v3/testsuite/23_containers/bitset/45713.cc b/libstdc++-v3/testsuite/23_containers/bitset/45713.cc
new file mode 100644
index 000000000..8d369d63e
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/bitset/45713.cc
@@ -0,0 +1,25 @@
+// 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-do compile }
+
+#include <bitset>
+
+// libstdc++/45713
+#if __SIZEOF_SIZE_T__ >= 4
+int test[sizeof(std::bitset<0xffffffff>) != 1 ? 1 : -1];
+#endif
diff --git a/libstdc++-v3/testsuite/23_containers/bitset/all/1.cc b/libstdc++-v3/testsuite/23_containers/bitset/all/1.cc
new file mode 100644
index 000000000..c23c1e96f
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/bitset/all/1.cc
@@ -0,0 +1,80 @@
+// 2007-11-23 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/>.
+
+// 23.3.5.2 bitset members
+
+#include <bitset>
+#include <testsuite_hooks.h>
+
+// DR 693. std::bitset::all() missing.
+void test01()
+{
+ bool test __attribute__((unused)) = true;
+
+ std::bitset<0> z1;
+ VERIFY( z1.all() );
+ z1.set();
+ VERIFY( z1.all() );
+
+ std::bitset<8> z2;
+ VERIFY( !z2.all() );
+ z2.set();
+ VERIFY( z2.all() );
+
+ std::bitset<16> z3;
+ VERIFY( !z3.all() );
+ z3.set();
+ VERIFY( z3.all() );
+
+ std::bitset<32> z4;
+ VERIFY( !z4.all() );
+ z4.set();
+ VERIFY( z4.all() );
+
+ std::bitset<64> z5;
+ VERIFY( !z5.all() );
+ z5.set();
+ VERIFY( z5.all() );
+
+ std::bitset<96> z6;
+ VERIFY( !z6.all() );
+ z6.set();
+ VERIFY( z6.all() );
+
+ std::bitset<128> z7;
+ VERIFY( !z7.all() );
+ z7.set();
+ VERIFY( z7.all() );
+
+ std::bitset<192> z8;
+ VERIFY( !z8.all() );
+ z8.set();
+ VERIFY( z8.all() );
+
+ std::bitset<1024> z9;
+ VERIFY( !z9.all() );
+ z9.set();
+ VERIFY( z9.all() );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/bitset/cons/1.cc b/libstdc++-v3/testsuite/23_containers/bitset/cons/1.cc
new file mode 100644
index 000000000..cc391c419
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/bitset/cons/1.cc
@@ -0,0 +1,84 @@
+// 1999-06-08 bkoz
+
+// Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2009
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 23.3.5.1 bitset constructors
+
+#include <string>
+#include <bitset>
+#include <algorithm> // std::reverse
+#include <stdexcept>
+#include <testsuite_hooks.h>
+
+bool test01(void)
+{
+ bool test __attribute__((unused)) = true;
+
+ // bitset()
+ const size_t n1 = 5;
+ std::bitset<n1> bit01;
+ for (size_t i = 0; i < n1; ++i)
+ VERIFY( !bit01.test(i) );
+
+ // bitset(unsigned long)
+ const size_t n2 = 32;
+ unsigned long ul1 = 2;
+ std::bitset<n2> bit02(ul1);
+ VERIFY( !bit02.test(0) );
+ VERIFY( bit02.test(1) );
+ VERIFY( !bit02.test(2) );
+
+ // template<_CharT, _Traits, _Alloc>
+ // explicit bitset(const basic_string<_C,_T,_A>&, size_type pos, size_type n)
+ std::string str01("stuff smith sessions");
+ const size_t n3 = 128;
+ try {
+ std::bitset<n3> bit03(str01, 5);
+ }
+ catch(std::invalid_argument& fail) {
+ VERIFY( true );
+ }
+ catch(...) {
+ VERIFY( false );
+ }
+
+ std::string str02("010101000011");
+ int sz = str02.size();
+ try {
+ std::bitset<n3> bit03(str02, 0);
+ std::string str03;
+ for (int i = 0; i < sz; ++i)
+ str03 += (bit03.test(i) ? '1' : '0');
+ std::reverse(str03.begin(), str03.end());
+ VERIFY( str03 == str02 );
+ }
+ catch(std::invalid_argument& fail) {
+ VERIFY( false );
+ }
+ catch(...) {
+ VERIFY( false );
+ }
+ return test;
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/bitset/cons/16020.cc b/libstdc++-v3/testsuite/23_containers/bitset/cons/16020.cc
new file mode 100644
index 000000000..f30746161
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/bitset/cons/16020.cc
@@ -0,0 +1,41 @@
+// Copyright (C) 2004, 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+#include <debug/bitset>
+#include <testsuite_hooks.h>
+
+// libstdc++/16020
+void test01()
+{
+ using __gnu_debug::bitset;
+ bool test __attribute__((unused)) = true;
+
+ bitset<5> b(7);
+ bitset<5> c;
+
+ bitset<5> bb(b);
+ c = bb;
+
+ VERIFY( bb == b );
+ VERIFY( c == bb );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/bitset/cons/2.cc b/libstdc++-v3/testsuite/23_containers/bitset/cons/2.cc
new file mode 100644
index 000000000..4a394473f
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/bitset/cons/2.cc
@@ -0,0 +1,46 @@
+// { dg-options "-std=gnu++0x" }
+
+// Copyright (C) 2009, 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+#include <bitset>
+#include <string>
+#include <testsuite_hooks.h>
+
+struct X
+{
+ operator const char*() { return "10101010"; }
+};
+
+void
+test01()
+{
+ bool test __attribute__((unused)) = true;
+
+ X x;
+ std::string s(x);
+ std::bitset<32> b1(static_cast<const char*>(x));
+ std::bitset<32> b2(s);
+ VERIFY( b1 == b2 );
+}
+
+int
+main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/bitset/cons/3.cc b/libstdc++-v3/testsuite/23_containers/bitset/cons/3.cc
new file mode 100644
index 000000000..b90806870
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/bitset/cons/3.cc
@@ -0,0 +1,62 @@
+// { dg-options "-std=gnu++0x" }
+
+// 2009-12-31 Paolo Carlini <paolo.carlini@oracle.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 <bitset>
+#include <testsuite_hooks.h>
+
+void test01()
+{
+ bool test __attribute__((unused)) = true;
+
+ const unsigned long long num0 = 0ULL;
+ std::bitset<0> bs0(num0);
+ VERIFY( bs0.to_ullong() == num0 );
+
+ const unsigned long long num1 = 215ULL;
+ std::bitset<32> bs1(num1);
+ VERIFY( bs1.to_ullong() == num1 );
+
+ const unsigned long long num2 = 215ULL;
+ std::bitset<64> bs2(num2);
+ VERIFY( bs2.to_ullong() == num2 );
+
+ const unsigned long long num3 = 343353215ULL;
+ std::bitset<32> bs3(num3);
+ VERIFY( bs3.to_ullong() == num3 );
+
+ const unsigned long long num4 = 343353215ULL;
+ std::bitset<64> bs4(num4);
+ VERIFY( bs4.to_ullong() == num4 );
+
+ const unsigned long long num5 = 13008719539498589283ULL;
+ std::bitset<64> bs5(num5);
+ VERIFY( bs5.to_ullong() == num5 );
+
+ const unsigned long long num6 = 13008719539498589283ULL;
+ std::bitset<128> bs6(num6);
+ VERIFY( bs6.to_ullong() == num6 );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/bitset/cons/38244.cc b/libstdc++-v3/testsuite/23_containers/bitset/cons/38244.cc
new file mode 100644
index 000000000..fae2174b0
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/bitset/cons/38244.cc
@@ -0,0 +1,43 @@
+// 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-do compile }
+
+#include <bitset>
+
+class C0
+{
+ public:
+ C0() : b(0) { }
+ private:
+ std::bitset<1> b;
+};
+
+class C1
+{
+ public:
+ C1() : b(1) { }
+ private:
+ std::bitset<1> b;
+};
+
+// libstdc++/38244
+void func()
+{
+ C0 val0;
+ C1 val1;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/bitset/cons/50268.cc b/libstdc++-v3/testsuite/23_containers/bitset/cons/50268.cc
new file mode 100644
index 000000000..6a61d7e2f
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/bitset/cons/50268.cc
@@ -0,0 +1,84 @@
+// { dg-options "-std=gnu++0x" }
+
+// 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/>.
+
+#include <bitset>
+#include <testsuite_hooks.h>
+
+// libstdc++/50268
+void test01()
+{
+ bool test __attribute__((unused)) = true;
+
+ std::bitset<1> b1(3ULL);
+ VERIFY( b1.count() == 1ULL );
+
+ std::bitset<3> b2(30ULL);
+ VERIFY( b2.count() == 2ULL );
+
+ std::bitset<6> b3(300ULL);
+ VERIFY( b3.count() == 3ULL );
+
+ std::bitset<9> b4(3000ULL);
+ VERIFY( b4.count() == 5ULL );
+
+ std::bitset<16> b5(300000ULL);
+ VERIFY( b5.count() == 7ULL );
+
+ std::bitset<24> b6(30000000ULL);
+ VERIFY( b6.count() == 9ULL );
+
+ std::bitset<32> b7(30000000000ULL);
+ VERIFY( b7.count() == 13ULL );
+
+ std::bitset<37> b8(3000000000000ULL);
+ VERIFY( b8.count() == 18ULL );
+
+ std::bitset<40> b9(30000000000000ULL);
+ VERIFY( b9.count() == 16ULL );
+
+ std::bitset<45> b10(30000000000000ULL);
+ VERIFY( b10.count() == 20ULL );
+
+ std::bitset<64> b11(30000000000000ULL);
+ VERIFY( b11.count() == 20ULL );
+
+ std::bitset<100> b12(30000000000000ULL);
+ VERIFY( b12.count() == 20ULL );
+
+ std::bitset<200> b13(30000000000000ULL);
+ VERIFY( b13.count() == 20ULL );
+
+ std::bitset<45> b14(18446744073709551615ULL);
+ VERIFY( b14.count() == 45ULL );
+
+ std::bitset<64> b15(18446744073709551615ULL);
+ VERIFY( b15.count() == 64ULL );
+
+ std::bitset<100> b16(18446744073709551615ULL);
+ VERIFY( b16.count() == 64ULL );
+
+ std::bitset<200> b17(18446744073709551615ULL);
+ VERIFY( b17.count() == 64ULL );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/bitset/cons/6282.cc b/libstdc++-v3/testsuite/23_containers/bitset/cons/6282.cc
new file mode 100644
index 000000000..387852412
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/bitset/cons/6282.cc
@@ -0,0 +1,63 @@
+// 1999-06-08 bkoz
+
+// Copyright (C) 1999, 2000, 2002, 2003, 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/>.
+
+// 23.3.5.1 bitset constructors
+
+#include <string>
+#include <bitset>
+#include <stdexcept>
+#include <testsuite_hooks.h>
+
+// boundary condition: a zero-sized set
+// libstdc++/6282
+bool test02(void)
+{
+ using std::char_traits; using std::allocator;
+ bool test __attribute__((unused)) = true;
+
+ std::bitset<0> z1;
+ VERIFY( z1.any() == false );
+
+ std::bitset<0> z2(12345);
+ VERIFY( z2.any() == false );
+
+ std::bitset<0> z3(std::string("10101010101"));
+ VERIFY( z3.any() == false );
+
+ try {
+ z1.set(0);
+ VERIFY( false );
+ }
+ catch(std::out_of_range& fail) {
+ VERIFY( true );
+ }
+ catch(...) {
+ VERIFY( false );
+ }
+
+ VERIFY( z1.to_ulong() == 0 );
+ VERIFY( (z1.to_string<char,char_traits<char>,allocator<char> >().empty() ));
+ return test;
+}
+
+int main()
+{
+ test02();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/bitset/cons/constexpr.cc b/libstdc++-v3/testsuite/23_containers/bitset/cons/constexpr.cc
new file mode 100644
index 000000000..aea503013
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/bitset/cons/constexpr.cc
@@ -0,0 +1,37 @@
+// { 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/>.
+
+#include <bitset>
+#include <testsuite_common_types.h>
+
+int main()
+{
+ __gnu_test::constexpr_default_constructible test1;
+ test1.operator()<std::bitset<0>>();
+ test1.operator()<std::bitset<1>>();
+ test1.operator()<std::bitset<256>>();
+
+ __gnu_test::constexpr_single_value_constructible test2;
+ test2.operator()<std::bitset<0>, unsigned long long>();
+ test2.operator()<std::bitset<1>, unsigned long long>();
+ test2.operator()<std::bitset<256>, unsigned long long>();
+
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/bitset/cons/dr1325-1.cc b/libstdc++-v3/testsuite/23_containers/bitset/cons/dr1325-1.cc
new file mode 100644
index 000000000..c79727e04
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/bitset/cons/dr1325-1.cc
@@ -0,0 +1,26 @@
+// { dg-options "-std=gnu++0x" }
+// { dg-do compile }
+
+// 2010-10-11 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 <bitset>
+
+// DR 1325.
+std::bitset<10> b(0);
diff --git a/libstdc++-v3/testsuite/23_containers/bitset/cons/dr1325-2.cc b/libstdc++-v3/testsuite/23_containers/bitset/cons/dr1325-2.cc
new file mode 100644
index 000000000..e261ce5e6
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/bitset/cons/dr1325-2.cc
@@ -0,0 +1,80 @@
+// { dg-options "-std=gnu++0x" }
+
+// 2010-10-11 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 <bitset>
+#include <testsuite_hooks.h>
+
+template<std::size_t Nb, typename CharT>
+ std::bitset<Nb>
+ test01_ref(const CharT* str,
+ typename std::basic_string<CharT>::size_type n
+ = std::basic_string<CharT>::npos,
+ CharT zero = CharT('0'), CharT one = CharT('1'))
+ {
+ return std::bitset<Nb>(n == std::basic_string<CharT>::npos
+ ? std::basic_string<CharT>(str)
+ : std::basic_string<CharT>(str, n),
+ 0, n, zero, one);
+ }
+
+// DR 1325.
+void test01()
+{
+ bool test __attribute__((unused)) = true;
+ using namespace std;
+
+ const char s1[4] = { '0', '1', '0', '1' };
+ VERIFY( bitset<4>(s1, 4) == test01_ref<4>(s1, 4) );
+
+ const char s2[3] = { '1', '1', '0' };
+ VERIFY( bitset<6>(s2, 3) == test01_ref<6>(s2, 3) );
+
+ const char* s3 = "1110110";
+ VERIFY( bitset<7>(s3) == test01_ref<7>(s3) );
+
+ const char* s4 = "0011";
+ VERIFY( bitset<10>(s4) == test01_ref<10>(s4) );
+
+ const char* s5 = "011110000111001";
+ VERIFY( bitset<5>(s5) == test01_ref<5>(s5) );
+
+ const char* s6 = "1cc1c1";
+ VERIFY( bitset<6>(s6, basic_string<char>::npos, 'c')
+ == test01_ref<6>(s6, basic_string<char>::npos, 'c') );
+
+ const char* s7 = "001011101";
+ VERIFY( bitset<9>(s7, basic_string<char>::npos, '0', '1')
+ == test01_ref<9>(s7, basic_string<char>::npos, '0', '1') );
+
+ const char* s8 = "babb";
+ VERIFY( bitset<4>(s8, basic_string<char>::npos, 'a', 'b')
+ == test01_ref<4>(s8, basic_string<char>::npos, 'a', 'b') );
+
+ const char* s9 = "bbabbbaaa";
+ VERIFY( bitset<100>(s9, basic_string<char>::npos, 'a', 'b')
+ == test01_ref<100>(s9, basic_string<char>::npos, 'a', 'b') );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/bitset/cons/dr396.cc b/libstdc++-v3/testsuite/23_containers/bitset/cons/dr396.cc
new file mode 100644
index 000000000..9fdb807d8
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/bitset/cons/dr396.cc
@@ -0,0 +1,51 @@
+// 2009-09-23 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 <bitset>
+#include <testsuite_hooks.h>
+
+// DR 396. what are characters zero and one.
+void test01()
+{
+ bool test __attribute__((unused)) = true;
+
+ std::bitset<4> z1(std::string("bbab"), 0, std::string::npos, 'a', 'b');
+ VERIFY( z1.to_string('a', 'b') == "bbab" );
+
+ std::bitset<4> z2(std::string("11a1"), 0, std::string::npos, 'a');
+ VERIFY( z2.to_string('a') == "11a1" );
+
+ std::bitset<8> z3(std::string("babb"), 0, std::string::npos, 'a', 'b');
+ VERIFY( z3.to_string('a', 'b') == "aaaababb" );
+
+ std::bitset<8> z4(std::string("1a11"), 0, std::string::npos, 'a');
+ VERIFY( z4.to_string('a') == "aaaa1a11" );
+
+ std::bitset<2> z5(std::string("bbab"), 0, std::string::npos, 'a', 'b');
+ VERIFY( z5.to_string('a', 'b') == "bb" );
+
+ std::bitset<2> z6(std::string("11a1"), 0, std::string::npos, 'a');
+ VERIFY( z6.to_string('a') == "11" );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/bitset/count/6124.cc b/libstdc++-v3/testsuite/23_containers/bitset/count/6124.cc
new file mode 100644
index 000000000..81061541e
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/bitset/count/6124.cc
@@ -0,0 +1,38 @@
+// 2001-06-03 pme
+
+// Copyright (C) 2001, 2002, 2003, 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/>.
+
+// 23.3.5.2 bitset members
+
+#include <bitset>
+#include <stdexcept>
+#include <sstream>
+#include <testsuite_hooks.h>
+
+// libstdc++/6124
+void test02()
+{
+ std::bitset<1> bs;
+ bs.count();
+}
+
+int main()
+{
+ test02();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/bitset/debug/invalidation/1.cc b/libstdc++-v3/testsuite/23_containers/bitset/debug/invalidation/1.cc
new file mode 100644
index 000000000..5959d5fff
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/bitset/debug/invalidation/1.cc
@@ -0,0 +1,47 @@
+// Bitset reference invalidation tests
+
+// Copyright (C) 2003, 2004, 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+#include <debug/bitset>
+#include <testsuite_hooks.h>
+
+using __gnu_debug::bitset;
+
+bool test = true;
+
+// Disappear
+void test01()
+{
+ bitset<32>::reference* i;
+ {
+ bitset<32> bs;
+ bs.flip(7);
+ i = new bitset<32>::reference(bs[7]);
+ VERIFY(*i);
+ }
+#ifndef __GXX_EXPERIMENTAL_CXX0X__
+ VERIFY(i->_M_singular());
+#endif
+ delete i;
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/bitset/ext/15361.cc b/libstdc++-v3/testsuite/23_containers/bitset/ext/15361.cc
new file mode 100644
index 000000000..574f5d7d4
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/bitset/ext/15361.cc
@@ -0,0 +1,39 @@
+// Copyright (C) 2004, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+#include <bitset>
+#include <testsuite_hooks.h>
+
+// libstdc++/15361
+void test01()
+{
+ using namespace std;
+ bool test __attribute__((unused)) = true;
+
+ bitset<256> b;
+ b.set(225);
+ b.set(226);
+
+ VERIFY( b._Find_first() == 225 );
+ VERIFY( b._Find_next(225) == 226 );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/bitset/hash/1.cc b/libstdc++-v3/testsuite/23_containers/bitset/hash/1.cc
new file mode 100644
index 000000000..655192e4e
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/bitset/hash/1.cc
@@ -0,0 +1,45 @@
+// { 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/>.
+
+#include <bitset>
+
+void test01()
+{
+ std::bitset<0> b0;
+ std::hash<std::bitset<0>> h0;
+ h0(b0);
+
+ std::bitset<10> b1;
+ std::hash<std::bitset<10>> h1;
+ h1(b1);
+
+ std::bitset<100> b2;
+ std::hash<std::bitset<100>> h2;
+ h2(b2);
+
+ std::bitset<1000> b3;
+ std::hash<std::bitset<1000>> h3;
+ h3(b3);
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/bitset/input/1.cc b/libstdc++-v3/testsuite/23_containers/bitset/input/1.cc
new file mode 100644
index 000000000..bf441e00d
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/bitset/input/1.cc
@@ -0,0 +1,49 @@
+// 2003-12-03 Paolo Carlini <pcarlini@suse.de>
+
+// Copyright (C) 2003, 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/>.
+
+// 23.3.5.3 bitset operators
+
+#include <bitset>
+#include <sstream>
+#include <testsuite_hooks.h>
+
+void test01()
+{
+ using namespace std;
+ bool test __attribute__((unused)) = true;
+
+ bitset<5> b5;
+ bitset<0> b0;
+ stringstream ss;
+
+ ss.str("*");
+ ss >> b5;
+ VERIFY( ss.rdstate() == ios_base::failbit );
+
+ ss.clear();
+ ss.str("*");
+ ss >> b0;
+ VERIFY( ss.rdstate() == ios_base::goodbit );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/bitset/operations/1.cc b/libstdc++-v3/testsuite/23_containers/bitset/operations/1.cc
new file mode 100644
index 000000000..227b66429
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/bitset/operations/1.cc
@@ -0,0 +1,108 @@
+// 2000-01-15 Anders Widell <awl@hem.passagen.se>
+
+// Copyright (C) 2000, 2003, 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 <set>
+#include <bitset>
+#include <testsuite_hooks.h>
+
+static char original_bits[1024];
+static char left_shifted[1024];
+static char right_shifted[1024];
+
+char
+random_bit() {
+ static long x = 1;
+ return ((x = (3432L*x + 6789L) % 9973L) & 1) + '0';
+}
+
+void
+initialise(size_t size) {
+ for (size_t i=0; i<size; i++)
+ original_bits[i] = random_bit();
+
+ original_bits[size] = '\0';
+ left_shifted[size] = '\0';
+ right_shifted[size] = '\0';
+}
+
+void
+shift_arrays(size_t shift_step, size_t size) {
+ for (size_t i=shift_step; i<size; i++) {
+ right_shifted[i] = original_bits[i-shift_step];
+ left_shifted[size-i-1] = original_bits[size+shift_step-i-1];
+ }
+ for (size_t i=0; i<shift_step && i<size; i++) {
+ right_shifted[i] = '0';
+ left_shifted[size-i-1] = '0';
+ }
+}
+
+template <size_t size>
+ bool
+ do_test() {
+ bool test __attribute__((unused)) = true;
+
+ std::bitset<size> shifted;
+ std::bitset<size> correct;
+
+ initialise(size);
+
+ //std::bitset<size> original = std::string(original_bits);
+ std::bitset<size> original = std::bitset<size> (std::string(original_bits));
+
+ for (size_t shift_step=0; shift_step==0 || shift_step<size; shift_step++) {
+ shift_arrays(shift_step, size);
+
+ shifted = original;
+ shifted <<= shift_step;
+ //correct = std::string(left_shifted);
+ correct = std::bitset<size> (std::string(left_shifted));
+ VERIFY( shifted == correct );
+
+ shifted = original;
+ shifted >>= shift_step;
+ //correct = std::string(right_shifted);
+ correct = std::bitset<size> (std::string(right_shifted));
+ VERIFY( shifted == correct );
+ }
+
+ return test;
+ }
+
+bool
+test01() {
+ bool test __attribute__((unused)) = true;
+
+ VERIFY( do_test<32>() );
+ VERIFY( do_test<48>() );
+ VERIFY( do_test<64>() );
+
+ VERIFY( do_test<511>() );
+ VERIFY( do_test<513>() );
+ VERIFY( do_test<997>() );
+ return test;
+}
+
+int
+main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/bitset/operations/13838.cc b/libstdc++-v3/testsuite/23_containers/bitset/operations/13838.cc
new file mode 100644
index 000000000..f47fa6e88
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/bitset/operations/13838.cc
@@ -0,0 +1,46 @@
+// Copyright (C) 2004, 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+#include <debug/bitset>
+#include <testsuite_hooks.h>
+
+// libstdc++/13838
+void test01()
+{
+ using __gnu_debug::bitset;
+ bool test __attribute__((unused)) = true;
+
+ bitset<4> b0, b1;
+ b0.set(1);
+ b0.set(3);
+ b1.set(2);
+ b1.set(3);
+
+ b0 |= b1;
+
+ bitset<4> br;
+ br.set(1);
+ br.set(2);
+ br.set(3);
+
+ VERIFY( b0 == br );
+}
+
+int main()
+{
+ test01();
+}
diff --git a/libstdc++-v3/testsuite/23_containers/bitset/operations/2.cc b/libstdc++-v3/testsuite/23_containers/bitset/operations/2.cc
new file mode 100644
index 000000000..f234b2b10
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/bitset/operations/2.cc
@@ -0,0 +1,41 @@
+// 2000-01-15 Anders Widell <awl@hem.passagen.se>
+
+// Copyright (C) 2000, 2003, 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 <set>
+#include <bitset>
+#include <testsuite_hooks.h>
+
+bool
+test02()
+{
+ bool test __attribute__((unused)) = true;
+
+ std::bitset<66> b;
+ b <<= 400;
+ VERIFY( b.count() == 0 );
+ return test;
+}
+
+int
+main()
+{
+ test02();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/bitset/requirements/constexpr_functions.cc b/libstdc++-v3/testsuite/23_containers/bitset/requirements/constexpr_functions.cc
new file mode 100644
index 000000000..d5b8b478c
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/bitset/requirements/constexpr_functions.cc
@@ -0,0 +1,55 @@
+// { 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/>.
+
+#include <bitset>
+#include <testsuite_common_types.h>
+
+namespace __gnu_test
+{
+ struct constexpr_member_functions
+ {
+ template<typename _Ttesttype>
+ void
+ operator()()
+ {
+ struct _Concept
+ {
+ void __constraint()
+ {
+ constexpr _Ttesttype obj;
+ constexpr auto v1 __attribute__((unused)) = obj.size();
+ // constexpr auto v2 = obj[4];
+ }
+ };
+
+ _Concept c;
+ c.__constraint();
+ }
+ };
+}
+
+int main()
+{
+ __gnu_test::constexpr_member_functions test;
+ test.operator()<std::bitset<0>>();
+ test.operator()<std::bitset<1>>();
+ test.operator()<std::bitset<64>>();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/bitset/requirements/explicit_instantiation/1.cc b/libstdc++-v3/testsuite/23_containers/bitset/requirements/explicit_instantiation/1.cc
new file mode 100644
index 000000000..25bfef8d1
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/bitset/requirements/explicit_instantiation/1.cc
@@ -0,0 +1,25 @@
+// { dg-do compile }
+
+// Copyright (C) 2007, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+
+// This file tests explicit instantiation of library containers.
+
+#include <bitset>
+
+template class std::bitset<10>;
diff --git a/libstdc++-v3/testsuite/23_containers/bitset/requirements/explicit_instantiation/1_c++0x.cc b/libstdc++-v3/testsuite/23_containers/bitset/requirements/explicit_instantiation/1_c++0x.cc
new file mode 100644
index 000000000..0393ac71d
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/bitset/requirements/explicit_instantiation/1_c++0x.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/>.
+
+// This file tests explicit instantiation of library containers.
+
+#include <bitset>
+
+template class std::bitset<10>;
diff --git a/libstdc++-v3/testsuite/23_containers/bitset/test/1.cc b/libstdc++-v3/testsuite/23_containers/bitset/test/1.cc
new file mode 100644
index 000000000..7f654d83f
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/bitset/test/1.cc
@@ -0,0 +1,52 @@
+// 2001-06-03 pme
+
+// Copyright (C) 2001, 2002, 2003, 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/>.
+
+// 23.3.5.2 bitset members
+
+#include <bitset>
+#include <stdexcept>
+#include <sstream>
+#include <testsuite_hooks.h>
+
+void
+test01(void)
+{
+ bool test __attribute__((unused)) = true;
+ const size_t n1 = 5;
+
+ // the other 22 member functions should be in here too...
+ try {
+ std::bitset<n1> five_bits;
+ bool unused __attribute__((unused)) = five_bits.test(n1); // should throw
+ VERIFY( false );
+ }
+ catch(std::out_of_range& fail) {
+ VERIFY( true );
+ }
+ catch(...) {
+ VERIFY( false );
+ }
+ VERIFY( test );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/bitset/to_string/1.cc b/libstdc++-v3/testsuite/23_containers/bitset/to_string/1.cc
new file mode 100644
index 000000000..a6e77b7aa
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/bitset/to_string/1.cc
@@ -0,0 +1,52 @@
+// 2004-11-17 Paolo Carlini <pcarlini@suse.de>
+
+// Copyright (C) 2004, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 23.3.5.2 bitset members
+
+#include <bitset>
+#include <testsuite_hooks.h>
+
+void test01()
+{
+ using namespace std;
+ bool test __attribute__((unused)) = true;
+
+ bitset<5> b5;
+ string s0 = b5.to_string<char, char_traits<char>, allocator<char> >();
+ VERIFY( s0 == "00000" );
+
+ // DR 434. bitset::to_string() hard to use.
+ b5.set(0);
+ string s1 = b5.to_string<char, char_traits<char> >();
+ VERIFY( s1 == "00001" );
+
+ b5.set(2);
+ string s2 = b5.to_string<char>();
+ VERIFY( s2 == "00101" );
+
+ b5.set(4);
+ string s3 = b5.to_string();
+ VERIFY( s3 == "10101" );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/bitset/to_string/dr396.cc b/libstdc++-v3/testsuite/23_containers/bitset/to_string/dr396.cc
new file mode 100644
index 000000000..d16f43561
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/bitset/to_string/dr396.cc
@@ -0,0 +1,64 @@
+// 2008-09-23 Paolo Carlini <pcarlini@suse.de>
+
+// 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/>.
+
+// 23.3.5.2 bitset members
+
+#include <bitset>
+#include <testsuite_hooks.h>
+
+// DR 396. what are characters zero and one.
+void test01()
+{
+ using namespace std;
+ bool test __attribute__((unused)) = true;
+
+ bitset<5> b5;
+ string s0 = b5.to_string<char, char_traits<char>, allocator<char> >('a', 'b');
+ VERIFY( s0 == "aaaaa" );
+
+ string s1 = b5.to_string<char, char_traits<char>, allocator<char> >('b');
+ VERIFY( s1 == "bbbbb" );
+
+ b5.set(0);
+ string s2 = b5.to_string<char, char_traits<char> >('c', 'd');
+ VERIFY( s2 == "ccccd" );
+
+ string s3 = b5.to_string<char, char_traits<char> >('d');
+ VERIFY( s3 == "dddd1" );
+
+ b5.set(2);
+ string s4 = b5.to_string<char>('e', 'f');
+ VERIFY( s4 == "eefef" );
+
+ string s5 = b5.to_string<char>('f');
+ VERIFY( s5 == "ff1f1" );
+
+ b5.set(4);
+ string s6 = b5.to_string('g', 'h');
+ VERIFY( s6 == "hghgh" );
+
+ string s7 = b5.to_string('h');
+ VERIFY( s7 == "1h1h1" );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/bitset/to_ullong/1.cc b/libstdc++-v3/testsuite/23_containers/bitset/to_ullong/1.cc
new file mode 100644
index 000000000..2a3b886c3
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/bitset/to_ullong/1.cc
@@ -0,0 +1,44 @@
+// { dg-options "-std=gnu++0x" }
+
+// 2009-12-29 Paolo Carlini <paolo.carlini@oracle.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 <bitset>
+#include <testsuite_hooks.h>
+
+void test01()
+{
+ bool test __attribute__((unused)) = true;
+
+ std::bitset<0> bs0;
+ VERIFY( bs0.to_ullong() == 0 );
+
+ std::bitset<64> bs1("11010111");
+ VERIFY( bs1.to_ullong() == 215 );
+
+ std::bitset<64> bs2("10110100100010000100000101111111"
+ "01111110011111110001110001100011");
+ VERIFY( bs2.to_ullong() == 13008719539498589283ULL );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/bitset/to_ulong/1.cc b/libstdc++-v3/testsuite/23_containers/bitset/to_ulong/1.cc
new file mode 100644
index 000000000..8b4de2ced
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/bitset/to_ulong/1.cc
@@ -0,0 +1,47 @@
+// 2001-06-03 pme
+
+// Copyright (C) 2001, 2002, 2003, 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/>.
+
+// 23.3.5.2 bitset members
+
+#include <bitset>
+#include <stdexcept>
+#include <sstream>
+#include <testsuite_hooks.h>
+
+void test03()
+{
+ bool test __attribute__((unused)) = true;
+ std::bitset<5> b;
+ std::stringstream ss("101");
+ ss.exceptions(std::ios_base::eofbit);
+
+ try
+ {
+ ss >> b;
+ }
+ catch (std::exception&) { }
+
+ VERIFY( b.to_ulong() == 5 );
+}
+
+int main()
+{
+ test03();
+ return 0;
+}