| 169 | |
| 170 | template <typename UINT_T> |
| 171 | void RandomUnpackTest() { |
| 172 | const std::vector<UINT_T> in = GenerateRandomInput<UINT_T>(NUM_IN_VALUES, |
| 173 | std::numeric_limits<UINT_T>::min(), std::numeric_limits<UINT_T>::max()); |
| 174 | |
| 175 | const std::vector<int> lengths = GetLengths(); |
| 176 | |
| 177 | constexpr int MAX_BITWIDTH = BitPacking::MAX_BITWIDTH; |
| 178 | const int max_bit_width = std::min<int>(MAX_BITWIDTH, sizeof(UINT_T) * CHAR_BIT); |
| 179 | for (int bit_width = 0; bit_width <= max_bit_width; ++bit_width) { |
| 180 | for (const int length : lengths) { |
| 181 | // Test that unpacking to/from aligned and unaligned memory works. |
| 182 | for (const bool aligned : {true, false}) { |
| 183 | PackUnpack<UINT_T>(in.data(), length, bit_width, aligned); |
| 184 | } |
| 185 | } |
| 186 | } |
| 187 | } |
| 188 | |
| 189 | TEST(BitPackingTest, RandomUnpack8) { |
| 190 | RandomUnpackTest<uint8_t>(); |
nothing calls this directly
no test coverage detected