Changeset View
Changeset View
Standalone View
Standalone View
src/test/fixture.cpp
// Copyright (c) 2011-2016 The Bitcoin Core developers | // Copyright (c) 2011-2016 The Bitcoin Core developers | ||||
// Distributed under the MIT software license, see the accompanying | // Distributed under the MIT software license, see the accompanying | ||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php. | // 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 Bitcoin ABC unit tests | #define BOOST_TEST_MODULE Bitcoin ABC unit tests | ||||
#include <util/system.h> | #include <util/system.h> | ||||
#include <test/util/setup_common.h> | #include <test/util/setup_common.h> | ||||
#include <boost/test/unit_test.hpp> | #include <boost/test/unit_test.hpp> | ||||
namespace utf = boost::unit_test::framework; | namespace utf = boost::unit_test::framework; | ||||
/** Redirect debug log to boost log */ | |||||
const std::function<void(const std::string &)> G_TEST_LOG_FUN = | |||||
[](const std::string &s) { | |||||
if (s.back() == '\n') { | |||||
// boost will insert the new line | |||||
BOOST_TEST_MESSAGE(s.substr(0, s.size() - 1)); | |||||
} else { | |||||
BOOST_TEST_MESSAGE(s); | |||||
} | |||||
}; | |||||
/** | /** | ||||
* Global fixture for passing custom arguments, and clearing them all after each | * Global fixture for passing custom arguments, and clearing them all after each | ||||
* test case. | * test case. | ||||
*/ | */ | ||||
struct CustomArgumentsFixture { | struct CustomArgumentsFixture { | ||||
CustomArgumentsFixture() { | CustomArgumentsFixture() { | ||||
auto &master_test_suite = utf::master_test_suite(); | auto &master_test_suite = utf::master_test_suite(); | ||||
Show All 21 Lines |