wipeable_string: add hex_to_pod function

This commit is contained in:
moneromooo-monero
2018-08-27 08:43:56 +00:00
parent 91c7d68b2d
commit 07ec748c82
4 changed files with 28 additions and 2 deletions

View File

@@ -32,6 +32,7 @@
#include "misc_log_ex.h"
#include "wipeable_string.h"
#include "hex.h"
TEST(wipeable_string, ctor)
{
@@ -202,3 +203,9 @@ TEST(wipeable_string, parse_hexstr)
ASSERT_TRUE((s = epee::wipeable_string("414243").parse_hexstr()));
ASSERT_EQ(*s, epee::wipeable_string("ABC"));
}
TEST(wipeable_string, to_hex)
{
ASSERT_TRUE(epee::to_hex::wipeable_string(epee::span<const uint8_t>((const uint8_t*)"", 0)) == epee::wipeable_string(""));
ASSERT_TRUE(epee::to_hex::wipeable_string(epee::span<const uint8_t>((const uint8_t*)"abc", 3)) == epee::wipeable_string("616263"));
}