diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -494,7 +494,7 @@ add_library(server addrdb.cpp addrman.cpp - avalanche.cpp + avalanche/avalanche.cpp banman.cpp blockencodings.cpp blockfilter.cpp @@ -579,8 +579,9 @@ endif() endif() -# Test suite. +# Test suites. add_subdirectory(test) +add_subdirectory(avalanche/test) # Benchmark suite. add_subdirectory(bench) diff --git a/src/Makefile.am b/src/Makefile.am --- a/src/Makefile.am +++ b/src/Makefile.am @@ -114,7 +114,7 @@ addrdb.h \ addrman.h \ attributes.h \ - avalanche.h \ + avalanche/avalanche.h \ banman.h \ base58.h \ bloom.h \ @@ -293,7 +293,7 @@ libbitcoin_server_a_SOURCES = \ addrdb.cpp \ addrman.cpp \ - avalanche.cpp \ + avalanche/avalanche.cpp \ banman.cpp \ blockencodings.cpp \ blockfilter.cpp \ diff --git a/src/Makefile.test.include b/src/Makefile.test.include --- a/src/Makefile.test.include +++ b/src/Makefile.test.include @@ -79,13 +79,13 @@ # test_bitcoin binary # BITCOIN_TESTS =\ + avalanche/test/avalanche_tests.cpp \ test/scriptnum10.h \ test/activation_tests.cpp \ test/addrman_tests.cpp \ test/allocator_tests.cpp \ test/amount_tests.cpp \ test/arith_uint256_tests.cpp \ - test/avalanche_tests.cpp \ test/base32_tests.cpp \ test/base58_tests.cpp \ test/base64_tests.cpp \ diff --git a/src/avalanche.h b/src/avalanche/avalanche.h rename from src/avalanche.h rename to src/avalanche/avalanche.h --- a/src/avalanche.h +++ b/src/avalanche/avalanche.h @@ -2,8 +2,8 @@ // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. -#ifndef BITCOIN_AVALANCHE_H -#define BITCOIN_AVALANCHE_H +#ifndef BITCOIN_AVALANCHE_AVALANCHE_H +#define BITCOIN_AVALANCHE_AVALANCHE_H #include #include @@ -369,4 +369,4 @@ */ extern std::unique_ptr g_avalanche; -#endif // BITCOIN_AVALANCHE_H +#endif // BITCOIN_AVALANCHE_AVALANCHE_H diff --git a/src/avalanche.cpp b/src/avalanche/avalanche.cpp rename from src/avalanche.cpp rename to src/avalanche/avalanche.cpp --- a/src/avalanche.cpp +++ b/src/avalanche/avalanche.cpp @@ -2,7 +2,7 @@ // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. -#include +#include #include #include diff --git a/src/avalanche/test/CMakeLists.txt b/src/avalanche/test/CMakeLists.txt new file mode 100644 --- /dev/null +++ b/src/avalanche/test/CMakeLists.txt @@ -0,0 +1,18 @@ +# Copyright (c) 2020 The Bitcoin developers +# Distributed under the MIT software license, see the accompanying +# file COPYING or http://www.opensource.org/licenses/mit-license.php. + +project(avalanche-test) + +include(TestSuite) +create_test_suite(avalanche) +add_dependencies(check check-avalanche) + +add_boost_unit_tests_to_suite(avalanche test_avalanche + fixture.cpp + + TESTS + avalanche_tests.cpp +) + +target_link_libraries(test_avalanche server testutil) diff --git a/src/test/avalanche_tests.cpp b/src/avalanche/test/avalanche_tests.cpp rename from src/test/avalanche_tests.cpp rename to src/avalanche/test/avalanche_tests.cpp --- a/src/test/avalanche_tests.cpp +++ b/src/avalanche/test/avalanche_tests.cpp @@ -2,7 +2,7 @@ // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. -#include +#include #include #include // For PeerLogicValidation diff --git a/src/avalanche/test/fixture.cpp b/src/avalanche/test/fixture.cpp new file mode 100644 --- /dev/null +++ b/src/avalanche/test/fixture.cpp @@ -0,0 +1,7 @@ +// Copyright (c) 2020 The Bitcoin developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. + +#define BOOST_TEST_MODULE Avalanche Test Suite + +#include diff --git a/src/init.cpp b/src/init.cpp --- a/src/init.cpp +++ b/src/init.cpp @@ -11,7 +11,7 @@ #include #include -#include +#include #include #include #include diff --git a/src/net_processing.cpp b/src/net_processing.cpp --- a/src/net_processing.cpp +++ b/src/net_processing.cpp @@ -6,7 +6,7 @@ #include #include -#include +#include #include #include #include diff --git a/src/rpc/avalanche.cpp b/src/rpc/avalanche.cpp --- a/src/rpc/avalanche.cpp +++ b/src/rpc/avalanche.cpp @@ -2,7 +2,7 @@ // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. -#include +#include #include #include #include diff --git a/src/test/CMakeLists.txt b/src/test/CMakeLists.txt --- a/src/test/CMakeLists.txt +++ b/src/test/CMakeLists.txt @@ -104,7 +104,6 @@ allocator_tests.cpp amount_tests.cpp arith_uint256_tests.cpp - avalanche_tests.cpp base32_tests.cpp base58_tests.cpp base64_tests.cpp diff --git a/src/validation.cpp b/src/validation.cpp --- a/src/validation.cpp +++ b/src/validation.cpp @@ -7,7 +7,7 @@ #include #include -#include +#include #include #include #include