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 #if defined(TEST_COMPILER_C1XX)
20 #pragma warning(disable: 6294) // Ill-defined for-loop: initial condition does not satisfy test. Loop body not executed.
23 template <std::size_t N>
27 TEST_CONSTEXPR std::bitset<N> v(0xAAAAAAAAAAAAAAAAULL);
28 assert(v.size() == N);
29 std::size_t M = std::min<std::size_t>(N, 64);
30 for (std::size_t i = 0; i < M; ++i)
31 assert(v[i] == ((i & 1) != 0));
32 for (std::size_t i = M; i < N; ++i)
33 assert(v[i] == false);
35 #if TEST_STD_VER >= 11
37 constexpr std::bitset<N> v(0xAAAAAAAAAAAAAAAAULL);
38 static_assert(v.size() == N, "");
53 test_val_ctor<1000>();