aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/CMakeLists.txt38
-rw-r--r--tests/core_proxy/core_proxy.h4
-rw-r--r--tests/core_tests/chaingen.cpp8
-rw-r--r--tests/core_tests/chaingen.h10
-rw-r--r--tests/core_tests/chaingen001.cpp4
-rw-r--r--tests/core_tests/transaction_tests.cpp6
-rw-r--r--tests/daemon_tests/transfers.cpp2
-rw-r--r--tests/difficulty/difficulty.cpp2
-rw-r--r--tests/functional_tests/transactions_flow_test.cpp2
-rw-r--r--tests/hash-target.cpp2
-rw-r--r--tests/performance_tests/check_tx_signature.h6
-rw-r--r--tests/performance_tests/cn_slow_hash.h2
-rw-r--r--tests/performance_tests/construct_tx.h6
-rw-r--r--tests/performance_tests/derive_public_key.h2
-rw-r--r--tests/performance_tests/derive_secret_key.h2
-rw-r--r--tests/performance_tests/ge_frombytes_vartime.h2
-rw-r--r--tests/performance_tests/generate_key_derivation.h2
-rw-r--r--tests/performance_tests/generate_key_image.h2
-rw-r--r--tests/performance_tests/generate_key_image_helper.h6
-rw-r--r--tests/performance_tests/generate_keypair.h2
-rw-r--r--tests/performance_tests/is_out_to_acc.h6
-rw-r--r--tests/performance_tests/multi_tx_test_base.h6
-rw-r--r--tests/performance_tests/single_tx_test_base.h6
-rw-r--r--tests/unit_tests/CMakeLists.txt4
-rw-r--r--tests/unit_tests/base58.cpp2
-rw-r--r--tests/unit_tests/block_reward.cpp2
-rw-r--r--tests/unit_tests/blockchain_db.cpp2
-rw-r--r--tests/unit_tests/canonical_amounts.cpp2
-rw-r--r--tests/unit_tests/checkpoints.cpp2
-rw-r--r--tests/unit_tests/decompose_amount_into_digits.cpp2
-rw-r--r--tests/unit_tests/hardfork.cpp2
-rw-r--r--tests/unit_tests/http.cpp (renamed from tests/unit_tests/http_auth.cpp)34
-rw-r--r--tests/unit_tests/parse_amount.cpp2
-rw-r--r--tests/unit_tests/serialization.cpp4
-rw-r--r--tests/unit_tests/test_tx_utils.cpp (renamed from tests/unit_tests/test_format_utils.cpp)2
-rw-r--r--tests/unit_tests/varint.cpp4
36 files changed, 106 insertions, 86 deletions
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
index 60b7a4dba..b3c40799e 100644
--- a/tests/CMakeLists.txt
+++ b/tests/CMakeLists.txt
@@ -43,24 +43,30 @@ if (GTest_FOUND)
include_directories(SYSTEM ${GTEST_INCLUDE_DIRS})
else ()
message(STATUS "GTest not found on the system: will use GTest bundled with this source")
- add_subdirectory(gtest)
- include_directories(SYSTEM "${gtest_SOURCE_DIR}/include" "${gtest_SOURCE_DIR}")
- # Emulate the FindGTest module's variable.
- set(GTEST_LIBRARIES gtest)
-
- # Ignore some warnings when building gtest binaries.
- if(NOT MSVC)
- set_property(TARGET gtest
- APPEND_STRING
- PROPERTY
- COMPILE_FLAGS " -Wno-undef -Wno-sign-compare")
- endif()
+ include(ExternalProject)
+ ExternalProject_Add(googletest
+ SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/gtest
+ BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/gtest
+ DOWNLOAD_COMMAND ""
+ UPDATE_COMMAND ""
+ INSTALL_COMMAND ""
+ )
+ add_library(gtest UNKNOWN IMPORTED)
+ add_library(gtest_main UNKNOWN IMPORTED)
+ set_target_properties(gtest PROPERTIES
+ IMPORTED_LOCATION "${CMAKE_CURRENT_BINARY_DIR}/gtest/${CMAKE_STATIC_LIBRARY_PREFIX}gtest${CMAKE_STATIC_LIBRARY_SUFFIX}"
+ )
+ set_target_properties(gtest_main PROPERTIES
+ IMPORTED_LOCATION "${CMAKE_CURRENT_BINARY_DIR}/gtest/${CMAKE_STATIC_LIBRARY_PREFIX}gtest_main${CMAKE_STATIC_LIBRARY_SUFFIX}"
+ )
+ add_dependencies(gtest googletest)
+ add_dependencies(gtest_main googletest)
- set_property(TARGET gtest
- PROPERTY
- FOLDER "${folder}")
-endif ()
+ # Emulate the FindGTest module's variable.
+ set(GTEST_LIBRARIES gtest gtest_main)
+ include_directories(SYSTEM "${CMAKE_CURRENT_SOURCE_DIR}/gtest/include")
+endif (GTest_FOUND)
file(COPY
data/wallet_9svHk1.keys
diff --git a/tests/core_proxy/core_proxy.h b/tests/core_proxy/core_proxy.h
index bec9a83bb..c649f51cc 100644
--- a/tests/core_proxy/core_proxy.h
+++ b/tests/core_proxy/core_proxy.h
@@ -32,8 +32,8 @@
#include <boost/program_options/variables_map.hpp>
-#include "cryptonote_core/cryptonote_basic_impl.h"
-#include "cryptonote_core/verification_context.h"
+#include "cryptonote_basic/cryptonote_basic_impl.h"
+#include "cryptonote_basic/verification_context.h"
#include <unordered_map>
namespace tests
diff --git a/tests/core_tests/chaingen.cpp b/tests/core_tests/chaingen.cpp
index 4cb70e745..53d0872dd 100644
--- a/tests/core_tests/chaingen.cpp
+++ b/tests/core_tests/chaingen.cpp
@@ -37,10 +37,10 @@
#include "console_handler.h"
#include "p2p/net_node.h"
-#include "cryptonote_core/cryptonote_basic.h"
-#include "cryptonote_core/cryptonote_basic_impl.h"
-#include "cryptonote_core/cryptonote_format_utils.h"
-#include "cryptonote_core/miner.h"
+#include "cryptonote_basic/cryptonote_basic.h"
+#include "cryptonote_basic/cryptonote_basic_impl.h"
+#include "cryptonote_basic/cryptonote_format_utils.h"
+#include "cryptonote_basic/miner.h"
#include "chaingen.h"
diff --git a/tests/core_tests/chaingen.h b/tests/core_tests/chaingen.h
index 04f910efc..4b0ed1355 100644
--- a/tests/core_tests/chaingen.h
+++ b/tests/core_tests/chaingen.h
@@ -44,12 +44,12 @@
#include "common/boost_serialization_helper.h"
#include "common/command_line.h"
-#include "cryptonote_core/account_boost_serialization.h"
-#include "cryptonote_core/cryptonote_basic.h"
-#include "cryptonote_core/cryptonote_basic_impl.h"
-#include "cryptonote_core/cryptonote_format_utils.h"
+#include "cryptonote_basic/account_boost_serialization.h"
+#include "cryptonote_basic/cryptonote_basic.h"
+#include "cryptonote_basic/cryptonote_basic_impl.h"
+#include "cryptonote_basic/cryptonote_format_utils.h"
#include "cryptonote_core/cryptonote_core.h"
-#include "cryptonote_core/cryptonote_boost_serialization.h"
+#include "cryptonote_basic/cryptonote_boost_serialization.h"
#include "misc_language.h"
#undef MONERO_DEFAULT_LOG_CATEGORY
diff --git a/tests/core_tests/chaingen001.cpp b/tests/core_tests/chaingen001.cpp
index f5150f2f7..9abd97185 100644
--- a/tests/core_tests/chaingen001.cpp
+++ b/tests/core_tests/chaingen001.cpp
@@ -35,8 +35,8 @@
#include "console_handler.h"
-#include "cryptonote_core/cryptonote_basic.h"
-#include "cryptonote_core/cryptonote_format_utils.h"
+#include "cryptonote_basic/cryptonote_basic.h"
+#include "cryptonote_basic/cryptonote_format_utils.h"
#include "chaingen.h"
#include "chaingen_tests_list.h"
diff --git a/tests/core_tests/transaction_tests.cpp b/tests/core_tests/transaction_tests.cpp
index cb585b975..b4af597e9 100644
--- a/tests/core_tests/transaction_tests.cpp
+++ b/tests/core_tests/transaction_tests.cpp
@@ -29,9 +29,9 @@
// Parts of this file are originally copyright (c) 2012-2013 The Cryptonote developers
#include "include_base_utils.h"
-#include "cryptonote_core/cryptonote_basic_impl.h"
-#include "cryptonote_core/account.h"
-#include "cryptonote_core/cryptonote_format_utils.h"
+#include "cryptonote_basic/cryptonote_basic_impl.h"
+#include "cryptonote_basic/account.h"
+#include "cryptonote_core/cryptonote_tx_utils.h"
#include "misc_language.h"
using namespace cryptonote;
diff --git a/tests/daemon_tests/transfers.cpp b/tests/daemon_tests/transfers.cpp
index ea851c541..398fdefe9 100644
--- a/tests/daemon_tests/transfers.cpp
+++ b/tests/daemon_tests/transfers.cpp
@@ -32,7 +32,7 @@
#include <sstream>
#include "wallet/wallet.h"
#include "rpc/core_rpc_server.h"
-#include "cryptonote_core/account.h"
+#include "cryptonote_basic/account.h"
#include "net/http_client_abstract_invoke.h"
using namespace std;
using namespace epee::misc_utils;
diff --git a/tests/difficulty/difficulty.cpp b/tests/difficulty/difficulty.cpp
index edfce46ab..d4c8e94c8 100644
--- a/tests/difficulty/difficulty.cpp
+++ b/tests/difficulty/difficulty.cpp
@@ -36,7 +36,7 @@
#include <algorithm>
#include "cryptonote_config.h"
-#include "cryptonote_core/difficulty.h"
+#include "cryptonote_basic/difficulty.h"
using namespace std;
diff --git a/tests/functional_tests/transactions_flow_test.cpp b/tests/functional_tests/transactions_flow_test.cpp
index 5666f49bf..8e7e494c9 100644
--- a/tests/functional_tests/transactions_flow_test.cpp
+++ b/tests/functional_tests/transactions_flow_test.cpp
@@ -159,7 +159,7 @@ bool transactions_flow_test(std::string& working_folder,
epee::net_utils::http::http_simple_client http_client;
COMMAND_RPC_STOP_MINING::request daemon1_req = AUTO_VAL_INIT(daemon1_req);
COMMAND_RPC_STOP_MINING::response daemon1_rsp = AUTO_VAL_INIT(daemon1_rsp);
- bool r = http_client.set_server(daemon_addr_a) && net_utils::invoke_http_json("/stop_mine", daemon1_req, daemon1_rsp, http_client, std::chrono::seconds(10));
+ bool r = http_client.set_server(daemon_addr_a, boost::none) && net_utils::invoke_http_json("/stop_mine", daemon1_req, daemon1_rsp, http_client, std::chrono::seconds(10));
CHECK_AND_ASSERT_MES(r, false, "failed to stop mining");
COMMAND_RPC_START_MINING::request daemon_req = AUTO_VAL_INIT(daemon_req);
diff --git a/tests/hash-target.cpp b/tests/hash-target.cpp
index aeb6688bc..de3a8df2c 100644
--- a/tests/hash-target.cpp
+++ b/tests/hash-target.cpp
@@ -33,7 +33,7 @@
#include <cstring>
#include <limits>
#include "crypto/hash.h"
-#include "cryptonote_core/difficulty.h"
+#include "cryptonote_basic/difficulty.h"
using namespace std;
using cryptonote::check_hash;
diff --git a/tests/performance_tests/check_tx_signature.h b/tests/performance_tests/check_tx_signature.h
index fe595a4da..b2b2f4004 100644
--- a/tests/performance_tests/check_tx_signature.h
+++ b/tests/performance_tests/check_tx_signature.h
@@ -32,9 +32,9 @@
#include <vector>
-#include "cryptonote_core/account.h"
-#include "cryptonote_core/cryptonote_basic.h"
-#include "cryptonote_core/cryptonote_format_utils.h"
+#include "cryptonote_basic/account.h"
+#include "cryptonote_basic/cryptonote_basic.h"
+#include "cryptonote_core/cryptonote_tx_utils.h"
#include "crypto/crypto.h"
#include "ringct/rctSigs.h"
diff --git a/tests/performance_tests/cn_slow_hash.h b/tests/performance_tests/cn_slow_hash.h
index 5492299cd..b646e5121 100644
--- a/tests/performance_tests/cn_slow_hash.h
+++ b/tests/performance_tests/cn_slow_hash.h
@@ -31,7 +31,7 @@
#pragma once
#include "crypto/crypto.h"
-#include "cryptonote_core/cryptonote_basic.h"
+#include "cryptonote_basic/cryptonote_basic.h"
class test_cn_slow_hash
{
diff --git a/tests/performance_tests/construct_tx.h b/tests/performance_tests/construct_tx.h
index aef455eaa..2fe6d288d 100644
--- a/tests/performance_tests/construct_tx.h
+++ b/tests/performance_tests/construct_tx.h
@@ -30,9 +30,9 @@
#pragma once
-#include "cryptonote_core/account.h"
-#include "cryptonote_core/cryptonote_basic.h"
-#include "cryptonote_core/cryptonote_format_utils.h"
+#include "cryptonote_basic/account.h"
+#include "cryptonote_basic/cryptonote_basic.h"
+#include "cryptonote_core/cryptonote_tx_utils.h"
#include "multi_tx_test_base.h"
diff --git a/tests/performance_tests/derive_public_key.h b/tests/performance_tests/derive_public_key.h
index 727dde000..559745ef9 100644
--- a/tests/performance_tests/derive_public_key.h
+++ b/tests/performance_tests/derive_public_key.h
@@ -31,7 +31,7 @@
#pragma once
#include "crypto/crypto.h"
-#include "cryptonote_core/cryptonote_basic.h"
+#include "cryptonote_basic/cryptonote_basic.h"
#include "single_tx_test_base.h"
diff --git a/tests/performance_tests/derive_secret_key.h b/tests/performance_tests/derive_secret_key.h
index 94df93843..c7aed162e 100644
--- a/tests/performance_tests/derive_secret_key.h
+++ b/tests/performance_tests/derive_secret_key.h
@@ -31,7 +31,7 @@
#pragma once
#include "crypto/crypto.h"
-#include "cryptonote_core/cryptonote_basic.h"
+#include "cryptonote_basic/cryptonote_basic.h"
#include "single_tx_test_base.h"
diff --git a/tests/performance_tests/ge_frombytes_vartime.h b/tests/performance_tests/ge_frombytes_vartime.h
index c815422f9..bf1785ab4 100644
--- a/tests/performance_tests/ge_frombytes_vartime.h
+++ b/tests/performance_tests/ge_frombytes_vartime.h
@@ -31,7 +31,7 @@
#pragma once
#include "crypto/crypto.h"
-#include "cryptonote_core/cryptonote_basic.h"
+#include "cryptonote_basic/cryptonote_basic.h"
#include "single_tx_test_base.h"
diff --git a/tests/performance_tests/generate_key_derivation.h b/tests/performance_tests/generate_key_derivation.h
index 35f41ef89..3e6481bda 100644
--- a/tests/performance_tests/generate_key_derivation.h
+++ b/tests/performance_tests/generate_key_derivation.h
@@ -31,7 +31,7 @@
#pragma once
#include "crypto/crypto.h"
-#include "cryptonote_core/cryptonote_basic.h"
+#include "cryptonote_basic/cryptonote_basic.h"
#include "single_tx_test_base.h"
diff --git a/tests/performance_tests/generate_key_image.h b/tests/performance_tests/generate_key_image.h
index fee987969..4a5fbb946 100644
--- a/tests/performance_tests/generate_key_image.h
+++ b/tests/performance_tests/generate_key_image.h
@@ -31,7 +31,7 @@
#pragma once
#include "crypto/crypto.h"
-#include "cryptonote_core/cryptonote_basic.h"
+#include "cryptonote_basic/cryptonote_basic.h"
#include "single_tx_test_base.h"
diff --git a/tests/performance_tests/generate_key_image_helper.h b/tests/performance_tests/generate_key_image_helper.h
index 44f5c9d12..66c9a244b 100644
--- a/tests/performance_tests/generate_key_image_helper.h
+++ b/tests/performance_tests/generate_key_image_helper.h
@@ -30,9 +30,9 @@
#pragma once
-#include "cryptonote_core/account.h"
-#include "cryptonote_core/cryptonote_basic.h"
-#include "cryptonote_core/cryptonote_format_utils.h"
+#include "cryptonote_basic/account.h"
+#include "cryptonote_basic/cryptonote_basic.h"
+#include "cryptonote_basic/cryptonote_format_utils.h"
#include "single_tx_test_base.h"
diff --git a/tests/performance_tests/generate_keypair.h b/tests/performance_tests/generate_keypair.h
index 4ba577e2a..4f9179318 100644
--- a/tests/performance_tests/generate_keypair.h
+++ b/tests/performance_tests/generate_keypair.h
@@ -31,7 +31,7 @@
#pragma once
#include "crypto/crypto.h"
-#include "cryptonote_core/cryptonote_basic.h"
+#include "cryptonote_basic/cryptonote_basic.h"
class test_generate_keypair
{
diff --git a/tests/performance_tests/is_out_to_acc.h b/tests/performance_tests/is_out_to_acc.h
index 7f8645b87..6c7adfa51 100644
--- a/tests/performance_tests/is_out_to_acc.h
+++ b/tests/performance_tests/is_out_to_acc.h
@@ -30,9 +30,9 @@
#pragma once
-#include "cryptonote_core/account.h"
-#include "cryptonote_core/cryptonote_basic.h"
-#include "cryptonote_core/cryptonote_format_utils.h"
+#include "cryptonote_basic/account.h"
+#include "cryptonote_basic/cryptonote_basic.h"
+#include "cryptonote_core/cryptonote_tx_utils.h"
#include "single_tx_test_base.h"
diff --git a/tests/performance_tests/multi_tx_test_base.h b/tests/performance_tests/multi_tx_test_base.h
index feabab022..ef5d277f1 100644
--- a/tests/performance_tests/multi_tx_test_base.h
+++ b/tests/performance_tests/multi_tx_test_base.h
@@ -32,9 +32,9 @@
#include <vector>
-#include "cryptonote_core/account.h"
-#include "cryptonote_core/cryptonote_basic.h"
-#include "cryptonote_core/cryptonote_format_utils.h"
+#include "cryptonote_basic/account.h"
+#include "cryptonote_basic/cryptonote_basic.h"
+#include "cryptonote_core/cryptonote_tx_utils.h"
#include "crypto/crypto.h"
template<size_t a_ring_size>
diff --git a/tests/performance_tests/single_tx_test_base.h b/tests/performance_tests/single_tx_test_base.h
index c667b71b7..3d3f81bc7 100644
--- a/tests/performance_tests/single_tx_test_base.h
+++ b/tests/performance_tests/single_tx_test_base.h
@@ -30,9 +30,9 @@
#pragma once
-#include "cryptonote_core/account.h"
-#include "cryptonote_core/cryptonote_basic.h"
-#include "cryptonote_core/cryptonote_format_utils.h"
+#include "cryptonote_basic/account.h"
+#include "cryptonote_basic/cryptonote_basic.h"
+#include "cryptonote_core/cryptonote_tx_utils.h"
class single_tx_test_base
{
diff --git a/tests/unit_tests/CMakeLists.txt b/tests/unit_tests/CMakeLists.txt
index 08c8213e4..e70ed1a24 100644
--- a/tests/unit_tests/CMakeLists.txt
+++ b/tests/unit_tests/CMakeLists.txt
@@ -42,14 +42,14 @@ set(unit_tests_sources
epee_levin_protocol_handler_async.cpp
fee.cpp
get_xtype_from_string.cpp
- http_auth.cpp
+ http.cpp
main.cpp
mnemonics.cpp
mul_div.cpp
parse_amount.cpp
serialization.cpp
slow_memmem.cpp
- test_format_utils.cpp
+ test_tx_utils.cpp
test_peerlist.cpp
test_protocol_pack.cpp
thread_group.cpp
diff --git a/tests/unit_tests/base58.cpp b/tests/unit_tests/base58.cpp
index 53f7f2673..d2c767956 100644
--- a/tests/unit_tests/base58.cpp
+++ b/tests/unit_tests/base58.cpp
@@ -33,7 +33,7 @@
#include <cstdint>
#include "common/base58.cpp"
-#include "cryptonote_core/cryptonote_basic_impl.h"
+#include "cryptonote_basic/cryptonote_basic_impl.h"
#include "serialization/binary_utils.h"
using namespace tools;
diff --git a/tests/unit_tests/block_reward.cpp b/tests/unit_tests/block_reward.cpp
index 5d93c3084..f8a944770 100644
--- a/tests/unit_tests/block_reward.cpp
+++ b/tests/unit_tests/block_reward.cpp
@@ -30,7 +30,7 @@
#include "gtest/gtest.h"
-#include "cryptonote_core/cryptonote_basic_impl.h"
+#include "cryptonote_basic/cryptonote_basic_impl.h"
using namespace cryptonote;
diff --git a/tests/unit_tests/blockchain_db.cpp b/tests/unit_tests/blockchain_db.cpp
index 127a15b44..8fc10be10 100644
--- a/tests/unit_tests/blockchain_db.cpp
+++ b/tests/unit_tests/blockchain_db.cpp
@@ -40,7 +40,7 @@
#ifdef BERKELEY_DB
#include "blockchain_db/berkeleydb/db_bdb.h"
#endif
-#include "cryptonote_core/cryptonote_format_utils.h"
+#include "cryptonote_basic/cryptonote_format_utils.h"
using namespace cryptonote;
using epee::string_tools::pod_to_hex;
diff --git a/tests/unit_tests/canonical_amounts.cpp b/tests/unit_tests/canonical_amounts.cpp
index 9bef58d4b..c5a27d47d 100644
--- a/tests/unit_tests/canonical_amounts.cpp
+++ b/tests/unit_tests/canonical_amounts.cpp
@@ -29,7 +29,7 @@
// Parts of this file are originally copyright (c) 2012-2013 The Cryptonote developers
#include "gtest/gtest.h"
-#include "cryptonote_core/cryptonote_format_utils.h"
+#include "cryptonote_basic/cryptonote_format_utils.h"
static const uint64_t valid_decomposed_outputs[] = {
(uint64_t)1, (uint64_t)2, (uint64_t)3, (uint64_t)4, (uint64_t)5, (uint64_t)6, (uint64_t)7, (uint64_t)8, (uint64_t)9, // 1 piconero
diff --git a/tests/unit_tests/checkpoints.cpp b/tests/unit_tests/checkpoints.cpp
index b1d251d26..bc18c2b9e 100644
--- a/tests/unit_tests/checkpoints.cpp
+++ b/tests/unit_tests/checkpoints.cpp
@@ -30,7 +30,7 @@
#include "gtest/gtest.h"
-#include "cryptonote_core/checkpoints.cpp"
+#include "cryptonote_basic/checkpoints.cpp"
using namespace cryptonote;
diff --git a/tests/unit_tests/decompose_amount_into_digits.cpp b/tests/unit_tests/decompose_amount_into_digits.cpp
index e40208113..b1fa79aa1 100644
--- a/tests/unit_tests/decompose_amount_into_digits.cpp
+++ b/tests/unit_tests/decompose_amount_into_digits.cpp
@@ -33,7 +33,7 @@
#include <cstdint>
#include <vector>
-#include "cryptonote_core/cryptonote_format_utils.h"
+#include "cryptonote_basic/cryptonote_format_utils.h"
#define VEC_FROM_ARR(vec) \
std::vector<uint64_t> vec; \
diff --git a/tests/unit_tests/hardfork.cpp b/tests/unit_tests/hardfork.cpp
index 2682f15d3..81cf32c8b 100644
--- a/tests/unit_tests/hardfork.cpp
+++ b/tests/unit_tests/hardfork.cpp
@@ -32,7 +32,7 @@
#include "gtest/gtest.h"
#include "blockchain_db/lmdb/db_lmdb.h"
-#include "cryptonote_core/hardfork.h"
+#include "cryptonote_basic/hardfork.h"
using namespace cryptonote;
diff --git a/tests/unit_tests/http_auth.cpp b/tests/unit_tests/http.cpp
index 97954642f..3513fa327 100644
--- a/tests/unit_tests/http_auth.cpp
+++ b/tests/unit_tests/http.cpp
@@ -109,7 +109,7 @@ http::http_response_info make_response(const auth_responses& choices)
std::string out{" DIGEST "};
write_fields(out, choice);
- response.m_additional_fields.push_back(
+ response.m_header_info.m_etc_fields.push_back(
std::make_pair(u8"WWW-authenticate", std::move(out))
);
}
@@ -510,7 +510,7 @@ TEST(HTTP_Server_Auth, MD5_sess_auth)
TEST(HTTP_Auth, DogFood)
{
- const auto add_field = [] (http::http_request_info& request, http::http_client_auth& client)
+ const auto add_auth_field = [] (http::http_request_info& request, http::http_client_auth& client)
{
auto field = client.get_auth_field(request.m_http_method_str, request.m_URI);
EXPECT_TRUE(bool(field));
@@ -529,19 +529,21 @@ TEST(HTTP_Auth, DogFood)
request.m_http_method_str = "GET";
request.m_URI = "/FOO";
- const auto response = server.get_response(request);
+ auto response = server.get_response(request);
ASSERT_TRUE(bool(response));
EXPECT_TRUE(is_unauthorized(*response));
+ EXPECT_TRUE(response->m_header_info.m_etc_fields.empty());
+ response->m_header_info.m_etc_fields = response->m_additional_fields;
EXPECT_EQ(http::http_client_auth::kSuccess, client.handle_401(*response));
- EXPECT_TRUE(add_field(request, client));
+ EXPECT_TRUE(add_auth_field(request, client));
EXPECT_FALSE(bool(server.get_response(request)));
for (unsigned i = 0; i < 1000; ++i)
{
request.m_http_method_str += std::to_string(i);
request.m_header_info.m_etc_fields.clear();
- EXPECT_TRUE(add_field(request, client));
+ EXPECT_TRUE(add_auth_field(request, client));
EXPECT_FALSE(bool(server.get_response(request)));
}
@@ -549,11 +551,13 @@ TEST(HTTP_Auth, DogFood)
request.m_header_info.m_etc_fields.clear();
client = http::http_client_auth{user};
EXPECT_EQ(http::http_client_auth::kSuccess, client.handle_401(*response));
- EXPECT_TRUE(add_field(request, client));
+ EXPECT_TRUE(add_auth_field(request, client));
- const auto response2 = server.get_response(request);
+ auto response2 = server.get_response(request);
ASSERT_TRUE(bool(response2));
EXPECT_TRUE(is_unauthorized(*response2));
+ EXPECT_TRUE(response2->m_header_info.m_etc_fields.empty());
+ response2->m_header_info.m_etc_fields = response2->m_additional_fields;
const auth_responses parsed1 = parse_response(*response);
const auth_responses parsed2 = parse_response(*response2);
@@ -564,7 +568,7 @@ TEST(HTTP_Auth, DogFood)
// with stale=true client should reset
request.m_header_info.m_etc_fields.clear();
EXPECT_EQ(http::http_client_auth::kSuccess, client.handle_401(*response2));
- EXPECT_TRUE(add_field(request, client));
+ EXPECT_TRUE(add_auth_field(request, client));
EXPECT_FALSE(bool(server.get_response(request)));
// client should give up if stale=false
@@ -654,7 +658,7 @@ TEST(HTTP_Client_Auth, MD5)
EXPECT_EQ(http::http_client_auth::kBadPassword, auth.handle_401(response));
- response.m_additional_fields.front().second.append(u8"," + write_fields({{u8"stale", u8"TRUE"}}));
+ response.m_header_info.m_etc_fields.front().second.append(u8"," + write_fields({{u8"stale", u8"TRUE"}}));
EXPECT_EQ(http::http_client_auth::kSuccess, auth.handle_401(response));
}
@@ -718,7 +722,17 @@ TEST(HTTP_Client_Auth, MD5_auth)
}
EXPECT_EQ(http::http_client_auth::kBadPassword, auth.handle_401(response));
- response.m_additional_fields.back().second.append(u8"," + write_fields({{u8"stale", u8"trUe"}}));
+ response.m_header_info.m_etc_fields.back().second.append(u8"," + write_fields({{u8"stale", u8"trUe"}}));
EXPECT_EQ(http::http_client_auth::kSuccess, auth.handle_401(response));
}
+
+TEST(HTTP, Add_Field)
+{
+ std::string str{"leading text"};
+ epee::net_utils::http::add_field(str, "foo", "bar");
+ epee::net_utils::http::add_field(str, std::string("bar"), std::string("foo"));
+ epee::net_utils::http::add_field(str, {"moarbars", "moarfoo"});
+
+ EXPECT_STREQ("leading textfoo: bar\r\nbar: foo\r\nmoarbars: moarfoo\r\n", str.c_str());
+}
diff --git a/tests/unit_tests/parse_amount.cpp b/tests/unit_tests/parse_amount.cpp
index 6c61d63f1..23e7eb292 100644
--- a/tests/unit_tests/parse_amount.cpp
+++ b/tests/unit_tests/parse_amount.cpp
@@ -30,7 +30,7 @@
#include "gtest/gtest.h"
-#include "cryptonote_core/cryptonote_format_utils.h"
+#include "cryptonote_basic/cryptonote_format_utils.h"
using namespace cryptonote;
diff --git a/tests/unit_tests/serialization.cpp b/tests/unit_tests/serialization.cpp
index 1083dd4cc..5b8486a19 100644
--- a/tests/unit_tests/serialization.cpp
+++ b/tests/unit_tests/serialization.cpp
@@ -35,8 +35,8 @@
#include <vector>
#include <boost/foreach.hpp>
#include <boost/archive/portable_binary_iarchive.hpp>
-#include "cryptonote_core/cryptonote_basic.h"
-#include "cryptonote_core/cryptonote_basic_impl.h"
+#include "cryptonote_basic/cryptonote_basic.h"
+#include "cryptonote_basic/cryptonote_basic_impl.h"
#include "ringct/rctSigs.h"
#include "serialization/serialization.h"
#include "serialization/binary_archive.h"
diff --git a/tests/unit_tests/test_format_utils.cpp b/tests/unit_tests/test_tx_utils.cpp
index 463d62529..91d5d5d67 100644
--- a/tests/unit_tests/test_format_utils.cpp
+++ b/tests/unit_tests/test_tx_utils.cpp
@@ -33,7 +33,7 @@
#include <vector>
#include "common/util.h"
-#include "cryptonote_core/cryptonote_format_utils.h"
+#include "cryptonote_core/cryptonote_tx_utils.h"
namespace
{
diff --git a/tests/unit_tests/varint.cpp b/tests/unit_tests/varint.cpp
index a483cbd5f..a87eeb14b 100644
--- a/tests/unit_tests/varint.cpp
+++ b/tests/unit_tests/varint.cpp
@@ -34,8 +34,8 @@
#include <iostream>
#include <vector>
#include <boost/foreach.hpp>
-#include "cryptonote_core/cryptonote_basic.h"
-#include "cryptonote_core/cryptonote_basic_impl.h"
+#include "cryptonote_basic/cryptonote_basic.h"
+#include "cryptonote_basic/cryptonote_basic_impl.h"
#include "serialization/serialization.h"
#include "serialization/binary_archive.h"
#include "serialization/json_archive.h"