Skip to content

Commit

Permalink
tests for parseHex accepts invalid syntax and does not throw an excep…
Browse files Browse the repository at this point in the history
…tion #880
  • Loading branch information
Alex Fabijanic committed Oct 6, 2017
1 parent 45dbbc6 commit 31dfdb5
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions Foundation/testsuite/src/NumberParserTest.cpp
Expand Up @@ -72,6 +72,7 @@ void NumberParserTest::testParse()
assert(NumberParser::parseHex("12AB") == 0x12ab);
assert(NumberParser::parseHex("0x12AB") == 0x12ab);
assert(NumberParser::parseHex("0X12AB") == 0x12ab);
assert(NumberParser::parseHex("0x99a") == 0x99a);
assert(NumberParser::parseHex("00") == 0);
assert(NumberParser::parseOct("123") == 0123);
assert(NumberParser::parseOct("0123") == 0123);
Expand Down Expand Up @@ -252,6 +253,13 @@ void NumberParserTest::testParseError()
NumberParser::parseHex("23z");
failmsg("must throw SyntaxException");
} catch (SyntaxException&) { }

try
{
NumberParser::parseHex("xxx");
failmsg("must throw SyntaxException");
}
catch (SyntaxException&) {}

#if defined(POCO_HAVE_INT64)

Expand Down

0 comments on commit 31dfdb5

Please sign in to comment.