fix(hash): str_size was added to isValid
This commit is contained in:
@ -7,7 +7,7 @@
|
||||
|
||||
namespace hex
|
||||
{
|
||||
bool isValid(const char *str) noexcept;
|
||||
bool isValid(const char *str, size_t str_size) noexcept;
|
||||
bool isValid(std::string_view str) noexcept;
|
||||
|
||||
void encode(const uint8_t *data, size_t data_size, char *str, size_t str_size);
|
||||
|
||||
@ -27,9 +27,9 @@ static const int8_t hexmap[] = {
|
||||
|
||||
namespace hex
|
||||
{
|
||||
bool isValid(const char *str) noexcept
|
||||
bool isValid(const char *str, size_t str_size) noexcept
|
||||
{
|
||||
return baseN::isValid(str, hexmap);
|
||||
return baseN::isValid(str, str_size, hexmap);
|
||||
}
|
||||
bool isValid(std::string_view str) noexcept
|
||||
{
|
||||
|
||||
@ -17,9 +17,9 @@ TEST(hex, encode)
|
||||
EXPECT_STREQ(e.what(), "hex::encode: not enough allocated length");
|
||||
}
|
||||
}
|
||||
TEST(hex, encode_1e6)
|
||||
TEST(hex, encode_1e7)
|
||||
{
|
||||
std::vector<uint8_t> data(1e6);
|
||||
std::vector<uint8_t> data(1e7);
|
||||
encode(data);
|
||||
}
|
||||
TEST(hex, decode)
|
||||
@ -36,9 +36,9 @@ TEST(hex, decode)
|
||||
EXPECT_STREQ(e.what(), "hex::decode: isn't hex");
|
||||
}
|
||||
}
|
||||
TEST(hex, decode_1e6)
|
||||
TEST(hex, decode_1e7)
|
||||
{
|
||||
std::string str(1e6, '0');
|
||||
std::string str(1e7, '0');
|
||||
decode(str);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user