From 8fe163285fcbb97238b3d27e65992fcc7fa67e9f Mon Sep 17 00:00:00 2001 From: orbitcowboy Date: Wed, 4 Jun 2014 08:41:30 +0200 Subject: [PATCH] MathLib: Added missing testcase for incdec. --- lib/mathlib.cpp | 1 - test/testmathlib.cpp | 2 ++ 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/mathlib.cpp b/lib/mathlib.cpp index 632dbc4cf..0e59ed46b 100644 --- a/lib/mathlib.cpp +++ b/lib/mathlib.cpp @@ -548,7 +548,6 @@ std::string MathLib::incdec(const std::string & var, const std::string & op) throw InternalError(0, std::string("Unexpected operation '") + op + "' in MathLib::incdec(). Please report this to Cppcheck developers."); return ""; - } std::string MathLib::divide(const std::string &first, const std::string &second) diff --git a/test/testmathlib.cpp b/test/testmathlib.cpp index ec34b8a4b..6a6eb4773 100644 --- a/test/testmathlib.cpp +++ b/test/testmathlib.cpp @@ -800,6 +800,8 @@ private: const MathLib::biguint decrementedNum = MathLib::toULongNumber(strNum); ASSERT_EQUALS(num - 1U, decrementedNum); } + // invalid operation + ASSERT_THROW(MathLib::incdec("1", "x"), InternalError); // throw } };