Improve test coverage for MathLib::calculate()

This commit is contained in:
Dmitry-Me 2020-01-09 18:18:03 +03:00
parent e6b873b7b9
commit 9d8f67a6ca
1 changed files with 10 additions and 0 deletions

View File

@ -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);
}