Debian Codegraph @

libcxx/test/std/utilities/template.bitset/bitset.members/size.pass.cpp

raw
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 // size_t count() const; // constexpr since C++23
10
11 #include <bitset>
12 #include <cassert>
13
14 #include "test_macros.h"
15
16 template <std::size_t N>
17 TEST_CONSTEXPR_CXX23 void test_size() {
18 const std::bitset<N> v;
19 assert(v.size() == N);
20 }
21
22 TEST_CONSTEXPR_CXX23 bool test() {
23 test_size<0>();
24 test_size<1>();
25 test_size<31>();
26 test_size<32>();
27 test_size<33>();
28 test_size<63>();
29 test_size<64>();
30 test_size<65>();
31 test_size<1000>();
32
33 return true;
34 }
35
36 int main(int, char**) {
37 test();
38 #if TEST_STD_VER > 20
39 static_assert(test());
40 #endif
41
42 return 0;
43 }