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

Method TestUnpackOnes

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

Source from the content-addressed store, hash-verified

142
143 template <typename Int>
144 void TestUnpackOnes(UnpackFunc<Int> unpack, const UnpackOptions& opts) {
145 const auto num_bytes = GetNumBytes(opts.batch_size, opts.bit_width, opts.bit_offset);
146
147 const std::vector<uint8_t> packed(static_cast<std::size_t>(num_bytes), uint8_t{0xFF});
148 const auto unpacked = UnpackValues(packed.data(), opts, unpack);
149
150 // Generate bit_width ones
151 Int expected_value = 0;
152 if constexpr (std::is_same_v<Int, bool>) {
153 expected_value = static_cast<bool>(opts.bit_width);
154 } else {
155 for (int i = 0; i < opts.bit_width; ++i) {
156 expected_value = (expected_value << 1) | 1;
157 }
158 }
159 const std::vector<Int> expected(static_cast<std::size_t>(opts.batch_size),
160 expected_value);
161 EXPECT_EQ(unpacked, expected);
162 }
163
164 template <typename Int>
165 void TestUnpackAlternating(UnpackFunc<Int> unpack, const UnpackOptions& opts) {

Callers

nothing calls this directly

Calls 3

UnpackValuesFunction · 0.85
GetNumBytesFunction · 0.70
dataMethod · 0.45

Tested by

no test coverage detected