diff options
Diffstat (limited to 'sal')
-rw-r--r-- | sal/qa/rtl/strings/test_oustring_stringliterals.cxx | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/sal/qa/rtl/strings/test_oustring_stringliterals.cxx b/sal/qa/rtl/strings/test_oustring_stringliterals.cxx index 192eeb5ae63b..0693fc2a3e08 100644 --- a/sal/qa/rtl/strings/test_oustring_stringliterals.cxx +++ b/sal/qa/rtl/strings/test_oustring_stringliterals.cxx @@ -31,6 +31,7 @@ private: void checkExtraIntArgument(); void checkNonconstChar(); void checkBuffer(); + void checkOUStringLiteral1(); void testcall( const char str[] ); @@ -40,6 +41,7 @@ CPPUNIT_TEST(checkUsage); CPPUNIT_TEST(checkExtraIntArgument); CPPUNIT_TEST(checkNonconstChar); CPPUNIT_TEST(checkBuffer); +CPPUNIT_TEST(checkOUStringLiteral1); CPPUNIT_TEST_SUITE_END(); }; @@ -170,6 +172,28 @@ void test::oustring::StringLiterals::checkBuffer() CPPUNIT_ASSERT( !VALID_CONVERSION( buf.append( rtl::OUStringBuffer( d )))); } +void test::oustring::StringLiterals::checkOUStringLiteral1() +{ + rtl::OUString s1; + s1 = rtlunittest::OUStringLiteral1<'A'>(); + CPPUNIT_ASSERT_EQUAL(1, s1.getLength()); + CPPUNIT_ASSERT_EQUAL(sal_Unicode('A'), s1[0]); + + CPPUNIT_ASSERT_EQUAL( + true, rtl::OUString("A") == rtlunittest::OUStringLiteral1<'A'>()); + CPPUNIT_ASSERT_EQUAL( + false, rtl::OUString("AB") == rtlunittest::OUStringLiteral1<'A'>()); + CPPUNIT_ASSERT_EQUAL( + false, rtl::OUString("A") != rtlunittest::OUStringLiteral1<'A'>()); + CPPUNIT_ASSERT_EQUAL( + true, rtl::OUString("AB") != rtlunittest::OUStringLiteral1<'A'>()); + + rtl::OUString s2("A" + rtlunittest::OUStringLiteral1<'b'>()); + CPPUNIT_ASSERT_EQUAL(2, s2.getLength()); + CPPUNIT_ASSERT_EQUAL(sal_Unicode('A'), s2[0]); + CPPUNIT_ASSERT_EQUAL(sal_Unicode('b'), s2[1]); +} + }} // namespace CPPUNIT_TEST_SUITE_REGISTRATION(test::oustring::StringLiterals); |