1 //===----------------------------------------------------------------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
9 // test bitset<N>& reset(size_t pos);
10 
11 #include <bitset>
12 #include <cassert>
13 #include <cstddef>
14 #include <vector>
15 
16 #include "../bitset_test_cases.h"
17 #include "test_macros.h"
18 
19 #ifdef TEST_COMPILER_MSVC
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>
24 void test_reset_one() {
25     std::vector<std::bitset<N> > const cases = get_test_cases<N>();
26     for (std::size_t c = 0; c != cases.size(); ++c) {
27         for (std::size_t i = 0; i != N; ++i) {
28             std::bitset<N> v = cases[c];
29             v.reset(i);
30             assert(v[i] == false);
31         }
32     }
33 }
34 
35 int main(int, char**) {
36     test_reset_one<0>();
37     test_reset_one<1>();
38     test_reset_one<31>();
39     test_reset_one<32>();
40     test_reset_one<33>();
41     test_reset_one<63>();
42     test_reset_one<64>();
43     test_reset_one<65>();
44     test_reset_one<1000>();
45 
46     return 0;
47 }
48