]> git.ipfire.org Git - thirdparty/gcc.git/blob - libstdc++-v3/testsuite/tr2/dynamic_bitset/cons.cc
Update copyright years.
[thirdparty/gcc.git] / libstdc++-v3 / testsuite / tr2 / dynamic_bitset / cons.cc
1 // Copyright (C) 2019-2020 Free Software Foundation, Inc.
2 //
3 // This file is part of the GNU ISO C++ Library. This library is free
4 // software; you can redistribute it and/or modify it under the
5 // terms of the GNU General Public License as published by the
6 // Free Software Foundation; either version 3, or (at your option)
7 // any later version.
8
9 // This library is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU General Public License for more details.
13
14 // You should have received a copy of the GNU General Public License along
15 // with this library; see the file COPYING3. If not see
16 // <http://www.gnu.org/licenses/>.
17
18 // { dg-do run { target c++11 } }
19
20 #include <tr2/dynamic_bitset>
21 #include <testsuite_hooks.h>
22
23 void
24 test01()
25 {
26 std::tr2::dynamic_bitset<> a;
27 VERIFY( a.size() == 0 );
28 VERIFY( a.empty() );
29 std::tr2::dynamic_bitset<> b(1);
30 VERIFY( b.size() == 1 );
31 VERIFY( !b.empty() );
32 VERIFY( a != b );
33 }
34
35 void
36 test02()
37 {
38 std::tr2::dynamic_bitset<> a(1, 0); // { 0 }
39 std::tr2::dynamic_bitset<> b(2, 2); // { 0, 1 }
40 VERIFY( a != b );
41 }
42
43 void
44 test03()
45 {
46 std::tr2::dynamic_bitset<> a;
47 a.resize(1); // { 0 }
48 std::tr2::dynamic_bitset<> b(2, 2); // { 0, 1 }
49 VERIFY( a != b );
50 }
51
52 void
53 test04()
54 {
55 std::tr2::dynamic_bitset<> a(3, 2); // { 0, 1, 0 }
56 std::tr2::dynamic_bitset<> b(2, 2); // { 0, 1 }
57 VERIFY( a != b );
58 }
59
60 void
61 test05()
62 {
63 std::tr2::dynamic_bitset<unsigned short> a(1, 0); // { 0 }
64 std::tr2::dynamic_bitset<unsigned short> b(2, 2); // { 0, 1 }
65 VERIFY( a != b );
66 }
67
68 void
69 test06()
70 {
71 std::tr2::dynamic_bitset<unsigned short> a;
72 a.resize(1); // { 0 }
73 std::tr2::dynamic_bitset<unsigned short> b(2, 2); // { 0, 1 }
74 VERIFY( a != b );
75 }
76
77 void
78 test07()
79 {
80 std::tr2::dynamic_bitset<unsigned short> a(3, 2); // { 0, 1, 0 }
81 std::tr2::dynamic_bitset<unsigned short> b(2, 2); // { 0, 1 }
82 VERIFY( a != b );
83 }
84
85 void
86 test08()
87 {
88 std::tr2::dynamic_bitset<> a(65, -1ULL);
89 std::tr2::dynamic_bitset<> b(64, -1ULL);
90 b.push_back(0);
91 VERIFY( a == b );
92 }
93
94 int
95 main()
96 {
97 test01();
98 test02();
99 test03();
100 test04();
101 test05();
102 test06();
103 test07();
104 test08();
105 }