diff options
| author | Alexander Blair <snipa@jagtech.io> | 2020-12-10 17:34:50 -0800 |
|---|---|---|
| committer | Alexander Blair <snipa@jagtech.io> | 2020-12-10 17:34:50 -0800 |
| commit | 1e9483a2d585d4ce4c2bf001862132ca46185c16 (patch) | |
| tree | b9a58d5cd7de6b8ed5da9df1c869449f0623611b /tests/unit_tests/net.cpp | |
| parent | 6bddd54f9d1195c4dcef04e096474c2ff7066f1d (diff) | |
| parent | 7414e2bac11cbf9163ca16dc1b1510b4fd9a0d64 (diff) | |
| download | monzero-core-1e9483a2d585d4ce4c2bf001862132ca46185c16.tar.gz monzero-core-1e9483a2d585d4ce4c2bf001862132ca46185c16.tar.xz monzero-core-1e9483a2d585d4ce4c2bf001862132ca46185c16.zip | |
Merge pull request #7009
7414e2bac Change epee binary output from std::stringstream to byte_stream (Lee Clagett)
Diffstat (limited to 'tests/unit_tests/net.cpp')
| -rw-r--r-- | tests/unit_tests/net.cpp | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/tests/unit_tests/net.cpp b/tests/unit_tests/net.cpp index f5aef4796..dffda5e4e 100644 --- a/tests/unit_tests/net.cpp +++ b/tests/unit_tests/net.cpp @@ -245,7 +245,7 @@ namespace TEST(tor_address, epee_serializev_v2) { - std::string buffer{}; + epee::byte_slice buffer{}; { test_command_tor command{MONERO_UNWRAP(net::tor_address::make(v2_onion, 10))}; EXPECT_FALSE(command.tor.is_unknown()); @@ -266,7 +266,7 @@ TEST(tor_address, epee_serializev_v2) EXPECT_EQ(0u, command.tor.port()); epee::serialization::portable_storage stg{}; - EXPECT_TRUE(stg.load_from_binary(buffer)); + EXPECT_TRUE(stg.load_from_binary(epee::to_span(buffer))); EXPECT_TRUE(command.load(stg)); } EXPECT_FALSE(command.tor.is_unknown()); @@ -277,7 +277,7 @@ TEST(tor_address, epee_serializev_v2) // make sure that exceeding max buffer doesn't destroy tor_address::_load { epee::serialization::portable_storage stg{}; - stg.load_from_binary(buffer); + stg.load_from_binary(epee::to_span(buffer)); std::string host{}; ASSERT_TRUE(stg.get_value("host", host, stg.open_section("tor", nullptr, false))); @@ -296,7 +296,7 @@ TEST(tor_address, epee_serializev_v2) TEST(tor_address, epee_serializev_v3) { - std::string buffer{}; + epee::byte_slice buffer{}; { test_command_tor command{MONERO_UNWRAP(net::tor_address::make(v3_onion, 10))}; EXPECT_FALSE(command.tor.is_unknown()); @@ -317,7 +317,7 @@ TEST(tor_address, epee_serializev_v3) EXPECT_EQ(0u, command.tor.port()); epee::serialization::portable_storage stg{}; - EXPECT_TRUE(stg.load_from_binary(buffer)); + EXPECT_TRUE(stg.load_from_binary(epee::to_span(buffer))); EXPECT_TRUE(command.load(stg)); } EXPECT_FALSE(command.tor.is_unknown()); @@ -328,7 +328,7 @@ TEST(tor_address, epee_serializev_v3) // make sure that exceeding max buffer doesn't destroy tor_address::_load { epee::serialization::portable_storage stg{}; - stg.load_from_binary(buffer); + stg.load_from_binary(epee::to_span(buffer)); std::string host{}; ASSERT_TRUE(stg.get_value("host", host, stg.open_section("tor", nullptr, false))); @@ -347,7 +347,7 @@ TEST(tor_address, epee_serializev_v3) TEST(tor_address, epee_serialize_unknown) { - std::string buffer{}; + epee::byte_slice buffer{}; { test_command_tor command{net::tor_address::unknown()}; EXPECT_TRUE(command.tor.is_unknown()); @@ -368,7 +368,7 @@ TEST(tor_address, epee_serialize_unknown) EXPECT_EQ(0u, command.tor.port()); epee::serialization::portable_storage stg{}; - EXPECT_TRUE(stg.load_from_binary(buffer)); + EXPECT_TRUE(stg.load_from_binary(epee::to_span(buffer))); EXPECT_TRUE(command.load(stg)); } EXPECT_TRUE(command.tor.is_unknown()); @@ -379,7 +379,7 @@ TEST(tor_address, epee_serialize_unknown) // make sure that exceeding max buffer doesn't destroy tor_address::_load { epee::serialization::portable_storage stg{}; - stg.load_from_binary(buffer); + stg.load_from_binary(epee::to_span(buffer)); std::string host{}; ASSERT_TRUE(stg.get_value("host", host, stg.open_section("tor", nullptr, false))); @@ -700,7 +700,7 @@ namespace TEST(i2p_address, epee_serializev_b32) { - std::string buffer{}; + epee::byte_slice buffer{}; { test_command_i2p command{MONERO_UNWRAP(net::i2p_address::make(b32_i2p, 10))}; EXPECT_FALSE(command.i2p.is_unknown()); @@ -721,7 +721,7 @@ TEST(i2p_address, epee_serializev_b32) EXPECT_EQ(0u, command.i2p.port()); epee::serialization::portable_storage stg{}; - EXPECT_TRUE(stg.load_from_binary(buffer)); + EXPECT_TRUE(stg.load_from_binary(epee::to_span(buffer))); EXPECT_TRUE(command.load(stg)); } EXPECT_FALSE(command.i2p.is_unknown()); @@ -732,7 +732,7 @@ TEST(i2p_address, epee_serializev_b32) // make sure that exceeding max buffer doesn't destroy i2p_address::_load { epee::serialization::portable_storage stg{}; - stg.load_from_binary(buffer); + stg.load_from_binary(epee::to_span(buffer)); std::string host{}; ASSERT_TRUE(stg.get_value("host", host, stg.open_section("i2p", nullptr, false))); @@ -751,7 +751,7 @@ TEST(i2p_address, epee_serializev_b32) TEST(i2p_address, epee_serialize_unknown) { - std::string buffer{}; + epee::byte_slice buffer{}; { test_command_i2p command{net::i2p_address::unknown()}; EXPECT_TRUE(command.i2p.is_unknown()); @@ -772,7 +772,7 @@ TEST(i2p_address, epee_serialize_unknown) EXPECT_EQ(0u, command.i2p.port()); epee::serialization::portable_storage stg{}; - EXPECT_TRUE(stg.load_from_binary(buffer)); + EXPECT_TRUE(stg.load_from_binary(epee::to_span(buffer))); EXPECT_TRUE(command.load(stg)); } EXPECT_TRUE(command.i2p.is_unknown()); @@ -783,7 +783,7 @@ TEST(i2p_address, epee_serialize_unknown) // make sure that exceeding max buffer doesn't destroy i2p_address::_load { epee::serialization::portable_storage stg{}; - stg.load_from_binary(buffer); + stg.load_from_binary(epee::to_span(buffer)); std::string host{}; ASSERT_TRUE(stg.get_value("host", host, stg.open_section("i2p", nullptr, false))); |
