MCPcopy Create free account
hub / github.com/bitcoin/bitcoin / TestParse

Function TestParse

src/test/argsman_tests.cpp:256–268  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

254}
255
256static void TestParse(const std::string& str, bool expected_bool, int64_t expected_int)
257{
258 TestArgsManager test;
259 test.SetupArgs({{"-value", ArgsManager::ALLOW_ANY}});
260 std::string arg = "-value=" + str;
261 const char* argv[] = {"ignored", arg.c_str()};
262 std::string error;
263 BOOST_CHECK(test.ParseParameters(2, argv, error));
264 BOOST_CHECK_EQUAL(test.GetBoolArg("-value", false), expected_bool);
265 BOOST_CHECK_EQUAL(test.GetBoolArg("-value", true), expected_bool);
266 BOOST_CHECK_EQUAL(test.GetIntArg("-value", 99998), expected_int);
267 BOOST_CHECK_EQUAL(test.GetIntArg("-value", 99999), expected_int);
268}
269
270// Test bool and int parsing.
271BOOST_AUTO_TEST_CASE(util_ArgParsing)

Callers 1

BOOST_AUTO_TEST_CASEFunction · 0.70

Calls 3

SetupArgsMethod · 0.80
ParseParametersMethod · 0.80
GetBoolArgMethod · 0.80

Tested by

no test coverage detected