1 //===----------------------------------------------------------------------===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is dual licensed under the MIT and the University of Illinois Open
6 // Source Licenses. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 
10 // test bitset(unsigned long long val);
11 
12 #include <bitset>
13 #include <cassert>
14 
15 #pragma clang diagnostic ignored "-Wtautological-compare"
16 
17 template <std::size_t N>
test_val_ctor()18 void test_val_ctor()
19 {
20     {
21     _LIBCPP_CONSTEXPR std::bitset<N> v(0xAAAAAAAAAAAAAAAAULL);
22     assert(v.size() == N);
23     unsigned M = std::min<std::size_t>(N, 64);
24     for (std::size_t i = 0; i < M; ++i)
25         assert(v[i] == (i & 1));
26     for (std::size_t i = M; i < N; ++i)
27         assert(v[i] == false);
28     }
29 }
30 
main()31 int main()
32 {
33     test_val_ctor<0>();
34     test_val_ctor<1>();
35     test_val_ctor<31>();
36     test_val_ctor<32>();
37     test_val_ctor<33>();
38     test_val_ctor<63>();
39     test_val_ctor<64>();
40     test_val_ctor<65>();
41     test_val_ctor<1000>();
42 }
43