1 //===----------------------------------------------------------------------===//
3 // The LLVM Compiler Infrastructure
5 // This file is dual licensed under the MIT and the University of Illinois Open
6 // Source Licenses. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // test bitset(unsigned long long val);
14 #include <algorithm> // for 'min' and 'max'
17 #include "test_macros.h"
19 template <std::size_t N>
23 TEST_CONSTEXPR std::bitset<N> v(0xAAAAAAAAAAAAAAAAULL);
24 assert(v.size() == N);
25 std::size_t M = std::min<std::size_t>(N, 64);
26 for (std::size_t i = 0; i < M; ++i)
27 assert(v[i] == ((i & 1) != 0));
28 for (std::size_t i = M; i < N; ++i)
29 assert(v[i] == false);
31 #if TEST_STD_VER >= 11
33 constexpr std::bitset<N> v(0xAAAAAAAAAAAAAAAAULL);
34 static_assert(v.size() == N, "");
49 test_val_ctor<1000>();