Fixed #5492 (Fix small bug in MathLib::isFloat())
This commit is contained in:
parent
dea4107245
commit
a02bbfa47e
|
@ -131,6 +131,10 @@ bool MathLib::isFloat(const std::string &s)
|
|||
case LEADING_DECIMAL:
|
||||
if (std::isdigit(*it))
|
||||
state=BASE_DIGITS2;
|
||||
else if (*it=='e' || *it=='E')
|
||||
state=E;
|
||||
else
|
||||
return false;
|
||||
break;
|
||||
case BASE_DIGITS1:
|
||||
if (*it=='e' || *it=='E')
|
||||
|
|
|
@ -368,6 +368,9 @@ private:
|
|||
ASSERT_EQUALS(false , MathLib::isFloat(" 0. "));
|
||||
ASSERT_EQUALS(false , MathLib::isFloat(" 0."));
|
||||
|
||||
ASSERT_EQUALS(false , MathLib::isFloat("0.."));
|
||||
ASSERT_EQUALS(false , MathLib::isFloat("..0.."));
|
||||
ASSERT_EQUALS(false , MathLib::isFloat("..0"));
|
||||
ASSERT_EQUALS(true , MathLib::isFloat("0.0"));
|
||||
ASSERT_EQUALS(true , MathLib::isFloat("-0."));
|
||||
ASSERT_EQUALS(true , MathLib::isFloat("+0."));
|
||||
|
|
Loading…
Reference in New Issue