dash/src/test/main.cpp
MarcoFalke 639386a7a1
Merge #18472: test: Remove unsafe BOOST_TEST_MESSAGE
fa3cc0bfc4c4fc13a384fc291403c9fd41082f18 test: Remove unsafe BOOST_TEST_MESSAGE (MarcoFalke)

Pull request description:

  Fixes #17987

  Can be tested with

  ```
  ./src/test/test_bitcoin -l test_suite  -- DEBUG_LOG_OUT

ACKs for top commit:
  fjahr:
    tested ACK fa3cc0bfc4c4fc13a384fc291403c9fd41082f18
  mzumsande:
    Tested ACK fa3cc0bfc4c4fc13a384fc291403c9fd41082f18

Tree-SHA512: f63b110d77882cd7c0d7574ff6c9c948db8febb3400ecdac45164746b587b0fa223463041801271b3959267ddc1d9a4a67ba76939e242e7dd2f92a2834a400a0
2022-04-03 08:35:45 +05:30

27 lines
1007 B
C++

// Copyright (c) 2011-2019 The Bitcoin Core developers
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
/**
* 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
*/
#define BOOST_TEST_MODULE Dash Core Test Suite
#include <boost/test/unit_test.hpp>
#include <test/util/setup_common.h>
#include <iostream>
/** Redirect debug log to unit_test.log files */
const std::function<void(const std::string&)> G_TEST_LOG_FUN = [](const std::string& s) {
static const bool should_log{std::any_of(
&boost::unit_test::framework::master_test_suite().argv[1],
&boost::unit_test::framework::master_test_suite().argv[boost::unit_test::framework::master_test_suite().argc],
[](const char* arg) {
return std::string{"DEBUG_LOG_OUT"} == arg;
})};
if (!should_log) return;
std::cout << s;
};