Merge pull request #312 from TsudaKageyu/string-format

Unified the string formatting functions
This commit is contained in:
Stephen F. Booth
2013-11-15 13:19:31 -08:00
5 changed files with 65 additions and 96 deletions

View File

@ -41,6 +41,7 @@ class TestString : public CppUnit::TestFixture
CPPUNIT_TEST(testAppendCharDetach);
CPPUNIT_TEST(testAppendStringDetach);
CPPUNIT_TEST(testToInt);
CPPUNIT_TEST(testFromInt);
CPPUNIT_TEST(testSubstr);
CPPUNIT_TEST(testNewline);
CPPUNIT_TEST(testUpper);
@ -216,6 +217,12 @@ public:
CPPUNIT_ASSERT_EQUAL(String("-123aa").toInt(), -123);
}
void testFromInt()
{
CPPUNIT_ASSERT_EQUAL(String("123"), String::number(123));
CPPUNIT_ASSERT_EQUAL(String("-123"), String::number(-123));
}
void testSubstr()
{
CPPUNIT_ASSERT_EQUAL(String("01"), String("0123456").substr(0, 2));