Author: damjan
Date: Wed Sep  2 04:24:01 2015
New Revision: 1700702

URL: http://svn.apache.org/r1700702
Log:
#i125003# migrate main/sal/qa/rtl/ostring from cppunit to Google Test.


Modified:
    openoffice/trunk/main/sal/qa/rtl/ostring/makefile.mk
    openoffice/trunk/main/sal/qa/rtl/ostring/rtl_OString2.cxx
    openoffice/trunk/main/sal/qa/rtl/ostring/rtl_str.cxx
    openoffice/trunk/main/sal/qa/rtl/ostring/rtl_string.cxx

Modified: openoffice/trunk/main/sal/qa/rtl/ostring/makefile.mk
URL: 
http://svn.apache.org/viewvc/openoffice/trunk/main/sal/qa/rtl/ostring/makefile.mk?rev=1700702&r1=1700701&r2=1700702&view=diff
==============================================================================
--- openoffice/trunk/main/sal/qa/rtl/ostring/makefile.mk (original)
+++ openoffice/trunk/main/sal/qa/rtl/ostring/makefile.mk Wed Sep  2 04:24:01 
2015
@@ -33,57 +33,47 @@ ENABLE_EXCEPTIONS=TRUE
 
 .INCLUDE :  settings.mk
 
+.IF "$(ENABLE_UNIT_TESTS)" != "YES"
+all:
+       @echo unit tests are disabled. Nothing to do.
+
+.ELSE
+
 CFLAGS+= $(LFS_CFLAGS)
 CXXFLAGS+= $(LFS_CFLAGS)
 
-CFLAGSCXX += $(CPPUNIT_CFLAGS)
-
 # BEGIN ----------------------------------------------------------------
 # auto generated Target:joblist by codegen.pl
-SHL1OBJS=  \
+APP1OBJS=  \
        $(SLO)$/rtl_OString2.obj
-
-SHL1TARGET= rtl_OString2
-SHL1STDLIBS= $(SALLIB) $(CPPUNITLIB) $(TESTSHL2LIB)
-
-SHL1IMPLIB= i$(SHL1TARGET)
-# SHL1DEF=    $(MISC)$/$(SHL1TARGET).def
-
-DEF1NAME    =$(SHL1TARGET)
-# DEF2EXPORTFILE= export.exp
-SHL1VERSIONMAP= $(PRJ)$/qa$/export.map
+APP1TARGET= rtl_OString2
+APP1STDLIBS= $(SALLIB) $(GTESTLIB) $(TESTSHL2LIB)
+APP1RPATH = NONE
+APP1TEST = enabled
 # auto generated Target:joblist
 # END ------------------------------------------------------------------
 
 # BEGIN ----------------------------------------------------------------
-SHL2OBJS=  \
+APP2OBJS=  \
        $(SLO)$/rtl_str.obj
-
-SHL2TARGET= rtl_str
-SHL2STDLIBS= $(SALLIB) $(CPPUNITLIB) $(TESTSHL2LIB)
-
-SHL2IMPLIB= i$(SHL2TARGET)
-DEF2NAME    =$(SHL2TARGET)
-SHL2VERSIONMAP= $(PRJ)$/qa$/export.map
+APP2TARGET= rtl_str
+APP2STDLIBS= $(SALLIB) $(GTESTLIB) $(TESTSHL2LIB)
+APP2RPATH = NONE
+APP2TEST = enabled
 # END ------------------------------------------------------------------
 
 # BEGIN ----------------------------------------------------------------
-SHL3OBJS=  \
+APP3OBJS=  \
        $(SLO)$/rtl_string.obj
-
-SHL3TARGET= rtl_string
-SHL3STDLIBS= $(SALLIB) $(CPPUNITLIB) $(TESTSHL2LIB)
-
-SHL3IMPLIB= i$(SHL3TARGET)
-DEF3NAME    =$(SHL3TARGET)
-SHL3VERSIONMAP= $(PRJ)$/qa$/export.map
+APP3TARGET= rtl_string
+APP3STDLIBS= $(SALLIB) $(GTESTLIB) $(TESTSHL2LIB)
+APP3RPATH = NONE
+APP3TEST = enabled
 # END ------------------------------------------------------------------
-#------------------------------- All object files 
-------------------------------
-# do this here, so we get right dependencies
-# SLOFILES=$(SHL1OBJS)
 
 # --- Targets ------------------------------------------------------
 
 .INCLUDE :  target.mk
-.INCLUDE : _cppunit.mk
+
+.ENDIF # "$(ENABLE_UNIT_TESTS)" != "YES"
 

Modified: openoffice/trunk/main/sal/qa/rtl/ostring/rtl_OString2.cxx
URL: 
http://svn.apache.org/viewvc/openoffice/trunk/main/sal/qa/rtl/ostring/rtl_OString2.cxx?rev=1700702&r1=1700701&r2=1700702&view=diff
==============================================================================
--- openoffice/trunk/main/sal/qa/rtl/ostring/rtl_OString2.cxx (original)
+++ openoffice/trunk/main/sal/qa/rtl/ostring/rtl_OString2.cxx Wed Sep  2 
04:24:01 2015
@@ -26,25 +26,27 @@
 #include "precompiled_sal.hxx"
 // autogenerated file with codegen.pl
 // There exist some more test code in sal/qa/rtl_strings/rtl_OString.cxx
+#include <rtl/string.hxx>
 
-#include <testshl/simpleheader.hxx>
+#include "gtest/gtest.h"
 #include "valueequal.hxx"
 
 namespace rtl_OString
 {
 
-class valueOf : public CppUnit::TestFixture
+class valueOf : public ::testing::Test
 {
+protected:
     void valueOf_float_test_impl(float _nValue)
         {
             rtl::OString sValue;
             sValue = rtl::OString::valueOf( _nValue );
-            t_print(T_VERBOSE, "nFloat := %.9f  sValue := %s\n", _nValue, 
sValue.getStr());
+            printf("nFloat := %.9f  sValue := %s\n", _nValue, sValue.getStr());
 
             float nValueATOF = static_cast<float>(atof( sValue.getStr() ));
 
             bool bEqualResult = is_float_equal(_nValue, nValueATOF);
-            CPPUNIT_ASSERT_MESSAGE("Values are not equal.", bEqualResult == 
true);
+            ASSERT_TRUE(bEqualResult == true) << "Values are not equal.";
         }
 
     void valueOf_float_test(float _nValue)
@@ -58,71 +60,26 @@ class valueOf : public CppUnit::TestFixt
 
 public:
     // initialise your test code values here.
-    void setUp()
+    void SetUp()
     {
     }
 
-    void tearDown()
+    void TearDown()
     {
     }
 
-    // insert your test code here.
-    void valueOf_float_test_001()
-    {
-        // this is demonstration code
-        // CPPUNIT_ASSERT_MESSAGE("a message", 1 == 1);
-        float nValue = 3.0f;
-        valueOf_float_test(nValue);
-    }
-
-    void valueOf_float_test_002()
-    {
-        float nValue = 3.5f;
-        valueOf_float_test(nValue);
-    }
-
-    void valueOf_float_test_003()
-    {
-        float nValue = 3.0625f;
-        valueOf_float_test(nValue);
-    }
-
-    void valueOf_float_test_004()
-    {
-        float nValue = 3.502525f;
-        valueOf_float_test(nValue);
-    }
-
-    void valueOf_float_test_005()
-    {
-        float nValue = 3.141592f;
-        valueOf_float_test(nValue);
-    }
-
-    void valueOf_float_test_006()
-    {
-        float nValue = 3.5025255f;
-        valueOf_float_test(nValue);
-    }
-
-    void valueOf_float_test_007()
-    {
-        float nValue = 3.0039062f;
-        valueOf_float_test(nValue);
-    }
-
-private:
+protected:
 
     void valueOf_double_test_impl(double _nValue)
         {
             rtl::OString sValue;
             sValue = rtl::OString::valueOf( _nValue );
-            t_print(T_VERBOSE, "nDouble := %.20f  sValue := %s\n", _nValue, 
sValue.getStr());
+            printf("nDouble := %.20f  sValue := %s\n", _nValue, 
sValue.getStr());
 
             double nValueATOF = atof( sValue.getStr() );
 
             bool bEqualResult = is_double_equal(_nValue, nValueATOF);
-            CPPUNIT_ASSERT_MESSAGE("Values are not equal.", bEqualResult == 
true);
+            ASSERT_TRUE(bEqualResult == true) << "Values are not equal.";
         }
 
     void valueOf_double_test(double _nValue)
@@ -133,79 +90,98 @@ private:
             double nNegativeValue = -_nValue;
             valueOf_double_test_impl(nNegativeValue);
         }
-public:
+}; // class valueOf
 
-    // valueOf double
-    void valueOf_double_test_001()
-        {
-            double nValue = 3.0;
-            valueOf_double_test(nValue);
-        }
-    void valueOf_double_test_002()
-        {
-            double nValue = 3.5;
-            valueOf_double_test(nValue);
-        }
-    void valueOf_double_test_003()
-        {
-            double nValue = 3.0625;
-            valueOf_double_test(nValue);
-        }
-    void valueOf_double_test_004()
-        {
-            double nValue = 3.1415926535;
-            valueOf_double_test(nValue);
-        }
-    void valueOf_double_test_005()
-        {
-            double nValue = 3.141592653589793;
-            valueOf_double_test(nValue);
-        }
-    void valueOf_double_test_006()
-        {
-            double nValue = 3.1415926535897932;
-            valueOf_double_test(nValue);
-        }
-    void valueOf_double_test_007()
-        {
-            double nValue = 3.14159265358979323;
-            valueOf_double_test(nValue);
-        }
-    void valueOf_double_test_008()
-        {
-            double nValue = 3.141592653589793238462643;
-            valueOf_double_test(nValue);
-        }
+TEST_F(valueOf, valueOf_float_test_001)
+{
+    // this is demonstration code
+    // ASSERT_TRUE(1 == 1) << "a message";
+    float nValue = 3.0f;
+    valueOf_float_test(nValue);
+}
+
+TEST_F(valueOf, valueOf_float_test_002)
+{
+    float nValue = 3.5f;
+    valueOf_float_test(nValue);
+}
+
+TEST_F(valueOf, valueOf_float_test_003)
+{
+    float nValue = 3.0625f;
+    valueOf_float_test(nValue);
+}
 
+TEST_F(valueOf, valueOf_float_test_004)
+{
+    float nValue = 3.502525f;
+    valueOf_float_test(nValue);
+}
 
-    // Change the following lines only, if you add, remove or rename
-    // member functions of the current class,
-    // because these macros are need by auto register mechanism.
+TEST_F(valueOf, valueOf_float_test_005)
+{
+    float nValue = 3.141592f;
+    valueOf_float_test(nValue);
+}
 
-    CPPUNIT_TEST_SUITE(valueOf);
-    CPPUNIT_TEST(valueOf_float_test_001);
-    CPPUNIT_TEST(valueOf_float_test_002);
-    CPPUNIT_TEST(valueOf_float_test_003);
-    CPPUNIT_TEST(valueOf_float_test_004);
-    CPPUNIT_TEST(valueOf_float_test_005);
-    CPPUNIT_TEST(valueOf_float_test_006);
-    CPPUNIT_TEST(valueOf_float_test_007);
+TEST_F(valueOf, valueOf_float_test_006)
+{
+    float nValue = 3.5025255f;
+    valueOf_float_test(nValue);
+}
+
+TEST_F(valueOf, valueOf_float_test_007)
+{
+    float nValue = 3.0039062f;
+    valueOf_float_test(nValue);
+}
+
+TEST_F(valueOf, valueOf_double_test_001)
+{
+    double nValue = 3.0;
+    valueOf_double_test(nValue);
+}
+TEST_F(valueOf, valueOf_double_test_002)
+{
+    double nValue = 3.5;
+    valueOf_double_test(nValue);
+}
+TEST_F(valueOf, valueOf_double_test_003)
+{
+    double nValue = 3.0625;
+    valueOf_double_test(nValue);
+}
+TEST_F(valueOf, valueOf_double_test_004)
+{
+    double nValue = 3.1415926535;
+    valueOf_double_test(nValue);
+}
+TEST_F(valueOf, valueOf_double_test_005)
+{
+    double nValue = 3.141592653589793;
+    valueOf_double_test(nValue);
+}
+TEST_F(valueOf, valueOf_double_test_006)
+{
+    double nValue = 3.1415926535897932;
+    valueOf_double_test(nValue);
+}
+TEST_F(valueOf, valueOf_double_test_007)
+{
+    double nValue = 3.14159265358979323;
+    valueOf_double_test(nValue);
+}
+TEST_F(valueOf, valueOf_double_test_008)
+{
+    double nValue = 3.141592653589793238462643;
+    valueOf_double_test(nValue);
+}
 
-    CPPUNIT_TEST(valueOf_double_test_001);
-    CPPUNIT_TEST(valueOf_double_test_002);
-    CPPUNIT_TEST(valueOf_double_test_003);
-    CPPUNIT_TEST(valueOf_double_test_004);
-    CPPUNIT_TEST(valueOf_double_test_005);
-    CPPUNIT_TEST(valueOf_double_test_006);
-    CPPUNIT_TEST(valueOf_double_test_007);
-    CPPUNIT_TEST(valueOf_double_test_008);
-    CPPUNIT_TEST_SUITE_END();
-}; // class valueOf
 
 // 
-----------------------------------------------------------------------------
 // - toDouble (tests)
 // 
-----------------------------------------------------------------------------
-class toDouble : public CppUnit::TestFixture
+class toDouble : public ::testing::Test
 {
 
 public:
@@ -218,13 +194,13 @@ public:
 
 
     // initialise your test code values here.
-    void setUp()
+    void SetUp()
         {
         }
 
-    void tearDown()
-        {
-        }
+    void TearDown()
+       {
+       }
 
     void toDouble_test_impl(rtl::OString const& _sValue)
         {
@@ -234,7 +210,7 @@ public:
             double nValueToDouble = _sValue.toDouble();
 
             bool bEqualResult = is_double_equal(nValueToDouble, nValueATOF);
-            CPPUNIT_ASSERT_MESSAGE("Values are not equal.", bEqualResult == 
true);
+            ASSERT_TRUE(bEqualResult == true) << "Values are not equal.";
         }
 
     void toDouble_test(rtl::OString const& _sValue)
@@ -246,226 +222,194 @@ public:
             sNegativValue += _sValue;
             toDouble_test_impl(sNegativValue);
         }
+}; // class toDouble
 
-    // insert your test code here.
-    void toDouble_selftest()
-        {
-            t_print("Start selftest:\n");
-            CPPUNIT_ASSERT (is_double_equal(1.0, 1.01) == false);
-            CPPUNIT_ASSERT (is_double_equal(1.0, 1.001) == false);
-            CPPUNIT_ASSERT (is_double_equal(1.0, 1.0001) == false);
-            CPPUNIT_ASSERT (is_double_equal(1.0, 1.00001) == false);
-            CPPUNIT_ASSERT (is_double_equal(1.0, 1.000001) == false);
-            CPPUNIT_ASSERT (is_double_equal(1.0, 1.0000001) == false);
-            CPPUNIT_ASSERT (is_double_equal(1.0, 1.00000001) == false);
-            CPPUNIT_ASSERT (is_double_equal(1.0, 1.000000001) == false);
-            CPPUNIT_ASSERT (is_double_equal(1.0, 1.0000000001) == false);
-            CPPUNIT_ASSERT (is_double_equal(1.0, 1.00000000001) == false);
-            CPPUNIT_ASSERT (is_double_equal(1.0, 1.000000000001) == false);
-            CPPUNIT_ASSERT (is_double_equal(1.0, 1.0000000000001) == false);
-            // we check til 14 values after comma
-            CPPUNIT_ASSERT (is_double_equal(1.0, 1.00000000000001) == true);
-            CPPUNIT_ASSERT (is_double_equal(1.0, 1.000000000000001) == true);
-            CPPUNIT_ASSERT (is_double_equal(1.0, 1.0000000000000001) == true);
-            t_print("Selftest done.\n");
-        }
-
-    void toDouble_test_3()
-        {
-            rtl::OString sValue("3");
-            toDouble_test(sValue);
-        }
-    void toDouble_test_3_5()
-        {
-            rtl::OString sValue("3.5");
-            toDouble_test(sValue);
-        }
-    void toDouble_test_3_0625()
-        {
-            rtl::OString sValue("3.0625");
-            toDouble_test(sValue);
-        }
-    void toDouble_test_pi()
-        {
-            // value from http://www.angio.net/pi/digits/50.txt
-            rtl::OString 
sValue("3.141592653589793238462643383279502884197169399375");
-            toDouble_test(sValue);
-        }
-
-    void toDouble_test_1()
-        {
-            rtl::OString sValue("1");
-            toDouble_test(sValue);
-        }
-    void toDouble_test_10()
-        {
-            rtl::OString sValue("10");
-            toDouble_test(sValue);
-        }
-    void toDouble_test_100()
-        {
-            rtl::OString sValue("100");
-            toDouble_test(sValue);
-        }
-    void toDouble_test_1000()
-        {
-            rtl::OString sValue("1000");
-            toDouble_test(sValue);
-        }
-    void toDouble_test_10000()
-        {
-            rtl::OString sValue("10000");
-            toDouble_test(sValue);
-        }
-    void toDouble_test_1e99()
-        {
-            rtl::OString sValue("1e99");
-            toDouble_test(sValue);
-        }
-    void toDouble_test_1e_n99()
-        {
-            rtl::OString sValue("1e-99");
-            toDouble_test(sValue);
-        }
-    void toDouble_test_1e308()
-        {
-            rtl::OString sValue("1e308");
-            toDouble_test(sValue);
-        }
-
-    // Change the following lines only, if you add, remove or rename
-    // member functions of the current class,
-    // because these macros are need by auto register mechanism.
+TEST_F(toDouble, toDouble_selftest)
+{
+    printf("Start selftest:\n");
+    ASSERT_TRUE (is_double_equal(1.0, 1.01) == false);
+    ASSERT_TRUE (is_double_equal(1.0, 1.001) == false);
+    ASSERT_TRUE (is_double_equal(1.0, 1.0001) == false);
+    ASSERT_TRUE (is_double_equal(1.0, 1.00001) == false);
+    ASSERT_TRUE (is_double_equal(1.0, 1.000001) == false);
+    ASSERT_TRUE (is_double_equal(1.0, 1.0000001) == false);
+    ASSERT_TRUE (is_double_equal(1.0, 1.00000001) == false);
+    ASSERT_TRUE (is_double_equal(1.0, 1.000000001) == false);
+    ASSERT_TRUE (is_double_equal(1.0, 1.0000000001) == false);
+    ASSERT_TRUE (is_double_equal(1.0, 1.00000000001) == false);
+    ASSERT_TRUE (is_double_equal(1.0, 1.000000000001) == false);
+    ASSERT_TRUE (is_double_equal(1.0, 1.0000000000001) == false);
+    // we check til 14 values after comma
+    ASSERT_TRUE (is_double_equal(1.0, 1.00000000000001) == true);
+    ASSERT_TRUE (is_double_equal(1.0, 1.000000000000001) == true);
+    ASSERT_TRUE (is_double_equal(1.0, 1.0000000000000001) == true);
+    printf("Selftest done.\n");
+}
 
-    CPPUNIT_TEST_SUITE(toDouble);
-    CPPUNIT_TEST(toDouble_selftest);
+TEST_F(toDouble, toDouble_test_3)
+{
+    rtl::OString sValue("3");
+    toDouble_test(sValue);
+}
+TEST_F(toDouble, toDouble_test_3_5)
+{
+    rtl::OString sValue("3.5");
+    toDouble_test(sValue);
+}
+TEST_F(toDouble, toDouble_test_3_0625)
+{
+    rtl::OString sValue("3.0625");
+    toDouble_test(sValue);
+}
+TEST_F(toDouble, toDouble_test_pi)
+{
+    // value from http://www.angio.net/pi/digits/50.txt
+    rtl::OString sValue("3.141592653589793238462643383279502884197169399375");
+    toDouble_test(sValue);
+}
 
-    CPPUNIT_TEST(toDouble_test_3);
-    CPPUNIT_TEST(toDouble_test_3_5);
-    CPPUNIT_TEST(toDouble_test_3_0625);
-    CPPUNIT_TEST(toDouble_test_pi);
-    CPPUNIT_TEST(toDouble_test_1);
-    CPPUNIT_TEST(toDouble_test_10);
-    CPPUNIT_TEST(toDouble_test_100);
-    CPPUNIT_TEST(toDouble_test_1000);
-    CPPUNIT_TEST(toDouble_test_10000);
-    CPPUNIT_TEST(toDouble_test_1e99);
-    CPPUNIT_TEST(toDouble_test_1e_n99);
-    CPPUNIT_TEST(toDouble_test_1e308);
-    CPPUNIT_TEST_SUITE_END();
-}; // class toDouble
+TEST_F(toDouble, toDouble_test_1)
+{
+    rtl::OString sValue("1");
+    toDouble_test(sValue);
+}
+TEST_F(toDouble, toDouble_test_10)
+{
+    rtl::OString sValue("10");
+    toDouble_test(sValue);
+}
+TEST_F(toDouble, toDouble_test_100)
+{
+    rtl::OString sValue("100");
+    toDouble_test(sValue);
+}
+TEST_F(toDouble, toDouble_test_1000)
+{
+    rtl::OString sValue("1000");
+    toDouble_test(sValue);
+}
+TEST_F(toDouble, toDouble_test_10000)
+{
+    rtl::OString sValue("10000");
+    toDouble_test(sValue);
+}
+TEST_F(toDouble, toDouble_test_1e99)
+{
+    rtl::OString sValue("1e99");
+    toDouble_test(sValue);
+}
+TEST_F(toDouble, toDouble_test_1e_n99)
+{
+    rtl::OString sValue("1e-99");
+    toDouble_test(sValue);
+}
+TEST_F(toDouble, toDouble_test_1e308)
+{
+    rtl::OString sValue("1e308");
+    toDouble_test(sValue);
+}
 
 // 
-----------------------------------------------------------------------------
 // - getToken (tests)
 // 
-----------------------------------------------------------------------------
-class getToken : public CppUnit::TestFixture
+class getToken : public ::testing::Test
 {
 
 public:
 
     // initialise your test code values here.
-    void setUp()
+    void SetUp()
         {
         }
 
-    void tearDown()
+    void TearDown()
         {
         }
+}; // class getToken
 
-    // 
-----------------------------------------------------------------------------
-
-    void getToken_000()
-        {
-            rtl::OString sTokenStr;
-
-            sal_Int32 nIndex = 0;
-            do
-            {
-                rtl::OString sToken = sTokenStr.getToken( 0, ';', nIndex );
-            }
-            while ( nIndex >= 0 );
-            // t_print("Index %d\n", nIndex);
-            // should not GPF
-        }
 
-    void getToken_001()
-        {
-            rtl::OString sTokenStr = "a;b";
+TEST_F(getToken, getToken_000)
+{
+    rtl::OString sTokenStr;
 
-            sal_Int32 nIndex = 0;
+    sal_Int32 nIndex = 0;
+    do
+    {
+        rtl::OString sToken = sTokenStr.getToken( 0, ';', nIndex );
+    }
+    while ( nIndex >= 0 );
+    // printf("Index %d\n", nIndex);
+    // should not GPF
+}
 
-            rtl::OString sToken = sTokenStr.getToken( 0, ';', nIndex );
-            CPPUNIT_ASSERT_MESSAGE("Token should be a 'a'", sToken.equals("a") 
== sal_True);
+TEST_F(getToken, getToken_001)
+{
+    rtl::OString sTokenStr = "a;b";
 
-            /* rtl::OString */ sToken = sTokenStr.getToken( 0, ';', nIndex );
-            CPPUNIT_ASSERT_MESSAGE("Token should be a 'b'", sToken.equals("b") 
== sal_True);
-            CPPUNIT_ASSERT_MESSAGE("index should be negative", nIndex == -1);
-        }
+    sal_Int32 nIndex = 0;
 
-    void getToken_002()
-        {
-            rtl::OString sTokenStr = "a;b.c";
+    rtl::OString sToken = sTokenStr.getToken( 0, ';', nIndex );
+    ASSERT_TRUE(sToken.equals("a") == sal_True) << "Token should be a 'a'";
 
-            sal_Int32 nIndex = 0;
+    /* rtl::OString */ sToken = sTokenStr.getToken( 0, ';', nIndex );
+    ASSERT_TRUE(sToken.equals("b") == sal_True) << "Token should be a 'b'";
+    ASSERT_TRUE(nIndex == -1) << "index should be negative";
+}
 
-            rtl::OString sToken = sTokenStr.getToken( 0, ';', nIndex );
-            CPPUNIT_ASSERT_MESSAGE("Token should be a 'a'", sToken.equals("a") 
== sal_True);
+TEST_F(getToken, getToken_002)
+{
+    rtl::OString sTokenStr = "a;b.c";
 
-            /* rtl::OString */ sToken = sTokenStr.getToken( 0, '.', nIndex );
-            CPPUNIT_ASSERT_MESSAGE("Token should be a 'b'", sToken.equals("b") 
== sal_True);
+    sal_Int32 nIndex = 0;
 
-            /* rtl::OString */ sToken = sTokenStr.getToken( 0, '.', nIndex );
-            CPPUNIT_ASSERT_MESSAGE("Token should be a 'c'", sToken.equals("c") 
== sal_True);
-            CPPUNIT_ASSERT_MESSAGE("index should be negative", nIndex == -1);
-        }
+    rtl::OString sToken = sTokenStr.getToken( 0, ';', nIndex );
+    ASSERT_TRUE(sToken.equals("a") == sal_True) << "Token should be a 'a'";
 
-    void getToken_003()
-        {
-            rtl::OString sTokenStr = "a;;b";
+    /* rtl::OString */ sToken = sTokenStr.getToken( 0, '.', nIndex );
+    ASSERT_TRUE(sToken.equals("b") == sal_True) << "Token should be a 'b'";
 
-            sal_Int32 nIndex = 0;
+    /* rtl::OString */ sToken = sTokenStr.getToken( 0, '.', nIndex );
+    ASSERT_TRUE(sToken.equals("c") == sal_True) << "Token should be a 'c'";
+    ASSERT_TRUE(nIndex == -1) << "index should be negative";
+}
 
-            rtl::OString sToken = sTokenStr.getToken( 0, ';', nIndex );
-            CPPUNIT_ASSERT_MESSAGE("Token should be a 'a'", sToken.equals("a") 
== sal_True);
+TEST_F(getToken, getToken_003)
+{
+    rtl::OString sTokenStr = "a;;b";
 
-            /* rtl::OString */ sToken = sTokenStr.getToken( 0, ';', nIndex );
-            CPPUNIT_ASSERT_MESSAGE("Token should be empty", sToken.getLength() 
== 0);
+    sal_Int32 nIndex = 0;
 
-            /* rtl::OString */ sToken = sTokenStr.getToken( 0, ';', nIndex );
-            CPPUNIT_ASSERT_MESSAGE("Token should be a 'b'", sToken.equals("b") 
== sal_True);
-            CPPUNIT_ASSERT_MESSAGE("index should be negative", nIndex == -1);
-        }
+    rtl::OString sToken = sTokenStr.getToken( 0, ';', nIndex );
+    ASSERT_TRUE(sToken.equals("a") == sal_True) << "Token should be a 'a'";
 
-    void getToken_004()
-        {
-            rtl::OString sTokenStr = "longer.then.ever.";
+    /* rtl::OString */ sToken = sTokenStr.getToken( 0, ';', nIndex );
+    ASSERT_TRUE(sToken.getLength() == 0) << "Token should be empty";
 
-            sal_Int32 nIndex = 0;
+    /* rtl::OString */ sToken = sTokenStr.getToken( 0, ';', nIndex );
+    ASSERT_TRUE(sToken.equals("b") == sal_True) << "Token should be a 'b'";
+    ASSERT_TRUE(nIndex == -1) << "index should be negative";
+}
 
-            rtl::OString sToken = sTokenStr.getToken( 0, '.', nIndex );
-            CPPUNIT_ASSERT_MESSAGE("Token should be 'longer'", 
sToken.equals("longer") == sal_True);
+TEST_F(getToken, getToken_004)
+{
+    rtl::OString sTokenStr = "longer.then.ever.";
 
-            /* rtl::OString */ sToken = sTokenStr.getToken( 0, '.', nIndex );
-            CPPUNIT_ASSERT_MESSAGE("Token should be 'then'", 
sToken.equals("then") == sal_True);
+    sal_Int32 nIndex = 0;
 
-            /* rtl::OString */ sToken = sTokenStr.getToken( 0, '.', nIndex );
-            CPPUNIT_ASSERT_MESSAGE("Token should be 'ever'", 
sToken.equals("ever") == sal_True);
+    rtl::OString sToken = sTokenStr.getToken( 0, '.', nIndex );
+    ASSERT_TRUE(sToken.equals("longer") == sal_True) << "Token should be 
'longer'";
 
-            /* rtl::OString */ sToken = sTokenStr.getToken( 0, '.', nIndex );
-            CPPUNIT_ASSERT_MESSAGE("Token should be empty", sToken.getLength() 
== 0);
+    /* rtl::OString */ sToken = sTokenStr.getToken( 0, '.', nIndex );
+    ASSERT_TRUE(sToken.equals("then") == sal_True) << "Token should be 'then'";
 
-            CPPUNIT_ASSERT_MESSAGE("index should be negative", nIndex == -1);
-        }
+    /* rtl::OString */ sToken = sTokenStr.getToken( 0, '.', nIndex );
+    ASSERT_TRUE(sToken.equals("ever") == sal_True) << "Token should be 'ever'";
 
+    /* rtl::OString */ sToken = sTokenStr.getToken( 0, '.', nIndex );
+    ASSERT_TRUE(sToken.getLength() == 0) << "Token should be empty";
 
-    CPPUNIT_TEST_SUITE(getToken);
-    CPPUNIT_TEST(getToken_000);
-    CPPUNIT_TEST(getToken_001);
-    CPPUNIT_TEST(getToken_002);
-    CPPUNIT_TEST(getToken_003);
-    CPPUNIT_TEST(getToken_004);
-    CPPUNIT_TEST_SUITE_END();
-}; // class getToken
+    ASSERT_TRUE(nIndex == -1) << "index should be negative";
+}
 
 // 
-----------------------------------------------------------------------------
 // testing the method replaceAt( sal_Int32 index, sal_Int32 count,
@@ -475,16 +419,16 @@ public:
 // Developer note: Mindy Liu, 2004-04-23
 // stollen from sal/qa/rtl_strings/rtl_OString.cxx
 
-class replaceAt : public CppUnit::TestFixture
+class replaceAt : public ::testing::Test
 {
 
 public:
     // initialise your test code values here.
-    void setUp()
+    void SetUp()
         {
         }
 
-    void tearDown()
+    void TearDown()
         {
         }
     sal_Bool check_replaceAt( const rtl::OString* expVal, const rtl::OString* 
input,
@@ -493,72 +437,55 @@ public:
         ::rtl::OString aStr1;
         aStr1= input->replaceAt( index, count, *newStr );
 
-        t_print("the result OString is %s#\n", aStr1.getStr() );
+        printf("the result OString is %s#\n", aStr1.getStr() );
 
         sal_Bool bRes = ( expVal->compareTo(aStr1) == 0 );
         return bRes;
     }
-    // 
-----------------------------------------------------------------------------
-
-   void replaceAt_001()
-        {
-           sal_Bool bRes = check_replaceAt(new rtl::OString("Java@Sun"),
-                       new rtl::OString("Sun java"), new 
rtl::OString("Java@Sun"), 0, 8 );
-            CPPUNIT_ASSERT_MESSAGE("string differs, replace whole string", 
bRes == sal_True);
-        }
-
-    void replaceAt_002()
-        {
-            sal_Bool bRes = check_replaceAt(new rtl::OString("Sun Java desktop 
system"),
-                       new rtl::OString("Sun "), new rtl::OString("Java 
desktop system"), 10, 8 );
-            CPPUNIT_ASSERT_MESSAGE("index > length of input string", bRes == 
sal_True);
-        }
-
-    void replaceAt_003()
-        {
-            sal_Bool bRes = check_replaceAt(new rtl::OString("SuJava desktop 
system"),
-                       new rtl::OString("Sun "), new rtl::OString("Java 
desktop system"), 2, 64 );
-            CPPUNIT_ASSERT_MESSAGE("larger count", bRes == sal_True);
-        }
+}; // class replaceAt
 
-    void replaceAt_004()
-        {
+TEST_F(replaceAt, replaceAt_001)
+{
+    sal_Bool bRes = check_replaceAt(new rtl::OString("Java@Sun"),
+               new rtl::OString("Sun java"), new rtl::OString("Java@Sun"), 0, 
8 );
+    ASSERT_TRUE(bRes == sal_True) << "string differs, replace whole string";
+}
 
-            sal_Bool bRes = check_replaceAt(new rtl::OString("Java desktop 
system"),
-                       new rtl::OString("Sun "), new rtl::OString("Java 
desktop system"), -4, 8 );
-            CPPUNIT_ASSERT_MESSAGE("navigate index", bRes == sal_True);
-        }
-    void replaceAt_005()
-        {
+TEST_F(replaceAt, replaceAt_002)
+{
+    sal_Bool bRes = check_replaceAt(new rtl::OString("Sun Java desktop 
system"),
+               new rtl::OString("Sun "), new rtl::OString("Java desktop 
system"), 10, 8 );
+    ASSERT_TRUE(bRes == sal_True) << "index > length of input string";
+}
 
-            sal_Bool bRes = check_replaceAt(new rtl::OString("Sun Jesktop 
System"),
-                       new rtl::OString("Sun Java Desktop System"), new 
rtl::OString(""), 5, 5 );
-            CPPUNIT_ASSERT_MESSAGE("replace with null string", bRes == 
sal_True);
-        }
+TEST_F(replaceAt, replaceAt_003)
+{
+    sal_Bool bRes = check_replaceAt(new rtl::OString("SuJava desktop system"),
+               new rtl::OString("Sun "), new rtl::OString("Java desktop 
system"), 2, 64 );
+    ASSERT_TRUE(bRes == sal_True) << "larger count";
+}
 
+TEST_F(replaceAt, replaceAt_004)
+{
 
-    CPPUNIT_TEST_SUITE(replaceAt);
-    CPPUNIT_TEST(replaceAt_001);
-    CPPUNIT_TEST(replaceAt_002);
-    CPPUNIT_TEST(replaceAt_003);
-    CPPUNIT_TEST(replaceAt_004);
-    CPPUNIT_TEST(replaceAt_005);
-    CPPUNIT_TEST_SUITE_END();
-}; // class replaceAt
+    sal_Bool bRes = check_replaceAt(new rtl::OString("Java desktop system"),
+               new rtl::OString("Sun "), new rtl::OString("Java desktop 
system"), -4, 8 );
+    ASSERT_TRUE(bRes == sal_True) << "navigate index";
+}
+TEST_F(replaceAt, replaceAt_005)
+{
 
+    sal_Bool bRes = check_replaceAt(new rtl::OString("Sun Jesktop System"),
+               new rtl::OString("Sun Java Desktop System"), new 
rtl::OString(""), 5, 5 );
+    ASSERT_TRUE(bRes == sal_True) << "replace with null string";
+}
 
-// 
-----------------------------------------------------------------------------
-CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(rtl_OString::valueOf, "rtl_OString");
-CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(rtl_OString::toDouble, "rtl_OString");
-CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(rtl_OString::getToken, "rtl_OString");
-CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(rtl_OString::replaceAt, "rtl_OString");
 
 } // namespace rtl_OString
 
 
-// 
-----------------------------------------------------------------------------
-
-// this macro creates an empty function, which will called by the 
RegisterAllFunctions()
-// to let the user the possibility to also register some functions by hand.
-NOADDITIONAL;
-
+int main(int argc, char **argv)
+{
+    ::testing::InitGoogleTest(&argc, argv);
+    return RUN_ALL_TESTS();
+}

Modified: openoffice/trunk/main/sal/qa/rtl/ostring/rtl_str.cxx
URL: 
http://svn.apache.org/viewvc/openoffice/trunk/main/sal/qa/rtl/ostring/rtl_str.cxx?rev=1700702&r1=1700701&r2=1700702&view=diff
==============================================================================
--- openoffice/trunk/main/sal/qa/rtl/ostring/rtl_str.cxx (original)
+++ openoffice/trunk/main/sal/qa/rtl/ostring/rtl_str.cxx Wed Sep  2 04:24:01 
2015
@@ -24,863 +24,666 @@
 
 // MARKER(update_precomp.py): autogen include statement, do not remove
 #include "precompiled_sal.hxx"
-#include <testshl/simpleheader.hxx>
+#include "gtest/gtest.h"
+#include <rtl/string.hxx>
 
 namespace rtl_str
 {
 
-    class compare : public CppUnit::TestFixture
+    class compare : public ::testing::Test
     {
     public:
+    }; // class compare
 
-        void compare_000()
-            {
-                rtl_str_compare( NULL, NULL);
-            }
-
-        void compare_000_1()
-            {
-                rtl::OString aStr1 = "Line must be equal.";
-                rtl_str_compare( aStr1.getStr(), NULL);
-            }
-        void compare_001()
-            {
-                rtl::OString aStr1 = "";
-                rtl::OString aStr2 = "";
-
-                sal_Int32 nValue = rtl_str_compare( aStr1.getStr(), 
aStr2.getStr());
-                CPPUNIT_ASSERT_MESSAGE("compare failed, strings are equal.", 
nValue == 0);
-            }
-
-        void compare_002()
-            {
-                rtl::OString aStr1 = "Line must be equal.";
-                rtl::OString aStr2 = "Line must be equal.";
-
-                sal_Int32 nValue = rtl_str_compare( aStr1.getStr(), 
aStr2.getStr());
-                CPPUNIT_ASSERT_MESSAGE("compare failed, strings are equal.", 
nValue == 0);
-            }
-
-        void compare_003()
-            {
-                rtl::OString aStr1 = "Line must differ.";
-                rtl::OString aStr2 = "Line foo bar, ok, differ.";
-
-                sal_Int32 nValue = rtl_str_compare( aStr1.getStr(), 
aStr2.getStr());
-                CPPUNIT_ASSERT_MESSAGE("compare failed, strings differ.", 
nValue != 0);
-            }
-
-    // Change the following lines only, if you add, remove or rename
-    // member functions of the current class,
-    // because these macros are need by auto register mechanism.
-
-    CPPUNIT_TEST_SUITE(compare);
-    CPPUNIT_TEST(compare_000);
-    CPPUNIT_TEST(compare_000_1);
-    CPPUNIT_TEST(compare_001);
-    CPPUNIT_TEST(compare_002);
-    CPPUNIT_TEST(compare_003);
-    CPPUNIT_TEST_SUITE_END();
-}; // class compare
-
-
-    class compareIgnoreAsciiCase : public CppUnit::TestFixture
-    {
-    public:
-
-        void compare_000()
-            {
-                rtl_str_compareIgnoreAsciiCase( NULL, NULL);
-            }
-
-        void compare_000_1()
-            {
-                rtl::OString aStr1 = "Line must be equal.";
-                rtl_str_compareIgnoreAsciiCase( aStr1.getStr(), NULL);
-            }
-        void compare_001()
-            {
-                rtl::OString aStr1 = "";
-                rtl::OString aStr2 = "";
-
-                sal_Int32 nValue = rtl_str_compareIgnoreAsciiCase( 
aStr1.getStr(), aStr2.getStr());
-                CPPUNIT_ASSERT_MESSAGE("compare failed, strings are equal.", 
nValue == 0);
-            }
-
-        void compare_002()
-            {
-                rtl::OString aStr1 = "Line must be equal.";
-                rtl::OString aStr2 = "Line must be equal.";
-
-                sal_Int32 nValue = rtl_str_compareIgnoreAsciiCase( 
aStr1.getStr(), aStr2.getStr());
-                CPPUNIT_ASSERT_MESSAGE("compare failed, strings are equal.", 
nValue == 0);
-            }
-
-        void compare_002_1()
-            {
-                rtl::OString aStr1 = "Line must be equal.";
-                rtl::OString aStr2 = "LINE MUST BE EQUAL.";
-
-                sal_Int32 nValue = rtl_str_compareIgnoreAsciiCase( 
aStr1.getStr(), aStr2.getStr());
-                CPPUNIT_ASSERT_MESSAGE("compare failed, strings are equal (if 
case insensitve).", nValue == 0);
-            }
-
-        void compare_003()
-            {
-                rtl::OString aStr1 = "Line must differ.";
-                rtl::OString aStr2 = "Line foo bar, ok, differ.";
-
-                sal_Int32 nValue = rtl_str_compareIgnoreAsciiCase( 
aStr1.getStr(), aStr2.getStr());
-                CPPUNIT_ASSERT_MESSAGE("compare failed, strings differ.", 
nValue != 0);
-            }
-
-    // Change the following lines only, if you add, remove or rename
-    // member functions of the current class,
-    // because these macros are need by auto register mechanism.
-
-    CPPUNIT_TEST_SUITE(compareIgnoreAsciiCase);
-    CPPUNIT_TEST(compare_000);
-    CPPUNIT_TEST(compare_000_1);
-    CPPUNIT_TEST(compare_001);
-    CPPUNIT_TEST(compare_002);
-    CPPUNIT_TEST(compare_002_1);
-    CPPUNIT_TEST(compare_003);
-    CPPUNIT_TEST_SUITE_END();
-    }; // class compareIgnoreAsciiCase
+    TEST_F(compare, compare_000)
+    {
+        rtl_str_compare( NULL, NULL);
+    }
 
-// 
-----------------------------------------------------------------------------
+    TEST_F(compare, compare_000_1)
+    {
+        rtl::OString aStr1 = "Line must be equal.";
+        rtl_str_compare( aStr1.getStr(), NULL);
+    }
+    TEST_F(compare, compare_001)
+    {
+        rtl::OString aStr1 = "";
+        rtl::OString aStr2 = "";
+
+        sal_Int32 nValue = rtl_str_compare( aStr1.getStr(), aStr2.getStr());
+        ASSERT_TRUE(nValue == 0) << "compare failed, strings are equal.";
+    }
 
-    class shortenedCompareIgnoreAsciiCase_WithLength : public 
CppUnit::TestFixture
+    TEST_F(compare, compare_002)
     {
-    public:
+        rtl::OString aStr1 = "Line must be equal.";
+        rtl::OString aStr2 = "Line must be equal.";
 
-        void compare_000()
-            {
-                rtl_str_shortenedCompareIgnoreAsciiCase_WithLength( NULL, 0, 
NULL, 0, 0);
-            }
-
-        void compare_000_1()
-            {
-                rtl::OString aStr1 = "Line must be equal.";
-                rtl_str_shortenedCompareIgnoreAsciiCase_WithLength( 
aStr1.getStr(), aStr1.getLength(), NULL, 0, 1);
-            }
-        void compare_001()
-            {
-                rtl::OString aStr1 = "";
-                rtl::OString aStr2 = "";
-
-                sal_Int32 nValue = 
rtl_str_shortenedCompareIgnoreAsciiCase_WithLength( aStr1.getStr(), 
aStr1.getLength(), aStr2.getStr(), aStr2.getLength(), aStr1.getLength());
-                CPPUNIT_ASSERT_MESSAGE("compare failed, strings are equal.", 
nValue == 0);
-            }
-
-        void compare_002()
-            {
-                rtl::OString aStr1 = "Line must be equal.";
-                rtl::OString aStr2 = "Line must be equal.";
-
-                sal_Int32 nValue = 
rtl_str_shortenedCompareIgnoreAsciiCase_WithLength( aStr1.getStr(), 
aStr1.getLength(),
-                                                                               
        aStr2.getStr(), aStr2.getLength(),
-                                                                               
        aStr1.getLength());
-                CPPUNIT_ASSERT_MESSAGE("compare failed, strings are equal.", 
nValue == 0);
-            }
-
-        void compare_002_1()
-            {
-                rtl::OString aStr1 = "Line must be equal.";
-                rtl::OString aStr2 = "LINE MUST BE EQUAL.";
-
-                sal_Int32 nValue = 
rtl_str_shortenedCompareIgnoreAsciiCase_WithLength( aStr1.getStr(), 
aStr1.getLength(),
-                                                                               
        aStr2.getStr(), aStr2.getLength(),
-                                                                               
        aStr1.getLength());
-                CPPUNIT_ASSERT_MESSAGE("compare failed, strings are equal (if 
case insensitve).", nValue == 0);
-            }
-
-        void compare_003()
-            {
-                rtl::OString aStr1 = "Line must differ.";
-                rtl::OString aStr2 = "Line foo bar, ok, differ.";
-
-                sal_Int32 nValue = 
rtl_str_shortenedCompareIgnoreAsciiCase_WithLength( aStr1.getStr(), 
aStr1.getLength(),
-                                                                               
        aStr2.getStr(), aStr2.getLength(),
-                                                                               
        5);
-                CPPUNIT_ASSERT_MESSAGE("compare failed, strings are equal 
first 5 characters.", nValue == 0);
-            }
-
-        void compare_004()
-            {
-                rtl::OString aStr1 = "Line must differ.";
-                rtl::OString aStr2 = "Line foo bar, ok, differ.";
-
-                sal_Int32 nValue = 
rtl_str_shortenedCompareIgnoreAsciiCase_WithLength( aStr1.getStr(), 
aStr1.getLength(),
-                                                                               
        aStr2.getStr(), aStr2.getLength(),
-                                                                               
        aStr1.getLength());
-                CPPUNIT_ASSERT_MESSAGE("compare failed, strings differ.", 
nValue != 0);
-            }
-
-    // Change the following lines only, if you add, remove or rename
-    // member functions of the current class,
-    // because these macros are need by auto register mechanism.
-
-    CPPUNIT_TEST_SUITE(shortenedCompareIgnoreAsciiCase_WithLength);
-    CPPUNIT_TEST(compare_000);
-    CPPUNIT_TEST(compare_000_1);
-    CPPUNIT_TEST(compare_001);
-    CPPUNIT_TEST(compare_002);
-    CPPUNIT_TEST(compare_002_1);
-    CPPUNIT_TEST(compare_003);
-    CPPUNIT_TEST(compare_004);
-    CPPUNIT_TEST_SUITE_END();
-}; // class compare
+        sal_Int32 nValue = rtl_str_compare( aStr1.getStr(), aStr2.getStr());
+        ASSERT_TRUE(nValue == 0) << "compare failed, strings are equal.";
+    }
 
+    TEST_F(compare, compare_003)
+    {
+        rtl::OString aStr1 = "Line must differ.";
+        rtl::OString aStr2 = "Line foo bar, ok, differ.";
 
-// 
-----------------------------------------------------------------------------
+        sal_Int32 nValue = rtl_str_compare( aStr1.getStr(), aStr2.getStr());
+        ASSERT_TRUE(nValue != 0) << "compare failed, strings differ.";
+    }
 
-    class hashCode : public CppUnit::TestFixture
+    class compareIgnoreAsciiCase : public ::testing::Test
     {
     public:
+    }; // class compareIgnoreAsciiCase
 
-        void hashCode_000()
-            {
-                rtl_str_hashCode( NULL );
-            }
-
-        void hashCode_001()
-            {
-                rtl::OString aStr1 = "Line for a hashCode.";
-                sal_Int32 nHashCode = rtl_str_hashCode( aStr1.getStr() );
-                t_print("hashcode: %d\n", nHashCode);
-                // CPPUNIT_ASSERT_MESSAGE("failed.", nValue == 0);
-            }
-
-        void hashCode_002()
-            {
-                rtl::OString aStr1 = "Line for a hashCode.";
-                sal_Int32 nHashCode1 = rtl_str_hashCode( aStr1.getStr() );
-
-                rtl::OString aStr2 = "Line for a hashCode.";
-                sal_Int32 nHashCode2 = rtl_str_hashCode( aStr2.getStr() );
-
-                CPPUNIT_ASSERT_MESSAGE("hashcodes must be equal.", nHashCode1 
== nHashCode2 );
-            }
-
-        void hashCode_003()
-            {
-                rtl::OString aStr1 = "Line for a hashCode.";
-                sal_Int32 nHashCode1 = rtl_str_hashCode( aStr1.getStr() );
-
-                rtl::OString aStr2 = "Line for an other hashcode.";
-                sal_Int32 nHashCode2 = rtl_str_hashCode( aStr2.getStr() );
-
-                CPPUNIT_ASSERT_MESSAGE("hashcodes must differ.", nHashCode1 != 
nHashCode2 );
-            }
-
-        // Change the following lines only, if you add, remove or rename
-        // member functions of the current class,
-        // because these macros are need by auto register mechanism.
-
-        CPPUNIT_TEST_SUITE(hashCode);
-        CPPUNIT_TEST(hashCode_000);
-        CPPUNIT_TEST(hashCode_001);
-        CPPUNIT_TEST(hashCode_002);
-        CPPUNIT_TEST(hashCode_003);
-        CPPUNIT_TEST_SUITE_END();
-    }; // class compare
+    TEST_F(compareIgnoreAsciiCase, compare_000)
+    {
+        rtl_str_compareIgnoreAsciiCase( NULL, NULL);
+    }
+
+    TEST_F(compareIgnoreAsciiCase, compare_000_1)
+    {
+        rtl::OString aStr1 = "Line must be equal.";
+        rtl_str_compareIgnoreAsciiCase( aStr1.getStr(), NULL);
+    }
+    TEST_F(compareIgnoreAsciiCase, compare_001)
+    {
+        rtl::OString aStr1 = "";
+        rtl::OString aStr2 = "";
+
+        sal_Int32 nValue = rtl_str_compareIgnoreAsciiCase( aStr1.getStr(), 
aStr2.getStr());
+        ASSERT_TRUE(nValue == 0) << "compare failed, strings are equal.";
+    }
+
+    TEST_F(compareIgnoreAsciiCase, compare_002)
+    {
+        rtl::OString aStr1 = "Line must be equal.";
+        rtl::OString aStr2 = "Line must be equal.";
 
+        sal_Int32 nValue = rtl_str_compareIgnoreAsciiCase( aStr1.getStr(), 
aStr2.getStr());
+        ASSERT_TRUE(nValue == 0) << "compare failed, strings are equal.";
+    }
 
+    TEST_F(compareIgnoreAsciiCase, compare_002_1)
+    {
+        rtl::OString aStr1 = "Line must be equal.";
+        rtl::OString aStr2 = "LINE MUST BE EQUAL.";
+
+        sal_Int32 nValue = rtl_str_compareIgnoreAsciiCase( aStr1.getStr(), 
aStr2.getStr());
+        ASSERT_TRUE(nValue == 0) << "compare failed, strings are equal (if 
case insensitve).";
+    }
+
+    TEST_F(compareIgnoreAsciiCase, compare_003)
+    {
+        rtl::OString aStr1 = "Line must differ.";
+        rtl::OString aStr2 = "Line foo bar, ok, differ.";
+
+        sal_Int32 nValue = rtl_str_compareIgnoreAsciiCase( aStr1.getStr(), 
aStr2.getStr());
+        ASSERT_TRUE(nValue != 0) << "compare failed, strings differ.";
+    }
 // 
-----------------------------------------------------------------------------
 
-    class indexOfChar : public CppUnit::TestFixture
+    class shortenedCompareIgnoreAsciiCase_WithLength : public ::testing::Test
     {
     public:
+    }; // class compare
 
-        void indexOfChar_000()
-            {
-                rtl_str_indexOfChar( NULL, 0 );
-            }
-
-        void indexOfChar_001()
-            {
-                rtl::OString aStr1 = "Line for a indexOfChar.";
+    TEST_F(shortenedCompareIgnoreAsciiCase_WithLength, compare_000)
+    {
+        rtl_str_shortenedCompareIgnoreAsciiCase_WithLength( NULL, 0, NULL, 0, 
0);
+    }
 
-                sal_Int32 nIndex = rtl_str_indexOfChar( aStr1.getStr(), 'L' );
-                CPPUNIT_ASSERT_MESSAGE("index is wrong.", nIndex == 0);
+    TEST_F(shortenedCompareIgnoreAsciiCase_WithLength, compare_000_1)
+    {
+        rtl::OString aStr1 = "Line must be equal.";
+        rtl_str_shortenedCompareIgnoreAsciiCase_WithLength( aStr1.getStr(), 
aStr1.getLength(), NULL, 0, 1);
+    }
+    TEST_F(shortenedCompareIgnoreAsciiCase_WithLength, compare_001)
+    {
+        rtl::OString aStr1 = "";
+        rtl::OString aStr2 = "";
 
-                /* sal_Int32 */ nIndex = rtl_str_indexOfChar( aStr1.getStr(), 
'i' );
-                CPPUNIT_ASSERT_MESSAGE("index is wrong.", nIndex == 1);
+        sal_Int32 nValue = rtl_str_shortenedCompareIgnoreAsciiCase_WithLength( 
aStr1.getStr(), aStr1.getLength(), aStr2.getStr(), aStr2.getLength(), 
aStr1.getLength());
+        ASSERT_TRUE(nValue == 0) << "compare failed, strings are equal.";
+    }
 
-                /* sal_Int32 */ nIndex = rtl_str_indexOfChar( aStr1.getStr(), 
'n' );
-                CPPUNIT_ASSERT_MESSAGE("index is wrong.", nIndex == 2);
+    TEST_F(shortenedCompareIgnoreAsciiCase_WithLength, compare_002)
+    {
+        rtl::OString aStr1 = "Line must be equal.";
+        rtl::OString aStr2 = "Line must be equal.";
 
-                /* sal_Int32 */ nIndex = rtl_str_indexOfChar( aStr1.getStr(), 
'e' );
-                CPPUNIT_ASSERT_MESSAGE("index is wrong.", nIndex == 3);
-            }
+        sal_Int32 nValue = rtl_str_shortenedCompareIgnoreAsciiCase_WithLength( 
aStr1.getStr(), aStr1.getLength(),
+                                                                               
aStr2.getStr(), aStr2.getLength(),
+                                                                               
aStr1.getLength());
+        ASSERT_TRUE(nValue == 0) << "compare failed, strings are equal.";
+    }
 
-        void indexOfChar_002()
-            {
-                rtl::OString aStr1 = "Line for a indexOfChar.";
-                sal_Int32 nIndex = rtl_str_indexOfChar( aStr1.getStr(), 'y' );
+    TEST_F(shortenedCompareIgnoreAsciiCase_WithLength, compare_002_1)
+    {
+        rtl::OString aStr1 = "Line must be equal.";
+        rtl::OString aStr2 = "LINE MUST BE EQUAL.";
 
-                CPPUNIT_ASSERT_MESSAGE("index is wrong.", nIndex == -1 );
-            }
+        sal_Int32 nValue = rtl_str_shortenedCompareIgnoreAsciiCase_WithLength( 
aStr1.getStr(), aStr1.getLength(),
+                                                                               
aStr2.getStr(), aStr2.getLength(),
+                                                                               
aStr1.getLength());
+        ASSERT_TRUE(nValue == 0) << "compare failed, strings are equal (if 
case insensitve).";
+    }
 
-        // Change the following lines only, if you add, remove or rename
-        // member functions of the current class,
-        // because these macros are need by auto register mechanism.
+    TEST_F(shortenedCompareIgnoreAsciiCase_WithLength, compare_003)
+    {
+        rtl::OString aStr1 = "Line must differ.";
+        rtl::OString aStr2 = "Line foo bar, ok, differ.";
 
-        CPPUNIT_TEST_SUITE(indexOfChar);
-        CPPUNIT_TEST(indexOfChar_000);
-        CPPUNIT_TEST(indexOfChar_001);
-        CPPUNIT_TEST(indexOfChar_002);
-        CPPUNIT_TEST_SUITE_END();
-    }; // class compare
+        sal_Int32 nValue = rtl_str_shortenedCompareIgnoreAsciiCase_WithLength( 
aStr1.getStr(), aStr1.getLength(),
+                                                                               
aStr2.getStr(), aStr2.getLength(),
+                                                                               
5);
+        ASSERT_TRUE(nValue == 0) << "compare failed, strings are equal first 5 
characters.";
+    }
 
-// 
-----------------------------------------------------------------------------
-    class lastIndexOfChar : public CppUnit::TestFixture
+    TEST_F(shortenedCompareIgnoreAsciiCase_WithLength, compare_004)
     {
-    public:
+        rtl::OString aStr1 = "Line must differ.";
+        rtl::OString aStr2 = "Line foo bar, ok, differ.";
 
-        void lastIndexOfChar_000()
-            {
-                rtl_str_lastIndexOfChar( NULL, 0 );
-            }
+        sal_Int32 nValue = rtl_str_shortenedCompareIgnoreAsciiCase_WithLength( 
aStr1.getStr(), aStr1.getLength(),
+                                                                               
aStr2.getStr(), aStr2.getLength(),
+                                                                               
aStr1.getLength());
+        ASSERT_TRUE(nValue != 0) << "compare failed, strings differ.";
+    }
 
-        void lastIndexOfChar_001()
-            {
-                rtl::OString aStr1 = "Line for a lastIndexOfChar.";
+// 
-----------------------------------------------------------------------------
 
-                sal_Int32 nIndex = rtl_str_lastIndexOfChar( aStr1.getStr(), 
'C' );
-                CPPUNIT_ASSERT_MESSAGE("index is wrong.", nIndex == 22);
+    class hashCode : public ::testing::Test
+    {
+    public:
+    }; // class compare
 
-                /* sal_Int32 */ nIndex = rtl_str_lastIndexOfChar( 
aStr1.getStr(), 'h' );
-                CPPUNIT_ASSERT_MESSAGE("index is wrong.", nIndex == 23);
+    TEST_F(hashCode, hashCode_000)
+    {
+        rtl_str_hashCode( NULL );
+    }
 
-                /* sal_Int32 */ nIndex = rtl_str_lastIndexOfChar( 
aStr1.getStr(), 'a' );
-                CPPUNIT_ASSERT_MESSAGE("index is wrong.", nIndex == 24);
+    TEST_F(hashCode, hashCode_001)
+    {
+        rtl::OString aStr1 = "Line for a hashCode.";
+        sal_Int32 nHashCode = rtl_str_hashCode( aStr1.getStr() );
+        printf("hashcode: %d\n", nHashCode);
+        // ASSERT_TRUE(nValue == 0) << "failed.";
+    }
 
-                /* sal_Int32 */ nIndex = rtl_str_lastIndexOfChar( 
aStr1.getStr(), 'r' );
-                CPPUNIT_ASSERT_MESSAGE("index is wrong.", nIndex == 25);
-            }
+    TEST_F(hashCode, hashCode_002)
+    {
+        rtl::OString aStr1 = "Line for a hashCode.";
+        sal_Int32 nHashCode1 = rtl_str_hashCode( aStr1.getStr() );
 
-        void lastIndexOfChar_002()
-            {
-                rtl::OString aStr1 = "Line for a lastIndexOfChar.";
-                sal_Int32 nIndex = rtl_str_lastIndexOfChar( aStr1.getStr(), 
'y' );
+        rtl::OString aStr2 = "Line for a hashCode.";
+        sal_Int32 nHashCode2 = rtl_str_hashCode( aStr2.getStr() );
 
-                CPPUNIT_ASSERT_MESSAGE("index is wrong.", nIndex == -1 );
-            }
+        ASSERT_TRUE(nHashCode1 == nHashCode2) << "hashcodes must be equal.";
+    }
 
-        // Change the following lines only, if you add, remove or rename
-        // member functions of the current class,
-        // because these macros are need by auto register mechanism.
+    TEST_F(hashCode, hashCode_003)
+    {
+        rtl::OString aStr1 = "Line for a hashCode.";
+        sal_Int32 nHashCode1 = rtl_str_hashCode( aStr1.getStr() );
 
-        CPPUNIT_TEST_SUITE(lastIndexOfChar);
-        CPPUNIT_TEST(lastIndexOfChar_000);
-        CPPUNIT_TEST(lastIndexOfChar_001);
-        CPPUNIT_TEST(lastIndexOfChar_002);
-        CPPUNIT_TEST_SUITE_END();
-    }; // class lastIndexOfChar
+        rtl::OString aStr2 = "Line for an other hashcode.";
+        sal_Int32 nHashCode2 = rtl_str_hashCode( aStr2.getStr() );
 
+        ASSERT_TRUE(nHashCode1 != nHashCode2) << "hashcodes must differ.";
+    }
 
 // 
-----------------------------------------------------------------------------
 
-    class indexOfStr : public CppUnit::TestFixture
+    class indexOfChar : public ::testing::Test
     {
     public:
+    }; // class compare
 
-        void indexOfStr_000()
-            {
-                rtl_str_indexOfStr( NULL, 0 );
-            }
+    TEST_F(indexOfChar, indexOfChar_000)
+    {
+        rtl_str_indexOfChar( NULL, 0 );
+    }
 
-        void indexOfStr_000_1()
-            {
-                rtl::OString aStr1 = "Line for a indexOfStr.";
-                rtl_str_indexOfStr( aStr1.getStr(), 0 );
-            }
+    TEST_F(indexOfChar, indexOfChar_001)
+    {
+        rtl::OString aStr1 = "Line for a indexOfChar.";
 
-        void indexOfStr_001()
-            {
-                rtl::OString aStr1 = "Line for a indexOfStr.";
+        sal_Int32 nIndex = rtl_str_indexOfChar( aStr1.getStr(), 'L' );
+        ASSERT_TRUE(nIndex == 0) << "index is wrong.";
 
-                sal_Int32 nIndex = rtl_str_indexOfStr( aStr1.getStr(), "Line" 
);
-                CPPUNIT_ASSERT_MESSAGE("index is wrong.", nIndex == 0);
+        /* sal_Int32 */ nIndex = rtl_str_indexOfChar( aStr1.getStr(), 'i' );
+        ASSERT_TRUE(nIndex == 1) << "index is wrong.";
 
-                /* sal_Int32 */ nIndex = rtl_str_indexOfStr( aStr1.getStr(), 
"for" );
-                CPPUNIT_ASSERT_MESSAGE("index is wrong.", nIndex == 5);
+        /* sal_Int32 */ nIndex = rtl_str_indexOfChar( aStr1.getStr(), 'n' );
+        ASSERT_TRUE(nIndex == 2) << "index is wrong.";
 
-                /* sal_Int32 */ nIndex = rtl_str_indexOfStr( aStr1.getStr(), 
"a" );
-                CPPUNIT_ASSERT_MESSAGE("index is wrong.", nIndex == 9);
+        /* sal_Int32 */ nIndex = rtl_str_indexOfChar( aStr1.getStr(), 'e' );
+        ASSERT_TRUE(nIndex == 3) << "index is wrong.";
+    }
 
-                /* sal_Int32 */ nIndex = rtl_str_indexOfStr( aStr1.getStr(), 
"a index" );
-                CPPUNIT_ASSERT_MESSAGE("index is wrong.", nIndex ==9);
-            }
+    TEST_F(indexOfChar, indexOfChar_002)
+    {
+        rtl::OString aStr1 = "Line for a indexOfChar.";
+        sal_Int32 nIndex = rtl_str_indexOfChar( aStr1.getStr(), 'y' );
 
-        void indexOfStr_002()
-            {
-                rtl::OString aStr1 = "Line for a indexOfStr.";
-                sal_Int32 nIndex = rtl_str_indexOfStr( aStr1.getStr(), "not 
exist" );
+        ASSERT_TRUE(nIndex == -1) << "index is wrong.";
+    }
 
-                CPPUNIT_ASSERT_MESSAGE("index is wrong.", nIndex == -1 );
-            }
+// 
-----------------------------------------------------------------------------
+    class lastIndexOfChar : public ::testing::Test
+    {
+    public:
+    }; // class lastIndexOfChar
 
-        // Change the following lines only, if you add, remove or rename
-        // member functions of the current class,
-        // because these macros are need by auto register mechanism.
+    TEST_F(lastIndexOfChar, lastIndexOfChar_000)
+    {
+        rtl_str_lastIndexOfChar( NULL, 0 );
+    }
 
-        CPPUNIT_TEST_SUITE(indexOfStr);
-        CPPUNIT_TEST(indexOfStr_000);
-        CPPUNIT_TEST(indexOfStr_001);
-        CPPUNIT_TEST(indexOfStr_002);
-        CPPUNIT_TEST_SUITE_END();
-    }; // class compare
-// 
-----------------------------------------------------------------------------
+    TEST_F(lastIndexOfChar, lastIndexOfChar_001)
+    {
+        rtl::OString aStr1 = "Line for a lastIndexOfChar.";
+
+        sal_Int32 nIndex = rtl_str_lastIndexOfChar( aStr1.getStr(), 'C' );
+        ASSERT_TRUE(nIndex == 22) << "index is wrong.";
+
+        /* sal_Int32 */ nIndex = rtl_str_lastIndexOfChar( aStr1.getStr(), 'h' 
);
+        ASSERT_TRUE(nIndex == 23) << "index is wrong.";
 
+        /* sal_Int32 */ nIndex = rtl_str_lastIndexOfChar( aStr1.getStr(), 'a' 
);
+        ASSERT_TRUE(nIndex == 24) << "index is wrong.";
 
-    class lastIndexOfStr : public CppUnit::TestFixture
+        /* sal_Int32 */ nIndex = rtl_str_lastIndexOfChar( aStr1.getStr(), 'r' 
);
+        ASSERT_TRUE(nIndex == 25) << "index is wrong.";
+    }
+
+    TEST_F(lastIndexOfChar, lastIndexOfChar_002)
     {
-    public:
+        rtl::OString aStr1 = "Line for a lastIndexOfChar.";
+        sal_Int32 nIndex = rtl_str_lastIndexOfChar( aStr1.getStr(), 'y' );
 
-        void lastIndexOfStr_000()
-            {
-                rtl_str_lastIndexOfStr( NULL, NULL );
-            }
-
-        void lastIndexOfStr_000_1()
-            {
-                rtl::OString aStr1 = "Line for a lastIndexOfStr.";
-                rtl_str_lastIndexOfStr( aStr1.getStr(), NULL );
-            }
-
-        void lastIndexOfStr_001()
-            {
-                rtl::OString aStr1 = "Line for a lastIndexOfStr.";
-                rtl::OString aSearchStr = "Index";
-
-                sal_Int32 nIndex = rtl_str_lastIndexOfStr( aStr1.getStr(), 
aSearchStr.getStr() );
-                CPPUNIT_ASSERT_MESSAGE("index is wrong.", nIndex == 15);
-
-                /* rtl::OString */ aSearchStr = "Line";
-                /* sal_Int32 */ nIndex = rtl_str_lastIndexOfStr( 
aStr1.getStr(), aSearchStr.getStr() );
-                CPPUNIT_ASSERT_MESSAGE("index is wrong.", nIndex == 0);
-
-                /* rtl::OString */ aSearchStr = "";
-                /* sal_Int32 */ nIndex = rtl_str_lastIndexOfStr( 
aStr1.getStr(), aSearchStr.getStr() );
-                CPPUNIT_ASSERT_MESSAGE("index is wrong.", nIndex == -1);
-            }
-
-        void lastIndexOfStr_002()
-            {
-                rtl::OString aStr1 = "Line for a lastIndexOfStr.";
-                rtl::OString aSearchStr = "foo";
-                sal_Int32 nIndex = rtl_str_lastIndexOfStr( aStr1.getStr(), 
aSearchStr.getStr() );
-
-                CPPUNIT_ASSERT_MESSAGE("index is wrong.", nIndex == -1 );
-            }
-
-        void lastIndexOfStr_003()
-            {
-                rtl::OString aStr1 = "Line for a lastIndexOfStr.";
-                rtl::OString aSearchStr = "O";
-                sal_Int32 nIndex = rtl_str_lastIndexOfStr( aStr1.getStr(), 
aSearchStr.getStr() );
-
-                CPPUNIT_ASSERT_MESSAGE("index is wrong.", nIndex == 20 );
-            }
-
-        // Change the following lines only, if you add, remove or rename
-        // member functions of the current class,
-        // because these macros are need by auto register mechanism.
-
-        CPPUNIT_TEST_SUITE(lastIndexOfStr);
-        CPPUNIT_TEST(lastIndexOfStr_000);
-        CPPUNIT_TEST(lastIndexOfStr_001);
-        CPPUNIT_TEST(lastIndexOfStr_002);
-        CPPUNIT_TEST(lastIndexOfStr_003);
-        CPPUNIT_TEST_SUITE_END();
-    }; // class lastIndexOfStr
+        ASSERT_TRUE(nIndex == -1) << "index is wrong.";
+    }
 
 // 
-----------------------------------------------------------------------------
 
-    class replaceChar : public CppUnit::TestFixture
+    class indexOfStr : public ::testing::Test
     {
     public:
+    }; // class compare
+
+    TEST_F(indexOfStr, indexOfStr_000)
+    {
+        rtl_str_indexOfStr( NULL, 0 );
+    }
 
-        void replaceChar_000()
-            {
-                rtl_str_replaceChar( NULL, 0, 0 );
-            }
+    TEST_F(indexOfStr, indexOfStr_000_1)
+    {
+        rtl::OString aStr1 = "Line for a indexOfStr.";
+        rtl_str_indexOfStr( aStr1.getStr(), 0 );
+    }
 
-        void replaceChar_001()
-            {
-                rtl::OString aStr1 = "replace char.";
-                rtl::OString aShouldStr1 = "ruplacu char.";
+    TEST_F(indexOfStr, indexOfStr_001)
+    {
+        rtl::OString aStr1 = "Line for a indexOfStr.";
 
-                sal_Char* pStr = (sal_Char*) malloc(aStr1.getLength() + 1);
-                CPPUNIT_ASSERT_MESSAGE("can't get memory for test", pStr != 
NULL);
-                strcpy(pStr, aStr1.getStr());
+        sal_Int32 nIndex = rtl_str_indexOfStr( aStr1.getStr(), "Line" );
+        ASSERT_TRUE(nIndex == 0) << "index is wrong.";
 
-                rtl_str_replaceChar( pStr, 'e', 'u' );
+        /* sal_Int32 */ nIndex = rtl_str_indexOfStr( aStr1.getStr(), "for" );
+        ASSERT_TRUE(nIndex == 5) << "index is wrong.";
 
-                CPPUNIT_ASSERT_MESSAGE("replace failed", 
aShouldStr1.equals(rtl::OString(pStr)) == sal_True);
-                free(pStr);
-            }
+        /* sal_Int32 */ nIndex = rtl_str_indexOfStr( aStr1.getStr(), "a" );
+        ASSERT_TRUE(nIndex == 9) << "index is wrong.";
 
-        // Change the following lines only, if you add, remove or rename
-        // member functions of the current class,
-        // because these macros are need by auto register mechanism.
+        /* sal_Int32 */ nIndex = rtl_str_indexOfStr( aStr1.getStr(), "a index" 
);
+        ASSERT_TRUE(nIndex ==9) << "index is wrong.";
+    }
 
-        CPPUNIT_TEST_SUITE(replaceChar);
-        CPPUNIT_TEST(replaceChar_000);
-        CPPUNIT_TEST(replaceChar_001);
-        CPPUNIT_TEST_SUITE_END();
-    }; // class replaceChar
+    TEST_F(indexOfStr, indexOfStr_002)
+    {
+        rtl::OString aStr1 = "Line for a indexOfStr.";
+        sal_Int32 nIndex = rtl_str_indexOfStr( aStr1.getStr(), "not exist" );
+
+        ASSERT_TRUE(nIndex == -1) << "index is wrong.";
+    }
 
 // 
-----------------------------------------------------------------------------
 
-    class replaceChar_WithLength : public CppUnit::TestFixture
+
+    class lastIndexOfStr : public ::testing::Test
     {
     public:
+    }; // class lastIndexOfStr
 
-        void replaceChar_WithLength_000()
-            {
-                rtl_str_replaceChar_WithLength( NULL, 0, 0, 0 );
-            }
-
-        void replaceChar_WithLength_000_1()
-            {
-                rtl_str_replaceChar_WithLength( NULL, 1, 0, 0 );
-            }
-        void replaceChar_WithLength_001()
-            {
-                rtl::OString aStr1 = "replace char.";
-                rtl::OString aShouldStr1 = "ruplace char.";
-
-                sal_Char* pStr = (sal_Char*) malloc(aStr1.getLength() + 1);
-                CPPUNIT_ASSERT_MESSAGE("can't get memory for test", pStr != 
NULL);
-                strcpy(pStr, aStr1.getStr());
-
-                rtl_str_replaceChar_WithLength( pStr, 6, 'e', 'u' );
-
-                CPPUNIT_ASSERT_MESSAGE("replace failed", 
aShouldStr1.equals(rtl::OString(pStr)) == sal_True);
-                free(pStr);
-            }
-
-        // Change the following lines only, if you add, remove or rename
-        // member functions of the current class,
-        // because these macros are need by auto register mechanism.
-
-        CPPUNIT_TEST_SUITE(replaceChar_WithLength);
-        CPPUNIT_TEST(replaceChar_WithLength_000);
-        CPPUNIT_TEST(replaceChar_WithLength_000_1);
-        CPPUNIT_TEST(replaceChar_WithLength_001);
-        CPPUNIT_TEST_SUITE_END();
-    }; // class replaceChar
+    TEST_F(lastIndexOfStr, lastIndexOfStr_000)
+    {
+        rtl_str_lastIndexOfStr( NULL, NULL );
+    }
 
+    TEST_F(lastIndexOfStr, lastIndexOfStr_000_1)
+    {
+        rtl::OString aStr1 = "Line for a lastIndexOfStr.";
+        rtl_str_lastIndexOfStr( aStr1.getStr(), NULL );
+    }
+
+    TEST_F(lastIndexOfStr, lastIndexOfStr_001)
+    {
+        rtl::OString aStr1 = "Line for a lastIndexOfStr.";
+        rtl::OString aSearchStr = "Index";
+
+        sal_Int32 nIndex = rtl_str_lastIndexOfStr( aStr1.getStr(), 
aSearchStr.getStr() );
+        ASSERT_TRUE(nIndex == 15) << "index is wrong.";
+
+        /* rtl::OString */ aSearchStr = "Line";
+        /* sal_Int32 */ nIndex = rtl_str_lastIndexOfStr( aStr1.getStr(), 
aSearchStr.getStr() );
+        ASSERT_TRUE(nIndex == 0) << "index is wrong.";
+
+        /* rtl::OString */ aSearchStr = "";
+        /* sal_Int32 */ nIndex = rtl_str_lastIndexOfStr( aStr1.getStr(), 
aSearchStr.getStr() );
+        ASSERT_TRUE(nIndex == -1) << "index is wrong.";
+    }
+
+    TEST_F(lastIndexOfStr, lastIndexOfStr_002)
+    {
+        rtl::OString aStr1 = "Line for a lastIndexOfStr.";
+        rtl::OString aSearchStr = "foo";
+        sal_Int32 nIndex = rtl_str_lastIndexOfStr( aStr1.getStr(), 
aSearchStr.getStr() );
+
+        ASSERT_TRUE(nIndex == -1) << "index is wrong.";
+    }
+
+    TEST_F(lastIndexOfStr, lastIndexOfStr_003)
+    {
+        rtl::OString aStr1 = "Line for a lastIndexOfStr.";
+        rtl::OString aSearchStr = "O";
+        sal_Int32 nIndex = rtl_str_lastIndexOfStr( aStr1.getStr(), 
aSearchStr.getStr() );
+
+        ASSERT_TRUE(nIndex == 20) << "index is wrong.";
+    }
 
 // 
-----------------------------------------------------------------------------
 
-    class toAsciiLowerCase : public CppUnit::TestFixture
+    class replaceChar : public ::testing::Test
     {
     public:
+    }; // class replaceChar
 
-        void toAsciiLowerCase_000()
-            {
-                rtl_str_toAsciiLowerCase( NULL );
-            }
+    TEST_F(replaceChar, replaceChar_000)
+    {
+        rtl_str_replaceChar( NULL, 0, 0 );
+    }
 
-        void toAsciiLowerCase_001()
-            {
-                rtl::OString aStr1 = "CHANGE THIS TO ASCII LOWER CASE.";
-                rtl::OString aShouldStr1 = "change this to ascii lower case.";
+    TEST_F(replaceChar, replaceChar_001)
+    {
+        rtl::OString aStr1 = "replace char.";
+        rtl::OString aShouldStr1 = "ruplacu char.";
 
-                sal_Char* pStr = (sal_Char*) malloc(aStr1.getLength() + 1);
-                CPPUNIT_ASSERT_MESSAGE("can't get memory for test", pStr != 
NULL);
-                strcpy(pStr, aStr1.getStr());
+        sal_Char* pStr = (sal_Char*) malloc(aStr1.getLength() + 1);
+        ASSERT_TRUE(pStr != NULL) << "can't get memory for test";
+        strcpy(pStr, aStr1.getStr());
 
-                rtl_str_toAsciiLowerCase( pStr );
+        rtl_str_replaceChar( pStr, 'e', 'u' );
 
-                CPPUNIT_ASSERT_MESSAGE("failed", 
aShouldStr1.equals(rtl::OString(pStr)) == sal_True);
-                free(pStr);
-            }
+        ASSERT_TRUE(aShouldStr1.equals(rtl::OString(pStr)) == sal_True) << 
"replace failed";
+        free(pStr);
+    }
 
-        // Change the following lines only, if you add, remove or rename
-        // member functions of the current class,
-        // because these macros are need by auto register mechanism.
+// 
-----------------------------------------------------------------------------
 
-        CPPUNIT_TEST_SUITE(toAsciiLowerCase);
-        CPPUNIT_TEST(toAsciiLowerCase_000);
-        CPPUNIT_TEST(toAsciiLowerCase_001);
-        CPPUNIT_TEST_SUITE_END();
+    class replaceChar_WithLength : public ::testing::Test
+    {
+    public:
     }; // class replaceChar
 
+    TEST_F(replaceChar_WithLength, replaceChar_WithLength_000)
+    {
+        rtl_str_replaceChar_WithLength( NULL, 0, 0, 0 );
+    }
 
-    class toAsciiLowerCase_WithLength : public CppUnit::TestFixture
+    TEST_F(replaceChar_WithLength, replaceChar_WithLength_000_1)
     {
-    public:
+        rtl_str_replaceChar_WithLength( NULL, 1, 0, 0 );
+    }
+    TEST_F(replaceChar_WithLength, replaceChar_WithLength_001)
+    {
+        rtl::OString aStr1 = "replace char.";
+        rtl::OString aShouldStr1 = "ruplace char.";
 
-        void toAsciiLowerCase_WithLength_000()
-            {
-                rtl_str_toAsciiLowerCase_WithLength( NULL, 0 );
-            }
+        sal_Char* pStr = (sal_Char*) malloc(aStr1.getLength() + 1);
+        ASSERT_TRUE(pStr != NULL) << "can't get memory for test";
+        strcpy(pStr, aStr1.getStr());
 
-        void toAsciiLowerCase_WithLength_001()
-            {
-                rtl::OString aStr1 = "CHANGE THIS TO ASCII LOWER CASE.";
-                rtl::OString aShouldStr1 = "change thiS TO ASCII LOWER CASE.";
+        rtl_str_replaceChar_WithLength( pStr, 6, 'e', 'u' );
 
-                sal_Char* pStr = (sal_Char*) malloc(aStr1.getLength() + 1);
-                CPPUNIT_ASSERT_MESSAGE("can't get memory for test", pStr != 
NULL);
-                strcpy(pStr, aStr1.getStr());
+        ASSERT_TRUE(aShouldStr1.equals(rtl::OString(pStr)) == sal_True) << 
"replace failed";
+        free(pStr);
+    }
 
-                rtl_str_toAsciiLowerCase_WithLength( pStr, 10 );
+// 
-----------------------------------------------------------------------------
 
-                t_print("Lowercase with length: '%s'\n", pStr);
-                CPPUNIT_ASSERT_MESSAGE("failed", 
aShouldStr1.equals(rtl::OString(pStr)) == sal_True);
-                free(pStr);
-            }
+    class toAsciiLowerCase : public ::testing::Test
+    {
+    public:
+    }; // class replaceChar
 
-        // Change the following lines only, if you add, remove or rename
-        // member functions of the current class,
-        // because these macros are need by auto register mechanism.
+    TEST_F(toAsciiLowerCase, toAsciiLowerCase_000)
+    {
+        rtl_str_toAsciiLowerCase( NULL );
+    }
 
-        CPPUNIT_TEST_SUITE(toAsciiLowerCase_WithLength);
-        CPPUNIT_TEST(toAsciiLowerCase_WithLength_000);
-        CPPUNIT_TEST(toAsciiLowerCase_WithLength_001);
-        CPPUNIT_TEST_SUITE_END();
-    }; // class replaceChar
+    TEST_F(toAsciiLowerCase, toAsciiLowerCase_001)
+    {
+        rtl::OString aStr1 = "CHANGE THIS TO ASCII LOWER CASE.";
+        rtl::OString aShouldStr1 = "change this to ascii lower case.";
 
-// 
-----------------------------------------------------------------------------
+        sal_Char* pStr = (sal_Char*) malloc(aStr1.getLength() + 1);
+        ASSERT_TRUE(pStr != NULL) << "can't get memory for test";
+        strcpy(pStr, aStr1.getStr());
+
+        rtl_str_toAsciiLowerCase( pStr );
+
+        ASSERT_TRUE(aShouldStr1.equals(rtl::OString(pStr)) == sal_True) << 
"failed";
+        free(pStr);
+    }
 
-    class toAsciiUpperCase : public CppUnit::TestFixture
+    class toAsciiLowerCase_WithLength : public ::testing::Test
     {
     public:
+    }; // class replaceChar
 
-        void toAsciiUpperCase_000()
-            {
-                rtl_str_toAsciiUpperCase( NULL );
-            }
+    TEST_F(toAsciiLowerCase_WithLength, toAsciiLowerCase_WithLength_000)
+    {
+        rtl_str_toAsciiLowerCase_WithLength( NULL, 0 );
+    }
 
-        void toAsciiUpperCase_001()
-            {
-                rtl::OString aStr1 = "change this to ascii upper case.";
-                rtl::OString aShouldStr1 = "CHANGE THIS TO ASCII UPPER CASE.";
+    TEST_F(toAsciiLowerCase_WithLength, toAsciiLowerCase_WithLength_001)
+    {
+        rtl::OString aStr1 = "CHANGE THIS TO ASCII LOWER CASE.";
+        rtl::OString aShouldStr1 = "change thiS TO ASCII LOWER CASE.";
 
-                sal_Char* pStr = (sal_Char*) malloc(aStr1.getLength() + 1);
-                CPPUNIT_ASSERT_MESSAGE("can't get memory for test", pStr != 
NULL);
-                strcpy(pStr, aStr1.getStr());
+        sal_Char* pStr = (sal_Char*) malloc(aStr1.getLength() + 1);
+        ASSERT_TRUE(pStr != NULL) << "can't get memory for test";
+        strcpy(pStr, aStr1.getStr());
 
-                rtl_str_toAsciiUpperCase( pStr );
+        rtl_str_toAsciiLowerCase_WithLength( pStr, 10 );
 
-                CPPUNIT_ASSERT_MESSAGE("failed", 
aShouldStr1.equals(rtl::OString(pStr)) == sal_True);
-                free(pStr);
-            }
+        printf("Lowercase with length: '%s'\n", pStr);
+        ASSERT_TRUE(aShouldStr1.equals(rtl::OString(pStr)) == sal_True) << 
"failed";
+        free(pStr);
+    }
 
-        // Change the following lines only, if you add, remove or rename
-        // member functions of the current class,
-        // because these macros are need by auto register mechanism.
+// 
-----------------------------------------------------------------------------
 
-        CPPUNIT_TEST_SUITE(toAsciiUpperCase);
-        CPPUNIT_TEST(toAsciiUpperCase_000);
-        CPPUNIT_TEST(toAsciiUpperCase_001);
-        CPPUNIT_TEST_SUITE_END();
+    class toAsciiUpperCase : public ::testing::Test
+    {
+    public:
     }; // class replaceChar
 
+    TEST_F(toAsciiUpperCase, toAsciiUpperCase_000)
+    {
+        rtl_str_toAsciiUpperCase( NULL );
+    }
 
-    class toAsciiUpperCase_WithLength : public CppUnit::TestFixture
+    TEST_F(toAsciiUpperCase, toAsciiUpperCase_001)
     {
-    public:
+        rtl::OString aStr1 = "change this to ascii upper case.";
+        rtl::OString aShouldStr1 = "CHANGE THIS TO ASCII UPPER CASE.";
 
-        void toAsciiUpperCase_WithLength_000()
-            {
-                rtl_str_toAsciiUpperCase_WithLength( NULL, 0 );
-            }
+        sal_Char* pStr = (sal_Char*) malloc(aStr1.getLength() + 1);
+        ASSERT_TRUE(pStr != NULL) << "can't get memory for test";
+        strcpy(pStr, aStr1.getStr());
 
-        void toAsciiUpperCase_WithLength_001()
-            {
-                rtl::OString aStr1 = "change this to ascii lower case.";
-                rtl::OString aShouldStr1 = "CHANGE THIs to ascii lower case.";
+        rtl_str_toAsciiUpperCase( pStr );
 
-                sal_Char* pStr = (sal_Char*) malloc(aStr1.getLength() + 1);
-                CPPUNIT_ASSERT_MESSAGE("can't get memory for test", pStr != 
NULL);
+        ASSERT_TRUE(aShouldStr1.equals(rtl::OString(pStr)) == sal_True) << 
"failed";
+        free(pStr);
+    }
 
-                strcpy(pStr, aStr1.getStr());
-                rtl_str_toAsciiUpperCase_WithLength( pStr, 10 );
+    class toAsciiUpperCase_WithLength : public ::testing::Test
+    {
+    public:
+    }; // class replaceChar
 
-                t_print("Uppercase with length: '%s'\n", aStr1.getStr());
-                CPPUNIT_ASSERT_MESSAGE("failed", 
aShouldStr1.equals(rtl::OString(pStr)) == sal_True);
-                free(pStr);
-            }
+    TEST_F(toAsciiUpperCase_WithLength, toAsciiUpperCase_WithLength_000)
+    {
+        rtl_str_toAsciiUpperCase_WithLength( NULL, 0 );
+    }
+
+    TEST_F(toAsciiUpperCase_WithLength, toAsciiUpperCase_WithLength_001)
+    {
+        rtl::OString aStr1 = "change this to ascii lower case.";
+        rtl::OString aShouldStr1 = "CHANGE THIs to ascii lower case.";
 
-        // Change the following lines only, if you add, remove or rename
-        // member functions of the current class,
-        // because these macros are need by auto register mechanism.
+        sal_Char* pStr = (sal_Char*) malloc(aStr1.getLength() + 1);
+        ASSERT_TRUE(pStr != NULL) << "can't get memory for test";
 
-        CPPUNIT_TEST_SUITE(toAsciiUpperCase_WithLength);
-        CPPUNIT_TEST(toAsciiUpperCase_WithLength_000);
-        CPPUNIT_TEST(toAsciiUpperCase_WithLength_001);
-        CPPUNIT_TEST_SUITE_END();
-    }; // class replaceChar
+        strcpy(pStr, aStr1.getStr());
+        rtl_str_toAsciiUpperCase_WithLength( pStr, 10 );
 
+        printf("Uppercase with length: '%s'\n", aStr1.getStr());
+        ASSERT_TRUE(aShouldStr1.equals(rtl::OString(pStr)) == sal_True) << 
"failed";
+        free(pStr);
+    }
 
     // 
-----------------------------------------------------------------------------
 
-    class trim_WithLength : public CppUnit::TestFixture
+    class trim_WithLength : public ::testing::Test
     {
       public:
-        void trim_WithLength_000()
-        {
-            rtl_str_trim_WithLength(NULL, 0);
-            // should not GPF
-        }
+    };
 
-        void trim_WithLength_000_1()
-        {
-            char pStr[] = { "  trim this" };
-            rtl_str_trim_WithLength( pStr, 0 );
-        }
+    TEST_F(trim_WithLength, trim_WithLength_000)
+    {
+        rtl_str_trim_WithLength(NULL, 0);
+        // should not GPF
+    }
+
+    TEST_F(trim_WithLength, trim_WithLength_000_1)
+    {
+        char pStr[] = { "  trim this" };
+        rtl_str_trim_WithLength( pStr, 0 );
+    }
 
-        void trim_WithLength_001()
+    TEST_F(trim_WithLength, trim_WithLength_001)
+    {
+        char const *pStr = "  trim this";
+        sal_Char *pStr2 = (sal_Char*)malloc(strlen(pStr) + 1);
+        if (pStr2)
         {
-            char const *pStr = "  trim this";
-            sal_Char *pStr2 = (sal_Char*)malloc(strlen(pStr) + 1);
-            if (pStr2)
-            {
-                strcpy(pStr2, pStr);
-                rtl_str_trim_WithLength( pStr2, 2 );
-
-                CPPUNIT_ASSERT_MESSAGE("string should be empty", strlen(pStr2) 
== 0);
-                free(pStr2);
-            }
+            strcpy(pStr2, pStr);
+            rtl_str_trim_WithLength( pStr2, 2 );
+
+            ASSERT_TRUE(strlen(pStr2) == 0) << "string should be empty";
+            free(pStr2);
         }
+    }
 
-        void trim_WithLength_002()
+    TEST_F(trim_WithLength, trim_WithLength_002)
+    {
+        char const *pStr = "trim this";
+        sal_Char *pStr2 = (sal_Char*)malloc(strlen(pStr) + 1);
+        if (pStr2)
         {
-            char const *pStr = "trim this";
-            sal_Char *pStr2 = (sal_Char*)malloc(strlen(pStr) + 1);
-            if (pStr2)
-            {
-                strcpy(pStr2, pStr);
-                rtl_str_trim_WithLength( pStr2, 5 );
-
-                CPPUNIT_ASSERT_MESSAGE("string should contain 'trim'", 
strlen(pStr2) == 4);
-                free(pStr2);
-            }
+            strcpy(pStr2, pStr);
+            rtl_str_trim_WithLength( pStr2, 5 );
+
+            ASSERT_TRUE(strlen(pStr2) == 4) << "string should contain 'trim'";
+            free(pStr2);
         }
+    }
 
-        void trim_WithLength_003()
+    TEST_F(trim_WithLength, trim_WithLength_003)
+    {
+        char const *pStr = "     trim   this";
+        sal_Char *pStr2 = (sal_Char*)malloc(strlen(pStr) + 1);
+        if (pStr2)
         {
-            char const *pStr = "     trim   this";
-            sal_Char *pStr2 = (sal_Char*)malloc(strlen(pStr) + 1);
-            if (pStr2)
-            {
-                strcpy(pStr2, pStr);
-                rtl_str_trim_WithLength( pStr2, 11 );
-
-                CPPUNIT_ASSERT_MESSAGE("string should contain 'trim'", 
strlen(pStr2) == 4);
-                free(pStr2);
-            }
+            strcpy(pStr2, pStr);
+            rtl_str_trim_WithLength( pStr2, 11 );
+
+            ASSERT_TRUE(strlen(pStr2) == 4) << "string should contain 'trim'";
+            free(pStr2);
         }
+    }
 
-        void trim_WithLength_004()
+    TEST_F(trim_WithLength, trim_WithLength_004)
+    {
+        char const *pStr = "\r\n\t \n\r    trim  \n this";
+        sal_Char *pStr2 = (sal_Char*)malloc(strlen(pStr) + 1);
+        if (pStr2)
         {
-            char const *pStr = "\r\n\t \n\r    trim  \n this";
-            sal_Char *pStr2 = (sal_Char*)malloc(strlen(pStr) + 1);
-            if (pStr2)
-            {
-                strcpy(pStr2, pStr);
-                rtl_str_trim_WithLength( pStr2, 17 );
-
-                CPPUNIT_ASSERT_MESSAGE("string should contain 'trim'", 
strlen(pStr2) == 4);
-                free(pStr2);
-            }
+            strcpy(pStr2, pStr);
+            rtl_str_trim_WithLength( pStr2, 17 );
+
+            ASSERT_TRUE(strlen(pStr2) == 4) << "string should contain 'trim'";
+            free(pStr2);
         }
+    }
 
-        void trim_WithLength_005()
+    TEST_F(trim_WithLength, trim_WithLength_005)
+    {
+        char const *pStr = "\r\n\t \n\r    trim \t this \n\r\t\t     ";
+        sal_Char *pStr2 = (sal_Char*)malloc(strlen(pStr) + 1);
+        if (pStr2)
         {
-            char const *pStr = "\r\n\t \n\r    trim \t this \n\r\t\t     ";
-            sal_Char *pStr2 = (sal_Char*)malloc(strlen(pStr) + 1);
-            if (pStr2)
-            {
-                strcpy(pStr2, pStr);
-                rtl_str_trim_WithLength( pStr2, strlen(pStr2) );
-
-                CPPUNIT_ASSERT_MESSAGE("string should contain 'trim'", 
strlen(pStr2) == 11);
-                free(pStr2);
-            }
+            strcpy(pStr2, pStr);
+            rtl_str_trim_WithLength( pStr2, strlen(pStr2) );
+            ASSERT_TRUE(strlen(pStr2) == 11) << "string should contain 'trim'";
+            free(pStr2);
         }
-
-        // Change the following lines only, if you add, remove or rename
-        // member functions of the current class,
-        // because these macros are need by auto register mechanism.
-
-        CPPUNIT_TEST_SUITE(trim_WithLength);
-        CPPUNIT_TEST(trim_WithLength_000);
-        CPPUNIT_TEST(trim_WithLength_000_1);
-        CPPUNIT_TEST(trim_WithLength_001);
-        CPPUNIT_TEST(trim_WithLength_002);
-        CPPUNIT_TEST(trim_WithLength_003);
-        CPPUNIT_TEST(trim_WithLength_004);
-        CPPUNIT_TEST(trim_WithLength_005);
-        CPPUNIT_TEST_SUITE_END();
-    };
+    }
 
     // 
-----------------------------------------------------------------------------
 
-    class valueOfChar : public CppUnit::TestFixture
+    class valueOfChar : public ::testing::Test
     {
       public:
-        void valueOfChar_000()
-            {
-                rtl_str_valueOfChar(NULL, 0);
-                // should not GPF
-            }
-        void valueOfChar_001()
-            {
-                sal_Char *pStr = (sal_Char*)malloc(RTL_STR_MAX_VALUEOFCHAR);
-                if (pStr)
-                {
-                    rtl_str_valueOfChar(pStr, 'A');
-
-                    CPPUNIT_ASSERT_MESSAGE("string should contain 'A'", 
pStr[0] == 'A');
-                    free(pStr);
-                }
-            }
-
-        // Change the following lines only, if you add, remove or rename
-        // member functions of the current class,
-        // because these macros are need by auto register mechanism.
-
-        CPPUNIT_TEST_SUITE(valueOfChar);
-        CPPUNIT_TEST(valueOfChar_000);
-        CPPUNIT_TEST(valueOfChar_001);
-        CPPUNIT_TEST_SUITE_END();
     };
 
-// 
-----------------------------------------------------------------------------
-CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(rtl_str::compare, "rtl_str");
-CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(rtl_str::compareIgnoreAsciiCase, 
"rtl_str");
-CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(rtl_str::shortenedCompareIgnoreAsciiCase_WithLength,
 "rtl_str");
-CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(rtl_str::hashCode, "rtl_str");
-
-CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(rtl_str::indexOfChar, "rtl_str");
-CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(rtl_str::lastIndexOfChar, "rtl_str");
-CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(rtl_str::indexOfStr, "rtl_str");
-CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(rtl_str::lastIndexOfStr, "rtl_str");
-
-CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(rtl_str::replaceChar, "rtl_str");
-CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(rtl_str::replaceChar_WithLength, 
"rtl_str");
-
-CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(rtl_str::toAsciiLowerCase, "rtl_str");
-CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(rtl_str::toAsciiLowerCase_WithLength, 
"rtl_str");
-CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(rtl_str::toAsciiUpperCase, "rtl_str");
-CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(rtl_str::toAsciiUpperCase_WithLength, 
"rtl_str");
+    TEST_F(valueOfChar, valueOfChar_000)
+    {
+        rtl_str_valueOfChar(NULL, 0);
+        // should not GPF
+    }
+    TEST_F(valueOfChar, valueOfChar_001)
+    {
+        sal_Char *pStr = (sal_Char*)malloc(RTL_STR_MAX_VALUEOFCHAR);
+        if (pStr)
+        {
+            rtl_str_valueOfChar(pStr, 'A');
 
-CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(rtl_str::trim_WithLength, "rtl_str");
-CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(rtl_str::valueOfChar, "rtl_str");
+            ASSERT_TRUE(pStr[0] == 'A') << "string should contain 'A'";
+            free(pStr);
+        }
+    }
 
 } // namespace rtl_str
 
-// 
-----------------------------------------------------------------------------
-
-// this macro creates an empty function, which will called by the 
RegisterAllFunctions()
-// to let the user the possibility to also register some functions by hand.
-NOADDITIONAL;
+int main(int argc, char **argv)
+{
+    ::testing::InitGoogleTest(&argc, argv);
+    return RUN_ALL_TESTS();
+}


Reply via email to