mirror of
https://codeberg.org/anoncontributorxmr/monero.git
synced 2024-11-23 10:37:37 -07:00
unit_tests: add some hex parsing test for non hex input
This commit is contained in:
parent
6671110ca3
commit
b36353e268
@ -469,6 +469,22 @@ TEST(StringTools, ParseHex)
|
||||
}
|
||||
}
|
||||
|
||||
TEST(StringTools, ParseNotHex)
|
||||
{
|
||||
std::string res;
|
||||
for (size_t i = 0; i < 256; ++i)
|
||||
{
|
||||
std::string inputHexString = std::string(2, static_cast<char>(i));
|
||||
if ((i >= '0' && i <= '9') || (i >= 'A' && i <= 'F') || (i >= 'a' && i <= 'f')) {
|
||||
ASSERT_TRUE(epee::string_tools::parse_hexstr_to_binbuff(inputHexString, res));
|
||||
} else {
|
||||
ASSERT_FALSE(epee::string_tools::parse_hexstr_to_binbuff(inputHexString, res));
|
||||
}
|
||||
}
|
||||
|
||||
ASSERT_FALSE(epee::string_tools::parse_hexstr_to_binbuff(std::string("a"), res));
|
||||
}
|
||||
|
||||
TEST(StringTools, GetIpString)
|
||||
{
|
||||
EXPECT_EQ(
|
||||
|
Loading…
Reference in New Issue
Block a user