Commit 2ee17c35 authored by Mohamed Fenjiro's avatar Mohamed Fenjiro Committed by Sébastien Blin

unitTest: fix string_utils

Change-Id: I57d3efa477490196e6e935d00a6e98f15d970714
parent d623c210
......@@ -45,9 +45,9 @@ private:
CPPUNIT_TEST(split_string_test);
CPPUNIT_TEST_SUITE_END();
const double DOUBLE = 3.14159265359;
const double DOUBLE = 3.141593;
const int INT = 42 ;
const std::string PI_DOUBLE = "3.14159265359";
const std::string PI_DOUBLE = "3.141593";
const std::string PI_FLOAT = "3.14159265359";
const std::string PI_42 = "42";
};
......@@ -65,16 +65,16 @@ void
StringUtilsTest::to_string_test()
{
// test with double
CPPUNIT_ASSERT(to_string(DOUBLE) == PI_DOUBLE);
CPPUNIT_ASSERT(std::to_string(DOUBLE) == PI_DOUBLE);
// test with float
float varFloat = 3.14;
std::string sVarFloat = to_string(varFloat);
std::string sVarFloat = std::to_string(varFloat);
CPPUNIT_ASSERT(sVarFloat.at(0) == '3' && sVarFloat.at(1) == '.'
&& sVarFloat.at(2) == '1' && sVarFloat.at(3) == '4');
// test with int
CPPUNIT_ASSERT(to_string(INT).compare(PI_42) == 0);
CPPUNIT_ASSERT(std::to_string(INT).compare(PI_42) == 0);
}
void
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment