• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 none() const;
11 
12 #include <bitset>
13 #include <cassert>
14 
15 template <std::size_t N>
test_none()16 void test_none()
17 {
18     std::bitset<N> v;
19     v.reset();
20     assert(v.none() == true);
21     v.set();
22     assert(v.none() == (N == 0));
23     if (N > 1)
24     {
25         v[N/2] = false;
26         assert(v.none() == false);
27         v.reset();
28         v[N/2] = true;
29         assert(v.none() == false);
30     }
31 }
32 
main()33 int main()
34 {
35     test_none<0>();
36     test_none<1>();
37     test_none<31>();
38     test_none<32>();
39     test_none<33>();
40     test_none<63>();
41     test_none<64>();
42     test_none<65>();
43     test_none<1000>();
44 }
45