Merge pull request #4852

057c279c epee: add SSL support (Martijn Otto)
This commit is contained in:
Riccardo Spagni 2019-03-05 16:21:30 +02:00
commit 5bbbe3902b
No known key found for this signature in database
GPG key ID: 55432DF31CCD4FCD
15 changed files with 200 additions and 49 deletions

View file

@ -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(