-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
test: Add more test cases for Base58 parser #5174
base: develop
Are you sure you want to change the base?
Changes from 1 commit
9c1b088
046f49c
2472ba1
6408a35
d188efb
cef381f
e3983dc
f5d9361
a7d0dd3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,6 +30,11 @@ struct types_test : public beast::unit_test::suite | |
auto const s = "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh"; | ||
if (BEAST_EXPECT(parseBase58<AccountID>(s))) | ||
BEAST_EXPECT(toBase58(*parseBase58<AccountID>(s)) == s); | ||
{ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [nit] For me the intention is not very clear - is this a deliberate scope introduction or a mistake in using
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah, now that you mention it, it does look a little off. I changed the test a little bit to make that all clearer, and to remove the need to parse |
||
auto const s = | ||
"âabcd1rNxp4h8apvRis6mJf9Sh8C6iRxfrDWNâabcdAVâ\xc2\x80\xc2\x8f"; | ||
BEAST_EXPECT(!parseBase58<AccountID>(s)); | ||
} | ||
} | ||
|
||
void | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What does this line do?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It fools the compiler into thinking the variable is used, so you don't get unused variable warnings when
assert
s are disabled.It's just an annoyance, but it was on the branch I had sitting around, so I included it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In this case it would be better to use
maybe_unused
attribute:static constexpr [[maybe_unused]] std::uint64_t B_58_10 = 430804206899405824; // 58^10
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I keep forgetting that exists. LOL