Confusing behavior of cmopareToAscii overloads

Change-Id: If432b67cebdb9a009a015ddf046ed1ce15920e57
This commit is contained in:
Stephan Bergmann 2012-07-16 10:35:53 +02:00
parent e35246c71f
commit 4ad006fc76

View file

@ -39,8 +39,11 @@ class Compare: public CppUnit::TestFixture
private:
void equalsIgnoreAsciiCaseAscii();
void compareToAscii();
CPPUNIT_TEST_SUITE(Compare);
CPPUNIT_TEST(equalsIgnoreAsciiCaseAscii);
CPPUNIT_TEST(compareToAscii);
CPPUNIT_TEST_SUITE_END();
};
@ -66,4 +69,14 @@ void test::oustring::Compare::equalsIgnoreAsciiCaseAscii()
equalsIgnoreAsciiCaseAscii("abcd"));
}
void test::oustring::Compare::compareToAscii()
{
// The different overloads of compareToAscii exhibit potentially confusing
// behavior:
rtl::OUString abc("abc");
CPPUNIT_ASSERT(abc.compareToAscii("a") > 0);
CPPUNIT_ASSERT_EQUAL(
0, abc.compareToAscii(RTL_CONSTASCII_STRINGPARAM("a")));
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */