1 // { dg-options "-std=gnu++0x" }
3 // Copyright (C) 2011-2013 Free Software Foundation, Inc.
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)
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.
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/>.
21 #include <testsuite_hooks.h>
26 bool test __attribute__((unused)) = true;
28 std::bitset<1> b1(3ULL);
29 VERIFY( b1.count() == 1ULL );
31 std::bitset<3> b2(30ULL);
32 VERIFY( b2.count() == 2ULL );
34 std::bitset<6> b3(300ULL);
35 VERIFY( b3.count() == 3ULL );
37 std::bitset<9> b4(3000ULL);
38 VERIFY( b4.count() == 5ULL );
40 std::bitset<16> b5(300000ULL);
41 VERIFY( b5.count() == 7ULL );
43 std::bitset<24> b6(30000000ULL);
44 VERIFY( b6.count() == 9ULL );
46 std::bitset<32> b7(30000000000ULL);
47 VERIFY( b7.count() == 13ULL );
49 std::bitset<37> b8(3000000000000ULL);
50 VERIFY( b8.count() == 18ULL );
52 std::bitset<40> b9(30000000000000ULL);
53 VERIFY( b9.count() == 16ULL );
55 std::bitset<45> b10(30000000000000ULL);
56 VERIFY( b10.count() == 20ULL );
58 std::bitset<64> b11(30000000000000ULL);
59 VERIFY( b11.count() == 20ULL );
61 std::bitset<100> b12(30000000000000ULL);
62 VERIFY( b12.count() == 20ULL );
64 std::bitset<200> b13(30000000000000ULL);
65 VERIFY( b13.count() == 20ULL );
67 std::bitset<45> b14(18446744073709551615ULL);
68 VERIFY( b14.count() == 45ULL );
70 std::bitset<64> b15(18446744073709551615ULL);
71 VERIFY( b15.count() == 64ULL );
73 std::bitset<100> b16(18446744073709551615ULL);
74 VERIFY( b16.count() == 64ULL );
76 std::bitset<200> b17(18446744073709551615ULL);
77 VERIFY( b17.count() == 64ULL );