• 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 constexpr bool operator[](size_t pos) const;
10 
11 #include <bitset>
12 #include <cassert>
13 #include <cstddef>
14 #include <vector>
15 
16 #include "../bitset_test_cases.h"
17 #include "test_macros.h"
18 
19 template <std::size_t N>
test_index_const()20 void test_index_const() {
21     std::vector<std::bitset<N> > const cases = get_test_cases<N>();
22     for (std::size_t c = 0; c != cases.size(); ++c) {
23         std::bitset<N> const v = cases[c];
24         if (v.size() > 0) {
25             assert(v[N/2] == v.test(N/2));
26         }
27     }
28 }
29 
main(int,char **)30 int main(int, char**) {
31     test_index_const<0>();
32     test_index_const<1>();
33     test_index_const<31>();
34     test_index_const<32>();
35     test_index_const<33>();
36     test_index_const<63>();
37     test_index_const<64>();
38     test_index_const<65>();
39     test_index_const<1000>();
40 
41     return 0;
42 }
43