diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/core_tests/transaction_tests.cpp | 2 | ||||
-rw-r--r-- | tests/core_tests/tx_pool.cpp | 7 | ||||
-rwxr-xr-x | tests/functional_tests/mining.py | 2 | ||||
-rw-r--r-- | tests/functional_tests/transactions_flow_test.cpp | 1 | ||||
-rw-r--r-- | tests/net_load_tests/srv.cpp | 2 | ||||
-rw-r--r-- | tests/performance_tests/performance_tests.h | 1 | ||||
-rw-r--r-- | tests/unit_tests/bulletproofs.cpp | 1 | ||||
-rw-r--r-- | tests/unit_tests/hardfork.cpp | 1 | ||||
-rw-r--r-- | tests/unit_tests/net.cpp | 16 | ||||
-rw-r--r-- | tests/unit_tests/node_server.cpp | 1 | ||||
-rw-r--r-- | tests/unit_tests/output_selection.cpp | 2 | ||||
-rw-r--r-- | tests/unit_tests/wipeable_string.cpp | 18 | ||||
-rw-r--r-- | tests/unit_tests/zmq_rpc.cpp | 1 |
13 files changed, 22 insertions, 33 deletions
diff --git a/tests/core_tests/transaction_tests.cpp b/tests/core_tests/transaction_tests.cpp index d0b55dcf4..d19bdd1f9 100644 --- a/tests/core_tests/transaction_tests.cpp +++ b/tests/core_tests/transaction_tests.cpp @@ -78,8 +78,6 @@ bool test_transaction_generation_and_ring_signature() tx_source_entry& src = sources.back(); src.amount = 70368744177663; { - tx_output_entry oe; - src.push_output(0, boost::get<txout_to_key>(tx_mine_1.vout[0].target).key, src.amount); src.push_output(1, boost::get<txout_to_key>(tx_mine_2.vout[0].target).key, src.amount); diff --git a/tests/core_tests/tx_pool.cpp b/tests/core_tests/tx_pool.cpp index 1e496f3da..166eb6075 100644 --- a/tests/core_tests/tx_pool.cpp +++ b/tests/core_tests/tx_pool.cpp @@ -165,9 +165,6 @@ bool txpool_double_spend_base::timestamp_change_pause(cryptonote::core& /*c*/, s bool txpool_double_spend_base::check_changed(cryptonote::core& c, const size_t ev_index, relay_test condition) { - const std::size_t public_hash_count = m_broadcasted_hashes.size(); - const std::size_t all_hash_count = m_all_hashes.size(); - const std::size_t new_broadcasted_hash_count = m_broadcasted_hashes.size() + unsigned(condition == relay_test::broadcasted); const std::size_t new_all_hash_count = m_all_hashes.size() + unsigned(condition == relay_test::hidden) + unsigned(condition == relay_test::no_relay); @@ -393,7 +390,7 @@ bool txpool_double_spend_base::check_changed(cryptonote::core& c, const size_t e } } - for (const std::pair<crypto::hash, uint64_t>& hash : m_all_hashes) + for (const std::pair<const crypto::hash, uint64_t>& hash : m_all_hashes) { cryptonote::blobdata tx_blob{}; if (!c.get_pool_transaction(hash.first, tx_blob, cryptonote::relay_category::all)) @@ -411,7 +408,7 @@ bool txpool_double_spend_base::check_changed(cryptonote::core& c, const size_t e for (const crypto::hash& hash : m_no_relay_hashes) difference.erase(hash); - for (const std::pair<crypto::hash, uint64_t>& hash : difference) + for (const std::pair<const crypto::hash, uint64_t>& hash : difference) { if (c.pool_has_tx(hash.first)) { diff --git a/tests/functional_tests/mining.py b/tests/functional_tests/mining.py index 1eb6b0ba7..50bfd32a2 100755 --- a/tests/functional_tests/mining.py +++ b/tests/functional_tests/mining.py @@ -97,7 +97,7 @@ class MiningTest(): # wait till we mined a few of them target_height = prev_height + 5 height = prev_height - timeout = 60 # randomx is slow to init + timeout = 240 # randomx is slow to init while height < target_height: seen_height = height for _ in range(timeout): diff --git a/tests/functional_tests/transactions_flow_test.cpp b/tests/functional_tests/transactions_flow_test.cpp index cec6825f5..3f5f90d3b 100644 --- a/tests/functional_tests/transactions_flow_test.cpp +++ b/tests/functional_tests/transactions_flow_test.cpp @@ -41,7 +41,6 @@ using namespace cryptonote; namespace { uint64_t const TEST_FEE = 5000000000; // 5 * 10^9 - uint64_t const TEST_DUST_THRESHOLD = 5000000000; // 5 * 10^9 } std::string generate_random_wallet_name() diff --git a/tests/net_load_tests/srv.cpp b/tests/net_load_tests/srv.cpp index 84d97ebd4..fabe14f49 100644 --- a/tests/net_load_tests/srv.cpp +++ b/tests/net_load_tests/srv.cpp @@ -169,7 +169,7 @@ namespace LOG_PRINT_L0("Closing connections. Number of opened connections: " << m_tcp_server.get_config_object().get_connections_count()); size_t count = 0; - bool r = m_tcp_server.get_config_object().foreach_connection([&](test_connection_context& ctx) { + m_tcp_server.get_config_object().foreach_connection([&](test_connection_context& ctx) { if (ctx.m_connection_id != cmd_conn_id) { ++count; diff --git a/tests/performance_tests/performance_tests.h b/tests/performance_tests/performance_tests.h index ae7aabe08..7bedfdd4e 100644 --- a/tests/performance_tests/performance_tests.h +++ b/tests/performance_tests/performance_tests.h @@ -215,7 +215,6 @@ void run_test(const std::string &filter, Params ¶ms, const char* test_name) if (params.stats) { uint64_t mins = min / scale; - uint64_t maxs = max / scale; uint64_t meds = med / scale; uint64_t p95s = quantiles[9] / scale; uint64_t stddevs = stddev / scale; diff --git a/tests/unit_tests/bulletproofs.cpp b/tests/unit_tests/bulletproofs.cpp index 7c6e459f5..ee617938c 100644 --- a/tests/unit_tests/bulletproofs.cpp +++ b/tests/unit_tests/bulletproofs.cpp @@ -296,7 +296,6 @@ TEST(bulletproof, weight_pruned) ASSERT_TRUE(tx.version == 2); ASSERT_FALSE(tx.pruned); ASSERT_TRUE(rct::is_rct_bulletproof(tx.rct_signatures.type)); - const uint64_t tx_size = bd.size(); const uint64_t tx_weight = cryptonote::get_transaction_weight(tx); ASSERT_TRUE(parse_and_validate_tx_base_from_blob(bd, pruned_tx)); ASSERT_TRUE(pruned_tx.version == 2); diff --git a/tests/unit_tests/hardfork.cpp b/tests/unit_tests/hardfork.cpp index 6d7e9a8aa..912651de4 100644 --- a/tests/unit_tests/hardfork.cpp +++ b/tests/unit_tests/hardfork.cpp @@ -432,7 +432,6 @@ TEST(voting, info) // 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 static const uint8_t block_versions[] = { 1, 1, 1, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4 }; - static const uint8_t expected_versions[] = { 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4 }; static const uint8_t expected_thresholds[] = { 0, 1, 1, 2, 2, 0, 0, 0, 0, 0, 0, 0, 4, 4, 4, 4, 2, 2, 2, 2 }; for (uint64_t h = 0; h < sizeof(block_versions) / sizeof(block_versions[0]); ++h) { diff --git a/tests/unit_tests/net.cpp b/tests/unit_tests/net.cpp index dffda5e4e..2836fd948 100644 --- a/tests/unit_tests/net.cpp +++ b/tests/unit_tests/net.cpp @@ -1351,7 +1351,7 @@ TEST(dandelionpp_map, dropped_connection) } EXPECT_EQ(3u, used.size()); - for (const std::pair<boost::uuids::uuid, std::size_t>& entry : used) + for (const std::pair<const boost::uuids::uuid, std::size_t>& entry : used) EXPECT_EQ(3u, entry.second); for (const boost::uuids::uuid& connection : in_connections) @@ -1409,7 +1409,7 @@ TEST(dandelionpp_map, dropped_connection) } EXPECT_EQ(3u, used.size()); - for (const std::pair<boost::uuids::uuid, std::size_t>& entry : used) + for (const std::pair<const boost::uuids::uuid, std::size_t>& entry : used) EXPECT_EQ(3u, entry.second); } { @@ -1472,7 +1472,7 @@ TEST(dandelionpp_map, dropped_connection_remapped) } EXPECT_EQ(3u, used.size()); - for (const std::pair<boost::uuids::uuid, std::size_t>& entry : used) + for (const std::pair<const boost::uuids::uuid, std::size_t>& entry : used) EXPECT_EQ(3u, entry.second); for (const boost::uuids::uuid& connection : in_connections) @@ -1511,7 +1511,7 @@ TEST(dandelionpp_map, dropped_connection_remapped) } EXPECT_EQ(2u, used.size()); - for (const std::pair<boost::uuids::uuid, std::size_t>& entry : used) + for (const std::pair<const boost::uuids::uuid, std::size_t>& entry : used) EXPECT_EQ(5u, entry.second); } // select 3 of 3 connections but do not remap existing links @@ -1532,7 +1532,7 @@ TEST(dandelionpp_map, dropped_connection_remapped) } EXPECT_EQ(2u, used.size()); - for (const std::pair<boost::uuids::uuid, std::size_t>& entry : used) + for (const std::pair<const boost::uuids::uuid, std::size_t>& entry : used) EXPECT_EQ(5u, entry.second); } // map 8 new incoming connections across 3 outgoing links @@ -1555,7 +1555,7 @@ TEST(dandelionpp_map, dropped_connection_remapped) } EXPECT_EQ(3u, used.size()); - for (const std::pair<boost::uuids::uuid, std::size_t>& entry : used) + for (const std::pair<const boost::uuids::uuid, std::size_t>& entry : used) EXPECT_EQ(6u, entry.second); } } @@ -1609,7 +1609,7 @@ TEST(dandelionpp_map, dropped_all_connections) } EXPECT_EQ(3u, used.size()); - for (const std::pair<boost::uuids::uuid, std::size_t>& entry : used) + for (const std::pair<const boost::uuids::uuid, std::size_t>& entry : used) EXPECT_EQ(3u, entry.second); for (const boost::uuids::uuid& connection : in_connections) @@ -1641,7 +1641,7 @@ TEST(dandelionpp_map, dropped_all_connections) } EXPECT_EQ(3u, used.size()); - for (const std::pair<boost::uuids::uuid, std::size_t>& entry : used) + for (const std::pair<const boost::uuids::uuid, std::size_t>& entry : used) EXPECT_EQ(3u, entry.second); } } diff --git a/tests/unit_tests/node_server.cpp b/tests/unit_tests/node_server.cpp index 4d6f09e69..af297d01a 100644 --- a/tests/unit_tests/node_server.cpp +++ b/tests/unit_tests/node_server.cpp @@ -250,7 +250,6 @@ TEST(ban, subnet) TEST(ban, ignores_port) { - time_t seconds; test_core pr_core; cryptonote::t_cryptonote_protocol_handler<test_core> cprotocol(pr_core, NULL); Server server(cprotocol); diff --git a/tests/unit_tests/output_selection.cpp b/tests/unit_tests/output_selection.cpp index cff509451..20dc58e03 100644 --- a/tests/unit_tests/output_selection.cpp +++ b/tests/unit_tests/output_selection.cpp @@ -206,7 +206,7 @@ TEST(select_outputs, same_distribution) for (size_t i = 0; i < chain_picks.size(); ++i) chain_norm[i * 100 / chain_picks.size()] += chain_picks[i]; - double max_dev = 0.0, avg_dev = 0.0; + double avg_dev = 0.0; for (size_t i = 0; i < 100; ++i) { const double diff = (double)output_norm[i] - (double)chain_norm[i]; diff --git a/tests/unit_tests/wipeable_string.cpp b/tests/unit_tests/wipeable_string.cpp index 9911bd6f4..0e0bf8906 100644 --- a/tests/unit_tests/wipeable_string.cpp +++ b/tests/unit_tests/wipeable_string.cpp @@ -189,20 +189,20 @@ TEST(wipeable_string, parse_hexstr) { boost::optional<epee::wipeable_string> s; - ASSERT_EQ(boost::none, epee::wipeable_string("x").parse_hexstr()); - ASSERT_EQ(boost::none, epee::wipeable_string("x0000000000000000").parse_hexstr()); - ASSERT_EQ(boost::none, epee::wipeable_string("0000000000000000x").parse_hexstr()); - ASSERT_EQ(boost::none, epee::wipeable_string("0").parse_hexstr()); - ASSERT_EQ(boost::none, epee::wipeable_string("000").parse_hexstr()); + ASSERT_TRUE(boost::none == epee::wipeable_string("x").parse_hexstr()); + ASSERT_TRUE(boost::none == epee::wipeable_string("x0000000000000000").parse_hexstr()); + ASSERT_TRUE(boost::none == epee::wipeable_string("0000000000000000x").parse_hexstr()); + ASSERT_TRUE(boost::none == epee::wipeable_string("0").parse_hexstr()); + ASSERT_TRUE(boost::none == epee::wipeable_string("000").parse_hexstr()); ASSERT_TRUE((s = epee::wipeable_string("").parse_hexstr()) != boost::none); - ASSERT_EQ(*s, ""); + ASSERT_TRUE(*s == ""); ASSERT_TRUE((s = epee::wipeable_string("00").parse_hexstr()) != boost::none); - ASSERT_EQ(*s, epee::wipeable_string("", 1)); + ASSERT_TRUE(*s == epee::wipeable_string("", 1)); ASSERT_TRUE((s = epee::wipeable_string("41").parse_hexstr()) != boost::none); - ASSERT_EQ(*s, epee::wipeable_string("A")); + ASSERT_TRUE(*s == epee::wipeable_string("A")); ASSERT_TRUE((s = epee::wipeable_string("414243").parse_hexstr()) != boost::none); - ASSERT_EQ(*s, epee::wipeable_string("ABC")); + ASSERT_TRUE(*s == epee::wipeable_string("ABC")); } TEST(wipeable_string, to_hex) diff --git a/tests/unit_tests/zmq_rpc.cpp b/tests/unit_tests/zmq_rpc.cpp index 59759bed8..66a7f3ac1 100644 --- a/tests/unit_tests/zmq_rpc.cpp +++ b/tests/unit_tests/zmq_rpc.cpp @@ -202,7 +202,6 @@ namespace MASSERT(!expected.empty()); std::size_t actual_height = 0; - crypto::hash actual_id{}; crypto::hash actual_prev_id{}; std::vector<crypto::hash> actual_ids{}; GET_FROM_JSON_OBJECT(pub.second, actual_height, first_height); |