mirror of
https://git.wownero.com/wownero/wownero.git
synced 2024-08-15 01:03:23 +00:00
commit
5bbbe3902b
15 changed files with 200 additions and 49 deletions
|
@ -389,6 +389,25 @@ TEST(ToHex, String)
|
|||
|
||||
}
|
||||
|
||||
TEST(FromHex, String)
|
||||
{
|
||||
// the source data to encode and decode
|
||||
std::vector<uint8_t> source{{ 0x00, 0xFF, 0x0F, 0xF0 }};
|
||||
|
||||
// encode and decode the data
|
||||
auto hex = epee::to_hex::string({ source.data(), source.size() });
|
||||
auto decoded = epee::from_hex::vector(hex);
|
||||
|
||||
// encoded should be twice the size and should decode to the exact same data
|
||||
EXPECT_EQ(source.size() * 2, hex.size());
|
||||
EXPECT_EQ(source, decoded);
|
||||
|
||||
// we will now create a padded hex string, we want to explicitly allow
|
||||
// decoding it this way also, ignoring spaces and colons between the numbers
|
||||
hex.assign("00:ff 0f:f0");
|
||||
EXPECT_EQ(source, epee::from_hex::vector(hex));
|
||||
}
|
||||
|
||||
TEST(ToHex, Array)
|
||||
{
|
||||
EXPECT_EQ(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue