Improve test coverage for MathLib::calculate()
This commit is contained in:
parent
e6b873b7b9
commit
9d8f67a6ca
|
@ -155,6 +155,16 @@ private:
|
|||
ASSERT_EQUALS("4611686018427387904", MathLib::divide("-9223372036854775808", "-2")); // #6679
|
||||
|
||||
|
||||
// invoke for each supported action
|
||||
ASSERT_EQUALS("3", MathLib::calculate("2", "1", '+'));
|
||||
ASSERT_EQUALS("1", MathLib::calculate("2", "1", '-'));
|
||||
ASSERT_EQUALS("2", MathLib::calculate("2", "1", '*'));
|
||||
ASSERT_EQUALS("2", MathLib::calculate("2", "1", '/'));
|
||||
ASSERT_EQUALS("0", MathLib::calculate("2", "1", '%'));
|
||||
ASSERT_EQUALS("0", MathLib::calculate("1", "2", '&'));
|
||||
ASSERT_EQUALS("1", MathLib::calculate("1", "1", '|'));
|
||||
ASSERT_EQUALS("1", MathLib::calculate("0", "1", '^'));
|
||||
|
||||
// Unknown action should throw exception
|
||||
ASSERT_THROW(MathLib::calculate("1","2",'j'),InternalError);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue