Skip to content
Snippets Groups Projects
Commit 2ee17c35 authored by Mohamed Fenjiro's avatar Mohamed Fenjiro Committed by Sébastien Blin
Browse files

unitTest: fix string_utils

Change-Id: I57d3efa477490196e6e935d00a6e98f15d970714
parent d623c210
Branches
No related tags found
No related merge requests found
...@@ -45,9 +45,9 @@ private: ...@@ -45,9 +45,9 @@ private:
CPPUNIT_TEST(split_string_test); CPPUNIT_TEST(split_string_test);
CPPUNIT_TEST_SUITE_END(); CPPUNIT_TEST_SUITE_END();
const double DOUBLE = 3.14159265359; const double DOUBLE = 3.141593;
const int INT = 42 ; 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_FLOAT = "3.14159265359";
const std::string PI_42 = "42"; const std::string PI_42 = "42";
}; };
...@@ -65,16 +65,16 @@ void ...@@ -65,16 +65,16 @@ void
StringUtilsTest::to_string_test() StringUtilsTest::to_string_test()
{ {
// test with double // test with double
CPPUNIT_ASSERT(to_string(DOUBLE) == PI_DOUBLE); CPPUNIT_ASSERT(std::to_string(DOUBLE) == PI_DOUBLE);
// test with float // test with float
float varFloat = 3.14; 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) == '.' CPPUNIT_ASSERT(sVarFloat.at(0) == '3' && sVarFloat.at(1) == '.'
&& sVarFloat.at(2) == '1' && sVarFloat.at(3) == '4'); && sVarFloat.at(2) == '1' && sVarFloat.at(3) == '4');
// test with int // test with int
CPPUNIT_ASSERT(to_string(INT).compare(PI_42) == 0); CPPUNIT_ASSERT(std::to_string(INT).compare(PI_42) == 0);
} }
void void
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment