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 bool all() const;
10 
11 #include <bitset>
12 #include <cassert>
13 #include <cstddef>
14 
15 #include "test_macros.h"
16 
17 template <std::size_t N>
test_all()18 void test_all() {
19     std::bitset<N> v;
20     v.reset();
21     assert(v.all() == (N == 0));
22     v.set();
23     assert(v.all() == true);
24     if (v.size() > 1) {
25         v[N/2] = false;
26         assert(v.all() == false);
27     }
28 }
29 
main(int,char **)30 int main(int, char**) {
31     test_all<0>();
32     test_all<1>();
33     test_all<31>();
34     test_all<32>();
35     test_all<33>();
36     test_all<63>();
37     test_all<64>();
38     test_all<65>();
39     test_all<1000>();
40 
41     return 0;
42 }
43