• 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>& reset();
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_reset_all()24 void test_reset_all()
25 {
26     std::bitset<N> v;
27     v.set();
28     v.reset();
29     for (std::size_t i = 0; i < N; ++i)
30         assert(!v[i]);
31 }
32 
main()33 int main()
34 {
35     test_reset_all<0>();
36     test_reset_all<1>();
37     test_reset_all<31>();
38     test_reset_all<32>();
39     test_reset_all<33>();
40     test_reset_all<63>();
41     test_reset_all<64>();
42     test_reset_all<65>();
43     test_reset_all<1000>();
44 }
45