testing mathlib: Test that conversion to numbers work

This commit is contained in:
Daniel Marjamäki 2009-05-02 11:12:49 +02:00
parent e26c999020
commit 7803466079
1 changed files with 8 additions and 0 deletions

View File

@ -33,6 +33,7 @@ private:
void run() void run()
{ {
TEST_CASE(calculate); TEST_CASE(calculate);
TEST_CASE(convert);
} }
void calculate() void calculate()
@ -44,6 +45,13 @@ private:
ASSERT_EQUALS(std::string("7"), MathLib::divide("21.", "3")); ASSERT_EQUALS(std::string("7"), MathLib::divide("21.", "3"));
ASSERT_EQUALS(std::string("1"), MathLib::divide("3", "2")); ASSERT_EQUALS(std::string("1"), MathLib::divide("3", "2"));
} }
void convert()
{
ASSERT_EQUALS(10, MathLib::toLongNumber("0xa"));
ASSERT_EQUALS(8, MathLib::toLongNumber("010"));
ASSERT_EQUALS(10, MathLib::toLongNumber("10"));
}
}; };
REGISTER_TEST(TestMathLib) REGISTER_TEST(TestMathLib)