Changeset View
Changeset View
Standalone View
Standalone View
src/test/getarg_tests.cpp
// Copyright (c) 2012-2019 The Bitcoin Core developers | // Copyright (c) 2012-2019 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. | ||||
#include <util/strencodings.h> | |||||
#include <util/system.h> | #include <util/system.h> | ||||
#include <test/setup_common.h> | #include <test/setup_common.h> | ||||
#include <univalue.h> | #include <univalue.h> | ||||
#include <boost/algorithm/string.hpp> | #include <boost/algorithm/string.hpp> | ||||
#include <boost/test/unit_test.hpp> | #include <boost/test/unit_test.hpp> | ||||
#include <string> | #include <string> | ||||
#include <utility> | #include <utility> | ||||
#include <vector> | #include <vector> | ||||
BOOST_FIXTURE_TEST_SUITE(getarg_tests, BasicTestingSetup) | BOOST_FIXTURE_TEST_SUITE(getarg_tests, BasicTestingSetup) | ||||
static void ResetArgs(ArgsManager &am, const std::string &strArg) { | static void ResetArgs(ArgsManager &am, const std::string &strArg) { | ||||
std::vector<std::string> vecArg; | std::vector<std::string> vecArg; | ||||
if (strArg.size()) { | if (strArg.size()) { | ||||
boost::split(vecArg, strArg, boost::is_space(), | boost::split(vecArg, strArg, IsSpace, boost::token_compress_on); | ||||
boost::token_compress_on); | |||||
} | } | ||||
// Insert dummy executable name: | // Insert dummy executable name: | ||||
vecArg.insert(vecArg.begin(), "testbitcoin"); | vecArg.insert(vecArg.begin(), "testbitcoin"); | ||||
// Convert to char*: | // Convert to char*: | ||||
std::vector<const char *> vecChar; | std::vector<const char *> vecChar; | ||||
for (const std::string &s : vecArg) { | for (const std::string &s : vecArg) { | ||||
▲ Show 20 Lines • Show All 196 Lines • Show Last 20 Lines |