mirror of
https://github.com/monero-project/monero.git
synced 2024-10-01 11:49:47 -04: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)
|
TEST(StringTools, GetIpString)
|
||||||
{
|
{
|
||||||
EXPECT_EQ(
|
EXPECT_EQ(
|
||||||
|
Loading…
Reference in New Issue
Block a user