Imported Upstream version 4.8.1
[platform/upstream/gcc48.git] / libstdc++-v3 / testsuite / 23_containers / bitset / cons / 50268.cc
1 // { dg-options "-std=gnu++0x" }
2
3 // Copyright (C) 2011-2013 Free Software Foundation, Inc.
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 {
26   bool test __attribute__((unused)) = true;
27
28   std::bitset<1> b1(3ULL);
29   VERIFY( b1.count() == 1ULL );
30
31   std::bitset<3> b2(30ULL);
32   VERIFY( b2.count() == 2ULL );
33
34   std::bitset<6> b3(300ULL);
35   VERIFY( b3.count() == 3ULL );
36
37   std::bitset<9> b4(3000ULL);
38   VERIFY( b4.count() == 5ULL );
39
40   std::bitset<16> b5(300000ULL);
41   VERIFY( b5.count() == 7ULL );
42
43   std::bitset<24> b6(30000000ULL);
44   VERIFY( b6.count() == 9ULL );
45
46   std::bitset<32> b7(30000000000ULL);
47   VERIFY( b7.count() == 13ULL );
48
49   std::bitset<37> b8(3000000000000ULL);
50   VERIFY( b8.count() == 18ULL );
51
52   std::bitset<40> b9(30000000000000ULL);
53   VERIFY( b9.count() == 16ULL );
54
55   std::bitset<45> b10(30000000000000ULL);
56   VERIFY( b10.count() == 20ULL );
57
58   std::bitset<64> b11(30000000000000ULL);
59   VERIFY( b11.count() == 20ULL );
60
61   std::bitset<100> b12(30000000000000ULL);
62   VERIFY( b12.count() == 20ULL );
63
64   std::bitset<200> b13(30000000000000ULL);
65   VERIFY( b13.count() == 20ULL );
66
67   std::bitset<45> b14(18446744073709551615ULL);
68   VERIFY( b14.count() == 45ULL );
69
70   std::bitset<64> b15(18446744073709551615ULL);
71   VERIFY( b15.count() == 64ULL );
72
73   std::bitset<100> b16(18446744073709551615ULL);
74   VERIFY( b16.count() == 64ULL );
75
76   std::bitset<200> b17(18446744073709551615ULL);
77   VERIFY( b17.count() == 64ULL );  
78 }
79
80 int main()
81 {
82   test01();
83   return 0;
84 }