1 //===----------------------------------------------------------------------===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is dual licensed under the MIT and the University of Illinois Open
6 // Source Licenses. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 
10 // test bool all() const;
11 
12 #include <bitset>
13 #include <cassert>
14 
15 template <std::size_t N>
16 void test_all()
17 {
18     std::bitset<N> v;
19     v.reset();
20     assert(v.all() == (N == 0));
21     v.set();
22     assert(v.all() == true);
23     if (N > 1)
24     {
25         v[N/2] = false;
26         assert(v.all() == false);
27     }
28 }
29 
30 int main()
31 {
32     test_all<0>();
33     test_all<1>();
34     test_all<31>();
35     test_all<32>();
36     test_all<33>();
37     test_all<63>();
38     test_all<64>();
39     test_all<65>();
40     test_all<1000>();
41 }
42