mirror of
https://github.com/monero-project/monero.git
synced 2025-08-10 19:50:08 -04:00
Add to_hex::buffer
This commit is contained in:
parent
94e67bf96b
commit
eb943562cb
3 changed files with 27 additions and 0 deletions
|
@ -1241,6 +1241,22 @@ TEST(ToHex, ArrayFromPod)
|
|||
);
|
||||
}
|
||||
|
||||
TEST(ToHex, Buffer)
|
||||
{
|
||||
static constexpr const std::uint8_t source[] = {0xFF, 0x00, 0xAB, 0x01};
|
||||
const std::vector<char> expected{'f', 'f', '0', '0', 'a', 'b', '0', '1'};
|
||||
|
||||
std::vector<char> buffer;
|
||||
buffer.resize(expected.size());
|
||||
EXPECT_TRUE(epee::to_hex::buffer(epee::to_mut_span(buffer), source));
|
||||
EXPECT_EQ(expected, buffer);
|
||||
|
||||
buffer.pop_back();
|
||||
EXPECT_FALSE(epee::to_hex::buffer(epee::to_mut_span(buffer), source));
|
||||
buffer.pop_back();
|
||||
EXPECT_FALSE(epee::to_hex::buffer(epee::to_mut_span(buffer), source));
|
||||
}
|
||||
|
||||
TEST(ToHex, Ostream)
|
||||
{
|
||||
std::stringstream out;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue