Branch data Line data Source code
# 1 : : // Copyright (c) 2011-2020 The Bitcoin Core developers # 2 : : // Distributed under the MIT software license, see the accompanying # 3 : : // file COPYING or http://www.opensource.org/licenses/mit-license.php. # 4 : : # 5 : : /** # 6 : : * See https://www.boost.org/doc/libs/1_71_0/libs/test/doc/html/boost_test/utf_reference/link_references/link_boost_test_module_macro.html # 7 : : */ # 8 : : #define BOOST_TEST_MODULE Bitcoin Core Test Suite # 9 : : # 10 : : #include <boost/test/unit_test.hpp> # 11 : : # 12 : : #include <test/util/setup_common.h> # 13 : : # 14 : : #include <iostream> # 15 : : # 16 : : /** Redirect debug log to unit_test.log files */ # 17 : 1581141 : const std::function<void(const std::string&)> G_TEST_LOG_FUN = [](const std::string& s) { # 18 : 1581141 : static const bool should_log{std::any_of( # 19 : 1581141 : &boost::unit_test::framework::master_test_suite().argv[1], # 20 : 1581141 : &boost::unit_test::framework::master_test_suite().argv[boost::unit_test::framework::master_test_suite().argc], # 21 : 1581141 : [](const char* arg) { # 22 : 0 : return std::string{"DEBUG_LOG_OUT"} == arg; # 23 : 0 : })}; # 24 [ + - ]: 1581141 : if (!should_log) return; # 25 : 0 : std::cout << s; # 26 : 0 : };