Changeset View
Changeset View
Standalone View
Standalone View
src/test/test_bitcoin_main.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. | ||||
#define BOOST_TEST_MODULE Bitcoin Test Suite | #define BOOST_TEST_MODULE Bitcoin ABC unit tests | ||||
#include <banman.h> | #include <banman.h> | ||||
#include <net.h> | #include <net.h> | ||||
#include <util/system.h> | #include <util/system.h> | ||||
#include <boost/test/unit_test.hpp> | #include <boost/test/unit_test.hpp> | ||||
#include <memory> | #include <memory> | ||||
Show All 18 Lines | |||||
/* | /* | ||||
* 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 { | ||||
std::string error; | std::string error; | ||||
CustomArgumentsFixture() { | CustomArgumentsFixture() { | ||||
std::set<std::string> testArgs = { | const std::string testsuitename = "-testsuitename"; | ||||
const std::set<std::string> testArgs = { | |||||
testsuitename, | |||||
"-phononactivationtime", | "-phononactivationtime", | ||||
}; | }; | ||||
for (const auto &arg : testArgs) { | for (const auto &arg : testArgs) { | ||||
gArgs.AddArg(arg, "", false, OptionsCategory::HIDDEN); | gArgs.AddArg(arg, "", false, OptionsCategory::HIDDEN); | ||||
} | } | ||||
const auto &master_test_suite = utf::master_test_suite(); | auto &master_test_suite = utf::master_test_suite(); | ||||
if (!gArgs.ParseParameters(master_test_suite.argc, | if (!gArgs.ParseParameters(master_test_suite.argc, | ||||
master_test_suite.argv, error)) { | master_test_suite.argv, error)) { | ||||
throw utf::setup_error(error); | throw utf::setup_error(error); | ||||
} | } | ||||
master_test_suite.p_name.value = | |||||
gArgs.GetArg(testsuitename, master_test_suite.p_name.value); | |||||
} | } | ||||
~CustomArgumentsFixture(){}; | ~CustomArgumentsFixture(){}; | ||||
}; | }; | ||||
BOOST_GLOBAL_FIXTURE(CustomArgumentsFixture); | BOOST_GLOBAL_FIXTURE(CustomArgumentsFixture); |