12 #include <boost/algorithm/string.hpp>
13 #include <boost/test/unit_test.hpp>
17 static void ResetArgs(
const std::string& strArg)
19 std::vector<std::string> vecArg;
21 boost::split(vecArg, strArg, boost::is_space(), boost::token_compress_on);
24 vecArg.insert(vecArg.begin(),
"testbitcoin");
27 std::vector<const char*> vecChar;
28 for (std::string& s : vecArg)
29 vecChar.push_back(s.c_str());
59 ResetArgs(
"-nofoo=1");
63 ResetArgs(
"-foo -nofoo");
67 ResetArgs(
"-foo=1 -nofoo=1");
71 ResetArgs(
"-foo=0 -nofoo=0");
80 ResetArgs(
"--nofoo=1");
92 ResetArgs(
"-foo -bar");
100 ResetArgs(
"-foo=11");
104 ResetArgs(
"-foo=eleven");
116 ResetArgs(
"-foo -bar");
120 ResetArgs(
"-foo=11 -bar=12");
124 ResetArgs(
"-foo=NaN -bar=NotANumber");
134 ResetArgs(
"--foo=verbose --bar=1");
145 ResetArgs(
"-nofoo=1");
149 ResetArgs(
"-nofoo=0");
153 ResetArgs(
"-foo --nofoo");
157 ResetArgs(
"-nofoo -foo");
void ParseParameters(int argc, const char *const argv[])
std::string GetArg(const std::string &strArg, const std::string &strDefault) const
Return string argument or default value.
bool GetBoolArg(const std::string &strArg, bool fDefault) const
Return boolean argument or default value.
BOOST_AUTO_TEST_SUITE_END()
BOOST_AUTO_TEST_CASE(boolarg)
#define BOOST_FIXTURE_TEST_SUITE(a, b)
#define BOOST_CHECK_EQUAL(v1, v2)
#define BOOST_CHECK(expr)