diff options
author | Artur Dorda <artur.dorda+libo@gmail.com> | 2012-08-10 14:44:48 +0200 |
---|---|---|
committer | Artur Dorda <artur.dorda+libo@gmail.com> | 2012-08-15 13:42:16 +0200 |
commit | d54174970b926a2ecfb2981447ee11e30fca581d (patch) | |
tree | dfbc14629df282a7222eea25f81ec353dbb6a206 /sax | |
parent | d2bffadb60079fb032e631b5635d2800c193cf0f (diff) |
'string to percent' test covered
Change-Id: Ib18e28cba03c7032e8a446449b2839e7b7534133
Diffstat (limited to 'sax')
-rw-r--r-- | sax/qa/cppunit/test_converter.cxx | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/sax/qa/cppunit/test_converter.cxx b/sax/qa/cppunit/test_converter.cxx index b95a65c9553d..62e6d5d797d6 100644 --- a/sax/qa/cppunit/test_converter.cxx +++ b/sax/qa/cppunit/test_converter.cxx @@ -52,6 +52,7 @@ public: void testDouble(); void testMeasure(); void testBool(); + void testPercent(); CPPUNIT_TEST_SUITE(ConverterTest); CPPUNIT_TEST(testDuration); @@ -59,6 +60,7 @@ public: CPPUNIT_TEST(testDouble); CPPUNIT_TEST(testMeasure); CPPUNIT_TEST(testBool); + CPPUNIT_TEST(testPercent); CPPUNIT_TEST_SUITE_END(); private: @@ -402,6 +404,24 @@ void ConverterTest::testBool() doTestBoolToString("false", false); } +void doTestStringToPercent(sal_Int32 nValue, char const*const pis) +{ + ::rtl::OUString const is(::rtl::OUString::createFromAscii(pis)); + sal_Int32 nTemp; + bool bSuccess(Converter::convertPercent(nTemp, is)); + OSL_TRACE("%i", nTemp); + CPPUNIT_ASSERT(bSuccess); + CPPUNIT_ASSERT_EQUAL(nValue, nTemp); +} + +void ConverterTest::testPercent() +{ + doTestStringToPercent(40, "40%"); + doTestStringToPercent(30, "30"); + doTestStringToPercent(120, "120%"); + doTestStringToPercent(-40, "-40%"); + doTestStringToPercent(0, "0%"); +} CPPUNIT_TEST_SUITE_REGISTRATION(ConverterTest); } |