mirror of
https://codeberg.org/anoncontributorxmr/monero.git
synced 2024-12-23 13:47:47 +00:00
unit_tests: add some hex parsing test for non hex input
This commit is contained in:
parent
6671110ca3
commit
b36353e268
1 changed files with 16 additions and 0 deletions
|
@ -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 a new issue