summaryrefslogtreecommitdiffstats
path: root/sal/qa
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/qa
parentStrings: boolean() as a replacement for valueOf(sal_Bool) (diff)
downloadcore-6ba8a2eab28cbe0967b360a09e1e9d7a7bb7bd26.tar.gz
core-6ba8a2eab28cbe0967b360a09e1e9d7a7bb7bd26.zip
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/qa')
-rw-r--r--sal/qa/rtl/strings/test_strings_valuex.cxx24
1 files changed, 24 insertions, 0 deletions
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 ));