testing mathlib: Test that conversion to numbers work
This commit is contained in:
parent
e26c999020
commit
7803466079
|
@ -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)
|
||||||
|
|
Loading…
Reference in New Issue