[Libreoffice-commits] core.git: Branch 'aoo/trunk' - 12 commits - l10ntools/scripts oowintool oox/source sal/qa sal/textenc sax/prj sax/qa sc/addin sd/res sfx2/qa solenv/bin solenv/gbuild sysui/desktop xmerge/source

Damjan Jovanovic damjan at apache.org
Thu Sep 3 23:50:10 PDT 2015


Rebased ref, commits from common ancestor:
commit 4ae6e362c610ebcf9b8006138f4f39d921cb869f
Author: Damjan Jovanovic <damjan at apache.org>
Date:   Thu Sep 3 17:51:30 2015 +0000

    #i125003# migrate main/sfx2 from cppunit to Google Test.

diff --git a/sfx2/qa/cppunit/makefile.mk b/sfx2/qa/cppunit/makefile.mk
index bbc19a9..1fc3350 100644
--- a/sfx2/qa/cppunit/makefile.mk
+++ b/sfx2/qa/cppunit/makefile.mk
@@ -35,24 +35,18 @@ ENABLE_EXCEPTIONS=TRUE
 
 .INCLUDE :  settings.mk
 
-#building with stlport, but cppunit was not built with stlport
-.IF "$(USE_SYSTEM_STL)"!="YES"
-.IF "$(SYSTEM_CPPUNIT)"=="YES"
-CFLAGSCXX+=-DADAPT_EXT_STL
-.ENDIF
-.ENDIF
+.IF "$(ENABLE_UNIT_TESTS)" != "YES"
+all:
+    @echo unit tests are disabled. Nothing to do.
 
-CFLAGSCXX += $(CPPUNIT_CFLAGS)
-DLLPRE = # no leading "lib" on .so files
-
-# --- Libs ---------------------------------------------------------
+.ELSE
 
-SHL1OBJS=  \
+APP1OBJS=  \
     $(SLO)/test_metadatable.obj \
 
 
-SHL1STDLIBS= \
-     $(CPPUNITLIB) \
+APP1STDLIBS= \
+     $(GTESTLIB) \
      $(SALLIB) \
      $(CPPULIB) \
      $(CPPUHELPERLIB) \
@@ -60,23 +54,13 @@ SHL1STDLIBS= \
      $(SFXLIB) \
 
 
-SHL1TARGET= test_metadatable
-SHL1RPATH = NONE
-SHL1IMPLIB= i$(SHL1TARGET)
-# SHL1DEF= $(MISC)/$(SHL1TARGET).def
-DEF1NAME=$(SHL1TARGET)
-# DEF1EXPORTFILE= export.exp
-SHL1VERSIONMAP= version.map
-
-# --- All object files ---------------------------------------------
-
-SLOFILES= \
-    $(SHL1OBJS) \
-
-
+APP1TARGET= test_metadatable
+APP1RPATH = NONE
+APP1TEST = enabled
 # --- Targets ------------------------------------------------------
 
 .INCLUDE :  target.mk
-.INCLUDE : _cppunit.mk
+
+.ENDIF # "$(ENABLE_UNIT_TESTS)" != "YES"
 
 .END
diff --git a/sfx2/qa/cppunit/test_metadatable.cxx b/sfx2/qa/cppunit/test_metadatable.cxx
index d08e7b7..c2bd100 100644
--- a/sfx2/qa/cppunit/test_metadatable.cxx
+++ b/sfx2/qa/cppunit/test_metadatable.cxx
@@ -21,7 +21,7 @@
 
 
 
-#include <sal/cppunit.h>
+#include "gtest/gtest.h"
 #include <rtl/ustrbuf.hxx>
 
 #include <com/sun/star/util/DateTime.hpp>
@@ -38,26 +38,18 @@ using namespace ::com::sun::star;
 namespace {
 
 class MetadatableTest
-    : public ::CppUnit::TestFixture
+    : public ::testing::Test
 {
 public:
-    virtual void setUp();
-    virtual void tearDown();
-
-    void test();
-
-    CPPUNIT_TEST_SUITE(MetadatableTest);
-    CPPUNIT_TEST(test);
-    CPPUNIT_TEST_SUITE_END();
-
-private:
+    virtual void SetUp();
+    virtual void TearDown();
 };
 
-void MetadatableTest::setUp()
+void MetadatableTest::SetUp()
 {
 }
 
-void MetadatableTest::tearDown()
+void MetadatableTest::TearDown()
 {
 }
 
@@ -89,7 +81,7 @@ static bool operator==(beans::StringPair p1, beans::StringPair p2)
     return p1.First == p2.First && p1.Second == p2.Second;
 }
 
-void MetadatableTest::test()
+TEST_F(MetadatableTest, test)
 {
     OSL_TRACE("SwMetadatable test(): start\n");
     ::std::auto_ptr< ::sfx2::IXmlIdRegistry > const pReg(
@@ -116,68 +108,54 @@ void MetadatableTest::test()
     beans::StringPair id3e(empty,  sid3);
     beans::StringPair id4e(empty,  sid4);
     m1.SetMetadataReference(id1);
-    CPPUNIT_ASSERT_MESSAGE("set failed", m1.GetMetadataReference() == id1);
+    ASSERT_TRUE(m1.GetMetadataReference() == id1) << "set failed";
     try {
         m2.SetMetadataReference(id1);
-        CPPUNIT_ASSERT_MESSAGE("set duplicate succeeded", false);
+        ASSERT_TRUE(false) << "set duplicate succeeded";
     } catch (lang::IllegalArgumentException) { }
     m1.SetMetadataReference(id1);
-    CPPUNIT_ASSERT_MESSAGE("set failed (existing)",
-            m1.GetMetadataReference() == id1);
+    ASSERT_TRUE(m1.GetMetadataReference() == id1) << "set failed (existing)";
     m1.EnsureMetadataReference();
-    CPPUNIT_ASSERT_MESSAGE("ensure failed (existing)",
-            m1.GetMetadataReference() == id1);
+    ASSERT_TRUE(m1.GetMetadataReference() == id1) << "ensure failed (existing)";
 
     m2.EnsureMetadataReference();
     beans::StringPair m2id(m2.GetMetadataReference());
-    CPPUNIT_ASSERT_MESSAGE("ensure failed", m2id.Second.getLength());
+    ASSERT_TRUE(m2id.Second.getLength()) << "ensure failed";
     m2.EnsureMetadataReference();
-    CPPUNIT_ASSERT_MESSAGE("ensure failed (idempotent)",
-            m2.GetMetadataReference() == m2id);
+    ASSERT_TRUE(m2.GetMetadataReference() == m2id) << "ensure failed (idempotent)";
 
     m1.m_bInUndo = true;
-    CPPUNIT_ASSERT_MESSAGE("move to undo failed",
-            !m1.GetMetadataReference().Second.getLength());
+    ASSERT_TRUE(!m1.GetMetadataReference().Second.getLength()) << "move to undo failed";
 
     m1.m_bInUndo = false;
-    CPPUNIT_ASSERT_MESSAGE("move from undo failed",
-            m1.GetMetadataReference() == id1);
+    ASSERT_TRUE(m1.GetMetadataReference() == id1) << "move from undo failed";
 
     m1.m_bInUndo = true;
     try {
         m2.SetMetadataReference(id1); // steal!
     } catch (lang::IllegalArgumentException &) {
-        CPPUNIT_FAIL("set duplicate to undo failed");
+        FAIL() << "set duplicate to undo failed";
     }
     m1.m_bInUndo = false;
-    CPPUNIT_ASSERT_MESSAGE("move from undo: duplicate",
-            !m1.GetMetadataReference().Second.getLength());
+    ASSERT_TRUE(!m1.GetMetadataReference().Second.getLength()) << "move from undo: duplicate";
 
     m3.RegisterAsCopyOf(m2);
-    CPPUNIT_ASSERT_MESSAGE("copy: source", m2.GetMetadataReference() == id1);
-    CPPUNIT_ASSERT_MESSAGE("copy: duplicate",
-            !m3.GetMetadataReference().Second.getLength());
+    ASSERT_TRUE(m2.GetMetadataReference() == id1) << "copy: source";
+    ASSERT_TRUE(!m3.GetMetadataReference().Second.getLength()) << "copy: duplicate";
     m4.RegisterAsCopyOf(m3);
-    CPPUNIT_ASSERT_MESSAGE("copy: source", m2.GetMetadataReference() == id1);
-    CPPUNIT_ASSERT_MESSAGE("copy: duplicate",
-            !m3.GetMetadataReference().Second.getLength());
-    CPPUNIT_ASSERT_MESSAGE("copy: duplicate",
-            !m4.GetMetadataReference().Second.getLength());
+    ASSERT_TRUE(m2.GetMetadataReference() == id1) << "copy: source";
+    ASSERT_TRUE(!m3.GetMetadataReference().Second.getLength()) << "copy: duplicate";
+    ASSERT_TRUE(!m4.GetMetadataReference().Second.getLength()) << "copy: duplicate";
     m2.m_bInUndo = true;
-    CPPUNIT_ASSERT_MESSAGE("duplicate to undo",
-            m3.GetMetadataReference() == id1);
-    CPPUNIT_ASSERT_MESSAGE("duplicate to undo",
-            !m2.GetMetadataReference().Second.getLength());
+    ASSERT_TRUE(m3.GetMetadataReference() == id1) << "duplicate to undo";
+    ASSERT_TRUE(!m2.GetMetadataReference().Second.getLength()) << "duplicate to undo";
     m2.m_bInUndo = false;
-    CPPUNIT_ASSERT_MESSAGE("duplicate from undo",
-            m2.GetMetadataReference() == id1);
-    CPPUNIT_ASSERT_MESSAGE("duplicate from undo",
-            !m3.GetMetadataReference().Second.getLength());
+    ASSERT_TRUE(m2.GetMetadataReference() == id1) << "duplicate from undo";
+    ASSERT_TRUE(!m3.GetMetadataReference().Second.getLength()) << "duplicate from undo";
 
     m4.EnsureMetadataReference(); // new!
     beans::StringPair m4id(m4.GetMetadataReference());
-    CPPUNIT_ASSERT_MESSAGE("ensure on duplicate",
-            m4id.Second.getLength() && !(m4id == id1));
+    ASSERT_TRUE(m4id.Second.getLength() && !(m4id == id1)) << "ensure on duplicate";
 
     MockMetadatable mc1(*pRegClip, true); // in clipboard
     MockMetadatable mc2(*pRegClip, true);
@@ -187,84 +165,67 @@ void MetadatableTest::test()
     MockMetadatable m3p(*pReg);
 
     mc1.SetMetadataReference(id2);
-    CPPUNIT_ASSERT_MESSAGE("set failed", mc1.GetMetadataReference() == id2);
+    ASSERT_TRUE(mc1.GetMetadataReference() == id2) << "set failed";
     try {
         mc2.SetMetadataReference(id2);
-        CPPUNIT_FAIL("set duplicate succeeded");
+        FAIL() << "set duplicate succeeded";
     } catch (lang::IllegalArgumentException) { }
     mc1.SetMetadataReference(id2);
-    CPPUNIT_ASSERT_MESSAGE("set failed (existing)",
-            mc1.GetMetadataReference() == id2);
+    ASSERT_TRUE(mc1.GetMetadataReference() == id2) << "set failed (existing)";
     mc1.EnsureMetadataReference();
-    CPPUNIT_ASSERT_MESSAGE("ensure failed (existing)",
-            mc1.GetMetadataReference() == id2);
+    ASSERT_TRUE(mc1.GetMetadataReference() == id2) << "ensure failed (existing)";
     mc2.EnsureMetadataReference();
     beans::StringPair mc2id(mc2.GetMetadataReference());
-    CPPUNIT_ASSERT_MESSAGE("ensure failed", mc2id.Second.getLength());
+    ASSERT_TRUE(mc2id.Second.getLength()) << "ensure failed";
     mc2.EnsureMetadataReference();
-    CPPUNIT_ASSERT_MESSAGE("ensure failed (idempotent)",
-            mc2.GetMetadataReference() == mc2id);
+    ASSERT_TRUE(mc2.GetMetadataReference() == mc2id) << "ensure failed (idempotent)";
     mc2.RemoveMetadataReference();
-    CPPUNIT_ASSERT_MESSAGE("remove failed",
-            !mc2.GetMetadataReference().Second.getLength());
+    ASSERT_TRUE(!mc2.GetMetadataReference().Second.getLength()) << "remove failed";
 
     // set up mc2 as copy of m2 and mc3 as copy of m3
     mc3.RegisterAsCopyOf(m3);
-    CPPUNIT_ASSERT_MESSAGE("copy to clipboard (latent)",
-            !mc3.GetMetadataReference().Second.getLength() );
+    ASSERT_TRUE(!mc3.GetMetadataReference().Second.getLength()) << "copy to clipboard (latent)";
     mc2.RegisterAsCopyOf(m2);
-    CPPUNIT_ASSERT_MESSAGE("copy to clipboard (non-latent)",
-            mc2.GetMetadataReference() == id1);
+    ASSERT_TRUE(mc2.GetMetadataReference() == id1) << "copy to clipboard (non-latent)";
     // paste mc2 to m2p and mc3 to m3p
     m2p.RegisterAsCopyOf(mc2);
-    CPPUNIT_ASSERT_MESSAGE("paste from clipboard (non-latent)",
-            !m2p.GetMetadataReference().Second.getLength() );
+    ASSERT_TRUE(!m2p.GetMetadataReference().Second.getLength()) << "paste from clipboard (non-latent)";
     m3p.RegisterAsCopyOf(mc3);
-    CPPUNIT_ASSERT_MESSAGE("paste from clipboard (latent)",
-            !m3p.GetMetadataReference().Second.getLength() );
+    ASSERT_TRUE(!m3p.GetMetadataReference().Second.getLength()) << "paste from clipboard (latent)";
     // delete m2, m2p, m3
     m2.RemoveMetadataReference();
-    CPPUNIT_ASSERT_MESSAGE("remove failed",
-            !m2.GetMetadataReference().Second.getLength());
-    CPPUNIT_ASSERT_MESSAGE("paste-remove (non-latent)",
-            m2p.GetMetadataReference() == id1);
+    ASSERT_TRUE(!m2.GetMetadataReference().Second.getLength()) << "remove failed";
+    ASSERT_TRUE(m2p.GetMetadataReference() == id1) << "paste-remove (non-latent)";
     m2p.RemoveMetadataReference();
-    CPPUNIT_ASSERT_MESSAGE("remove failed",
-            !m2p.GetMetadataReference().Second.getLength());
-    CPPUNIT_ASSERT_MESSAGE("paste-remove2 (non-latent)",
-            m3.GetMetadataReference() == id1);
+    ASSERT_TRUE(!m2p.GetMetadataReference().Second.getLength()) << "remove failed";
+    ASSERT_TRUE(m3.GetMetadataReference() == id1) << "paste-remove2 (non-latent)";
     m3.RemoveMetadataReference();
-    CPPUNIT_ASSERT_MESSAGE("remove failed",
-            !m3.GetMetadataReference().Second.getLength());
-    CPPUNIT_ASSERT_MESSAGE("paste-remove (latent)",
-            m3p.GetMetadataReference() == id1);
+    ASSERT_TRUE(!m3.GetMetadataReference().Second.getLength()) << "remove failed";
+    ASSERT_TRUE(m3p.GetMetadataReference() == id1) << "paste-remove (latent)";
     // delete mc2
     mc2.SetMetadataReference(beans::StringPair());
-    CPPUNIT_ASSERT_MESSAGE("in clipboard becomes non-latent",
-            !mc3.GetMetadataReference().Second.getLength() );
+    ASSERT_TRUE(!mc3.GetMetadataReference().Second.getLength()) << "in clipboard becomes non-latent";
     // paste mc2
     m2p.RegisterAsCopyOf(mc2);
-    CPPUNIT_ASSERT_MESSAGE("remove-paste",
-            !m2p.GetMetadataReference().Second.getLength());
-    CPPUNIT_ASSERT_MESSAGE("remove-paste (stolen)",
-            m3p.GetMetadataReference() == id1);
+    ASSERT_TRUE(!m2p.GetMetadataReference().Second.getLength()) << "remove-paste";
+    ASSERT_TRUE(m3p.GetMetadataReference() == id1) << "remove-paste (stolen)";
 
     // auto-detect stream
     m5.SetMetadataReference(id3e);
-    CPPUNIT_ASSERT_MESSAGE("auto-detect (content)",
-            m5.GetMetadataReference() == id3);
+    ASSERT_TRUE(m5.GetMetadataReference() == id3) << "auto-detect (content)";
     m5.m_bInContent = false;
     m5.SetMetadataReference(id4e);
-    CPPUNIT_ASSERT_MESSAGE("auto-detect (styles)",
-            m5.GetMetadataReference() == id4);
+    ASSERT_TRUE(m5.GetMetadataReference() == id4) << "auto-detect (styles)";
 
     OSL_TRACE("sfx2::Metadatable test(): finished\n");
 }
 
 
-CPPUNIT_TEST_SUITE_REGISTRATION(MetadatableTest);
-
 }
 
-CPPUNIT_PLUGIN_IMPLEMENT();
+int main(int argc, char **argv)
+{
+    ::testing::InitGoogleTest(&argc, argv);
+    return RUN_ALL_TESTS();
+}
 
commit 549c24ab3c657d144a3d32197796cbc05dd1cfae
Author: Damjan Jovanovic <damjan at apache.org>
Date:   Thu Sep 3 17:44:40 2015 +0000

    Complete cppunit -> gtest migration in main/sax.

diff --git a/sax/prj/build.lst b/sax/prj/build.lst
index 8497000..0d581e4 100644
--- a/sax/prj/build.lst
+++ b/sax/prj/build.lst
@@ -3,4 +3,4 @@ ax	sax										usr1	-	all	ax_mkout NULL
 ax	sax\source\expatwrap					nmake	-	all	ax_expatwrap NULL
 ax	sax\source\tools						nmake	-	all ax_tools  NULL
 ax  sax\source\fastparser					nmake	-	all ax_fastparser ax_expatwrap ax_tools NULL
-ax  sax\qa\cppunit							nmake	-	all ax_qa_cppunit ax_tools NULL
+ax  sax\qa\gtest							nmake	-	all ax_qa_gtest ax_tools NULL
diff --git a/sax/qa/cppunit/version.map b/sax/qa/cppunit/version.map
deleted file mode 100644
index ec49c45..0000000
--- a/sax/qa/cppunit/version.map
+++ /dev/null
@@ -1,30 +0,0 @@
-#**************************************************************
-#
-#  Licensed to the Apache Software Foundation (ASF) under one
-#  or more contributor license agreements.  See the NOTICE file
-#  distributed with this work for additional information
-#  regarding copyright ownership.  The ASF licenses this file
-#  to you under the Apache License, Version 2.0 (the
-#  "License"); you may not use this file except in compliance
-#  with the License.  You may obtain a copy of the License at
-#
-#    http://www.apache.org/licenses/LICENSE-2.0
-#
-#  Unless required by applicable law or agreed to in writing,
-#  software distributed under the License is distributed on an
-#  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-#  KIND, either express or implied.  See the License for the
-#  specific language governing permissions and limitations
-#  under the License.
-#
-#**************************************************************
-
-
-
-UDK_3_0_0 {
-    global:
-        cppunitTestPlugIn;
-
-    local:
-        *;
-};
diff --git a/sax/qa/cppunit/makefile.mk b/sax/qa/gtest/makefile.mk
similarity index 98%
rename from sax/qa/cppunit/makefile.mk
rename to sax/qa/gtest/makefile.mk
index 83db47b..070970f 100644
--- a/sax/qa/cppunit/makefile.mk
+++ b/sax/qa/gtest/makefile.mk
@@ -23,7 +23,7 @@
 
 PRJ=../..
 PRJNAME=sax
-TARGET=qa_cppunit
+TARGET=qa_gtest
 
 ENABLE_EXCEPTIONS=TRUE
 
diff --git a/sax/qa/cppunit/test_converter.cxx b/sax/qa/gtest/test_converter.cxx
similarity index 100%
rename from sax/qa/cppunit/test_converter.cxx
rename to sax/qa/gtest/test_converter.cxx
commit 6f838cc8cb8d1a9d0e36c3282099c156f50fa31a
Author: Damjan Jovanovic <damjan at apache.org>
Date:   Thu Sep 3 17:35:52 2015 +0000

    #i125003# migrate main/sax/qa/cppunit from cppunit to Google Test.

diff --git a/sax/qa/cppunit/makefile.mk b/sax/qa/cppunit/makefile.mk
index 711dc6f..83db47b 100644
--- a/sax/qa/cppunit/makefile.mk
+++ b/sax/qa/cppunit/makefile.mk
@@ -31,50 +31,30 @@ ENABLE_EXCEPTIONS=TRUE
 
 .INCLUDE :  settings.mk
 
-.IF "$(WITH_CPPUNIT)" != "YES"
+.IF "$(ENABLE_UNIT_TESTS)" != "YES"
+all:
+    @echo unit tests are disabled. Nothing to do.
 
- at all:
-    @echo "cppunit disabled. nothing do do."
-
-.ELSE # "$(WITH_CPPUNIT)" != "YES"
-
-CFLAGSCXX += $(CPPUNIT_CFLAGS)
-DLLPRE = # no leading "lib" on .so files
+.ELSE # "$(ENABLE_UNIT_TESTS)" != "YES"
 
 # --- Libs ---------------------------------------------------------
 
-SHL1OBJS=  \
-    $(SLO)/test_converter.obj \
-
-
-SHL1STDLIBS= \
-     $(SAXLIB) \
-     $(SALLIB) \
-     $(CPPUNITLIB) \
-
-
+APP1OBJS=  \
+    $(SLO)/test_converter.obj
+APP1STDLIBS= \
+    $(SAXLIB) \
+    $(SALLIB) \
+    $(GTESTLIB)
 .IF "$(GUI)" == "OS2"
-SHL1TARGET= tst_cnv
+APP1TARGET= tst_cnv
 .ELSE
-SHL1TARGET= test_converter
+APP1TARGET= test_converter
 .ENDIF
-SHL1RPATH = NONE
-SHL1IMPLIB= i$(SHL1TARGET)
-# SHL1DEF= $(MISC)/$(SHL1TARGET).def
-DEF1NAME=$(SHL1TARGET)
-# DEF1EXPORTFILE= export.exp
-SHL1VERSIONMAP= version.map
-
-# --- All object files ---------------------------------------------
-
-SLOFILES= \
-    $(SHL1OBJS) \
-
+APP1RPATH = NONE
+APP1TEST = enabled
 
 # --- Targets ------------------------------------------------------
 
-.ENDIF # "$(WITH_CPPUNIT)" != "YES"
-
 .INCLUDE :  target.mk
-.INCLUDE : _cppunit.mk
 
+.ENDIF # "$(ENABLE_UNIT_TESTS)" != "YES"
diff --git a/sax/qa/cppunit/test_converter.cxx b/sax/qa/cppunit/test_converter.cxx
index 083f62d..546da3e 100644
--- a/sax/qa/cppunit/test_converter.cxx
+++ b/sax/qa/cppunit/test_converter.cxx
@@ -22,10 +22,7 @@
 
 
 #include "preextstl.h"
-#include <cppunit/TestAssert.h>
-#include <cppunit/TestFixture.h>
-#include <cppunit/extensions/HelperMacros.h>
-#include <cppunit/plugin/TestPlugIn.h>
+#include "gtest/gtest.h"
 #include "postextstl.h"
 
 #include <rtl/ustrbuf.hxx>
@@ -44,28 +41,18 @@ using sax::Converter;
 namespace {
 
 class ConverterTest
-    : public ::CppUnit::TestFixture
+    : public ::testing::Test
 {
 public:
-    virtual void setUp();
-    virtual void tearDown();
-
-    void testDuration();
-    void testDateTime();
-
-    CPPUNIT_TEST_SUITE(ConverterTest);
-    CPPUNIT_TEST(testDuration);
-    CPPUNIT_TEST(testDateTime);
-    CPPUNIT_TEST_SUITE_END();
-
-private:
+    virtual void SetUp();
+    virtual void TearDown();
 };
 
-void ConverterTest::setUp()
+void ConverterTest::SetUp()
 {
 }
 
-void ConverterTest::tearDown()
+void ConverterTest::TearDown()
 {
 }
 
@@ -87,13 +74,13 @@ static void doTest(util::Duration const & rid, char const*const pis,
     OSL_TRACE("%d %dY %dM %dD %dH %dM %dS %dm",
         od.Negative, od.Years, od.Months, od.Days,
         od.Hours, od.Minutes, od.Seconds, od.MilliSeconds);
-    CPPUNIT_ASSERT(bSuccess);
-    CPPUNIT_ASSERT(eqDuration(rid, od));
+    ASSERT_TRUE(bSuccess);
+    ASSERT_TRUE(eqDuration(rid, od));
     ::rtl::OUStringBuffer buf;
     Converter::convertDuration(buf, od);
     OSL_TRACE(
         ::rtl::OUStringToOString(buf.getStr(), RTL_TEXTENCODING_UTF8));
-    CPPUNIT_ASSERT(buf.makeStringAndClear().equalsAscii(pos));
+    ASSERT_TRUE(buf.makeStringAndClear().equalsAscii(pos));
 }
 
 static void doTestDurationF(char const*const pis)
@@ -104,10 +91,10 @@ static void doTestDurationF(char const*const pis)
     OSL_TRACE("%d %dY %dM %dD %dH %dM %dS %dH",
         od.Negative, od.Years, od.Months, od.Days,
         od.Hours, od.Minutes, od.Seconds, od.MilliSeconds);
-    CPPUNIT_ASSERT(!bSuccess);
+    ASSERT_TRUE(!bSuccess);
 }
 
-void ConverterTest::testDuration()
+TEST_F(ConverterTest, testDuration)
 {
     OSL_TRACE("\nSAX CONVERTER TEST BEGIN\n");
     doTest( util::Duration(false, 1, 0, 0, 0, 0, 0, 0), "P1Y" );
@@ -158,13 +145,13 @@ static void doTest(util::DateTime const & rdt, char const*const pis,
     OSL_TRACE("Y:%d M:%d D:%d  H:%d M:%d S:%d H:%d",
         odt.Year, odt.Month, odt.Day,
         odt.Hours, odt.Minutes, odt.Seconds, odt.HundredthSeconds);
-    CPPUNIT_ASSERT(bSuccess);
-    CPPUNIT_ASSERT(eqDateTime(rdt, odt));
+    ASSERT_TRUE(bSuccess);
+    ASSERT_TRUE(eqDateTime(rdt, odt));
     ::rtl::OUStringBuffer buf;
     Converter::convertDateTime(buf, odt, true);
     OSL_TRACE(
         ::rtl::OUStringToOString(buf.getStr(), RTL_TEXTENCODING_UTF8));
-    CPPUNIT_ASSERT(buf.makeStringAndClear().equalsAscii(pos));
+    ASSERT_TRUE(buf.makeStringAndClear().equalsAscii(pos));
 }
 
 static void doTestDateTimeF(char const*const pis)
@@ -175,10 +162,10 @@ static void doTestDateTimeF(char const*const pis)
     OSL_TRACE("Y:%d M:%d D:%d  H:%dH M:%d S:%d H:%d",
         odt.Year, odt.Month, odt.Day,
         odt.Hours, odt.Minutes, odt.Seconds, odt.HundredthSeconds);
-    CPPUNIT_ASSERT(!bSuccess);
+    ASSERT_TRUE(!bSuccess);
 }
 
-void ConverterTest::testDateTime()
+TEST_F(ConverterTest, testDateTime)
 {
     OSL_TRACE("\nSAX CONVERTER TEST BEGIN\n");
     doTest( util::DateTime(0, 0, 0, 0, 1, 1, 1), "0001-01-01T00:00:00" );
@@ -234,9 +221,11 @@ void ConverterTest::testDateTime()
     OSL_TRACE("\nSAX CONVERTER TEST END\n");
 }
 
-CPPUNIT_TEST_SUITE_REGISTRATION(ConverterTest);
 
 }
 
-CPPUNIT_PLUGIN_IMPLEMENT();
-
+int main(int argc, char **argv)
+{
+    ::testing::InitGoogleTest(&argc, argv);
+    return RUN_ALL_TESTS();
+}
commit e59b59198d29e687c39b1ba2148d6ea37910613f
Author: Damjan Jovanovic <damjan at apache.org>
Date:   Thu Sep 3 17:13:34 2015 +0000

    #i125003# migrate main/sal/qa/osl/profile from cppunit to Google Test.

diff --git a/sal/qa/osl/profile/makefile.mk b/sal/qa/osl/profile/makefile.mk
index a6c5b76..34f2cec 100644
--- a/sal/qa/osl/profile/makefile.mk
+++ b/sal/qa/osl/profile/makefile.mk
@@ -36,33 +36,29 @@ 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 ----------------------------------------------------------------
-SHL1OBJS=  \
+APP1OBJS=  \
     $(SLO)$/osl_old_testprofile.obj
 
-SHL1TARGET= osl_old_testprofile
-SHL1STDLIBS= $(SALLIB) $(CPPUNITLIB)
-
-SHL1IMPLIB= i$(SHL1TARGET)
-DEF1NAME    =$(SHL1TARGET)
-SHL1VERSIONMAP = $(PRJ)$/qa$/export.map
-SHL1RPATH = NONE
+APP1TARGET= osl_old_testprofile
+APP1STDLIBS= $(SALLIB) $(GTESTLIB)
+APP1RPATH = NONE
+APP1TEST = 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"
 
 .END
diff --git a/sal/qa/osl/profile/osl_old_testprofile.cxx b/sal/qa/osl/profile/osl_old_testprofile.cxx
index c307107..cc9f494 100644
--- a/sal/qa/osl/profile/osl_old_testprofile.cxx
+++ b/sal/qa/osl/profile/osl_old_testprofile.cxx
@@ -33,26 +33,18 @@
 #include <stdio.h>
 #include <osl/profile.h>
 
-#include "cppunit/TestAssert.h"
-#include "cppunit/TestFixture.h"
-#include "cppunit/extensions/HelperMacros.h"
-#include "cppunit/plugin/TestPlugIn.h"
+#include "gtest/gtest.h"
 
 //==================================================================================================
 // -----------------------------------------------------------------------------
 namespace osl_Profile
 {
-    class oldtests : public CppUnit::TestFixture
+    class oldtests : public ::testing::Test
     {
     public:
-        void test_profile();
-
-        CPPUNIT_TEST_SUITE( oldtests );
-        CPPUNIT_TEST( test_profile );
-        CPPUNIT_TEST_SUITE_END( );
     };
 
-void oldtests::test_profile(void)
+TEST_F(oldtests, test_profile)
 {
     oslProfile hProfile;
     rtl_uString* ustrProfileName=0;
@@ -88,8 +80,8 @@ void oldtests::test_profile(void)
 
 } // namespace osl_Profile
 
-// -----------------------------------------------------------------------------
-CPPUNIT_TEST_SUITE_REGISTRATION( osl_Profile::oldtests );
-
-// -----------------------------------------------------------------------------
-CPPUNIT_PLUGIN_IMPLEMENT();
+int main(int argc, char **argv)
+{
+    ::testing::InitGoogleTest(&argc, argv);
+    return RUN_ALL_TESTS();
+}
commit 38ee8ff75aa5b6f1527493baa41569a1377a7cc3
Author: Damjan Jovanovic <damjan at apache.org>
Date:   Thu Sep 3 17:11:28 2015 +0000

    #i125003# migrate main/sal/qa/osl/setthreadname from cppunit to Google Test.

diff --git a/sal/qa/osl/setthreadname/makefile.mk b/sal/qa/osl/setthreadname/makefile.mk
index 672e589..6beca9a 100644
--- a/sal/qa/osl/setthreadname/makefile.mk
+++ b/sal/qa/osl/setthreadname/makefile.mk
@@ -33,21 +33,20 @@ ENABLE_EXCEPTIONS = TRUE
 
 .INCLUDE: settings.mk
 
-CFLAGSCXX += $(CPPUNIT_CFLAGS)
+.IF "$(ENABLE_UNIT_TESTS)" != "YES"
+all:
+    @echo unit tests are disabled. Nothing to do.
 
-DLLPRE =
-
-SHL1IMPLIB = i$(SHL1TARGET)
-SHL1OBJS = $(SLO)/test-setthreadname.obj
-SHL1RPATH = NONE
-SHL1STDLIBS = $(CPPUNITLIB) $(SALLIB)
-SHL1TARGET = test-setthreadname
-SHL1VERSIONMAP = version.map
-DEF1NAME = $(SHL1TARGET)
+.ELSE
 
-SLOFILES = $(SHL1OBJS)
+APP1OBJS = $(SLO)/test-setthreadname.obj
+APP1RPATH = NONE
+APP1STDLIBS = $(GTESTLIB) $(SALLIB)
+APP1TARGET = test-setthreadname
+APP1TEST = enabled
 
 .INCLUDE: target.mk
-.INCLUDE: _cppunit.mk
+
+.ENDIF # "$(ENABLE_UNIT_TESTS)" != "YES"
 
 .END
diff --git a/sal/qa/osl/setthreadname/test-setthreadname.cxx b/sal/qa/osl/setthreadname/test-setthreadname.cxx
index ebe52af..4dec92f 100755
--- a/sal/qa/osl/setthreadname/test-setthreadname.cxx
+++ b/sal/qa/osl/setthreadname/test-setthreadname.cxx
@@ -29,10 +29,7 @@
 #include <limits>
 
 #include "boost/noncopyable.hpp"
-#include "cppunit/TestAssert.h"
-#include "cppunit/TestFixture.h"
-#include "cppunit/extensions/HelperMacros.h"
-#include "cppunit/plugin/TestPlugIn.h"
+#include "gtest/gtest.h"
 #include "osl/thread.hxx"
 
 namespace {
@@ -61,23 +58,20 @@ void TestThread::run() {
     }
 }
 
-class Test: public CppUnit::TestFixture {
-private:
-    CPPUNIT_TEST_SUITE(Test);
-    CPPUNIT_TEST(test);
-    CPPUNIT_TEST_SUITE_END();
-
-    void test();
+class Test: public ::testing::Test {
 };
 
-void Test::test() {
+TEST_F(Test, test) {
     TestThread t;
     t.create();
     t.join();
 }
 
-CPPUNIT_TEST_SUITE_REGISTRATION(Test);
 
 }
 
-CPPUNIT_PLUGIN_IMPLEMENT();
+int main(int argc, char **argv)
+{
+    ::testing::InitGoogleTest(&argc, argv);
+    return RUN_ALL_TESTS();
+}
commit 8d66d4ef923da745e98d23dc8dc330b943481c5e
Author: Damjan Jovanovic <damjan at apache.org>
Date:   Thu Sep 3 17:09:00 2015 +0000

    #i125003# migrate main/sal/qa/osl/mutex from cppunit to Google Test.

diff --git a/sal/qa/osl/mutex/makefile.mk b/sal/qa/osl/mutex/makefile.mk
index d738ca2..52d90b9 100644
--- a/sal/qa/osl/mutex/makefile.mk
+++ b/sal/qa/osl/mutex/makefile.mk
@@ -36,34 +36,34 @@ 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:Socket by codegen.pl
-SHL1OBJS=  \
+APP1OBJS=  \
     $(SLO)$/osl_Mutex.obj
 
-SHL1TARGET= osl_Mutex
-SHL1STDLIBS= $(SALLIB) $(CPPUNITLIB)
+APP1TARGET= osl_Mutex
+APP1STDLIBS= $(SALLIB) $(GTESTLIB)
 .IF "$(GUI)" == "WNT"
-SHL1STDLIBS += $(WS2_32LIB)
+APP1STDLIBS += $(WS2_32LIB)
 .ENDIF
-
-SHL1IMPLIB= i$(SHL1TARGET)
-
-DEF1NAME    =$(SHL1TARGET)
-SHL1VERSIONMAP = $(PRJ)$/qa$/export.map
-SHL1RPATH = NONE
-
+APP1RPATH = NONE
+APP1TEST = enabled
 # auto generated Target:Socket
 # END ------------------------------------------------------------------
 
 # --- Targets ------------------------------------------------------
 
 .INCLUDE :  target.mk
-.INCLUDE : _cppunit.mk
+
+.ENDIF # "$(ENABLE_UNIT_TESTS)" != "YES"
 
 .END
diff --git a/sal/qa/osl/mutex/osl_Mutex.cxx b/sal/qa/osl/mutex/osl_Mutex.cxx
index ad91d75..ba3d722 100644
--- a/sal/qa/osl/mutex/osl_Mutex.cxx
+++ b/sal/qa/osl/mutex/osl_Mutex.cxx
@@ -27,10 +27,7 @@
 //------------------------------------------------------------------------
 // include files
 //------------------------------------------------------------------------
-#include "cppunit/TestAssert.h"
-#include "cppunit/TestFixture.h"
-#include "cppunit/extensions/HelperMacros.h"
-#include "cppunit/plugin/TestPlugIn.h"
+#include "gtest/gtest.h"
 #include <osl_Mutex_Const.h>
 
 using namespace osl;
@@ -114,7 +111,7 @@ public:
 
     ~IncreaseThread( )
     {
-        CPPUNIT_ASSERT_MESSAGE( "#IncreaseThread does not shutdown properly.\n", sal_False == this -> isRunning( ) );
+        ASSERT_TRUE(sal_False == this -> isRunning( )) << "#IncreaseThread does not shutdown properly.\n";
     }
 protected:
     struct resource *pResource;
@@ -142,7 +139,7 @@ public:
 
     ~DecreaseThread( )
     {
-        CPPUNIT_ASSERT_MESSAGE( "#DecreaseThread does not shutdown properly.\n", sal_False == this -> isRunning( ) );
+        ASSERT_TRUE(sal_False == this -> isRunning( )) << "#DecreaseThread does not shutdown properly.\n";
     }
 protected:
     struct resource *pResource;
@@ -180,7 +177,7 @@ public:
 
     ~PutThread( )
     {
-        CPPUNIT_ASSERT_MESSAGE( "#PutThread does not shutdown properly.\n", sal_False == this -> isRunning( ) );
+        ASSERT_TRUE(sal_False == this -> isRunning( )) << "#PutThread does not shutdown properly.\n";
     }
 protected:
     struct chain* pChain;
@@ -218,7 +215,7 @@ public:
 
     ~HoldThread( )
     {
-        CPPUNIT_ASSERT_MESSAGE( "#HoldThread does not shutdown properly.\n", sal_False == this -> isRunning( ) );
+        ASSERT_TRUE(sal_False == this -> isRunning( )) << "#HoldThread does not shutdown properly.\n";
     }
 protected:
     Mutex* pMyMutex;
@@ -240,7 +237,7 @@ public:
 
     ~WaitThread( )
     {
-        CPPUNIT_ASSERT_MESSAGE( "#WaitThread does not shutdown properly.\n", sal_False == this -> isRunning( ) );
+        ASSERT_TRUE(sal_False == this -> isRunning( )) << "#WaitThread does not shutdown properly.\n";
     }
 protected:
     Mutex* pMyMutex;
@@ -264,7 +261,7 @@ public:
 
     ~GlobalMutexThread( )
     {
-        CPPUNIT_ASSERT_MESSAGE( "#GlobalMutexThread does not shutdown properly.\n", sal_False == this -> isRunning( ) );
+        ASSERT_TRUE(sal_False == this -> isRunning( )) << "#GlobalMutexThread does not shutdown properly.\n";
     }
 protected:
     void SAL_CALL run( )
@@ -285,14 +282,14 @@ namespace osl_Mutex
 
     /** Test of the osl::Mutex::constructor
      */
-    class ctor : public CppUnit::TestFixture
+    class MutexConstructor : public ::testing::Test
     {
     public:
         // initialise your test code values here.
         struct chain m_Data;
         struct resource m_Res;
 
-        void setUp( )
+        void SetUp( )
         {
             for ( sal_Int8 i=0; i < BUFFER_SIZE; i++ )
                 m_Data.buffer[i] = 0;
@@ -302,287 +299,254 @@ namespace osl_Mutex
             m_Res.data2 = 0;
         }
 
-        void tearDown()
+        void TearDown()
         {
         }
+    }; // class ctor
 
-        /** Create two threads to write data to the same buffer, use Mutex to assure
-            during one thread write data five times, the other thread should not begin writing.
-            the two threads wrote two different datas: their thread ID, so we can check the datas
-            in buffer to know the order of the two threads writing
+    /** Create two threads to write data to the same buffer, use Mutex to assure
+        during one thread write data five times, the other thread should not begin writing.
+        the two threads wrote two different datas: their thread ID, so we can check the datas
+        in buffer to know the order of the two threads writing
+    */
+    TEST_F(MutexConstructor, ctor_001)
+    {
+        PutThread myThread1( &m_Data );
+        PutThread myThread2( &m_Data );
+
+        myThread1.create( );
+        myThread2.create( );
+
+        //wait until the two threads terminate
+        myThread1.join( );
+        myThread2.join( );
+
+        sal_Bool bRes = sal_False;
+
+        // every 5 datas should the same
+        // LLA: this is not a good check, it's too fix
+        if (m_Data.buffer[0] == m_Data.buffer[1] &&
+            m_Data.buffer[1] == m_Data.buffer[2] &&
+            m_Data.buffer[2] == m_Data.buffer[3] &&
+            m_Data.buffer[3] == m_Data.buffer[4] &&
+            m_Data.buffer[5] == m_Data.buffer[6] &&
+            m_Data.buffer[6] == m_Data.buffer[7] &&
+            m_Data.buffer[7] == m_Data.buffer[8] &&
+            m_Data.buffer[8] == m_Data.buffer[9])
+            bRes = sal_True;
+
+        /*for (sal_Int8 i=0; i<BUFFER_SIZE; i++)
+            printf("#data in buffer is %d\n", m_Data.buffer[i]);
         */
-        void ctor_001()
-        {
-            PutThread myThread1( &m_Data );
-            PutThread myThread2( &m_Data );
-
-            myThread1.create( );
-            myThread2.create( );
-
-            //wait until the two threads terminate
-            myThread1.join( );
-            myThread2.join( );
-
-            sal_Bool bRes = sal_False;
-
-            // every 5 datas should the same
-            // LLA: this is not a good check, it's too fix
-            if (m_Data.buffer[0] == m_Data.buffer[1] &&
-                m_Data.buffer[1] == m_Data.buffer[2] &&
-                m_Data.buffer[2] == m_Data.buffer[3] &&
-                m_Data.buffer[3] == m_Data.buffer[4] &&
-                m_Data.buffer[5] == m_Data.buffer[6] &&
-                m_Data.buffer[6] == m_Data.buffer[7] &&
-                m_Data.buffer[7] == m_Data.buffer[8] &&
-                m_Data.buffer[8] == m_Data.buffer[9])
-                bRes = sal_True;
-
-            /*for (sal_Int8 i=0; i<BUFFER_SIZE; i++)
-                printf("#data in buffer is %d\n", m_Data.buffer[i]);
-            */
-
-            CPPUNIT_ASSERT_MESSAGE("Mutex ctor", bRes == sal_True);
 
-        }
+        ASSERT_TRUE(bRes == sal_True) << "Mutex ctor";
 
-        /** Create two threads to write data to operate on the same number , use Mutex to assure,
-            one thread increase data 3 times, the other thread decrease 3 times, store the operate
-            result when the first thread complete, if it is interrupt by the other thread, the stored
-            number will not be 3.
-        */
-        void ctor_002()
-        {
-            IncreaseThread myThread1( &m_Res );
-            DecreaseThread myThread2( &m_Res );
+    }
 
-            myThread1.create( );
-            myThread2.create( );
+    /** Create two threads to write data to operate on the same number , use Mutex to assure,
+        one thread increase data 3 times, the other thread decrease 3 times, store the operate
+        result when the first thread complete, if it is interrupt by the other thread, the stored
+        number will not be 3.
+    */
+    TEST_F(MutexConstructor, ctor_002)
+    {
+        IncreaseThread myThread1( &m_Res );
+        DecreaseThread myThread2( &m_Res );
 
-            //wait until the two threads terminate
-            myThread1.join( );
-            myThread2.join( );
+        myThread1.create( );
+        myThread2.create( );
 
-            sal_Bool bRes = sal_False;
+        //wait until the two threads terminate
+        myThread1.join( );
+        myThread2.join( );
 
-            // every 5 datas should the same
-            if ( ( m_Res.data1 == 0 ) && ( m_Res.data2 == 3 ) )
-                bRes = sal_True;
+        sal_Bool bRes = sal_False;
 
-            CPPUNIT_ASSERT_MESSAGE( "test Mutex ctor function: increase and decrease a number 3 times without interrupt.", bRes == sal_True );
-        }
+        // every 5 datas should the same
+        if ( ( m_Res.data1 == 0 ) && ( m_Res.data2 == 3 ) )
+            bRes = sal_True;
 
-        CPPUNIT_TEST_SUITE( ctor );
-        CPPUNIT_TEST( ctor_001 );
-        CPPUNIT_TEST( ctor_002 );
-        CPPUNIT_TEST_SUITE_END( );
-    }; // class ctor
+        ASSERT_TRUE(bRes == sal_True) << "test Mutex ctor function: increase and decrease a number 3 times without interrupt.";
+    }
 
 
     /** Test of the osl::Mutex::acquire method
      */
-    class acquire : public CppUnit::TestFixture
+    class acquire : public ::testing::Test
     {
     public:
-        // acquire mutex in main thread, and then call acquire again in myThread,
-        // the child thread should block, wait 2 secs, it still block.
-        // Then release mutex in main thread, the child thread could return from acquire,
-        // and go to exec next statement, so could terminate quickly.
-        void acquire_001( )
-        {
-            Mutex aMutex;
-            //acquire here
-            sal_Bool bRes = aMutex.acquire( );
-            // pass the pointer of mutex to child thread
-            HoldThread myThread( &aMutex );
-            myThread.create( );
-
-            ThreadHelper::thread_sleep_tenth_sec( 2 );
-            // if acquire in myThread does not work, 2 secs is long enough,
-            // myThread should terminate now, and bRes1 should be sal_False
-            sal_Bool bRes1 = myThread.isRunning( );
+    }; // class acquire
 
-            aMutex.release( );
-            ThreadHelper::thread_sleep_tenth_sec( 1 );
-            // after release mutex, myThread stops blocking and will terminate immediately
-            sal_Bool bRes2 = myThread.isRunning( );
-            myThread.join( );
+    // acquire mutex in main thread, and then call acquire again in myThread,
+    // the child thread should block, wait 2 secs, it still block.
+    // Then release mutex in main thread, the child thread could return from acquire,
+    // and go to exec next statement, so could terminate quickly.
+    TEST_F(acquire, acquire_001 )
+    {
+        Mutex aMutex;
+        //acquire here
+        sal_Bool bRes = aMutex.acquire( );
+        // pass the pointer of mutex to child thread
+        HoldThread myThread( &aMutex );
+        myThread.create( );
 
-            CPPUNIT_ASSERT_MESSAGE( "Mutex acquire",
-                bRes == sal_True && bRes1 == sal_True && bRes2 == sal_False );
-        }
+        ThreadHelper::thread_sleep_tenth_sec( 2 );
+        // if acquire in myThread does not work, 2 secs is long enough,
+        // myThread should terminate now, and bRes1 should be sal_False
+        sal_Bool bRes1 = myThread.isRunning( );
 
-        //in the same thread, acquire twice should success
-        void acquire_002()
-        {
-            Mutex aMutex;
-            //acquire here
-            sal_Bool bRes = aMutex.acquire();
-            sal_Bool bRes1 = aMutex.acquire();
+        aMutex.release( );
+        ThreadHelper::thread_sleep_tenth_sec( 1 );
+        // after release mutex, myThread stops blocking and will terminate immediately
+        sal_Bool bRes2 = myThread.isRunning( );
+        myThread.join( );
 
-            sal_Bool bRes2 = aMutex.tryToAcquire();
+        ASSERT_TRUE(bRes == sal_True && bRes1 == sal_True && bRes2 == sal_False) << "Mutex acquire";
+    }
 
-            aMutex.release();
+    //in the same thread, acquire twice should success
+    TEST_F(acquire, acquire_002)
+    {
+        Mutex aMutex;
+        //acquire here
+        sal_Bool bRes = aMutex.acquire();
+        sal_Bool bRes1 = aMutex.acquire();
 
-            CPPUNIT_ASSERT_MESSAGE("Mutex acquire",
-                bRes == sal_True && bRes1 == sal_True && bRes2 == sal_True);
+        sal_Bool bRes2 = aMutex.tryToAcquire();
 
-        }
+        aMutex.release();
 
-        CPPUNIT_TEST_SUITE( acquire );
-        CPPUNIT_TEST( acquire_001 );
-        CPPUNIT_TEST( acquire_002 );
-        CPPUNIT_TEST_SUITE_END( );
-    }; // class acquire
+        ASSERT_TRUE(bRes == sal_True && bRes1 == sal_True && bRes2 == sal_True) << "Mutex acquire";
+
+    }
 
 
     /** Test of the osl::Mutex::tryToAcquire method
      */
-    class tryToAcquire : public CppUnit::TestFixture
+    class tryToAcquire : public ::testing::Test
     {
     public:
-        // First let child thread acquire the mutex, and wait 2 secs, during the 2 secs,
-        // in main thread, tryToAcquire mutex should return False
-        // then after the child thread terminated, tryToAcquire should return True
-        void tryToAcquire_001()
-        {
-            Mutex aMutex;
-            WaitThread myThread(&aMutex);
-            myThread.create();
+    }; // class tryToAcquire
 
-            // ensure the child thread acquire the mutex
-            ThreadHelper::thread_sleep_tenth_sec(1);
+    // First let child thread acquire the mutex, and wait 2 secs, during the 2 secs,
+    // in main thread, tryToAcquire mutex should return False
+    // then after the child thread terminated, tryToAcquire should return True
+    TEST_F(tryToAcquire, tryToAcquire_001)
+    {
+        Mutex aMutex;
+        WaitThread myThread(&aMutex);
+        myThread.create();
 
-            sal_Bool bRes1 = aMutex.tryToAcquire();
+        // ensure the child thread acquire the mutex
+        ThreadHelper::thread_sleep_tenth_sec(1);
 
-            if (bRes1 == sal_True)
-                aMutex.release();
-            // wait the child thread terminate
-            myThread.join();
+        sal_Bool bRes1 = aMutex.tryToAcquire();
 
-            sal_Bool bRes2 = aMutex.tryToAcquire();
+        if (bRes1 == sal_True)
+            aMutex.release();
+        // wait the child thread terminate
+        myThread.join();
 
-            if (bRes2 == sal_True)
-                aMutex.release();
+        sal_Bool bRes2 = aMutex.tryToAcquire();
 
-        CPPUNIT_ASSERT_MESSAGE("Try to acquire Mutex",
-                bRes1 == sal_False && bRes2 == sal_True);
-        }
+        if (bRes2 == sal_True)
+            aMutex.release();
+
+    ASSERT_TRUE(bRes1 == sal_False && bRes2 == sal_True) << "Try to acquire Mutex";
+    }
 
-        CPPUNIT_TEST_SUITE(tryToAcquire);
-        CPPUNIT_TEST(tryToAcquire_001);
-        CPPUNIT_TEST_SUITE_END();
-    }; // class tryToAcquire
 
     /** Test of the osl::Mutex::release method
      */
-    class release : public CppUnit::TestFixture
+    class release : public ::testing::Test
     {
     public:
-        /** acquire/release are not used in pairs: after child thread acquired mutex,
-            the main thread release it, then any thread could acquire it.
-        */
-        void release_001()
-        {
-            Mutex aMutex;
-            WaitThread myThread( &aMutex );
-            myThread.create( );
+    }; // class release
 
-            // ensure the child thread acquire the mutex
-            ThreadHelper::thread_sleep_tenth_sec( 1 );
+    /** acquire/release are not used in pairs: after child thread acquired mutex,
+        the main thread release it, then any thread could acquire it.
+    */
+    TEST_F(release, release_001)
+    {
+        Mutex aMutex;
+        WaitThread myThread( &aMutex );
+        myThread.create( );
 
-            sal_Bool bRunning = myThread.isRunning( );
-            sal_Bool bRes1 = aMutex.tryToAcquire( );
-            // wait the child thread terminate
-            myThread.join( );
+        // ensure the child thread acquire the mutex
+        ThreadHelper::thread_sleep_tenth_sec( 1 );
 
-            sal_Bool bRes2 = aMutex.tryToAcquire( );
+        sal_Bool bRunning = myThread.isRunning( );
+        sal_Bool bRes1 = aMutex.tryToAcquire( );
+        // wait the child thread terminate
+        myThread.join( );
 
-            if ( bRes2 == sal_True )
-                aMutex.release( );
+        sal_Bool bRes2 = aMutex.tryToAcquire( );
 
-            CPPUNIT_ASSERT_MESSAGE( "release Mutex: try to acquire before and after the mutex has been released",
-                bRes1 == sal_False && bRes2 == sal_True && bRunning == sal_True );
+        if ( bRes2 == sal_True )
+            aMutex.release( );
 
-        }
+        ASSERT_TRUE(bRes1 == sal_False && bRes2 == sal_True && bRunning == sal_True) << "release Mutex: try to aquire before and after the mutex has been released";
 
-        // how about release twice?
-        void release_002()
-        {
+    }
+
+    // how about release twice?
+    TEST_F(release, release_002)
+    {
 // LLA: is this a real test?
 #if 0
-            Mutex aMutex;
-            sal_Bool bRes1 = aMutex.release( );
-            sal_Bool bRes2 = aMutex.release( );
+        Mutex aMutex;
+        sal_Bool bRes1 = aMutex.release( );
+        sal_Bool bRes2 = aMutex.release( );
 
-            CPPUNIT_ASSERT_MESSAGE( "release Mutex: mutex should not be released without acquire, should not release twice. although the behaviour is still under discussion, this test is passed on (LINUX), not passed on (SOLARIS)&(WINDOWS)",
-                bRes1 == sal_False && bRes2 == sal_False );
+        ASSERT_TRUE(bRes1 == sal_False && bRes2 == sal_False) << "release Mutex: mutex should not be released without aquire, should not release twice. although the behaviour is still under discussion, this test is passed on (LINUX), not passed on (SOLARIS)&(WINDOWS)";
 #endif
-        }
-
-        CPPUNIT_TEST_SUITE( release );
-        CPPUNIT_TEST( release_001 );
-        CPPUNIT_TEST( release_002 );
-        CPPUNIT_TEST_SUITE_END( );
-    }; // class release
-
+    }
 
 
     /** Test of the osl::Mutex::getGlobalMutex method
      */
-    class getGlobalMutex : public CppUnit::TestFixture
+    class getGlobalMutex : public ::testing::Test
     {
     public:
-        // initialise your test code values here.
-        void getGlobalMutex_001()
-        {
-            Mutex* pGlobalMutex;
-            pGlobalMutex = pGlobalMutex->getGlobalMutex();
-            pGlobalMutex->acquire();
+    }; // class getGlobalMutex
 
-            GlobalMutexThread myThread;
-            myThread.create();
+    // initialise your test code values here.
+    TEST_F(getGlobalMutex, getGlobalMutex_001)
+    {
+        Mutex* pGlobalMutex;
+        pGlobalMutex = pGlobalMutex->getGlobalMutex();
+        pGlobalMutex->acquire();
 
-            ThreadHelper::thread_sleep_tenth_sec(1);
-            sal_Bool bRes1 = myThread.isRunning();
+        GlobalMutexThread myThread;
+        myThread.create();
 
-            pGlobalMutex->release();
-            ThreadHelper::thread_sleep_tenth_sec(1);
-            // after release mutex, myThread stops blocking and will terminate immediately
-            sal_Bool bRes2 = myThread.isRunning();
+        ThreadHelper::thread_sleep_tenth_sec(1);
+        sal_Bool bRes1 = myThread.isRunning();
 
-            CPPUNIT_ASSERT_MESSAGE("Global Mutex works",
-                bRes1 == sal_True && bRes2 == sal_False);
-        }
+        pGlobalMutex->release();
+        ThreadHelper::thread_sleep_tenth_sec(1);
+        // after release mutex, myThread stops blocking and will terminate immediately
+        sal_Bool bRes2 = myThread.isRunning();
 
-        void getGlobalMutex_002( )
-        {
-            sal_Bool bRes;
+        ASSERT_TRUE(bRes1 == sal_True && bRes2 == sal_False) << "Global Mutex works";
+    }
 
-            Mutex *pGlobalMutex;
-            pGlobalMutex = pGlobalMutex->getGlobalMutex( );
-            pGlobalMutex->acquire( );
-            {
-                Mutex *pGlobalMutex1;
-                pGlobalMutex1 = pGlobalMutex1->getGlobalMutex( );
-                bRes = pGlobalMutex1->release( );
-            }
+    TEST_F(getGlobalMutex, getGlobalMutex_002 )
+    {
+        sal_Bool bRes;
 
-            CPPUNIT_ASSERT_MESSAGE( "Global Mutex works: if the code between {} get the different mutex as the former one, it will return false when release.",
-                bRes == sal_True );
+        Mutex *pGlobalMutex;
+        pGlobalMutex = pGlobalMutex->getGlobalMutex( );
+        pGlobalMutex->acquire( );
+        {
+            Mutex *pGlobalMutex1;
+            pGlobalMutex1 = pGlobalMutex1->getGlobalMutex( );
+            bRes = pGlobalMutex1->release( );
         }
 
-        CPPUNIT_TEST_SUITE(getGlobalMutex);
-        CPPUNIT_TEST(getGlobalMutex_001);
-        CPPUNIT_TEST(getGlobalMutex_002);
-        CPPUNIT_TEST_SUITE_END();
-    }; // class getGlobalMutex
+        ASSERT_TRUE(bRes == sal_True) << "Global Mutex works: if the code between {} get the different mutex as the former one, it will return false when release.";
+    }
 
-// -----------------------------------------------------------------------------
-CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(osl_Mutex::ctor, "osl_Mutex");
-CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(osl_Mutex::acquire, "osl_Mutex");
-CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(osl_Mutex::tryToAcquire, "osl_Mutex");
-CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(osl_Mutex::release, "osl_Mutex");
-CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(osl_Mutex::getGlobalMutex, "osl_Mutex");
 } // namespace osl_Mutex
 
 
@@ -598,7 +562,7 @@ public:
 
     ~GuardThread( )
     {
-        CPPUNIT_ASSERT_MESSAGE( "#GuardThread does not shutdown properly.\n", sal_False == this -> isRunning( ) );
+        ASSERT_TRUE(sal_False == this -> isRunning( )) << "#GuardThread does not shutdown properly.\n";
     }
 protected:
     Mutex* pMyMutex;
@@ -614,59 +578,51 @@ protected:
 
 namespace osl_Guard
 {
-    class ctor : public CppUnit::TestFixture
+    class GuardThreadConstructor : public ::testing::Test
     {
     public:
-        // insert your test code here.
-        void ctor_001()
-        {
-            Mutex aMutex;
-            GuardThread myThread(&aMutex);
-            myThread.create();
+    }; // class ctor
 
-            ThreadHelper::thread_sleep_tenth_sec(1);
-            sal_Bool bRes = aMutex.tryToAcquire();
-            // after 1 second, the mutex has been guarded, and the child thread should be running
-            sal_Bool bRes1 = myThread.isRunning();
+    // insert your test code here.
+    TEST_F(GuardThreadConstructor, ctor_001)
+    {
+        Mutex aMutex;
+        GuardThread myThread(&aMutex);
+        myThread.create();
 
-            myThread.join();
-            sal_Bool bRes2 = aMutex.tryToAcquire();
+        ThreadHelper::thread_sleep_tenth_sec(1);
+        sal_Bool bRes = aMutex.tryToAcquire();
+        // after 1 second, the mutex has been guarded, and the child thread should be running
+        sal_Bool bRes1 = myThread.isRunning();
 
-            CPPUNIT_ASSERT_MESSAGE("GuardThread constructor",
-                bRes == sal_False && bRes1 == sal_True && bRes2 == sal_True);
-        }
+        myThread.join();
+        sal_Bool bRes2 = aMutex.tryToAcquire();
 
-        void ctor_002( )
-        {
-            Mutex aMutex;
+        ASSERT_TRUE(bRes == sal_False && bRes1 == sal_True && bRes2 == sal_True) << "GuardThread constructor";
+    }
 
-            /// use reference constructor here
-            MutexGuard myGuard( aMutex );
+    TEST_F(GuardThreadConstructor, ctor_002 )
+    {
+        Mutex aMutex;
 
-            /// the GuardThread will block here when it is initialised.
-            GuardThread myThread( &aMutex );
-            myThread.create( );
+        /// use reference constructor here
+        MutexGuard myGuard( aMutex );
 
-            /// is it still blocking?
-            ThreadHelper::thread_sleep_tenth_sec( 2 );
-            sal_Bool bRes = myThread.isRunning( );
+        /// the GuardThread will block here when it is initialised.
+        GuardThread myThread( &aMutex );
+        myThread.create( );
 
-            /// oh, release him.
-            aMutex.release( );
-            myThread.join( );
+        /// is it still blocking?
+        ThreadHelper::thread_sleep_tenth_sec( 2 );
+        sal_Bool bRes = myThread.isRunning( );
 
-            CPPUNIT_ASSERT_MESSAGE("GuardThread constructor: reference initialization, acquire the mutex before running the thread, then check if it is blocking.",
-                bRes == sal_True);
-        }
+        /// oh, release him.
+        aMutex.release( );
+        myThread.join( );
 
-        CPPUNIT_TEST_SUITE(ctor);
-        CPPUNIT_TEST(ctor_001);
-        CPPUNIT_TEST(ctor_002);
-        CPPUNIT_TEST_SUITE_END();
-    }; // class ctor
+        ASSERT_TRUE(bRes == sal_True) << "GuardThread constructor: reference initialization, aquire the mutex before running the thread, then check if it is blocking.";
+    }
 
-// -----------------------------------------------------------------------------
-CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(osl_Guard::ctor, "osl_Guard");
 } // namespace osl_Guard
 
 
@@ -684,7 +640,7 @@ public:
 
     ~ClearGuardThread( )
     {
-        CPPUNIT_ASSERT_MESSAGE( "#ClearGuardThread does not shutdown properly.\n", sal_False == this -> isRunning( ) );
+        ASSERT_TRUE(sal_False == this -> isRunning( )) << "#ClearGuardThread does not shutdown properly.\n";
     }
 protected:
     Mutex* pMyMutex;
@@ -706,109 +662,94 @@ protected:
 namespace osl_ClearableGuard
 {
 
-    class ctor : public CppUnit::TestFixture
+    class ClearableGuardConstructor : public ::testing::Test
     {
     public:
-        void ctor_001()
-        {
-            Mutex aMutex;
+    }; // class ctor
 
-            /// now, the aMutex has been guarded.
-            ClearableMutexGuard myMutexGuard( &aMutex );
+    TEST_F(ClearableGuardConstructor, ctor_001)
+    {
+        Mutex aMutex;
 
-            /// it will return sal_False if the aMutex has not been Guarded.
-            sal_Bool bRes = aMutex.release( );
+        /// now, the aMutex has been guarded.
+        ClearableMutexGuard myMutexGuard( &aMutex );
 
-            CPPUNIT_ASSERT_MESSAGE("ClearableMutexGuard constructor, test the acquire operation when initilized.",
-                bRes == sal_True );
-        }
+        /// it will return sal_False if the aMutex has not been Guarded.
+        sal_Bool bRes = aMutex.release( );
 
-        void ctor_002( )
-        {
-            Mutex aMutex;
+        ASSERT_TRUE(bRes == sal_True) << "ClearableMutexGuard constructor, test the aquire operation when initilized.";
+    }
 
-            /// now, the aMutex has been guarded, this time, we use reference constructor.
-            ClearableMutexGuard myMutexGuard( aMutex );
+    TEST_F(ClearableGuardConstructor, ctor_002 )
+    {
+        Mutex aMutex;
 
-            /// it will return sal_False if the aMutex has not been Guarded.
-            sal_Bool bRes = aMutex.release( );
+        /// now, the aMutex has been guarded, this time, we use reference constructor.
+        ClearableMutexGuard myMutexGuard( aMutex );
 
-            CPPUNIT_ASSERT_MESSAGE("ClearableMutexGuard constructor, test the acquire operation when initilized, we use reference constructor this time.",
-                bRes == sal_True );
-        }
+        /// it will return sal_False if the aMutex has not been Guarded.
+        sal_Bool bRes = aMutex.release( );
 
-        CPPUNIT_TEST_SUITE(ctor);
-        CPPUNIT_TEST(ctor_001);
-        CPPUNIT_TEST(ctor_002);
-        CPPUNIT_TEST_SUITE_END();
-    }; // class ctor
+        ASSERT_TRUE(bRes == sal_True) << "ClearableMutexGuard constructor, test the aquire operation when initilized, we use reference constructor this time.";
+    }
 
-    class clear : public CppUnit::TestFixture
+    class clear : public ::testing::Test
     {
     public:
-        void clear_001()
-        {
-            Mutex aMutex;
-            ClearGuardThread myThread(&aMutex);
-            myThread.create();
+    }; // class clear
 
-            TimeValue aTimeVal_befor;
-            osl_getSystemTime( &aTimeVal_befor );
-            // wait 1 second to assure the child thread has begun
-            ThreadHelper::thread_sleep(1);
+    TEST_F(clear, clear_001)
+    {
+        Mutex aMutex;
+        ClearGuardThread myThread(&aMutex);
+        myThread.create();
+
+        TimeValue aTimeVal_befor;
+        osl_getSystemTime( &aTimeVal_befor );
+        // wait 1 second to assure the child thread has begun
+        ThreadHelper::thread_sleep(1);
 
-            while (1)
+        while (1)
+        {
+            if (aMutex.tryToAcquire() == sal_True)
             {
-                if (aMutex.tryToAcquire() == sal_True)
-                {
-                    break;
-                }
-                ThreadHelper::thread_sleep(1);
+                break;
             }
-            TimeValue aTimeVal_after;
-            osl_getSystemTime( &aTimeVal_after );
-            sal_Int32 nSec = aTimeVal_after.Seconds - aTimeVal_befor.Seconds;
-            printf("nSec is %"SAL_PRIdINT32"\n", nSec);
-
-            myThread.join();
-
-            CPPUNIT_ASSERT_MESSAGE("ClearableGuard method: clear",
-                nSec < 7 && nSec > 1);
+            ThreadHelper::thread_sleep(1);
         }
+        TimeValue aTimeVal_after;
+        osl_getSystemTime( &aTimeVal_after );
+        sal_Int32 nSec = aTimeVal_after.Seconds - aTimeVal_befor.Seconds;
+        printf("nSec is %"SAL_PRIdINT32"\n", nSec);
 
-        void clear_002( )
-        {
-            Mutex aMutex;
+        myThread.join();
 
-            /// now, the aMutex has been guarded.
-            ClearableMutexGuard myMutexGuard( &aMutex );
+        ASSERT_TRUE(nSec < 7 && nSec > 1) << "ClearableGuard method: clear";
+    }
 
-            /// launch the HoldThread, it will be blocked here.
-            HoldThread myThread( &aMutex );
-            myThread.create( );
+    TEST_F(clear, clear_002 )
+    {
+        Mutex aMutex;
 
-            /// is it blocking?
-            ThreadHelper::thread_sleep_tenth_sec( 4 );
-            sal_Bool bRes = myThread.isRunning( );
+        /// now, the aMutex has been guarded.
+        ClearableMutexGuard myMutexGuard( &aMutex );
 
-            /// use clear to release.
-            myMutexGuard.clear( );
-            myThread.join( );
-            sal_Bool bRes1 = myThread.isRunning( );
+        /// launch the HoldThread, it will be blocked here.
+        HoldThread myThread( &aMutex );
+        myThread.create( );
 
-            CPPUNIT_ASSERT_MESSAGE( "ClearableGuard method: clear, control the HoldThread's running status!",
-                ( sal_True == bRes ) && ( sal_False == bRes1 ) );
-        }
+        /// is it blocking?
+        ThreadHelper::thread_sleep_tenth_sec( 4 );
+        sal_Bool bRes = myThread.isRunning( );
 
-        CPPUNIT_TEST_SUITE( clear );
-        CPPUNIT_TEST( clear_001 );
-        CPPUNIT_TEST( clear_002 );
-        CPPUNIT_TEST_SUITE_END( );
-    }; // class clear
+        /// use clear to release.
+        myMutexGuard.clear( );
+        myThread.join( );
+        sal_Bool bRes1 = myThread.isRunning( );
+
+        ASSERT_TRUE(( sal_True == bRes ) && ( sal_False == bRes1 )) << "ClearableGuard method: clear, control the HoldThread's running status!";
+    }
 
-// -----------------------------------------------------------------------------
-CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( osl_ClearableGuard::ctor, "osl_ClearableGuard" );
-CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( osl_ClearableGuard::clear, "osl_ClearableGuard" );
 } // namespace osl_ClearableGuard
 
 
@@ -826,7 +767,7 @@ public:
 
     ~ResetGuardThread( )
     {
-        CPPUNIT_ASSERT_MESSAGE( "#ResetGuardThread does not shutdown properly.\n", sal_False == this -> isRunning( ) );
+        ASSERT_TRUE(sal_False == this -> isRunning( )) << "#ResetGuardThread does not shutdown properly.\n";
     }
 protected:
     Mutex* pMyMutex;
@@ -845,99 +786,89 @@ protected:
 // -----------------------------------------------------------------------------
 namespace osl_ResettableGuard
 {
-    class ctor : public CppUnit::TestFixture
+    class ctor : public ::testing::Test
     {
     public:
-        void ctor_001()
-        {
-            Mutex aMutex;
+    }; // class ctor
 
-            /// now, the aMutex has been guarded.
-            ResettableMutexGuard myMutexGuard( &aMutex );
+    TEST_F(ctor, ctor_001)
+    {
+        Mutex aMutex;
 
-            /// it will return sal_False if the aMutex has not been Guarded.
-            sal_Bool bRes = aMutex.release( );
+        /// now, the aMutex has been guarded.
+        ResettableMutexGuard myMutexGuard( &aMutex );
 
-            CPPUNIT_ASSERT_MESSAGE("ResettableMutexGuard constructor, test the acquire operation when initilized.",
-                bRes == sal_True );
-        }
+        /// it will return sal_False if the aMutex has not been Guarded.
+        sal_Bool bRes = aMutex.release( );
 
-        void ctor_002( )
-        {
-            Mutex aMutex;
+        ASSERT_TRUE(bRes == sal_True) << "ResettableMutexGuard constructor, test the aquire operation when initilized.";
+    }
 
-            /// now, the aMutex has been guarded, this time, we use reference constructor.
-            ResettableMutexGuard myMutexGuard( aMutex );
+    TEST_F(ctor, ctor_002 )
+    {
+        Mutex aMutex;
 
-            /// it will return sal_False if the aMutex has not been Guarded.
-            sal_Bool bRes = aMutex.release( );
+        /// now, the aMutex has been guarded, this time, we use reference constructor.
+        ResettableMutexGuard myMutexGuard( aMutex );
 
-            CPPUNIT_ASSERT_MESSAGE( "ResettableMutexGuard constructor, test the acquire operation when initilized, we use reference constructor this time.",
-                bRes == sal_True );
-        }
+        /// it will return sal_False if the aMutex has not been Guarded.
+        sal_Bool bRes = aMutex.release( );
 
+        ASSERT_TRUE(bRes == sal_True) << "ResettableMutexGuard constructor, test the aquire operation when initilized, we use reference constructor this time.";
+    }
 
-        CPPUNIT_TEST_SUITE(ctor);
-        CPPUNIT_TEST(ctor_001);
-        CPPUNIT_TEST(ctor_002);
-        CPPUNIT_TEST_SUITE_END();
-    }; // class ctor
 
-    class reset : public CppUnit::TestFixture
+    class reset : public ::testing::Test
     {
     public:
-        void reset_001( )
-        {
-            Mutex aMutex;
-            ResetGuardThread myThread( &aMutex );
-            ResettableMutexGuard myMutexGuard( aMutex );
-            myThread.create( );
-
-            /// is it running? and clear done?
-            sal_Bool bRes = myThread.isRunning( );
-            myMutexGuard.clear( );
-            ThreadHelper::thread_sleep_tenth_sec( 1 );
-
-            /// if reset is not success, the release will return sal_False
-            myMutexGuard.reset( );
-            sal_Bool bRes1 = aMutex.release( );
-            myThread.join( );
-
-            CPPUNIT_ASSERT_MESSAGE( "ResettableMutexGuard method: reset",
-                ( sal_True == bRes ) && ( sal_True == bRes1 ) );
-        }
+    }; // class reset
 
-        void reset_002( )
-        {
-            Mutex aMutex;
-            ResettableMutexGuard myMutexGuard( &aMutex );
 
-            /// shouldn't release after clear;
-            myMutexGuard.clear( );
-            sal_Bool bRes = aMutex.release( );
+    TEST_F(reset, reset_001 )
+    {
+        Mutex aMutex;
+        ResetGuardThread myThread( &aMutex );
+        ResettableMutexGuard myMutexGuard( aMutex );
+        myThread.create( );
+
+        /// is it running? and clear done?
+        sal_Bool bRes = myThread.isRunning( );
+        myMutexGuard.clear( );
+        ThreadHelper::thread_sleep_tenth_sec( 1 );
+
+        /// if reset is not success, the release will return sal_False
+        myMutexGuard.reset( );
+        sal_Bool bRes1 = aMutex.release( );
+        myThread.join( );
+
+        ASSERT_TRUE(( sal_True == bRes ) && ( sal_True == bRes1 )) << "ResettableMutexGuard method: reset";
+    }
 
-            /// can release after reset.
-            myMutexGuard.reset( );
-            sal_Bool bRes1 = aMutex.release( );
+    TEST_F(reset, reset_002 )
+    {
+#ifdef LINUX
+        Mutex aMutex;
+        ResettableMutexGuard myMutexGuard( &aMutex );
 
-            CPPUNIT_ASSERT_MESSAGE( "ResettableMutexGuard method: reset, release after clear and reset, on Solaris, the mutex can be release without acquire, so it can not passed on (SOLARIS), but not the reason for reset_002",
-                ( sal_False == bRes ) && ( sal_True == bRes1 ) );
-        }
+        /// shouldn't release after clear;
+        myMutexGuard.clear( );
+        sal_Bool bRes = aMutex.release( );
 
-        CPPUNIT_TEST_SUITE(reset);
-        CPPUNIT_TEST(reset_001);
-#ifdef LINUX
-        CPPUNIT_TEST(reset_002);
+        /// can release after reset.
+        myMutexGuard.reset( );
+        sal_Bool bRes1 = aMutex.release( );
+
+        ASSERT_TRUE(( sal_False == bRes ) && ( sal_True == bRes1 )) << "ResettableMutexGuard method: reset, release after clear and reset, on Solaris, the mutex can be release without aquire, so it can not passed on (SOLARIS), but not the reason for reset_002";
 #endif
-        CPPUNIT_TEST_SUITE_END();
-    }; // class reset
+    }
 
-// -----------------------------------------------------------------------------
-CPPUNIT_TEST_SUITE_REGISTRATION(osl_ResettableGuard::ctor);
-CPPUNIT_TEST_SUITE_REGISTRATION(osl_ResettableGuard::reset);
 } // namespace osl_ResettableGuard
 
-CPPUNIT_PLUGIN_IMPLEMENT();
+int main(int argc, char **argv)
+{
+    ::testing::InitGoogleTest(&argc, argv);
+    return RUN_ALL_TESTS();
+}
 
 // The following sets variables for GNU EMACS
 // Local Variables:
commit 6dff45ed57cea70ff3414dd35628a16b0dbe4c81
Author: Damjan Jovanovic <damjan at apache.org>
Date:   Thu Sep 3 16:25:13 2015 +0000

    #i125003# migrate main/sal/qa/testHelperFunctions from cppunit to Google Test.

diff --git a/sal/qa/testHelperFunctions/makefile.mk b/sal/qa/testHelperFunctions/makefile.mk
index 087a2bc..b56cd30 100644
--- a/sal/qa/testHelperFunctions/makefile.mk
+++ b/sal/qa/testHelperFunctions/makefile.mk
@@ -32,28 +32,29 @@ 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)
 
 # --- BEGIN --------------------------------------------------------
-SHL1OBJS=  \
+APP1OBJS=  \
     $(SLO)$/testHelperFunctions.obj \
     $(SLO)$/testHelperFunctions2.obj
 
-SHL1TARGET= testHelperFunctions
-SHL1STDLIBS= $(SALLIB) $(CPPUNITLIB) $(TESTSHL2LIB)
-
-SHL1IMPLIB= i$(SHL1TARGET)
-DEF1NAME    =$(SHL1TARGET)
-SHL1VERSIONMAP = $(PRJ)$/qa$/export.map
+APP1TARGET= testHelperFunctions
+APP1STDLIBS= $(SALLIB) $(GTESTLIB) $(TESTSHL2LIB)
+APP1RPATH = NONE
+APP1TEST = 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"
diff --git a/sal/qa/testHelperFunctions/testHelperFunctions.cxx b/sal/qa/testHelperFunctions/testHelperFunctions.cxx
index 7fae886..d2e7d01 100644
--- a/sal/qa/testHelperFunctions/testHelperFunctions.cxx
+++ b/sal/qa/testHelperFunctions/testHelperFunctions.cxx
@@ -31,19 +31,19 @@
 
 #include "stringhelper.hxx"
 
-#include <testshl/simpleheader.hxx>
+#include "gtest/gtest.h"
 
 // void isJaBloed()
 // {
-//     t_print("Ist ja echt bloed.\n");
+//     printf("Ist ja echt bloed.\n");
 // }
 
 inline sal_Int64 t_abs64(sal_Int64 _nValue)
 {
     // std::abs() seems to have some ambiguity problems (so-texas)
     // return abs(_nValue);
-    t_print("t_abs64(%ld)\n", _nValue);
-    // CPPUNIT_ASSERT(_nValue < 2147483647);
+    printf("t_abs64(%ld)\n", _nValue);
+    // ASSERT_TRUE(_nValue < 2147483647);
 
     if (_nValue < 0)
     {
@@ -52,7 +52,7 @@ inline sal_Int64 t_abs64(sal_Int64 _nValue)
     return _nValue;
 }
 
-void t_print64(sal_Int64 n)
+void printf64(sal_Int64 n)
 {
     if (n < 0)
     {
@@ -79,146 +79,123 @@ void t_print64(sal_Int64 n)
 // -----------------------------------------------------------------------------
 namespace testOfHelperFunctions
 {
-    class test_t_abs64 : public CppUnit::TestFixture
+    class test_t_abs64 : public ::testing::Test
     {
-    public:
-        void test0();
-        void test1_0();
-        void test1();
-        void test1_1();
-        void test2();
-        void test3();
-        void test4();
-
-        CPPUNIT_TEST_SUITE( test_t_abs64 );
-        CPPUNIT_TEST( test0 );
-        CPPUNIT_TEST( test1_0 );
-        CPPUNIT_TEST( test1 );
-        CPPUNIT_TEST( test1_1 );
-        CPPUNIT_TEST( test2 );
-        CPPUNIT_TEST( test3 );
-        CPPUNIT_TEST( test4 );
-        CPPUNIT_TEST_SUITE_END( );
     };
 
-    void test_t_abs64::test0()
+    TEST_F(test_t_abs64, test0)
     {
         // this values has an overrun!
         sal_Int32 n32 = 2147483648;
-        t_print("n32 should be -2^31 is: %d\n", n32);
-        CPPUNIT_ASSERT_MESSAGE("n32!=2147483648", n32 == -2147483648 );
+        printf("n32 should be -2^31 is: %d\n", n32);
+        ASSERT_TRUE(n32 == -2147483648 ) << "n32!=2147483648";
     }
 
 
-    void test_t_abs64::test1_0()
+    TEST_F(test_t_abs64,test1_0)
     {
         sal_Int64 n;
         n = 1073741824;
         n <<= 9;
-        t_print("Value of n is ");
-        t_print64(n);
-        CPPUNIT_ASSERT_MESSAGE("n=2^30 << 9", t_abs64(n) > 0 );
+        printf("Value of n is ");
+        printf64(n);
+        ASSERT_TRUE(t_abs64(n) > 0) << "n=2^30 << 9";
     }
 
-    void test_t_abs64::test1()
+    TEST_F(test_t_abs64, test1)
     {
         sal_Int64 n;
         n = 2147483648 << 8;
-        t_print("Value of n is ");
-        t_print64(n);
-        CPPUNIT_ASSERT_MESSAGE("n=2^31 << 8", t_abs64(n) > 0 );
+        printf("Value of n is ");
+        printf64(n);
+        ASSERT_TRUE(t_abs64(n) > 0) << "n=2^31 << 8";
     }
-    void test_t_abs64::test1_1()
+    TEST_F(test_t_abs64, test1_1)
     {
         sal_Int64 n;
         n = sal_Int64(2147483648) << 8;
-        t_print("Value of n is ");
-        t_print64(n);
-        CPPUNIT_ASSERT_MESSAGE("n=2^31 << 8", t_abs64(n) > 0 );
+        printf("Value of n is ");
+        printf64(n);
+        ASSERT_TRUE(t_abs64(n) > 0) << "n=2^31 << 8";
     }
 
-    void test_t_abs64::test2()
+    TEST_F(test_t_abs64, test2)
     {
         sal_Int64 n;
         n = 2147483648 << 1;
-        t_print("Value of n is ");
-        t_print64(n);
+        printf("Value of n is ");
+        printf64(n);
 
-        CPPUNIT_ASSERT_MESSAGE("(2147483648 << 1) is != 0", n != 0 );
+        ASSERT_TRUE(n != 0) << "(2147483648 << 1) is != 0";
 
         sal_Int64 n2 = 2147483648 * 2;
-        CPPUNIT_ASSERT_MESSAGE("2147483648 * 2 is != 0", n2 != 0 );
+        ASSERT_TRUE(n2 != 0) << "2147483648 * 2 is != 0";
 
         sal_Int64 n3 = 4294967296LL;
-        CPPUNIT_ASSERT_MESSAGE("4294967296 is != 0", n3 != 0 );
+        ASSERT_TRUE(n3 != 0) << "4294967296 is != 0";
 
-        CPPUNIT_ASSERT_MESSAGE("n=2^31 << 1, n2 = 2^31 * 2, n3 = 2^32, all should equal!", n == n2 && n == n3 );
+        ASSERT_TRUE(n == n2 && n == n3) << "n=2^31 << 1, n2 = 2^31 * 2, n3 = 2^32, all should equal!";
     }
 
 
-    void test_t_abs64::test3()
+    TEST_F(test_t_abs64, test3)
     {
         sal_Int64 n = 0;
-        CPPUNIT_ASSERT_MESSAGE("n=0", t_abs64(n) == 0 );
+        ASSERT_TRUE(t_abs64(n) == 0) << "n=0";
 
         n = 1;
-        CPPUNIT_ASSERT_MESSAGE("n=1", t_abs64(n) > 0 );
+        ASSERT_TRUE(t_abs64(n) > 0) << "n=1";
 
         n = 2147483647;
-        CPPUNIT_ASSERT_MESSAGE("n=2^31 - 1", t_abs64(n) > 0 );
+        ASSERT_TRUE(t_abs64(n) > 0) << "n=2^31 - 1";
 
         n = 2147483648;
-        CPPUNIT_ASSERT_MESSAGE("n=2^31", t_abs64(n) > 0 );
+        ASSERT_TRUE(t_abs64(n) > 0) << "n=2^31";
     }
 
-    void test_t_abs64::test4()
+    TEST_F(test_t_abs64, test4)
     {
         sal_Int64 n = 0;
         n = -1;
-        t_print("Value of n is -1 : ");
-        t_print64(n);
-        CPPUNIT_ASSERT_MESSAGE("n=-1", t_abs64(n) > 0 );
+        printf("Value of n is -1 : ");
+        printf64(n);
+        ASSERT_TRUE(t_abs64(n) > 0) << "n=-1";
 
         n = -2147483648;
-        t_print("Value of n is -2^31 : ");
-        t_print64(n);
-        CPPUNIT_ASSERT_MESSAGE("n=-2^31", t_abs64(n) > 0 );
+        printf("Value of n is -2^31 : ");
+        printf64(n);
+        ASSERT_TRUE(t_abs64(n) > 0) << "n=-2^31";
 
         n = -8589934592LL;
-        t_print("Value of n is -2^33 : ");
-        t_print64(n);
-        CPPUNIT_ASSERT_MESSAGE("n=-2^33", t_abs64(n) > 0 );
+        printf("Value of n is -2^33 : ");
+        printf64(n);
+        ASSERT_TRUE(t_abs64(n) > 0) << "n=-2^33";
     }
 
 
 // -----------------------------------------------------------------------------
-    class test_t_print : public CppUnit::TestFixture
+    class test_printf : public ::testing::Test
     {
-    public:
-        void t_print_001();
-
-        CPPUNIT_TEST_SUITE( test_t_print );
-        CPPUNIT_TEST( t_print_001 );
-        CPPUNIT_TEST_SUITE_END( );
     };
 
-    void test_t_print::t_print_001( )
+    TEST_F(test_printf, printf_001)
     {
-        t_print("This is only a test of some helper functions\n");
+        printf("This is only a test of some helper functions\n");
         sal_Int32 nValue = 12345;
-        t_print("a value %d (should be 12345)\n", nValue);
+        printf("a value %d (should be 12345)\n", nValue);
 
         rtl::OString sValue("foo bar");
-        t_print("a String '%s' (should be 'foo bar')\n", sValue.getStr());
+        printf("a String '%s' (should be 'foo bar')\n", sValue.getStr());
 
         rtl::OUString suValue(rtl::OUString::createFromAscii("a unicode string"));
         sValue <<= suValue;
-        t_print("a String '%s'\n", sValue.getStr());
+        printf("a String '%s'\n", sValue.getStr());
     }
 
 
     class StopWatch
     {
+    protected:
         TimeValue m_aStartTime;
         TimeValue m_aEndTime;
         bool m_bStarted;
@@ -365,22 +342,11 @@ bool isBTimeGreaterATime(TimeValue const& A, TimeValue const& B)
     // -----------------------------------------------------------------------------
 
 
-    class test_TimeValues : public CppUnit::TestFixture
+    class test_TimeValues : public ::testing::Test
     {
-    public:
-
-        void t_time1();
-        void t_time2();
-        void t_time3();
-
-        CPPUNIT_TEST_SUITE( test_TimeValues );
-        CPPUNIT_TEST( t_time1 );
-        CPPUNIT_TEST( t_time2 );
-        CPPUNIT_TEST( t_time3 );
-        CPPUNIT_TEST_SUITE_END( );
     };
 
-void test_TimeValues::t_time1()
+TEST_F(test_TimeValues, t_time1)
 {
     StopWatch aWatch;
     aWatch.start();
@@ -390,9 +356,9 @@ void test_TimeValues::t_time1()
     aWatch.showTime("Wait for 3 seconds");
 }
 
-void test_TimeValues::t_time2()
+TEST_F(test_TimeValues, t_time2)
 {
-    t_print("Wait repeats 20 times.\n");
+    printf("Wait repeats 20 times.\n");
     int i=0;
     while(i++<20)
     {
@@ -405,9 +371,9 @@ void test_TimeValues::t_time2()
     }
 }
 
-void test_TimeValues::t_time3()
+TEST_F(test_TimeValues, t_time3)
 {
-    t_print("Wait repeats 100 times.\n");
+    printf("Wait repeats 100 times.\n");
     int i=0;
     while(i++<20)
     {
@@ -441,10 +407,8 @@ void test_TimeValues::t_time3()
 
 } // namespace testOfHelperFunctions
 
-// -----------------------------------------------------------------------------
-CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( testOfHelperFunctions::test_t_print, "helperFunctions" );
-CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( testOfHelperFunctions::test_t_abs64, "helperFunctions" );
-CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( testOfHelperFunctions::test_TimeValues, "helperFunctions" );
-
-// -----------------------------------------------------------------------------
-NOADDITIONAL;
+int main(int argc, char **argv)
+{
+    ::testing::InitGoogleTest(&argc, argv);
+    return RUN_ALL_TESTS();
+}
diff --git a/sal/qa/testHelperFunctions/testHelperFunctions2.cxx b/sal/qa/testHelperFunctions/testHelperFunctions2.cxx
index 83824c5..0cb22f4 100644
--- a/sal/qa/testHelperFunctions/testHelperFunctions2.cxx
+++ b/sal/qa/testHelperFunctions/testHelperFunctions2.cxx
@@ -24,34 +24,21 @@
 
 // MARKER(update_precomp.py): autogen include statement, do not remove
 #include "precompiled_sal.hxx"
-#include <testshl/simpleheader.hxx>
+#include "gtest/gtest.h"
 #include "stringhelper.hxx"
 
 namespace testOfHelperFunctions
 {
-    class test_valueequal : public CppUnit::TestFixture
+    class test_valueequal : public ::testing::Test
     {
-    public:
-        void valueequal_001();
-
-        CPPUNIT_TEST_SUITE( test_valueequal );
-        CPPUNIT_TEST( valueequal_001 );
-        CPPUNIT_TEST_SUITE_END( );
     };
 
-    void test_valueequal::valueequal_001( )
+    TEST_F(test_valueequal, valueequal_001)
     {
         rtl::OString sValue;
         rtl::OUString suValue(rtl::OUString::createFromAscii("This is only a test of some helper functions"));
         sValue <<= suValue;
-        t_print("'%s'\n", sValue.getStr());
+        printf("'%s'\n", sValue.getStr());
     }
 
 } // namespace testOfHelperFunctions
-
-// -----------------------------------------------------------------------------
-CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( testOfHelperFunctions::test_valueequal, "helperFunctions" );
-
-// -----------------------------------------------------------------------------
-// This is only allowed to be in one file!
-// NOADDITIONAL;
commit 366772dd241284c50182ecd60d88c28348d4b4c4
Author: Damjan Jovanovic <damjan at apache.org>
Date:   Thu Sep 3 04:26:09 2015 +0000

    #i125003# migrate main/sal/qa/OStringBuffer from cppunit to Google Test.

diff --git a/sal/qa/OStringBuffer/makefile.mk b/sal/qa/OStringBuffer/makefile.mk
index 6b511ed..297cf7d 100644
--- a/sal/qa/OStringBuffer/makefile.mk
+++ b/sal/qa/OStringBuffer/makefile.mk
@@ -36,39 +36,30 @@ ENABLE_EXCEPTIONS=TRUE
 
 .INCLUDE :  settings.mk
 
-CFLAGS+= $(LFS_CFLAGS)
-CXXFLAGS+= $(LFS_CFLAGS)
+.IF "$(ENABLE_UNIT_TESTS)" != "YES"
+all:
+    @echo unit tests are disabled. Nothing to do.
 
-CFLAGSCXX += $(CPPUNIT_CFLAGS)
+.ELSE
 
-#------------------------------- All object files -------------------------------
-# do this here, so we get right dependencies
-# SLOFILES= \
-#	  $(SLO)$/OStringBuffer.obj
+CFLAGS+= $(LFS_CFLAGS)
+CXXFLAGS+= $(LFS_CFLAGS)
 
 #----------------------------------- OStringBuffer -----------------------------------
 
-SHL1OBJS= \
+APP1OBJS= \
     $(SLO)$/rtl_OStringBuffer.obj \
     $(SLO)$/rtl_String_Utils.obj
 
-SHL1TARGET= rtl_OStringBuffer
-SHL1STDLIBS= $(SALLIB) $(CPPUNITLIB)
-
-SHL1IMPLIB= i$(SHL1TARGET)
-# SHL1DEF=    $(MISC)$/$(SHL1TARGET).def
-
-DEF1NAME    =$(SHL1TARGET)
-SHL1VERSIONMAP = $(PRJ)$/qa$/export.map
-SHL1RPATH = NONE
-
-#------------------------------- All object files -------------------------------
-# do this here, so we get right dependencies
-SLOFILES=$(SHL1OBJS)
+APP1TARGET= rtl_OStringBuffer
+APP1STDLIBS= $(SALLIB) $(GTESTLIB)
+APP1RPATH = NONE
+APP1TEST = enabled
 
 # --- Targets ------------------------------------------------------
 
 .INCLUDE :  target.mk
-.INCLUDE : _cppunit.mk
+
+.ENDIF # "$(ENABLE_UNIT_TESTS)" != "YES"
 
 .END
diff --git a/sal/qa/OStringBuffer/rtl_OStringBuffer.cxx b/sal/qa/OStringBuffer/rtl_OStringBuffer.cxx
index 11f8b6b..9035006 100644
--- a/sal/qa/OStringBuffer/rtl_OStringBuffer.cxx
+++ b/sal/qa/OStringBuffer/rtl_OStringBuffer.cxx
@@ -31,10 +31,7 @@
 
 #include <rtl/strbuf.hxx>
 
-#include "cppunit/TestAssert.h"
-#include "cppunit/TestFixture.h"
-#include "cppunit/extensions/HelperMacros.h"
-#include "cppunit/plugin/TestPlugIn.h"
+#include "gtest/gtest.h"
 
 #include <string.h>
 
@@ -57,143 +54,107 @@ using namespace rtl;
 
 namespace rtl_OStringBuffer
 {
-    class  ctors : public CppUnit::TestFixture
+    class  ctors : public ::testing::Test
     {
     public:
+    };
 
-        void ctor_001()
-        {
-            ::rtl::OStringBuffer aStrBuf;
-            const sal_Char* pStr = aStrBuf.getStr();
-
-            CPPUNIT_ASSERT_MESSAGE
-            (
-                "New OStringBuffer containing no characters",
-                aStrBuf.getLength() == 0 &&
-                *pStr == '\0' && aStrBuf.getCapacity() == 16
-            );
-        }
+    TEST_F(ctors, ctor_001)
+    {
+        ::rtl::OStringBuffer aStrBuf;
+        const sal_Char* pStr = aStrBuf.getStr();
 
-        void ctor_002()
-        {
-            ::rtl::OString       aStrtmp( kTestStr1 );
-            ::rtl::OStringBuffer aStrBuftmp( aStrtmp );
-            ::rtl::OStringBuffer aStrBuf( aStrBuftmp );
-            // sal_Bool res = cmpstr(aStrBuftmp.getStr(),aStrBuf.getStr());
+        ASSERT_TRUE(aStrBuf.getLength() == 0 &&
+            *pStr == '\0' && aStrBuf.getCapacity() == 16) << "New OStringBuffer containing no characters";
+    }
 
-            sal_Int32 nLenStrBuftmp = aStrBuftmp.getLength();
+    TEST_F(ctors, ctor_002)
+    {
+        ::rtl::OString       aStrtmp( kTestStr1 );
+        ::rtl::OStringBuffer aStrBuftmp( aStrtmp );
+        ::rtl::OStringBuffer aStrBuf( aStrBuftmp );
+        // sal_Bool res = cmpstr(aStrBuftmp.getStr(),aStrBuf.getStr());
 
-            rtl::OString sStr(aStrBuftmp.getStr());
-            sal_Bool res = aStrtmp.equals( sStr );
+        sal_Int32 nLenStrBuftmp = aStrBuftmp.getLength();
 
-            CPPUNIT_ASSERT_MESSAGE
-            (
-                "New OStringBuffer from another OStringBuffer",
-                aStrBuf.getLength() == nLenStrBuftmp &&
-                aStrBuf.getCapacity() == aStrBuftmp.getCapacity() &&
-                res
-            );
+        rtl::OString sStr(aStrBuftmp.getStr());
+        sal_Bool res = aStrtmp.equals( sStr );
 
-        }
+        ASSERT_TRUE(aStrBuf.getLength() == nLenStrBuftmp &&
+            aStrBuf.getCapacity() == aStrBuftmp.getCapacity() &&
+            res) << "New OStringBuffer from another OStringBuffer";
 
-        void ctor_003()
-        {
-            ::rtl::OStringBuffer aStrBuf1(kTestStr2Len);
+    }
+
+    TEST_F(ctors, ctor_003)
+    {
+        ::rtl::OStringBuffer aStrBuf1(kTestStr2Len);
 #ifdef WITH_CORE
-            ::rtl::OStringBuffer aStrBuf2(kSInt32Max);     //will core dump
-            // LLA: will core, due to the fact, that ksint32max is too big, the max length can't
-            //      use, because there are some internal bytes, which we can't calculate.
+        ::rtl::OStringBuffer aStrBuf2(kSInt32Max);     //will core dump
+        // LLA: will core, due to the fact, that ksint32max is too big, the max length can't
+        //      use, because there are some internal bytes, which we can't calculate.
 
 #else
-            ::rtl::OStringBuffer aStrBuf2(0);
+        ::rtl::OStringBuffer aStrBuf2(0);
 #endif
 
-            const sal_Char* pStr1 = aStrBuf1.getStr();
-            const sal_Char* pStr2 = aStrBuf2.getStr();
+        const sal_Char* pStr1 = aStrBuf1.getStr();
+        const sal_Char* pStr2 = aStrBuf2.getStr();
 
 #ifdef WITH_CORE
-            CPPUNIT_ASSERT_MESSAGE
-            (
-                "New OStringBuffer containing no characters and contain assigned capacity",
-                aStrBuf1.getLength() == 0 &&
-                ! *(aStrBuf1.getStr()) && aStrBuf1.getCapacity() == kTestStr2Len &&
-                aStrBuf2.getLength() == 0 &&
-                ! *(aStrBuf2.getStr()) && aStrBuf2.getCapacity() == kSInt32Max
-
-            );
+        ASSERT_TRUE(aStrBuf1.getLength() == 0 &&
+            ! *(aStrBuf1.getStr()) && aStrBuf1.getCapacity() == kTestStr2Len &&
+            aStrBuf2.getLength() == 0 &&
+            ! *(aStrBuf2.getStr()) && aStrBuf2.getCapacity() == kSInt32Max) << "New OStringBuffer containing no characters and contain assigned capacity";
 #else
-            CPPUNIT_ASSERT_MESSAGE
-            (
-                "New OStringBuffer containing no characters and contain assigned capacity",
-                aStrBuf1.getLength() == 0 &&
-                *pStr1 == '\0' &&
-                aStrBuf1.getCapacity() == kTestStr2Len &&
-                aStrBuf2.getLength() == 0 &&
-                *pStr2 == '\0' &&
-                aStrBuf2.getCapacity() == 0
-            );
+        ASSERT_TRUE(aStrBuf1.getLength() == 0 &&
+            *pStr1 == '\0' &&
+            aStrBuf1.getCapacity() == kTestStr2Len &&
+            aStrBuf2.getLength() == 0 &&
+            *pStr2 == '\0' &&
+            aStrBuf2.getCapacity() == 0) << "New OStringBuffer containing no characters and contain assigned capacity";
 #endif
 
-        }
+    }
 
-        void ctor_003_1()
-        {
-            // LLA: StringBuffer with created negativ size are the same as empty StringBuffers
-            ::rtl::OStringBuffer aStrBuf3(kNonSInt32Max);
-
-            const sal_Char* pStr = aStrBuf3.getStr();
-
-            CPPUNIT_ASSERT_MESSAGE
-            (
-                "New OStringBuffer containing no characters and contain assigned capacity",
-                aStrBuf3.getLength() == 0 &&
-                *pStr == '\0' &&
-                aStrBuf3.getCapacity() == kNonSInt32Max
-            );
-        }
+    TEST_F(ctors, ctor_003_1)
+    {
+        // LLA: StringBuffer with created negativ size are the same as empty StringBuffers
+        ::rtl::OStringBuffer aStrBuf3(kNonSInt32Max);
 
-        void ctor_004()
-        {
-            ::rtl::OString aStrtmp( kTestStr1 );
-            ::rtl::OStringBuffer aStrBuf( aStrtmp );
-            sal_Int32 leg = aStrBuf.getLength();
-
-            CPPUNIT_ASSERT_MESSAGE
-            (
-                "New OStringBuffer from Ostring",
-                aStrBuf.getStr() == aStrtmp &&
-                leg == aStrtmp.pData->length &&
-                aStrBuf.getCapacity() == leg+16
-
-            );
-        }
+        const sal_Char* pStr = aStrBuf3.getStr();
 
-        void ctor_005() {
-            rtl::OStringBuffer b1;
-            b1.makeStringAndClear();
-            rtl::OStringBuffer b2(b1);
-        }
+        ASSERT_TRUE(aStrBuf3.getLength() == 0 &&
+            *pStr == '\0' &&
+            aStrBuf3.getCapacity() == kNonSInt32Max) << "New OStringBuffer containing no characters and contain assigned capacity";
+    }
 
-        CPPUNIT_TEST_SUITE(ctors);
-        CPPUNIT_TEST(ctor_001);
-        CPPUNIT_TEST(ctor_002);
-        CPPUNIT_TEST(ctor_003);
-        CPPUNIT_TEST(ctor_003_1);
-        CPPUNIT_TEST(ctor_004);
-        CPPUNIT_TEST(ctor_005);
-        CPPUNIT_TEST_SUITE_END();
-    };
+    TEST_F(ctors, ctor_004)
+    {
+        ::rtl::OString aStrtmp( kTestStr1 );
+        ::rtl::OStringBuffer aStrBuf( aStrtmp );
+        sal_Int32 leg = aStrBuf.getLength();
 
+        ASSERT_TRUE(aStrBuf.getStr() == aStrtmp &&
+            leg == aStrtmp.pData->length &&
+            aStrBuf.getCapacity() == leg+16) << "New OStringBuffer from Ostring";
+    }
 
+    TEST_F(ctors, ctor_005) {
+        rtl::OStringBuffer b1;
+        b1.makeStringAndClear();
+        rtl::OStringBuffer b2(b1);
+    }
 
 // -----------------------------------------------------------------------------
 
-    class  makeStringAndClear : public CppUnit::TestFixture
+    class  makeStringAndClear : public ::testing::Test
     {
+    protected:
         OString* arrOUS[6];
 
     public:
-        void setUp()
+        void SetUp()
         {
             arrOUS[0] = new OString( kTestStr1 );
             arrOUS[1] = new OString( kTestStr14 );
@@ -204,155 +165,113 @@ namespace rtl_OStringBuffer
 
         }
 
-        void tearDown()
+        void TearDown()
         {
             delete arrOUS[0]; delete arrOUS[1]; delete arrOUS[2];
             delete arrOUS[3]; delete arrOUS[4]; delete arrOUS[5];
         }
+    };
 
-        void makeStringAndClear_001()
-        {
-            ::rtl::OStringBuffer   aStrBuf1;
-            ::rtl::OString         aStr1;
-
-            sal_Bool lastRes = (aStrBuf1.makeStringAndClear() ==  aStr1 );
+    TEST_F(makeStringAndClear, makeStringAndClear_001)
+    {
+        ::rtl::OStringBuffer   aStrBuf1;
+        ::rtl::OString         aStr1;
 
-            CPPUNIT_ASSERT_MESSAGE
-            (
-                "two empty strings(def. constructor)",
-                lastRes && ( aStrBuf1.getCapacity() == 0 ) &&
-                        ( *(aStrBuf1.getStr()) == '\0' )
-            );
+        sal_Bool lastRes = (aStrBuf1.makeStringAndClear() ==  aStr1 );
 
-        }
+        ASSERT_TRUE(lastRes && ( aStrBuf1.getCapacity() == 0 ) &&
+                    ( *(aStrBuf1.getStr()) == '\0' )) << "two empty strings(def. constructor)";
 
-        void makeStringAndClear_002()
-        {
-            ::rtl::OStringBuffer   aStrBuf2(26);
-            ::rtl::OString         aStr2;
+    }
 
-            sal_Bool lastRes = (aStrBuf2.makeStringAndClear() == aStr2 );
+    TEST_F(makeStringAndClear, makeStringAndClear_002)
+    {
+        ::rtl::OStringBuffer   aStrBuf2(26);
+        ::rtl::OString         aStr2;
 
-            CPPUNIT_ASSERT_MESSAGE
-            (
-                "two empty strings(with a argu)",
-                lastRes && ( aStrBuf2.getCapacity() == 0 ) &&
-                        ( *(aStrBuf2.getStr()) == '\0' )
-            );
+        sal_Bool lastRes = (aStrBuf2.makeStringAndClear() == aStr2 );
 
-        }
+        ASSERT_TRUE(lastRes && ( aStrBuf2.getCapacity() == 0 ) &&
+                    ( *(aStrBuf2.getStr()) == '\0' )) << "two empty strings(with a argu)";
 
-        void makeStringAndClear_003()
-        {
-            ::rtl::OStringBuffer   aStrBuf3(*arrOUS[0]);
-            ::rtl::OString        aStr3(*arrOUS[0]);
+    }
 
-            sal_Bool lastRes = (aStrBuf3.makeStringAndClear() == aStr3 );
+    TEST_F(makeStringAndClear, makeStringAndClear_003)
+    {
+        ::rtl::OStringBuffer   aStrBuf3(*arrOUS[0]);
+        ::rtl::OString        aStr3(*arrOUS[0]);
 
-            CPPUNIT_ASSERT_MESSAGE
-            (
-                "normal string",
-                lastRes && ( aStrBuf3.getCapacity() == 0 ) &&
-                        ( *(aStrBuf3.getStr()) == '\0' )
-            );
+        sal_Bool lastRes = (aStrBuf3.makeStringAndClear() == aStr3 );
 
-        }
+        ASSERT_TRUE(lastRes && ( aStrBuf3.getCapacity() == 0 ) &&
+                    ( *(aStrBuf3.getStr()) == '\0' )) << "normal string";
 
-        void makeStringAndClear_004()
-        {
-            ::rtl::OStringBuffer   aStrBuf4(*arrOUS[1]);
-            ::rtl::OString         aStr4(*arrOUS[1]);
+    }
 
-            sal_Bool lastRes = (aStrBuf4.makeStringAndClear() ==  aStr4 );
+    TEST_F(makeStringAndClear, makeStringAndClear_004)
+    {
+        ::rtl::OStringBuffer   aStrBuf4(*arrOUS[1]);
+        ::rtl::OString         aStr4(*arrOUS[1]);
 
-            CPPUNIT_ASSERT_MESSAGE
-            (
-                "string with space ",
-                lastRes && ( aStrBuf4.getCapacity() == 0 ) &&
-                        ( *(aStrBuf4.getStr()) == '\0' )
-            );
-        }
+        sal_Bool lastRes = (aStrBuf4.makeStringAndClear() ==  aStr4 );
 
-        void makeStringAndClear_005()
-        {
-            ::rtl::OStringBuffer   aStrBuf5(*arrOUS[2]);
-            ::rtl::OString         aStr5(*arrOUS[2]);
+        ASSERT_TRUE(lastRes && ( aStrBuf4.getCapacity() == 0 ) &&
+                    ( *(aStrBuf4.getStr()) == '\0' )) << "string with space ";
+    }
 
-            sal_Bool lastRes = (aStrBuf5.makeStringAndClear() ==  aStr5 );
+    TEST_F(makeStringAndClear, makeStringAndClear_005)
+    {
+        ::rtl::OStringBuffer   aStrBuf5(*arrOUS[2]);
+        ::rtl::OString         aStr5(*arrOUS[2]);
 
-            CPPUNIT_ASSERT_MESSAGE
-            (
-                "empty string",
-                lastRes && ( aStrBuf5.getCapacity() == 0 ) &&
-                        ( *(aStrBuf5.getStr()) == '\0' )
-            );
-        }
+        sal_Bool lastRes = (aStrBuf5.makeStringAndClear() ==  aStr5 );
 
-        void makeStringAndClear_006()
-        {
-            ::rtl::OStringBuffer   aStrBuf6(*arrOUS[3]);
-            ::rtl::OString         aStr6(*arrOUS[3]);
+        ASSERT_TRUE(lastRes && ( aStrBuf5.getCapacity() == 0 ) &&
+                    ( *(aStrBuf5.getStr()) == '\0' )) << "empty string";
+    }
 
-            sal_Bool lastRes = (aStrBuf6.makeStringAndClear() == aStr6 );
+    TEST_F(makeStringAndClear, makeStringAndClear_006)
+    {
+        ::rtl::OStringBuffer   aStrBuf6(*arrOUS[3]);
+        ::rtl::OString         aStr6(*arrOUS[3]);
 
-            CPPUNIT_ASSERT_MESSAGE
-            (
-                "string with a character",
-                lastRes && ( aStrBuf6.getCapacity() == 0 ) &&
-                        ( *(aStrBuf6.getStr()) == '\0' )
-            );
-        }
+        sal_Bool lastRes = (aStrBuf6.makeStringAndClear() == aStr6 );
 
-        void makeStringAndClear_007()
-        {
-            ::rtl::OStringBuffer   aStrBuf7(*arrOUS[4]);
-            ::rtl::OString         aStr7(*arrOUS[4]);
+        ASSERT_TRUE(lastRes && ( aStrBuf6.getCapacity() == 0 ) &&
+                    ( *(aStrBuf6.getStr()) == '\0' )) << "string with a character";
+    }
 
-            sal_Bool lastRes = (aStrBuf7.makeStringAndClear() == aStr7 );
+    TEST_F(makeStringAndClear, makeStringAndClear_007)
+    {
+        ::rtl::OStringBuffer   aStrBuf7(*arrOUS[4]);
+        ::rtl::OString         aStr7(*arrOUS[4]);
 
-            CPPUNIT_ASSERT_MESSAGE
-            (
-                "string with special characters",
-                lastRes && ( aStrBuf7.getCapacity() == 0 ) &&
-                        ( *(aStrBuf7.getStr()) == '\0' )
-            );
-        }
+        sal_Bool lastRes = (aStrBuf7.makeStringAndClear() == aStr7 );
 
-        void makeStringAndClear_008()
-        {
-            ::rtl::OStringBuffer   aStrBuf8(*arrOUS[5]);
-            ::rtl::OString         aStr8(*arrOUS[5]);
+        ASSERT_TRUE(lastRes && ( aStrBuf7.getCapacity() == 0 ) &&
+                    ( *(aStrBuf7.getStr()) == '\0' )) << "string with special characters";
+    }
 
-            sal_Bool lastRes = (aStrBuf8.makeStringAndClear() == aStr8 );
+    TEST_F(makeStringAndClear, makeStringAndClear_008)
+    {
+        ::rtl::OStringBuffer   aStrBuf8(*arrOUS[5]);
+        ::rtl::OString         aStr8(*arrOUS[5]);
 
-            CPPUNIT_ASSERT_MESSAGE
-            (
-                "string only with (\0)",
-                lastRes && ( aStrBuf8.getCapacity() == 0 ) &&
-                        ( *(aStrBuf8.getStr()) == '\0' )
-            );
-        }
+        sal_Bool lastRes = (aStrBuf8.makeStringAndClear() == aStr8 );
 
-        CPPUNIT_TEST_SUITE(makeStringAndClear);
-        CPPUNIT_TEST(makeStringAndClear_001);
-        CPPUNIT_TEST(makeStringAndClear_002);
-        CPPUNIT_TEST(makeStringAndClear_003);
-        CPPUNIT_TEST(makeStringAndClear_004);
-        CPPUNIT_TEST(makeStringAndClear_005);
-        CPPUNIT_TEST(makeStringAndClear_006);
-        CPPUNIT_TEST(makeStringAndClear_007);
-        CPPUNIT_TEST(makeStringAndClear_008);
-        CPPUNIT_TEST_SUITE_END();
-    };
+        ASSERT_TRUE(lastRes && ( aStrBuf8.getCapacity() == 0 ) &&
+                    ( *(aStrBuf8.getStr()) == '\0' )) << "string only with (\0)";
+    }
 
 // -----------------------------------------------------------------------------
 
-    class  getLength : public CppUnit::TestFixture
+    class  getLength : public ::testing::Test
     {
+    protected:
         OString* arrOUS[6];
 
     public:
-        void setUp()
+        void SetUp()
         {
             arrOUS[0] = new OString( kTestStr1 );
             arrOUS[1] = new OString( "1" );
@@ -363,129 +282,87 @@ namespace rtl_OStringBuffer
 
         }
 
-        void tearDown()
+        void TearDown()
         {
             delete arrOUS[0]; delete arrOUS[1]; delete arrOUS[2];
             delete arrOUS[3]; delete arrOUS[4]; delete arrOUS[5];
         }
+    };
 
-        void getLength_001()
-        {
-            ::rtl::OStringBuffer   aStrBuf( *arrOUS[0] );
-            sal_Int32              expVal = kTestStr1Len;
+    TEST_F(getLength, getLength_001)
+    {
+        ::rtl::OStringBuffer   aStrBuf( *arrOUS[0] );
+        sal_Int32              expVal = kTestStr1Len;
 
-            CPPUNIT_ASSERT_MESSAGE
-            (
-                "length of ascii string",
-                aStrBuf.getLength() == expVal
-            );
+        ASSERT_TRUE(aStrBuf.getLength() == expVal) << "length of ascii string";
 
-        }
+    }
 
-        void getLength_002()
-        {
-            ::rtl::OStringBuffer   aStrBuf( *arrOUS[1] );
-            sal_Int32              expVal = 1;
-
-            CPPUNIT_ASSERT_MESSAGE
-            (
-                "length of ascci string of size 1",
-                aStrBuf.getLength() == expVal
-            );
-        }
+    TEST_F(getLength, getLength_002)
+    {
+        ::rtl::OStringBuffer   aStrBuf( *arrOUS[1] );
+        sal_Int32              expVal = 1;
 
-        void getLength_003()
-        {
-            ::rtl::OStringBuffer   aStrBuf( *arrOUS[2] );
-            sal_Int32              expVal = 0;
-
-            CPPUNIT_ASSERT_MESSAGE
-            (
-                "length of empty string",
-                aStrBuf.getLength() == expVal
-            );
-        }
+        ASSERT_TRUE(aStrBuf.getLength() == expVal) << "length of ascci string of size 1";
+    }
 
-        void getLength_004()
-        {
-            ::rtl::OStringBuffer   aStrBuf( *arrOUS[3] );
-            sal_Int32              expVal = 0;
-
-            CPPUNIT_ASSERT_MESSAGE
-            (
-                "length of empty string (empty ascii string arg)",
-                aStrBuf.getLength() == expVal
-            );
-        }
+    TEST_F(getLength, getLength_003)
+    {
+        ::rtl::OStringBuffer   aStrBuf( *arrOUS[2] );
+        sal_Int32              expVal = 0;
 
-        void getLength_005()
-        {
-            ::rtl::OStringBuffer   aStrBuf( *arrOUS[4] );
-            sal_Int32              expVal = 0;
-
-            CPPUNIT_ASSERT_MESSAGE
-            (
-                "length of empty string (string arg = '\\0')",
-                aStrBuf.getLength() == expVal
-            );
-        }
+        ASSERT_TRUE(aStrBuf.getLength() == expVal) << "length of empty string";
+    }
 
-        void getLength_006()
-        {
-            ::rtl::OStringBuffer   aStrBuf( *arrOUS[5] );
-            sal_Int32              expVal = kTestStr2Len;
-
-            CPPUNIT_ASSERT_MESSAGE
-            (
-                "length(>16) of ascii string",
-                aStrBuf.getLength() == expVal
-            );
-        }
+    TEST_F(getLength, getLength_004)
+    {
+        ::rtl::OStringBuffer   aStrBuf( *arrOUS[3] );
+        sal_Int32              expVal = 0;
 
-        void getLength_007()
-        {
-            ::rtl::OStringBuffer   aStrBuf;
-            sal_Int32              expVal = 0;
-
-            CPPUNIT_ASSERT_MESSAGE
-            (
-                "length of empty string (default constructor)",
-                aStrBuf.getLength()== expVal
-            );
-        }
+        ASSERT_TRUE(aStrBuf.getLength() == expVal) << "length of empty string (empty ascii string arg)";
+    }
 
-        void getLength_008()
-        {
-            ::rtl::OStringBuffer   aStrBuf( 26 );
-            sal_Int32               expVal   = 0;
-
-            CPPUNIT_ASSERT_MESSAGE
-            (
-                "length of empty string (with capacity)",
-                aStrBuf.getLength()== expVal
-            );
-        }
+    TEST_F(getLength, getLength_005)
+    {
+        ::rtl::OStringBuffer   aStrBuf( *arrOUS[4] );
+        sal_Int32              expVal = 0;
 
-        CPPUNIT_TEST_SUITE( getLength );
-        CPPUNIT_TEST( getLength_001 );
-        CPPUNIT_TEST( getLength_002 );
-        CPPUNIT_TEST( getLength_003 );
-        CPPUNIT_TEST( getLength_004 );
-        CPPUNIT_TEST( getLength_005 );
-        CPPUNIT_TEST( getLength_006 );
-        CPPUNIT_TEST( getLength_007 );
-        CPPUNIT_TEST( getLength_008 );
-        CPPUNIT_TEST_SUITE_END();
-    };
+        ASSERT_TRUE(aStrBuf.getLength() == expVal) << "length of empty string (string arg = '\\0')";
+    }
+
+    TEST_F(getLength, getLength_006)
+    {
+        ::rtl::OStringBuffer   aStrBuf( *arrOUS[5] );

... etc. - the rest is truncated


More information about the Libreoffice-commits mailing list