| 102 | /// and only the aligned path runs. |
| 103 | template <typename Decoder> |
| 104 | void CheckDecoderValuesChunked(const typename Decoder::RunType& run, |
| 105 | const std::vector<bool>& expected, |
| 106 | rle_size_t chunk_size = 1, rle_size_t expected_skip = 0) { |
| 107 | ARROW_SCOPED_TRACE("chunk_size = ", chunk_size, ", expected_skip = ", expected_skip); |
| 108 | |
| 109 | const auto n_vals = static_cast<rle_size_t>(expected.size()); |
| 110 | ASSERT_LE(expected_skip, n_vals); |
| 111 | |
| 112 | Decoder decoder(run); |
| 113 | const auto advanced = decoder.Advance(expected_skip); |
| 114 | ASSERT_EQ(advanced, expected_skip); |
| 115 | const auto n_vals_to_decode = n_vals - expected_skip; |
| 116 | |
| 117 | // Output buffer |
| 118 | const auto n_bytes = static_cast<size_t>(bit_util::BytesForBits(n_vals_to_decode)); |
| 119 | std::vector<uint8_t> out(n_bytes, 0); |
| 120 | |
| 121 | rle_size_t n_val_read = 0; |
| 122 | while (n_val_read < n_vals_to_decode) { |
| 123 | const auto want = std::min(chunk_size, n_vals_to_decode - n_val_read); |
| 124 | const auto got = |
| 125 | decoder.GetBatch(BitmapSpanMut(out.data(), /*bit_start=*/n_val_read), want); |
| 126 | EXPECT_EQ(got, want) << "at pos " << n_val_read; |
| 127 | ASSERT_GT(got, 0) << "at pos " << n_val_read; // break on failure |
| 128 | n_val_read += got; |
| 129 | EXPECT_EQ(decoder.remaining(), n_vals_to_decode - n_val_read); |
| 130 | } |
| 131 | |
| 132 | EXPECT_EQ(decoder.remaining(), 0); |
| 133 | CheckDecodedBits({ |
| 134 | .actual = out, |
| 135 | .expected = expected, |
| 136 | .count = n_vals_to_decode, |
| 137 | .actual_start_bit = 0, |
| 138 | .expected_start_idx = expected_skip, |
| 139 | }); |
| 140 | } |
| 141 | |
| 142 | /// Decode a chunk of data into a known output to check for out of bounds write. |
| 143 | /// |
nothing calls this directly
no test coverage detected