Merge pull request #5876

a5c7eeb unit_tests: fix build with CLANG 8 and boost 1.69 (moneromooo-monero)
This commit is contained in:
luigi1111 2019-09-08 20:10:44 -05:00
commit d0d76f771a
No known key found for this signature in database
GPG key ID: F4ACA0183641E010

View file

@ -1040,7 +1040,8 @@ TEST(dandelionpp_map, dropped_connection_remapped)
boost::uuids::random_generator random_uuid{}; boost::uuids::random_generator random_uuid{};
std::vector<boost::uuids::uuid> connections{3}; std::vector<boost::uuids::uuid> connections{3};
std::generate(connections.begin(), connections.end(), random_uuid); for (auto &e: connections)
e = random_uuid();
std::sort(connections.begin(), connections.end()); std::sort(connections.begin(), connections.end());
// select 3 of 3 outgoing connections // select 3 of 3 outgoing connections
@ -1070,7 +1071,8 @@ TEST(dandelionpp_map, dropped_connection_remapped)
} }
std::map<boost::uuids::uuid, boost::uuids::uuid> mapping; std::map<boost::uuids::uuid, boost::uuids::uuid> mapping;
std::vector<boost::uuids::uuid> in_connections{9}; std::vector<boost::uuids::uuid> in_connections{9};
std::generate(in_connections.begin(), in_connections.end(), random_uuid); for (auto &e: in_connections)
e = random_uuid();
{ {
std::map<boost::uuids::uuid, std::size_t> used; std::map<boost::uuids::uuid, std::size_t> used;
std::multimap<boost::uuids::uuid, boost::uuids::uuid> inverse_mapping; std::multimap<boost::uuids::uuid, boost::uuids::uuid> inverse_mapping;
@ -1149,7 +1151,8 @@ TEST(dandelionpp_map, dropped_connection_remapped)
} }
// map 8 new incoming connections across 3 outgoing links // map 8 new incoming connections across 3 outgoing links
in_connections.resize(18); in_connections.resize(18);
std::generate(in_connections.begin() + 10, in_connections.end(), random_uuid); for (size_t i = 10; i < in_connections.size(); ++i)
in_connections[i] = random_uuid();
{ {
std::map<boost::uuids::uuid, std::size_t> used; std::map<boost::uuids::uuid, std::size_t> used;
for (const boost::uuids::uuid& connection : in_connections) for (const boost::uuids::uuid& connection : in_connections)
@ -1176,7 +1179,8 @@ TEST(dandelionpp_map, dropped_all_connections)
boost::uuids::random_generator random_uuid{}; boost::uuids::random_generator random_uuid{};
std::vector<boost::uuids::uuid> connections{8}; std::vector<boost::uuids::uuid> connections{8};
std::generate(connections.begin(), connections.end(), random_uuid); for (auto &e: connections)
e = random_uuid();
std::sort(connections.begin(), connections.end()); std::sort(connections.begin(), connections.end());
// select 3 of 8 outgoing connections // select 3 of 8 outgoing connections
@ -1205,7 +1209,8 @@ TEST(dandelionpp_map, dropped_all_connections)
} }
} }
std::vector<boost::uuids::uuid> in_connections{9}; std::vector<boost::uuids::uuid> in_connections{9};
std::generate(in_connections.begin(), in_connections.end(), random_uuid); for (auto &e: in_connections)
e = random_uuid();
{ {
std::map<boost::uuids::uuid, std::size_t> used; std::map<boost::uuids::uuid, std::size_t> used;
std::map<boost::uuids::uuid, boost::uuids::uuid> mapping; std::map<boost::uuids::uuid, boost::uuids::uuid> mapping;
@ -1237,7 +1242,8 @@ TEST(dandelionpp_map, dropped_all_connections)
// select 3 of 30 connections, only 7 should be remapped to new indexes (but all to new uuids) // select 3 of 30 connections, only 7 should be remapped to new indexes (but all to new uuids)
connections.resize(30); connections.resize(30);
std::generate(connections.begin(), connections.end(), random_uuid); for (auto &e: connections)
e = random_uuid();
EXPECT_TRUE(mapper.update(connections)); EXPECT_TRUE(mapper.update(connections));
{ {
std::map<boost::uuids::uuid, std::size_t> used; std::map<boost::uuids::uuid, std::size_t> used;