Skip to content

Commit b7c9187

Browse files
IOBYTEdanmar
authored andcommitted
Fixed danmar#6280 (MathLib: binary literals are integers)
1 parent 1c19184 commit b7c9187

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

lib/mathlib.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -505,7 +505,7 @@ bool MathLib::isDec(const std::string & s)
505505

506506
bool MathLib::isInt(const std::string & s)
507507
{
508-
return isDec(s) || isHex(s) || isOct(s);
508+
return isDec(s) || isHex(s) || isOct(s) || isBin(s);
509509
}
510510

511511
std::string MathLib::add(const std::string & first, const std::string & second)

test/testmathlib.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -274,6 +274,8 @@ class TestMathLib : public TestFixture {
274274

275275
ASSERT_EQUALS(true , MathLib::isInt("0xff"));
276276
ASSERT_EQUALS(true , MathLib::isInt("0xa"));
277+
ASSERT_EQUALS(true , MathLib::isInt("0b1000"));
278+
ASSERT_EQUALS(true , MathLib::isInt("0B1000"));
277279
ASSERT_EQUALS(true , MathLib::isInt("0l"));
278280
ASSERT_EQUALS(true , MathLib::isInt("0L"));
279281
ASSERT_EQUALS(true , MathLib::isInt("0ul"));

0 commit comments

Comments
 (0)