summaryrefslogtreecommitdiff
path: root/libstdc++-v3/testsuite/20_util/bitset/observers
diff options
context:
space:
mode:
authorJonathan Wakely <jwakely@redhat.com>2022-09-22 14:37:58 +0100
committerJonathan Wakely <jwakely@redhat.com>2022-09-22 14:49:51 +0100
commit4b4b51445f7f3d11420439a92faaf5553f3128e3 (patch)
tree947c6ce1b5d2eb84061a4ce4262220040b63c63e /libstdc++-v3/testsuite/20_util/bitset/observers
parentf35be1268c996d993ab0b4ff329734d467474445 (diff)
downloadgcc-4b4b51445f7f3d11420439a92faaf5553f3128e3.tar.gz
libstdc++: Rearrange tests for <bitset>
In C++03 std::bitset was in the Container clause, but since C++11 it has been in the Utilties clause. This moves the tests to the 20_util directory, where most people probably expect to find them. Also create 'access', 'observers', and 'io' subdirectories and group some tests under there, rather than having one directory per function name, and only a single test in that directory. libstdc++-v3/ChangeLog: * testsuite/23_containers/bitset/18604.cc: Moved to... * testsuite/20_util/bitset/18604.cc: ...here. * testsuite/23_containers/bitset/45713.cc: Moved to... * testsuite/20_util/bitset/45713.cc: ...here. * testsuite/23_containers/bitset/to_string/dr396.cc: Moved to... * testsuite/20_util/bitset/access/dr396.cc: ...here. * testsuite/23_containers/bitset/to_string/1.cc: Moved to... * testsuite/20_util/bitset/access/to_string.cc: ...here. * testsuite/23_containers/bitset/to_ullong/1.cc: Moved to... * testsuite/20_util/bitset/access/to_ullong.cc: ...here. * testsuite/23_containers/bitset/to_ulong/1.cc: Moved to... * testsuite/20_util/bitset/access/to_ulong.cc: ...here. * testsuite/23_containers/bitset/cons/1.cc: Moved to... * testsuite/20_util/bitset/cons/1.cc: ...here. * testsuite/23_containers/bitset/cons/16020.cc: Moved to... * testsuite/20_util/bitset/cons/16020.cc: ...here. * testsuite/23_containers/bitset/cons/2.cc: Moved to... * testsuite/20_util/bitset/cons/2.cc: ...here. * testsuite/23_containers/bitset/cons/3.cc: Moved to... * testsuite/20_util/bitset/cons/3.cc: ...here. * testsuite/23_containers/bitset/cons/38244.cc: Moved to... * testsuite/20_util/bitset/cons/38244.cc: ...here. * testsuite/23_containers/bitset/cons/50268.cc: Moved to... * testsuite/20_util/bitset/cons/50268.cc: ...here. * testsuite/23_containers/bitset/cons/6282.cc: Moved to... * testsuite/20_util/bitset/cons/6282.cc: ...here. * testsuite/23_containers/bitset/cons/constexpr.cc: Moved to... * testsuite/20_util/bitset/cons/constexpr.cc: ...here. * testsuite/23_containers/bitset/cons/dr1325-1.cc: Moved to... * testsuite/20_util/bitset/cons/dr1325-1.cc: ...here. * testsuite/23_containers/bitset/cons/dr1325-2.cc: Moved to... * testsuite/20_util/bitset/cons/dr1325-2.cc: ...here. * testsuite/23_containers/bitset/cons/dr396.cc: Moved to... * testsuite/20_util/bitset/cons/dr396.cc: ...here. * testsuite/23_containers/bitset/debug/invalidation/1.cc: Moved to... * testsuite/20_util/bitset/debug/invalidation/1.cc: ...here. * testsuite/23_containers/bitset/ext/15361.cc: Moved to... * testsuite/20_util/bitset/ext/15361.cc: ...here. * testsuite/23_containers/bitset/hash/1.cc: Moved to... * testsuite/20_util/bitset/hash/1.cc: ...here. * testsuite/23_containers/bitset/input/1.cc: Moved to... * testsuite/20_util/bitset/io/input.cc: ...here. * testsuite/23_containers/bitset/count/6124.cc: Moved to... * testsuite/20_util/bitset/observers/6124.cc: ...here. * testsuite/23_containers/bitset/all/1.cc: Moved to... * testsuite/20_util/bitset/observers/all.cc: ...here. * testsuite/23_containers/bitset/test/1.cc: Moved to... * testsuite/20_util/bitset/observers/test.cc: ...here. * testsuite/23_containers/bitset/operations/1.cc: Moved to... * testsuite/20_util/bitset/operations/1.cc: ...here. * testsuite/23_containers/bitset/operations/13838.cc: Moved to... * testsuite/20_util/bitset/operations/13838.cc: ...here. * testsuite/23_containers/bitset/operations/2.cc: Moved to... * testsuite/20_util/bitset/operations/2.cc: ...here. * testsuite/23_containers/bitset/operations/96303.cc: Moved to... * testsuite/20_util/bitset/operations/96303.cc: ...here. * testsuite/23_containers/bitset/operations/constexpr-2.cc: Moved to... * testsuite/20_util/bitset/operations/constexpr-2.cc: ...here. * testsuite/23_containers/bitset/operations/constexpr.cc: Moved to... * testsuite/20_util/bitset/operations/constexpr.cc: ...here. * testsuite/23_containers/bitset/requirements/constexpr_functions.cc: Moved to... * testsuite/20_util/bitset/requirements/constexpr_functions.cc: ...here. * testsuite/23_containers/bitset/requirements/explicit_instantiation/1.cc: Moved to... * testsuite/20_util/bitset/requirements/explicit_instantiation/1.cc: ...here. * testsuite/23_containers/bitset/requirements/explicit_instantiation/1_c++0x.cc: Moved to... * testsuite/20_util/bitset/requirements/explicit_instantiation/1_c++0x.cc: ...here. * testsuite/23_containers/headers/bitset/synopsis.cc: Moved to... * testsuite/20_util/headers/bitset/synopsis.cc: ...here.
Diffstat (limited to 'libstdc++-v3/testsuite/20_util/bitset/observers')
-rw-r--r--libstdc++-v3/testsuite/20_util/bitset/observers/6124.cc38
-rw-r--r--libstdc++-v3/testsuite/20_util/bitset/observers/all.cc78
-rw-r--r--libstdc++-v3/testsuite/20_util/bitset/observers/test.cc50
3 files changed, 166 insertions, 0 deletions
diff --git a/libstdc++-v3/testsuite/20_util/bitset/observers/6124.cc b/libstdc++-v3/testsuite/20_util/bitset/observers/6124.cc
new file mode 100644
index 00000000000..d08211cec8a
--- /dev/null
+++ b/libstdc++-v3/testsuite/20_util/bitset/observers/6124.cc
@@ -0,0 +1,38 @@
+// 2001-06-03 pme
+
+// Copyright (C) 2001-2022 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/20_util/bitset/observers/all.cc b/libstdc++-v3/testsuite/20_util/bitset/observers/all.cc
new file mode 100644
index 00000000000..9840f25058c
--- /dev/null
+++ b/libstdc++-v3/testsuite/20_util/bitset/observers/all.cc
@@ -0,0 +1,78 @@
+// 2007-11-23 Paolo Carlini <pcarlini@suse.de>
+
+// Copyright (C) 2007-2022 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()
+{
+ 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/20_util/bitset/observers/test.cc b/libstdc++-v3/testsuite/20_util/bitset/observers/test.cc
new file mode 100644
index 00000000000..2444499e621
--- /dev/null
+++ b/libstdc++-v3/testsuite/20_util/bitset/observers/test.cc
@@ -0,0 +1,50 @@
+// 2001-06-03 pme
+
+// Copyright (C) 2001-2022 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)
+{
+ 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 );
+ }
+}
+
+int main()
+{
+ test01();
+ return 0;
+}