| 818 | /// Utility function to test LEB128 decoding with known byte array and expected result |
| 819 | template <typename Int> |
| 820 | void TestLEB128Decode(const std::vector<uint8_t>& data, Int expected_value, |
| 821 | int32_t expected_bytes_read) { |
| 822 | Int result = 0; |
| 823 | auto bytes_read = bit_util::ParseLeadingLEB128( |
| 824 | data.data(), static_cast<int32_t>(data.size()), &result); |
| 825 | EXPECT_EQ(bytes_read, expected_bytes_read); |
| 826 | if (expected_bytes_read > 0) { |
| 827 | EXPECT_EQ(result, expected_value); |
| 828 | } |
| 829 | } |
| 830 | |
| 831 | /// Test decoding from known LEB128 byte sequences with edge case parameters. |
| 832 | /// \see LEB128.KnownSuccessfulValues for other known values tested. |
no test coverage detected