diff options
author | Caolán McNamara <caolanm@redhat.com> | 2011-08-28 00:17:42 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2011-08-29 09:56:06 +0100 |
commit | 14d2a60053e30dcb7e6956637fe8d57d18563e3f (patch) | |
tree | a395e8185afde2031fa255094ee9b0d23f11afe9 /comphelper/qa | |
parent | 65302eb1bed16db8f06cbb048d03ba6d644b3fb6 (diff) |
remove ByteString::IsAlphaNumericAscii and refactor a bit
Diffstat (limited to 'comphelper/qa')
-rw-r--r-- | comphelper/qa/string/test_string.cxx | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/comphelper/qa/string/test_string.cxx b/comphelper/qa/string/test_string.cxx index 4ac96dccc5f7..d7187e04fd75 100644 --- a/comphelper/qa/string/test_string.cxx +++ b/comphelper/qa/string/test_string.cxx @@ -46,6 +46,8 @@ public: void testReplace(); void testToken(); void testDecimalStringToNumber(); + void testIsdigitAsciiString(); + void testIsalnumAsciiString(); CPPUNIT_TEST_SUITE(TestString); CPPUNIT_TEST(testSearchAndReplaceAsciiL); @@ -53,6 +55,8 @@ public: CPPUNIT_TEST(testReplace); CPPUNIT_TEST(testToken); CPPUNIT_TEST(testDecimalStringToNumber); + CPPUNIT_TEST(testIsdigitAsciiString); + CPPUNIT_TEST(testIsalnumAsciiString); CPPUNIT_TEST_SUITE_END(); }; @@ -98,6 +102,33 @@ void TestString::testDecimalStringToNumber() CPPUNIT_ASSERT_EQUAL((sal_uInt32)81, comphelper::string::decimalStringToNumber(s1)); } +void TestString::testIsdigitAsciiString() +{ + rtl::OString s1(RTL_CONSTASCII_STRINGPARAM("1234")); + CPPUNIT_ASSERT_EQUAL(comphelper::string::isdigitAsciiString(s1), true); + + rtl::OString s2(RTL_CONSTASCII_STRINGPARAM("1A34")); + CPPUNIT_ASSERT_EQUAL(comphelper::string::isdigitAsciiString(s2), false); + + rtl::OString s3; + CPPUNIT_ASSERT_EQUAL(comphelper::string::isdigitAsciiString(s3), true); +} + +void TestString::testIsalnumAsciiString() +{ + rtl::OString s1(RTL_CONSTASCII_STRINGPARAM("1234")); + CPPUNIT_ASSERT_EQUAL(comphelper::string::isalnumAsciiString(s1), true); + + rtl::OString s2(RTL_CONSTASCII_STRINGPARAM("1A34")); + CPPUNIT_ASSERT_EQUAL(comphelper::string::isalnumAsciiString(s2), true); + + rtl::OString s3; + CPPUNIT_ASSERT_EQUAL(comphelper::string::isalnumAsciiString(s3), true); + + rtl::OString s4(RTL_CONSTASCII_STRINGPARAM("1A[4")); + CPPUNIT_ASSERT_EQUAL(comphelper::string::isalnumAsciiString(s4), false); +} + using namespace ::com::sun::star; class testCollator : public cppu::WeakImplHelper1< i18n::XCollator > |