mirror of
https://github.com/pocoproject/poco.git
synced 2025-10-28 19:51:58 +01:00
added methods parseBool() and tryParseBool() to Poco::NumberParser + test unit
This commit is contained in:
@@ -58,6 +58,13 @@ void NumberParserTest::testParse()
|
||||
assert (NumberParser::parseUnsigned("123") == 123);
|
||||
assert (NumberParser::parseHex("12AB") == 0x12ab);
|
||||
|
||||
assert (NumberParser::parseBool("0") == false);
|
||||
assert (NumberParser::parseBool("FALSE") == false);
|
||||
assert (NumberParser::parseBool("no") == false);
|
||||
assert (NumberParser::parseBool("1") == true);
|
||||
assert (NumberParser::parseBool("True") == true);
|
||||
assert (NumberParser::parseBool("YeS") == true);
|
||||
|
||||
#if defined(POCO_HAVE_INT64)
|
||||
assert (NumberParser::parse64("123") == 123);
|
||||
assert (NumberParser::parse64("-123") == -123);
|
||||
@@ -73,6 +80,7 @@ void NumberParserTest::testParseError()
|
||||
try
|
||||
{
|
||||
NumberParser::parse("");
|
||||
NumberParser::parseBool("");
|
||||
failmsg("must throw SyntaxException");
|
||||
}
|
||||
catch (SyntaxException&)
|
||||
@@ -82,6 +90,7 @@ void NumberParserTest::testParseError()
|
||||
try
|
||||
{
|
||||
NumberParser::parse("asd");
|
||||
NumberParser::parseBool("asd");
|
||||
failmsg("must throw SyntaxException");
|
||||
}
|
||||
catch (SyntaxException&)
|
||||
|
||||
Reference in New Issue
Block a user