summaryrefslogtreecommitdiffstats
path: root/comphelper/qa
diff options
context:
space:
mode:
authorSébastien Le Ray <sebastien-libreoffice@orniz.org>2011-02-17 10:41:21 +0100
committerCaolán McNamara <caolanm@redhat.com>2011-02-18 10:20:15 +0000
commita6ba342adec9edad3e4bcf4d614d3525b4e66186 (patch)
tree2975f1c4b78c69358857e40285d685644ded7340 /comphelper/qa
parentDrop 16-bit Windows code (diff)
downloadcore-a6ba342adec9edad3e4bcf4d614d3525b4e66186.tar.gz
core-a6ba342adec9edad3e4bcf4d614d3525b4e66186.zip
Added comphelper::string::decimalStringToNumber
Diffstat (limited to 'comphelper/qa')
-rw-r--r--comphelper/qa/string/test_string.cxx13
1 files changed, 13 insertions, 0 deletions
diff --git a/comphelper/qa/string/test_string.cxx b/comphelper/qa/string/test_string.cxx
index a5826ae3628d..2f92b8190d15 100644
--- a/comphelper/qa/string/test_string.cxx
+++ b/comphelper/qa/string/test_string.cxx
@@ -49,10 +49,12 @@ class TestString: public CppUnit::TestFixture
public:
void test();
void testNatural();
+ void testDecimalStringToNumber();
CPPUNIT_TEST_SUITE(TestString);
CPPUNIT_TEST(test);
CPPUNIT_TEST(testNatural);
+ CPPUNIT_TEST(testDecimalStringToNumber);
CPPUNIT_TEST_SUITE_END();
};
@@ -86,6 +88,17 @@ void TestString::test()
CPPUNIT_ASSERT(n3 == -1);
}
+void TestString::testDecimalStringToNumber() {
+ rtl::OUString s1(RTL_CONSTASCII_USTRINGPARAM("1234"));
+ CPPUNIT_ASSERT_EQUAL((sal_uInt32)1234, comphelper::string::decimalStringToNumber(s1));
+ s1 += rtl::OUString(L'\u07C6');
+ CPPUNIT_ASSERT_EQUAL((sal_uInt32)12346, comphelper::string::decimalStringToNumber(s1));
+ // Codepoints on 2 16bits words
+ sal_uInt32 utf16String[] = { 0x1D7FE /* 8 */, 0x1D7F7 /* 1 */};
+ s1 = rtl::OUString(utf16String, 2);
+ CPPUNIT_ASSERT_EQUAL((sal_uInt32)81, comphelper::string::decimalStringToNumber(s1));
+}
+
using namespace ::com::sun::star;
class testCollator : public cppu::WeakImplHelper1< i18n::XCollator >