| 254 | } |
| 255 | |
| 256 | static 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. |
| 271 | BOOST_AUTO_TEST_CASE(util_ArgParsing) |
no test coverage detected