summaryrefslogtreecommitdiff
path: root/sal
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2013-02-04 14:44:24 +0100
committerStephan Bergmann <sbergman@redhat.com>2013-02-04 14:44:24 +0100
commit6ba8a2eab28cbe0967b360a09e1e9d7a7bb7bd26 (patch)
tree79db01666398739bd2bb9b10494a4d3a4faea4d6 /sal
parent751950edc84e0069e5bce1083160d46d9ba1bf33 (diff)
OK for boolean() to take true bool argument
...instead of sal_Bool; this would cause C4800 performance warnings with MSVC, but we disable them anyway. Also, added unit tests that are actually executed. Change-Id: Ib405132565918be72d93b3fc24180edcb6e565c7
Diffstat (limited to 'sal')
-rw-r--r--sal/inc/rtl/string.hxx4
-rw-r--r--sal/inc/rtl/ustring.hxx4
-rw-r--r--sal/qa/rtl/strings/test_strings_valuex.cxx24
3 files changed, 28 insertions, 4 deletions
diff --git a/sal/inc/rtl/string.hxx b/sal/inc/rtl/string.hxx
index 9ed01e5824cb..a239768df777 100644
--- a/sal/inc/rtl/string.hxx
+++ b/sal/inc/rtl/string.hxx
@@ -1504,11 +1504,11 @@ public:
If the sal_Bool is false, the string "false" is returned.
This function can't be used for language specific conversion.
- @param b a sal_Bool.
+ @param b a bool.
@return a string with the string representation of the argument.
@since LibreOffice 4.1
*/
- static OString boolean( sal_Bool b ) SAL_THROW(())
+ static OString boolean( bool b ) SAL_THROW(())
{
sal_Char aBuf[RTL_STR_MAX_VALUEOFBOOLEAN];
rtl_String* pNewData = 0;
diff --git a/sal/inc/rtl/ustring.hxx b/sal/inc/rtl/ustring.hxx
index 7cdbb4e22d90..25ed82b2b83d 100644
--- a/sal/inc/rtl/ustring.hxx
+++ b/sal/inc/rtl/ustring.hxx
@@ -2155,11 +2155,11 @@ public:
If the sal_Bool is false, the string "false" is returned.
This function can't be used for language specific conversion.
- @param b a sal_Bool.
+ @param b a bool.
@return a string with the string representation of the argument.
@since LibreOffice 4.1
*/
- static OUString boolean( sal_Bool b ) SAL_THROW(())
+ static OUString boolean( bool b ) SAL_THROW(())
{
sal_Unicode aBuf[RTL_USTR_MAX_VALUEOFBOOLEAN];
rtl_uString* pNewData = 0;
diff --git a/sal/qa/rtl/strings/test_strings_valuex.cxx b/sal/qa/rtl/strings/test_strings_valuex.cxx
index cbd12c5ff94f..3ad4cd7a4b99 100644
--- a/sal/qa/rtl/strings/test_strings_valuex.cxx
+++ b/sal/qa/rtl/strings/test_strings_valuex.cxx
@@ -17,12 +17,16 @@ namespace test { namespace strings {
class valueX : public CppUnit::TestFixture {
public:
+ void testOBoolean();
+ void testOUBoolean();
void testOUInt();
void testOInt();
void testOUFloat();
void testOFloat();
CPPUNIT_TEST_SUITE(valueX);
+ CPPUNIT_TEST(testOBoolean);
+ CPPUNIT_TEST(testOUBoolean);
CPPUNIT_TEST(testOUInt);
CPPUNIT_TEST(testOInt);
CPPUNIT_TEST(testOUFloat);
@@ -34,6 +38,26 @@ public:
CPPUNIT_TEST_SUITE_REGISTRATION(test::strings::valueX);
+namespace {
+
+template< typename T >
+void testBoolean() {
+ CPPUNIT_ASSERT_EQUAL( T( "false" ), T::boolean( false ) );
+ CPPUNIT_ASSERT_EQUAL( T( "false" ), T::boolean( sal_False ) );
+ CPPUNIT_ASSERT_EQUAL( T( "true" ), T::boolean( true ) );
+ CPPUNIT_ASSERT_EQUAL( T( "true" ), T::boolean( sal_True ) );
+}
+
+}
+
+void test::strings::valueX::testOBoolean() {
+ testBoolean<rtl::OString>();
+}
+
+void test::strings::valueX::testOUBoolean() {
+ testBoolean<rtl::OString>();
+}
+
template< typename T >
void testInt() {
CPPUNIT_ASSERT_EQUAL( T( "30039062" ), T::number( 30039062 ));