diff --git a/lib/mathlib.cpp b/lib/mathlib.cpp index 309008ff3..837441ff5 100644 --- a/lib/mathlib.cpp +++ b/lib/mathlib.cpp @@ -505,7 +505,7 @@ bool MathLib::isDec(const std::string & s) bool MathLib::isInt(const std::string & s) { - return isDec(s) || isHex(s) || isOct(s); + return isDec(s) || isHex(s) || isOct(s) || isBin(s); } std::string MathLib::add(const std::string & first, const std::string & second) diff --git a/test/testmathlib.cpp b/test/testmathlib.cpp index 04ca3a41a..a20337c68 100644 --- a/test/testmathlib.cpp +++ b/test/testmathlib.cpp @@ -274,6 +274,8 @@ private: ASSERT_EQUALS(true , MathLib::isInt("0xff")); ASSERT_EQUALS(true , MathLib::isInt("0xa")); + ASSERT_EQUALS(true , MathLib::isInt("0b1000")); + ASSERT_EQUALS(true , MathLib::isInt("0B1000")); ASSERT_EQUALS(true , MathLib::isInt("0l")); ASSERT_EQUALS(true , MathLib::isInt("0L")); ASSERT_EQUALS(true , MathLib::isInt("0ul"));