MCPcopy Create free account
hub / github.com/apache/arrow / TestAll

Method TestAll

cpp/src/arrow/util/bpacking_test.cc:193–255  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

191 }
192
193 void TestAll(UnpackFunc<Int> unpack) {
194 // There are actually many differences across the different sizes.
195 // It is best to test them all.
196 for (int num_values_base : {64, 128, 2048}) {
197 SCOPED_TRACE(::testing::Message() << "Testing num_values=" << num_values_base);
198
199 constexpr int kMaxBitWidth = std::is_same_v<Int, bool> ? 1 : 8 * sizeof(Int);
200
201 // Given how many edge cases there are in unpacking integers, it is best to test all
202 // bit widths.
203 for (int bit_width = 0; bit_width <= kMaxBitWidth; ++bit_width) {
204 SCOPED_TRACE(::testing::Message() << "Testing bit_width=" << bit_width);
205
206 // We test all bit offset within a byte / misalignments to change how the
207 // prolog.
208 for (int bit_offset = 0; bit_offset < 8; ++bit_offset) {
209 SCOPED_TRACE(::testing::Message() << "Testing bit_offset=" << bit_offset);
210
211 const UnpackOptions opts{
212 .batch_size = num_values_base,
213 .bit_width = bit_width,
214 .bit_offset = bit_offset,
215 .max_read_bytes = -1, // No over-reading in testing (strict ASAN)
216 };
217
218 // Known values
219 TestUnpackZeros(unpack, opts);
220 TestUnpackOnes(unpack, opts);
221 TestUnpackAlternating(unpack, opts);
222
223 // Roundtrips
224 TestRoundtripAlignment(unpack, opts);
225
226 if (testing::Test::HasFailure()) return;
227 }
228
229 // Similarly, we test all epilog sizes. That is extra values that could make it
230 // fall outside of an SIMD register
231 for (int epilogue_size = 0; epilogue_size <= kMaxBitWidth; ++epilogue_size) {
232 SCOPED_TRACE(::testing::Message() << "Testing epilog_size=" << epilogue_size);
233
234 const int num_values = num_values_base + epilogue_size;
235
236 const UnpackOptions opts{
237 .batch_size = num_values,
238 .bit_width = bit_width,
239 .bit_offset = 0,
240 .max_read_bytes = -1, // No over-reading in testing (strict ASAN)
241 };
242
243 // Known values
244 TestUnpackZeros(unpack, opts);
245 TestUnpackOnes(unpack, opts);
246 TestUnpackAlternating(unpack, opts);
247
248 // Roundtrips
249 TestRoundtripAlignment(unpack, opts);
250

Callers 1

TYPED_TESTFunction · 0.80

Calls 1

MessageClass · 0.50

Tested by

no test coverage detected