diff options
author | moneromooo-monero <moneromooo-monero@users.noreply.github.com> | 2018-11-15 12:40:55 +0000 |
---|---|---|
committer | moneromooo-monero <moneromooo-monero@users.noreply.github.com> | 2018-11-15 23:34:15 +0000 |
commit | 6671110ca3db97f1169dd853fbb22ad725708e4a (patch) | |
tree | 84ab6b9f70ee06b874d68917b14f914020b73ee2 /tests/unit_tests | |
parent | epee: speed up parse_hexstr_to_binbuff a little (diff) | |
download | monero-6671110ca3db97f1169dd853fbb22ad725708e4a.tar.xz |
unit_tests: add a test for parse_hexstr_to_binbuff
Diffstat (limited to 'tests/unit_tests')
-rw-r--r-- | tests/unit_tests/epee_utils.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/unit_tests/epee_utils.cpp b/tests/unit_tests/epee_utils.cpp index c2b0b7647..b3c812dca 100644 --- a/tests/unit_tests/epee_utils.cpp +++ b/tests/unit_tests/epee_utils.cpp @@ -456,6 +456,19 @@ TEST(StringTools, PodToHex) ); } +TEST(StringTools, ParseHex) +{ + static const char data[] = "a10b68c2"; + for (size_t i = 0; i < sizeof(data); i += 2) + { + std::string res; + ASSERT_TRUE(epee::string_tools::parse_hexstr_to_binbuff(std::string(data, i), res)); + std::string hex = epee::string_tools::buff_to_hex_nodelimer(res); + ASSERT_EQ(hex.size(), i); + ASSERT_EQ(memcmp(data, hex.data(), i), 0); + } +} + TEST(StringTools, GetIpString) { EXPECT_EQ( |