• 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 bitset<N>& set();
11 
12 #include <bitset>
13 #include <cassert>
14 
15 #include "test_macros.h"
16 
17 #if defined(TEST_COMPILER_CLANG)
18 #pragma clang diagnostic ignored "-Wtautological-compare"
19 #elif defined(TEST_COMPILER_C1XX)
20 #pragma warning(disable: 6294) // Ill-defined for-loop:  initial condition does not satisfy test.  Loop body not executed.
21 #endif
22 
23 template <std::size_t N>
test_set_all()24 void test_set_all()
25 {
26     std::bitset<N> v;
27     v.set();
28     for (std::size_t i = 0; i < N; ++i)
29         assert(v[i]);
30 }
31 
main()32 int main()
33 {
34     test_set_all<0>();
35     test_set_all<1>();
36     test_set_all<31>();
37     test_set_all<32>();
38     test_set_all<33>();
39     test_set_all<63>();
40     test_set_all<64>();
41     test_set_all<65>();
42     test_set_all<1000>();
43 }
44