From f34e2e20bdfbefa171e3bbb46615b2b0513ca394 Mon Sep 17 00:00:00 2001 From: moneromooo-monero Date: Sun, 14 Jan 2018 23:05:48 +0000 Subject: [PATCH] performance_tests: add tx checking tests with more than 2 outputs --- tests/performance_tests/check_tx_signature.h | 12 +++++++---- tests/performance_tests/main.cpp | 21 +++++++++++++------- 2 files changed, 22 insertions(+), 11 deletions(-) diff --git a/tests/performance_tests/check_tx_signature.h b/tests/performance_tests/check_tx_signature.h index ec570e69d..93a8304be 100644 --- a/tests/performance_tests/check_tx_signature.h +++ b/tests/performance_tests/check_tx_signature.h @@ -40,15 +40,17 @@ #include "multi_tx_test_base.h" -template +template class test_check_tx_signature : private multi_tx_test_base { static_assert(0 < a_ring_size, "ring_size must be greater than 0"); public: - static const size_t loop_count = a_rct ? 10 : a_ring_size < 100 ? 100 : 10; + static const size_t loop_count = a_rct ? (a_ring_size <= 2 ? 50 : 10) : a_ring_size < 100 ? 100 : 10; static const size_t ring_size = a_ring_size; + static const size_t outputs = a_outputs; static const bool rct = a_rct; + static const bool bulletproof = a_bulletproof; typedef multi_tx_test_base base_class; @@ -62,13 +64,15 @@ public: m_alice.generate(); std::vector destinations; - destinations.push_back(tx_destination_entry(this->m_source_amount, m_alice.get_keys().m_account_address, false)); + destinations.push_back(tx_destination_entry(this->m_source_amount - outputs + 1, m_alice.get_keys().m_account_address, false)); + for (size_t n = 1; n < outputs; ++n) + destinations.push_back(tx_destination_entry(1, m_alice.get_keys().m_account_address, false)); crypto::secret_key tx_key; std::vector additional_tx_keys; std::unordered_map subaddresses; subaddresses[this->m_miners[this->real_source_idx].get_keys().m_account_address.m_spend_public_key] = {0,0}; - if (!construct_tx_and_get_tx_key(this->m_miners[this->real_source_idx].get_keys(), subaddresses, this->m_sources, destinations, cryptonote::account_public_address{}, std::vector(), m_tx, 0, tx_key, additional_tx_keys, rct)) + if (!construct_tx_and_get_tx_key(this->m_miners[this->real_source_idx].get_keys(), subaddresses, this->m_sources, destinations, cryptonote::account_public_address{}, std::vector(), m_tx, 0, tx_key, additional_tx_keys, rct, bulletproof)) return false; get_transaction_prefix_hash(m_tx, m_tx_prefix_hash); diff --git a/tests/performance_tests/main.cpp b/tests/performance_tests/main.cpp index ba1640263..c18a653c8 100644 --- a/tests/performance_tests/main.cpp +++ b/tests/performance_tests/main.cpp @@ -124,14 +124,21 @@ int main(int argc, char** argv) TEST_PERFORMANCE3(filter, verbose, test_construct_tx, 100, 2, true); TEST_PERFORMANCE3(filter, verbose, test_construct_tx, 100, 10, true); - TEST_PERFORMANCE2(filter, verbose, test_check_tx_signature, 1, false); - TEST_PERFORMANCE2(filter, verbose, test_check_tx_signature, 2, false); - TEST_PERFORMANCE2(filter, verbose, test_check_tx_signature, 10, false); - TEST_PERFORMANCE2(filter, verbose, test_check_tx_signature, 100, false); + TEST_PERFORMANCE4(filter, verbose, test_check_tx_signature, 1, 2, false, false); + TEST_PERFORMANCE4(filter, verbose, test_check_tx_signature, 2, 2, false, false); + TEST_PERFORMANCE4(filter, verbose, test_check_tx_signature, 10, 2, false, false); + TEST_PERFORMANCE4(filter, verbose, test_check_tx_signature, 100, 2, false, false); + TEST_PERFORMANCE4(filter, verbose, test_check_tx_signature, 2, 10, false, false); - TEST_PERFORMANCE2(filter, verbose, test_check_tx_signature, 2, true); - TEST_PERFORMANCE2(filter, verbose, test_check_tx_signature, 10, true); - TEST_PERFORMANCE2(filter, verbose, test_check_tx_signature, 100, true); + TEST_PERFORMANCE4(filter, verbose, test_check_tx_signature, 2, 2, true, false); + TEST_PERFORMANCE4(filter, verbose, test_check_tx_signature, 10, 2, true, false); + TEST_PERFORMANCE4(filter, verbose, test_check_tx_signature, 100, 2, true, false); + TEST_PERFORMANCE4(filter, verbose, test_check_tx_signature, 2, 10, true, false); + + TEST_PERFORMANCE4(filter, verbose, test_check_tx_signature, 2, 2, true, true); + TEST_PERFORMANCE4(filter, verbose, test_check_tx_signature, 10, 2, true, true); + TEST_PERFORMANCE4(filter, verbose, test_check_tx_signature, 100, 2, true, true); + TEST_PERFORMANCE4(filter, verbose, test_check_tx_signature, 2, 10, true, true); TEST_PERFORMANCE0(filter, verbose, test_is_out_to_acc); TEST_PERFORMANCE0(filter, verbose, test_is_out_to_acc_precomp);