diff options
author | Artur Dorda <artur.dorda+libo@gmail.com> | 2012-08-10 15:40:05 +0200 |
---|---|---|
committer | Artur Dorda <artur.dorda+libo@gmail.com> | 2012-08-15 13:42:18 +0200 |
commit | 36955a6e1e99858954c7f6d8b96b027359fe522e (patch) | |
tree | cb2fdd026a6d1fe3c4fd9f4b6d5c04384aa731bc /sax | |
parent | daae18fd8f4933aea886dba02a3a16ebd0159728 (diff) |
'string to number' test covered
Change-Id: Ib8a81edce168be5babd1bcd62746199de77c2ade
Diffstat (limited to 'sax')
-rw-r--r-- | sax/qa/cppunit/test_converter.cxx | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/sax/qa/cppunit/test_converter.cxx b/sax/qa/cppunit/test_converter.cxx index f0df6ad6e389..c4fe50e3a6c7 100644 --- a/sax/qa/cppunit/test_converter.cxx +++ b/sax/qa/cppunit/test_converter.cxx @@ -471,6 +471,16 @@ void ConverterTest::testColor() doTestColorToString("#000000", 0); } +void doTestStringToNumber(sal_Int32 nValue, char const*const pis, sal_Int32 nMin, sal_Int32 nMax) +{ + ::rtl::OUString const is(::rtl::OUString::createFromAscii(pis)); + sal_Int32 nTemp; + bool bSuccess(Converter::convertNumber(nTemp, is, nMin, nMax)); + OSL_TRACE("%i", nTemp); + CPPUNIT_ASSERT(bSuccess); + CPPUNIT_ASSERT_EQUAL(nValue, nTemp); +} + void doTestNumberToString(char const*const pis, sal_Int32 nValue) { ::rtl::OUString const is(::rtl::OUString::createFromAscii(pis)); @@ -482,6 +492,11 @@ void doTestNumberToString(char const*const pis, sal_Int32 nValue) void ConverterTest::testNumber() { + doTestStringToNumber(30, "30", 1, 40); + doTestStringToNumber(1, "-5", 1, 300); + doTestStringToNumber(-30, "7", -100, -30); + doTestStringToNumber(0, "-0", 0, 1); + doTestStringToNumber(0, "666", -0, 0); doTestNumberToString("333", 333); doTestNumberToString("-1", -1); doTestNumberToString("0", 0000); |