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 //===----------------------------------------------------------------------===//
8 #ifndef LIBCPP_TEST_BITSET_TEST_CASES_H
9 #define LIBCPP_TEST_BITSET_TEST_CASES_H
16 std::vector
<std::bitset
<N
> > get_test_cases();
19 inline std::vector
<std::bitset
<0> > get_test_cases
<0>() {
20 std::vector
<std::bitset
<0> > cases
;
21 cases
.push_back(std::bitset
<0>());
26 inline std::vector
<std::bitset
<1> > get_test_cases
<1>() {
27 std::vector
<std::bitset
<1> > cases
;
28 cases
.push_back(std::bitset
<1>("0"));
29 cases
.push_back(std::bitset
<1>("1"));
34 inline std::vector
<std::bitset
<2> > get_test_cases
<2>() {
35 std::vector
<std::bitset
<2> > cases
;
36 cases
.push_back(std::bitset
<2>("00"));
37 cases
.push_back(std::bitset
<2>("01"));
38 cases
.push_back(std::bitset
<2>("10"));
39 cases
.push_back(std::bitset
<2>("11"));
44 inline std::vector
<std::bitset
<31> > get_test_cases
<31>() {
45 std::vector
<std::bitset
<31> > cases
;
46 cases
.push_back(std::bitset
<31>("0000000000000000000000000000000"));
47 cases
.push_back(std::bitset
<31>("0000000000000000000000000000001"));
48 cases
.push_back(std::bitset
<31>("1000000000000000000000000000000"));
49 cases
.push_back(std::bitset
<31>("1000000000000000000000000000001"));
50 cases
.push_back(std::bitset
<31>("1000000000000000000001000000001"));
51 cases
.push_back(std::bitset
<31>("0000000000000000111111111111111"));
52 cases
.push_back(std::bitset
<31>("1000000000000000111111111111111"));
53 cases
.push_back(std::bitset
<31>("1111111111111111000000000000000"));
54 cases
.push_back(std::bitset
<31>("1111111111111111000000000000001"));
55 cases
.push_back(std::bitset
<31>("1010101010101010101010101010101"));
56 cases
.push_back(std::bitset
<31>("0101010101010101010101010101010"));
57 cases
.push_back(std::bitset
<31>("1111111111111111111111111111111"));
62 inline std::vector
<std::bitset
<32> > get_test_cases
<32>() {
63 std::vector
<std::bitset
<32> > cases
;
64 cases
.push_back(std::bitset
<32>("00000000000000000000000000000000"));
65 cases
.push_back(std::bitset
<32>("00000000000000000000000000000001"));
66 cases
.push_back(std::bitset
<32>("10000000000000000000000000000000"));
67 cases
.push_back(std::bitset
<32>("10000000000000000000000000000001"));
68 cases
.push_back(std::bitset
<32>("10000000000000000000111000000001"));
69 cases
.push_back(std::bitset
<32>("00000000000000001111111111111111"));
70 cases
.push_back(std::bitset
<32>("10000000000000001111111111111111"));
71 cases
.push_back(std::bitset
<32>("11111111111111110000000000000000"));
72 cases
.push_back(std::bitset
<32>("11111111111111110000000000000001"));
73 cases
.push_back(std::bitset
<32>("10101010101010101010101010101010"));
74 cases
.push_back(std::bitset
<32>("01010101010101010101010101010101"));
75 cases
.push_back(std::bitset
<32>("11111111111111111111111111111111"));
80 inline std::vector
<std::bitset
<33> > get_test_cases
<33>() {
81 std::vector
<std::bitset
<33> > cases
;
82 cases
.push_back(std::bitset
<33>("000000000000000000000000000000000"));
83 cases
.push_back(std::bitset
<33>("000000000000000000000000000000001"));
84 cases
.push_back(std::bitset
<33>("100000000000000000000000000000000"));
85 cases
.push_back(std::bitset
<33>("100000000000000000000000000000001"));
86 cases
.push_back(std::bitset
<33>("100000000000000000001110000000001"));
87 cases
.push_back(std::bitset
<33>("000000000000000011111111111111111"));
88 cases
.push_back(std::bitset
<33>("100000000000000011111111111111111"));
89 cases
.push_back(std::bitset
<33>("111111111111111100000000000000000"));
90 cases
.push_back(std::bitset
<33>("111111111111111100000000000000001"));
91 cases
.push_back(std::bitset
<33>("101010101010101010101010101010101"));
92 cases
.push_back(std::bitset
<33>("010101010101010101010101010101010"));
93 cases
.push_back(std::bitset
<33>("111111111111111111111111111111111"));
98 inline std::vector
<std::bitset
<63> > get_test_cases
<63>() {
99 std::vector
<std::bitset
<63> > cases
;
100 cases
.push_back(std::bitset
<63>("000000000000000000000000000000000000000000000000000000000000000"));
101 cases
.push_back(std::bitset
<63>("000000000000000000000000000000000000000000000000000000000000001"));
102 cases
.push_back(std::bitset
<63>("100000000000000000000000000000000000000000000000000000000000000"));
103 cases
.push_back(std::bitset
<63>("100000000000000000000000000000000000000000000000000000000000001"));
104 cases
.push_back(std::bitset
<63>("100000000000000000000000001111100000000000000000000000000000001"));
105 cases
.push_back(std::bitset
<63>("000000000000000000000000000000001111111111111111111111111111111"));
106 cases
.push_back(std::bitset
<63>("100000000000000000000000000000001111111111111111111111111111111"));
107 cases
.push_back(std::bitset
<63>("111111111111111111111111111111110000000000000000000000000000000"));
108 cases
.push_back(std::bitset
<63>("111111111111111111111111111111110000000000000000000000000000001"));
109 cases
.push_back(std::bitset
<63>("101010101010101010101010101010101010101010101010101010101010101"));
110 cases
.push_back(std::bitset
<63>("010101010101010101010101010101010101010101010101010101010101010"));
111 cases
.push_back(std::bitset
<63>("111111111111111111111111111111111111111111111111111111111111111"));
116 inline std::vector
<std::bitset
<64> > get_test_cases
<64>() {
117 std::vector
<std::bitset
<64> > cases
;
118 cases
.push_back(std::bitset
<64>("0000000000000000000000000000000000000000000000000000000000000000"));
119 cases
.push_back(std::bitset
<64>("0000000000000000000000000000000000000000000000000000000000000001"));
120 cases
.push_back(std::bitset
<64>("1000000000000000000000000000000000000000000000000000000000000000"));
121 cases
.push_back(std::bitset
<64>("1000000000000000000000000000000000000000000000000000000000000001"));
122 cases
.push_back(std::bitset
<64>("1000000000000000000000000011111000000000000000000000000000000001"));
123 cases
.push_back(std::bitset
<64>("0000000000000000000000000000000011111111111111111111111111111111"));
124 cases
.push_back(std::bitset
<64>("1000000000000000000000000000000011111111111111111111111111111111"));
125 cases
.push_back(std::bitset
<64>("1111111111111111111111111111111100000000000000000000000000000000"));
126 cases
.push_back(std::bitset
<64>("1111111111111111111111111111111100000000000000000000000000000001"));
127 cases
.push_back(std::bitset
<64>("1010101010101010101010101010101010101010101010101010101010101010"));
128 cases
.push_back(std::bitset
<64>("0101010101010101010101010101010101010101010101010101010101010101"));
129 cases
.push_back(std::bitset
<64>("1111111111111111111111111111111111111111111111111111111111111111"));
134 inline std::vector
<std::bitset
<65> > get_test_cases
<65>() {
135 std::vector
<std::bitset
<65> > cases
;
136 cases
.push_back(std::bitset
<65>("00000000000000000000000000000000000000000000000000000000000000000"));
137 cases
.push_back(std::bitset
<65>("00000000000000000000000000000000000000000000000000000000000000001"));
138 cases
.push_back(std::bitset
<65>("10000000000000000000000000000000000000000000000000000000000000000"));
139 cases
.push_back(std::bitset
<65>("10000000000000000000000000000000000000000000000000000000000000001"));
140 cases
.push_back(std::bitset
<65>("10000000000000000000000000011111000000000000000000000000000000001"));
141 cases
.push_back(std::bitset
<65>("00000000000000000000000000000000011111111111111111111111111111111"));
142 cases
.push_back(std::bitset
<65>("10000000000000000000000000000000011111111111111111111111111111111"));
143 cases
.push_back(std::bitset
<65>("11111111111111111111111111111111000000000000000000000000000000000"));
144 cases
.push_back(std::bitset
<65>("11111111111111111111111111111111000000000000000000000000000000001"));
145 cases
.push_back(std::bitset
<65>("10101010101010101010101010101010101010101010101010101010101010101"));
146 cases
.push_back(std::bitset
<65>("01010101010101010101010101010101010101010101010101010101010101010"));
147 cases
.push_back(std::bitset
<65>("11111111111111111111111111111111111111111111111111111111111111111"));
151 inline std::string
str_repeat(std::string s
, unsigned int n
) {
159 inline std::vector
<std::bitset
<1000> > get_test_cases
<1000>() {
160 std::vector
<std::bitset
<1000> > cases
;
161 cases
.push_back(std::bitset
<1000>(std::string(1000, '0')));
162 cases
.push_back(std::bitset
<1000>(std::string(999, '0') + std::string(1, '1')));
163 cases
.push_back(std::bitset
<1000>(std::string(1, '1') + std::string(999, '0')));
164 cases
.push_back(std::bitset
<1000>(std::string(1, '1') + std::string(998, '0') + std::string(1, '1')));
165 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')));
166 cases
.push_back(std::bitset
<1000>(std::string(500, '0') + std::string(500, '1')));
167 cases
.push_back(std::bitset
<1000>(std::string(1, '1') + std::string(499, '0') + std::string(500, '1')));
168 cases
.push_back(std::bitset
<1000>(std::string(500, '1') + std::string(500, '0')));
169 cases
.push_back(std::bitset
<1000>(std::string(500, '1') + std::string(499, '0') + std::string(1, '1')));
170 cases
.push_back(std::bitset
<1000>(str_repeat("10", 500)));
171 cases
.push_back(std::bitset
<1000>(str_repeat("01", 500)));
172 cases
.push_back(std::bitset
<1000>(std::string(1000, '1')));
177 #endif // !LIBCPP_TEST_BITSET_TEST_CASES_H