• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 // test default ctor
10 
11 #include <bitset>
12 #include <cassert>
13 
14 #include "test_macros.h"
15 
16 template <std::size_t N>
test_default_ctor()17 void test_default_ctor()
18 {
19     {
20         TEST_CONSTEXPR std::bitset<N> v1;
21         assert(v1.size() == N);
22         for (std::size_t i = 0; i < v1.size(); ++i)
23             assert(v1[i] == false);
24     }
25 #if TEST_STD_VER >= 11
26     {
27         constexpr std::bitset<N> v1;
28         static_assert(v1.size() == N, "");
29     }
30 #endif
31 }
32 
33 
main(int,char **)34 int main(int, char**)
35 {
36     test_default_ctor<0>();
37     test_default_ctor<1>();
38     test_default_ctor<31>();
39     test_default_ctor<32>();
40     test_default_ctor<33>();
41     test_default_ctor<63>();
42     test_default_ctor<64>();
43     test_default_ctor<65>();
44     test_default_ctor<1000>();
45 
46   return 0;
47 }
48