Bitcoin Core 28.99.0
P2P Digital Currency
main.cpp
Go to the documentation of this file.
1// Copyright (c) 2011-2022 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
8#define BOOST_TEST_MODULE Bitcoin Core Test Suite
9
10#include <boost/test/included/unit_test.hpp>
11
13
14#include <functional>
15#include <iostream>
16
18const std::function<void(const std::string&)> G_TEST_LOG_FUN = [](const std::string& s) {
19 static const bool should_log{std::any_of(
20 &boost::unit_test::framework::master_test_suite().argv[1],
21 &boost::unit_test::framework::master_test_suite().argv[boost::unit_test::framework::master_test_suite().argc],
22 [](const char* arg) {
23 return std::string{"DEBUG_LOG_OUT"} == arg;
24 })};
25 if (!should_log) return;
26 std::cout << s;
27};
28
35const std::function<std::vector<const char*>()> G_TEST_COMMAND_LINE_ARGUMENTS = []() {
36 std::vector<const char*> args;
37 for (int i = 1; i < boost::unit_test::framework::master_test_suite().argc; ++i) {
38 args.push_back(boost::unit_test::framework::master_test_suite().argv[i]);
39 }
40 return args;
41};
42
46const std::function<std::string()> G_TEST_GET_FULL_NAME = []() {
47 return boost::unit_test::framework::current_test_case().full_name();
48};
ArgsManager & args
Definition: bitcoind.cpp:277
const std::function< std::string()> G_TEST_GET_FULL_NAME
Retrieve the unit test name.
Definition: main.cpp:20
const std::function< void(const std::string &)> G_TEST_LOG_FUN
Redirect debug log to unit_test.log files.
Definition: main.cpp:18
const std::function< std::vector< const char * >()> G_TEST_COMMAND_LINE_ARGUMENTS
Retrieve the command line arguments from boost.
Definition: main.cpp:35