]>
Commit | Line | Data |
---|---|---|
52066eae | 1 | // { dg-do run { target c++11 } } |
5da7fa30 | 2 | |
99dee823 | 3 | // Copyright (C) 2011-2021 Free Software Foundation, Inc. |
5da7fa30 PC |
4 | // |
5 | // This file is part of the GNU ISO C++ Library. This library is free | |
6 | // software; you can redistribute it and/or modify it under the | |
7 | // terms of the GNU General Public License as published by the | |
8 | // Free Software Foundation; either version 3, or (at your option) | |
9 | // any later version. | |
10 | ||
11 | // This library is distributed in the hope that it will be useful, | |
12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
14 | // GNU General Public License for more details. | |
15 | ||
16 | // You should have received a copy of the GNU General Public License along | |
17 | // with this library; see the file COPYING3. If not see | |
18 | // <http://www.gnu.org/licenses/>. | |
19 | ||
20 | #include <bitset> | |
21 | #include <testsuite_hooks.h> | |
22 | ||
23 | // libstdc++/50268 | |
24 | void test01() | |
25 | { | |
5da7fa30 PC |
26 | std::bitset<1> b1(3ULL); |
27 | VERIFY( b1.count() == 1ULL ); | |
28 | ||
29 | std::bitset<3> b2(30ULL); | |
30 | VERIFY( b2.count() == 2ULL ); | |
31 | ||
32 | std::bitset<6> b3(300ULL); | |
33 | VERIFY( b3.count() == 3ULL ); | |
34 | ||
35 | std::bitset<9> b4(3000ULL); | |
36 | VERIFY( b4.count() == 5ULL ); | |
37 | ||
38 | std::bitset<16> b5(300000ULL); | |
39 | VERIFY( b5.count() == 7ULL ); | |
40 | ||
41 | std::bitset<24> b6(30000000ULL); | |
42 | VERIFY( b6.count() == 9ULL ); | |
43 | ||
44 | std::bitset<32> b7(30000000000ULL); | |
45 | VERIFY( b7.count() == 13ULL ); | |
46 | ||
47 | std::bitset<37> b8(3000000000000ULL); | |
48 | VERIFY( b8.count() == 18ULL ); | |
49 | ||
50 | std::bitset<40> b9(30000000000000ULL); | |
51 | VERIFY( b9.count() == 16ULL ); | |
52 | ||
53 | std::bitset<45> b10(30000000000000ULL); | |
54 | VERIFY( b10.count() == 20ULL ); | |
55 | ||
56 | std::bitset<64> b11(30000000000000ULL); | |
57 | VERIFY( b11.count() == 20ULL ); | |
58 | ||
59 | std::bitset<100> b12(30000000000000ULL); | |
60 | VERIFY( b12.count() == 20ULL ); | |
61 | ||
62 | std::bitset<200> b13(30000000000000ULL); | |
63 | VERIFY( b13.count() == 20ULL ); | |
64 | ||
65 | std::bitset<45> b14(18446744073709551615ULL); | |
66 | VERIFY( b14.count() == 45ULL ); | |
67 | ||
68 | std::bitset<64> b15(18446744073709551615ULL); | |
69 | VERIFY( b15.count() == 64ULL ); | |
70 | ||
71 | std::bitset<100> b16(18446744073709551615ULL); | |
72 | VERIFY( b16.count() == 64ULL ); | |
73 | ||
74 | std::bitset<200> b17(18446744073709551615ULL); | |
75 | VERIFY( b17.count() == 64ULL ); | |
76 | } | |
77 | ||
78 | int main() | |
79 | { | |
80 | test01(); | |
81 | return 0; | |
82 | } |