Skip to content

Commit 8fe1632

Browse files
committed
MathLib: Added missing testcase for incdec.
1 parent 60e80b6 commit 8fe1632

2 files changed

Lines changed: 2 additions & 1 deletion

File tree

lib/mathlib.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -548,7 +548,6 @@ std::string MathLib::incdec(const std::string & var, const std::string & op)
548548

549549
throw InternalError(0, std::string("Unexpected operation '") + op + "' in MathLib::incdec(). Please report this to Cppcheck developers.");
550550
return "";
551-
552551
}
553552

554553
std::string MathLib::divide(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
@@ -800,6 +800,8 @@ class TestMathLib : public TestFixture {
800800
const MathLib::biguint decrementedNum = MathLib::toULongNumber(strNum);
801801
ASSERT_EQUALS(num - 1U, decrementedNum);
802802
}
803+
// invalid operation
804+
ASSERT_THROW(MathLib::incdec("1", "x"), InternalError); // throw
803805
}
804806
};
805807

0 commit comments

Comments
 (0)