]> git.ipfire.org Git - thirdparty/gcc.git/blame - libstdc++-v3/testsuite/tr2/dynamic_bitset/cons.cc
Update copyright years.
[thirdparty/gcc.git] / libstdc++-v3 / testsuite / tr2 / dynamic_bitset / cons.cc
CommitLineData
8d9254fc 1// Copyright (C) 2019-2020 Free Software Foundation, Inc.
07758d90
JW
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
23void
24test01()
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
35void
36test02()
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
43void
44test03()
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
52void
53test04()
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
60void
61test05()
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
68void
69test06()
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
77void
78test07()
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
85void
86test08()
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
94int
95main()
96{
97 test01();
98 test02();
99 test03();
100 test04();
101 test05();
102 test06();
103 test07();
104 test08();
105}