[PowerPC][NFC] Cleanup PPCCTRLoopsVerify pass
[llvm-project.git] / libcxx / test / std / utilities / template.bitset / bitset.members / none.pass.cpp
blob9143fc42f3c47897b14fcb1c13d242145757448f
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 //===----------------------------------------------------------------------===//
9 // test bool none() const;
11 #include <bitset>
12 #include <cassert>
13 #include <cstddef>
15 #include "test_macros.h"
17 template <std::size_t N>
18 void test_none() {
19 std::bitset<N> v;
20 v.reset();
21 assert(v.none() == true);
22 v.set();
23 assert(v.none() == (N == 0));
24 if (v.size() > 1) {
25 v[N/2] = false;
26 assert(v.none() == false);
27 v.reset();
28 v[N/2] = true;
29 assert(v.none() == false);
33 int main(int, char**) {
34 test_none<0>();
35 test_none<1>();
36 test_none<31>();
37 test_none<32>();
38 test_none<33>();
39 test_none<63>();
40 test_none<64>();
41 test_none<65>();
42 test_none<1000>();
44 return 0;