48 lines · cpp
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-exception6//7//===----------------------------------------------------------------------===//8 9// bitset<N>& reset(); // constexpr since C++2310 11#include <bitset>12#include <cassert>13#include <cstddef>14 15#include "test_macros.h"16 17template <std::size_t N>18TEST_CONSTEXPR_CXX23 void test_reset_all() {19 std::bitset<N> v;20 v.set();21 v.reset();22 for (std::size_t i = 0; i < v.size(); ++i)23 assert(!v[i]);24}25 26TEST_CONSTEXPR_CXX23 bool test() {27 test_reset_all<0>();28 test_reset_all<1>();29 test_reset_all<31>();30 test_reset_all<32>();31 test_reset_all<33>();32 test_reset_all<63>();33 test_reset_all<64>();34 test_reset_all<65>();35 test_reset_all<1000>();36 37 return true;38}39 40int main(int, char**) {41 test();42#if TEST_STD_VER > 2043 static_assert(test());44#endif45 46 return 0;47}48