1 //===----------------------------------------------------------------------===//
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
7 //===----------------------------------------------------------------------===//
9 #ifndef LIBCPP_TEST_BITSET_TEST_CASES_H
10 #define LIBCPP_TEST_BITSET_TEST_CASES_H
16 #include "test_macros.h"
19 TEST_CONSTEXPR_CXX23
std::vector
<std::bitset
<N
> > get_test_cases();
22 TEST_CONSTEXPR_CXX23
inline std::vector
<std::bitset
<0> > get_test_cases
<0>() {
23 std::vector
<std::bitset
<0> > cases
;
24 cases
.push_back(std::bitset
<0>());
29 TEST_CONSTEXPR_CXX23
inline std::vector
<std::bitset
<1> > get_test_cases
<1>() {
30 std::vector
<std::bitset
<1> > cases
;
31 cases
.push_back(std::bitset
<1>("0"));
32 cases
.push_back(std::bitset
<1>("1"));
37 TEST_CONSTEXPR_CXX23
inline std::vector
<std::bitset
<2> > get_test_cases
<2>() {
38 std::vector
<std::bitset
<2> > cases
;
39 cases
.push_back(std::bitset
<2>("00"));
40 cases
.push_back(std::bitset
<2>("01"));
41 cases
.push_back(std::bitset
<2>("10"));
42 cases
.push_back(std::bitset
<2>("11"));
47 TEST_CONSTEXPR_CXX23
inline std::vector
<std::bitset
<31> > get_test_cases
<31>() {
48 std::vector
<std::bitset
<31> > cases
;
49 cases
.push_back(std::bitset
<31>("0000000000000000000000000000000"));
50 cases
.push_back(std::bitset
<31>("0000000000000000000000000000001"));
51 cases
.push_back(std::bitset
<31>("1000000000000000000000000000000"));
52 cases
.push_back(std::bitset
<31>("1000000000000000000000000000001"));
53 cases
.push_back(std::bitset
<31>("1000000000000000000001000000001"));
54 cases
.push_back(std::bitset
<31>("0000000000000000111111111111111"));
55 cases
.push_back(std::bitset
<31>("1000000000000000111111111111111"));
56 cases
.push_back(std::bitset
<31>("1111111111111111000000000000000"));
57 cases
.push_back(std::bitset
<31>("1111111111111111000000000000001"));
58 cases
.push_back(std::bitset
<31>("1010101010101010101010101010101"));
59 cases
.push_back(std::bitset
<31>("0101010101010101010101010101010"));
60 cases
.push_back(std::bitset
<31>("1111111111111111111111111111111"));
65 TEST_CONSTEXPR_CXX23
inline std::vector
<std::bitset
<32> > get_test_cases
<32>() {
66 std::vector
<std::bitset
<32> > cases
;
67 cases
.push_back(std::bitset
<32>("00000000000000000000000000000000"));
68 cases
.push_back(std::bitset
<32>("00000000000000000000000000000001"));
69 cases
.push_back(std::bitset
<32>("10000000000000000000000000000000"));
70 cases
.push_back(std::bitset
<32>("10000000000000000000000000000001"));
71 cases
.push_back(std::bitset
<32>("10000000000000000000111000000001"));
72 cases
.push_back(std::bitset
<32>("00000000000000001111111111111111"));
73 cases
.push_back(std::bitset
<32>("10000000000000001111111111111111"));
74 cases
.push_back(std::bitset
<32>("11111111111111110000000000000000"));
75 cases
.push_back(std::bitset
<32>("11111111111111110000000000000001"));
76 cases
.push_back(std::bitset
<32>("10101010101010101010101010101010"));
77 cases
.push_back(std::bitset
<32>("01010101010101010101010101010101"));
78 cases
.push_back(std::bitset
<32>("11111111111111111111111111111111"));
83 TEST_CONSTEXPR_CXX23
inline std::vector
<std::bitset
<33> > get_test_cases
<33>() {
84 std::vector
<std::bitset
<33> > cases
;
85 cases
.push_back(std::bitset
<33>("000000000000000000000000000000000"));
86 cases
.push_back(std::bitset
<33>("000000000000000000000000000000001"));
87 cases
.push_back(std::bitset
<33>("100000000000000000000000000000000"));
88 cases
.push_back(std::bitset
<33>("100000000000000000000000000000001"));
89 cases
.push_back(std::bitset
<33>("100000000000000000001110000000001"));
90 cases
.push_back(std::bitset
<33>("000000000000000011111111111111111"));
91 cases
.push_back(std::bitset
<33>("100000000000000011111111111111111"));
92 cases
.push_back(std::bitset
<33>("111111111111111100000000000000000"));
93 cases
.push_back(std::bitset
<33>("111111111111111100000000000000001"));
94 cases
.push_back(std::bitset
<33>("101010101010101010101010101010101"));
95 cases
.push_back(std::bitset
<33>("010101010101010101010101010101010"));
96 cases
.push_back(std::bitset
<33>("111111111111111111111111111111111"));
101 TEST_CONSTEXPR_CXX23
inline std::vector
<std::bitset
<63> > get_test_cases
<63>() {
102 std::vector
<std::bitset
<63> > cases
;
103 cases
.push_back(std::bitset
<63>("000000000000000000000000000000000000000000000000000000000000000"));
104 cases
.push_back(std::bitset
<63>("000000000000000000000000000000000000000000000000000000000000001"));
105 cases
.push_back(std::bitset
<63>("100000000000000000000000000000000000000000000000000000000000000"));
106 cases
.push_back(std::bitset
<63>("100000000000000000000000000000000000000000000000000000000000001"));
107 cases
.push_back(std::bitset
<63>("100000000000000000000000001111100000000000000000000000000000001"));
108 cases
.push_back(std::bitset
<63>("000000000000000000000000000000001111111111111111111111111111111"));
109 cases
.push_back(std::bitset
<63>("100000000000000000000000000000001111111111111111111111111111111"));
110 cases
.push_back(std::bitset
<63>("111111111111111111111111111111110000000000000000000000000000000"));
111 cases
.push_back(std::bitset
<63>("111111111111111111111111111111110000000000000000000000000000001"));
112 cases
.push_back(std::bitset
<63>("101010101010101010101010101010101010101010101010101010101010101"));
113 cases
.push_back(std::bitset
<63>("010101010101010101010101010101010101010101010101010101010101010"));
114 cases
.push_back(std::bitset
<63>("111111111111111111111111111111111111111111111111111111111111111"));
119 TEST_CONSTEXPR_CXX23
inline std::vector
<std::bitset
<64> > get_test_cases
<64>() {
120 std::vector
<std::bitset
<64> > cases
;
121 cases
.push_back(std::bitset
<64>("0000000000000000000000000000000000000000000000000000000000000000"));
122 cases
.push_back(std::bitset
<64>("0000000000000000000000000000000000000000000000000000000000000001"));
123 cases
.push_back(std::bitset
<64>("1000000000000000000000000000000000000000000000000000000000000000"));
124 cases
.push_back(std::bitset
<64>("1000000000000000000000000000000000000000000000000000000000000001"));
125 cases
.push_back(std::bitset
<64>("1000000000000000000000000011111000000000000000000000000000000001"));
126 cases
.push_back(std::bitset
<64>("0000000000000000000000000000000011111111111111111111111111111111"));
127 cases
.push_back(std::bitset
<64>("1000000000000000000000000000000011111111111111111111111111111111"));
128 cases
.push_back(std::bitset
<64>("1111111111111111111111111111111100000000000000000000000000000000"));
129 cases
.push_back(std::bitset
<64>("1111111111111111111111111111111100000000000000000000000000000001"));
130 cases
.push_back(std::bitset
<64>("1010101010101010101010101010101010101010101010101010101010101010"));
131 cases
.push_back(std::bitset
<64>("0101010101010101010101010101010101010101010101010101010101010101"));
132 cases
.push_back(std::bitset
<64>("1111111111111111111111111111111111111111111111111111111111111111"));
137 TEST_CONSTEXPR_CXX23
inline std::vector
<std::bitset
<65> > get_test_cases
<65>() {
138 std::vector
<std::bitset
<65> > cases
;
139 cases
.push_back(std::bitset
<65>("00000000000000000000000000000000000000000000000000000000000000000"));
140 cases
.push_back(std::bitset
<65>("00000000000000000000000000000000000000000000000000000000000000001"));
141 cases
.push_back(std::bitset
<65>("10000000000000000000000000000000000000000000000000000000000000000"));
142 cases
.push_back(std::bitset
<65>("10000000000000000000000000000000000000000000000000000000000000001"));
143 cases
.push_back(std::bitset
<65>("10000000000000000000000000011111000000000000000000000000000000001"));
144 cases
.push_back(std::bitset
<65>("00000000000000000000000000000000011111111111111111111111111111111"));
145 cases
.push_back(std::bitset
<65>("10000000000000000000000000000000011111111111111111111111111111111"));
146 cases
.push_back(std::bitset
<65>("11111111111111111111111111111111000000000000000000000000000000000"));
147 cases
.push_back(std::bitset
<65>("11111111111111111111111111111111000000000000000000000000000000001"));
148 cases
.push_back(std::bitset
<65>("10101010101010101010101010101010101010101010101010101010101010101"));
149 cases
.push_back(std::bitset
<65>("01010101010101010101010101010101010101010101010101010101010101010"));
150 cases
.push_back(std::bitset
<65>("11111111111111111111111111111111111111111111111111111111111111111"));
154 TEST_CONSTEXPR_CXX23
inline std::string
str_repeat(std::string s
, unsigned int n
) {
162 TEST_CONSTEXPR_CXX23
inline std::vector
<std::bitset
<1000> > get_test_cases
<1000>() {
163 std::vector
<std::bitset
<1000> > cases
;
164 cases
.push_back(std::bitset
<1000>(std::string(1000, '0')));
165 cases
.push_back(std::bitset
<1000>(std::string(999, '0') + std::string(1, '1')));
166 cases
.push_back(std::bitset
<1000>(std::string(1, '1') + std::string(999, '0')));
167 cases
.push_back(std::bitset
<1000>(std::string(1, '1') + std::string(998, '0') + std::string(1, '1')));
168 cases
.push_back(std::bitset
<1000>(std::string(1, '1') + std::string(400, '0') + std::string(99, '1') + std::string(499, '0') + std::string(1, '1')));
169 cases
.push_back(std::bitset
<1000>(std::string(500, '0') + std::string(500, '1')));
170 cases
.push_back(std::bitset
<1000>(std::string(1, '1') + std::string(499, '0') + std::string(500, '1')));
171 cases
.push_back(std::bitset
<1000>(std::string(500, '1') + std::string(500, '0')));
172 cases
.push_back(std::bitset
<1000>(std::string(500, '1') + std::string(499, '0') + std::string(1, '1')));
173 cases
.push_back(std::bitset
<1000>(str_repeat("10", 500)));
174 cases
.push_back(std::bitset
<1000>(str_repeat("01", 500)));
175 cases
.push_back(std::bitset
<1000>(std::string(1000, '1')));
180 #endif // !LIBCPP_TEST_BITSET_TEST_CASES_H