mirror of
https://github.com/XRPLF/rippled.git
synced 2025-11-20 11:05:54 +00:00
test: Add more test cases for Base58 parser (#5174)
--------- Co-authored-by: John Freeman <jfreeman08@gmail.com>
This commit is contained in:
@@ -177,7 +177,8 @@ inplace_bigint_div_rem(std::span<uint64_t> numerator, std::uint64_t divisor)
|
|||||||
[[nodiscard]] inline std::array<std::uint8_t, 10>
|
[[nodiscard]] inline std::array<std::uint8_t, 10>
|
||||||
b58_10_to_b58_be(std::uint64_t input)
|
b58_10_to_b58_be(std::uint64_t input)
|
||||||
{
|
{
|
||||||
constexpr std::uint64_t B_58_10 = 430804206899405824; // 58^10;
|
[[maybe_unused]] static constexpr std::uint64_t B_58_10 =
|
||||||
|
430804206899405824; // 58^10;
|
||||||
ASSERT(
|
ASSERT(
|
||||||
input < B_58_10,
|
input < B_58_10,
|
||||||
"ripple::b58_fast::detail::b58_10_to_b58_be : valid input");
|
"ripple::b58_fast::detail::b58_10_to_b58_be : valid input");
|
||||||
|
|||||||
@@ -28,8 +28,16 @@ struct types_test : public beast::unit_test::suite
|
|||||||
testAccountID()
|
testAccountID()
|
||||||
{
|
{
|
||||||
auto const s = "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh";
|
auto const s = "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh";
|
||||||
if (BEAST_EXPECT(parseBase58<AccountID>(s)))
|
if (auto const parsed = parseBase58<AccountID>(s); BEAST_EXPECT(parsed))
|
||||||
BEAST_EXPECT(toBase58(*parseBase58<AccountID>(s)) == s);
|
{
|
||||||
|
BEAST_EXPECT(toBase58(*parsed) == s);
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
auto const s =
|
||||||
|
"âabcd1rNxp4h8apvRis6mJf9Sh8C6iRxfrDWNâabcdAVâ\xc2\x80\xc2\x8f";
|
||||||
|
BEAST_EXPECT(!parseBase58<AccountID>(s));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|||||||
Reference in New Issue
Block a user