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

Method TestUnpackOnes

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

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 3

UnpackValuesFunction · 0.85
GetNumBytesFunction · 0.70
dataMethod · 0.45

Tested by

no test coverage detected