aboutsummaryrefslogtreecommitdiff
path: root/tests/performance_tests
diff options
context:
space:
mode:
authormydesktop <dev.mc2@gmail.com>2014-05-28 21:13:32 -0400
committermydesktop <dev.mc2@gmail.com>2014-05-28 21:13:32 -0400
commit5c1b7c72249a114b1c30945fc8a9116c07573a48 (patch)
tree5e110e349a1f4dccd33867fecbbc4a2c51fc312d /tests/performance_tests
parentraise min fee and correct COIN value (diff)
parenttypo in tx_pool.cpp (diff)
downloadmonero-5c1b7c72249a114b1c30945fc8a9116c07573a48.tar.xz
Merge branch '0.8.8update'
Update to newest version 0.8.8. See change log for details.
Diffstat (limited to 'tests/performance_tests')
-rw-r--r--tests/performance_tests/cn_slow_hash.h45
-rw-r--r--tests/performance_tests/main.cpp3
2 files changed, 48 insertions, 0 deletions
diff --git a/tests/performance_tests/cn_slow_hash.h b/tests/performance_tests/cn_slow_hash.h
new file mode 100644
index 000000000..ec001326e
--- /dev/null
+++ b/tests/performance_tests/cn_slow_hash.h
@@ -0,0 +1,45 @@
+// Copyright (c) 2012-2013 The Cryptonote developers
+// Distributed under the MIT/X11 software license, see the accompanying
+// file COPYING or http://www.opensource.org/licenses/mit-license.php.
+
+#pragma once
+
+#include "crypto/crypto.h"
+#include "cryptonote_core/cryptonote_basic.h"
+
+class test_cn_slow_hash
+{
+public:
+ static const size_t loop_count = 10;
+
+#pragma pack(push, 1)
+ struct data_t
+ {
+ char data[13];
+ };
+#pragma pack(pop)
+
+ static_assert(13 == sizeof(data_t), "Invalid structure size");
+
+ bool init()
+ {
+ if (!epee::string_tools::hex_to_pod("63617665617420656d70746f72", m_data))
+ return false;
+
+ if (!epee::string_tools::hex_to_pod("bbec2cacf69866a8e740380fe7b818fc78f8571221742d729d9d02d7f8989b87", m_expected_hash))
+ return false;
+
+ return true;
+ }
+
+ bool test()
+ {
+ crypto::hash hash;
+ crypto::cn_slow_hash(&m_data, sizeof(m_data), hash);
+ return hash == m_expected_hash;
+ }
+
+private:
+ data_t m_data;
+ crypto::hash m_expected_hash;
+};
diff --git a/tests/performance_tests/main.cpp b/tests/performance_tests/main.cpp
index 2ad503b83..72ee2ca6c 100644
--- a/tests/performance_tests/main.cpp
+++ b/tests/performance_tests/main.cpp
@@ -8,6 +8,7 @@
// tests
#include "construct_tx.h"
#include "check_ring_signature.h"
+#include "cn_slow_hash.h"
#include "derive_public_key.h"
#include "derive_secret_key.h"
#include "generate_key_derivation.h"
@@ -56,6 +57,8 @@ int main(int argc, char** argv)
TEST_PERFORMANCE0(test_derive_public_key);
TEST_PERFORMANCE0(test_derive_secret_key);
+ TEST_PERFORMANCE0(test_cn_slow_hash);
+
std::cout << "Tests finished. Elapsed time: " << timer.elapsed_ms() / 1000 << " sec" << std::endl;
return 0;