Author: damjan
Date: Sat Aug 29 14:29:12 2015
New Revision: 1700039

URL: http://svn.apache.org/r1700039
Log:
#i125003# migrate main/binaryurp from cppunit to Google Test.


Added:
    openoffice/trunk/main/binaryurp/qa/main.cxx
Modified:
    openoffice/trunk/main/binaryurp/qa/makefile.mk
    openoffice/trunk/main/binaryurp/qa/test-cache.cxx
    openoffice/trunk/main/binaryurp/qa/test-unmarshal.cxx

Added: openoffice/trunk/main/binaryurp/qa/main.cxx
URL: 
http://svn.apache.org/viewvc/openoffice/trunk/main/binaryurp/qa/main.cxx?rev=1700039&view=auto
==============================================================================
--- openoffice/trunk/main/binaryurp/qa/main.cxx (added)
+++ openoffice/trunk/main/binaryurp/qa/main.cxx Sat Aug 29 14:29:12 2015
@@ -0,0 +1,28 @@
+/**************************************************************
+ * 
+ * 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.
+ * 
+ *************************************************************/
+
+#include "gtest/gtest.h"
+
+int main(int argc, char **argv)
+{
+    ::testing::InitGoogleTest(&argc, argv);
+    return RUN_ALL_TESTS();
+}

Modified: openoffice/trunk/main/binaryurp/qa/makefile.mk
URL: 
http://svn.apache.org/viewvc/openoffice/trunk/main/binaryurp/qa/makefile.mk?rev=1700039&r1=1700038&r2=1700039&view=diff
==============================================================================
--- openoffice/trunk/main/binaryurp/qa/makefile.mk (original)
+++ openoffice/trunk/main/binaryurp/qa/makefile.mk Sat Aug 29 14:29:12 2015
@@ -29,39 +29,21 @@ ENABLE_EXCEPTIONS = TRUE
 
 .INCLUDE: settings.mk
 
-.IF "$(WITH_CPPUNIT)" != "YES" || "$(GUI)" == "OS2"
+.IF "$(ENABLE_UNIT_TESTS)" != "YES"
 
 @all:
-.IF "$(GUI)" == "OS2"
-       @echo "Skipping, cppunit broken."
-.ELIF "$(WITH_CPPUNIT)" != "YES"
-       @echo "cppunit disabled. nothing do do."
-.END
+       @echo unit tests are disabled. Nothing to do.
 
 .ELSE
 
-CFLAGSCXX += $(CPPUNIT_CFLAGS)
 
-DLLPRE =
+APP1OBJS = $(SLO)/test-cache.obj $(SLO)/main.obj
+APP1RPATH = NONE
+APP1STDLIBS = $(GTESTLIB) $(SALLIB)
+APP1TARGET = test-cache
+APP1TEST = enabled
 
-.IF "$(GUI)" != "OS2"
-SLOFILES = $(SLO)/test-cache.obj $(SLO)/test-unmarshal.obj
-.ENDIF
-
-SHL1IMPLIB = i$(SHL1TARGET)
-SHL1OBJS = $(SLO)/test-cache.obj
-SHL1RPATH = NONE
-SHL1STDLIBS = $(CPPUNITLIB) $(SALLIB)
-.IF "$(GUI)" != "OS2"
-SHL1TARGET = test-cache
-.ELSE
-SHL1TARGET = test-c
-.ENDIF
-SHL1VERSIONMAP = version.map
-DEF1NAME = $(SHL1TARGET)
-
-SHL2IMPLIB = i$(SHL2TARGET)
-SHL2OBJS = \
+APP2OBJS = \
     $(SLO)/test-unmarshal.obj \
     $(SLO)/binaryany.obj \
     $(SLO)/bridge.obj \
@@ -69,29 +51,27 @@ SHL2OBJS = \
     $(SLO)/currentcontext.obj \
     $(SLO)/incomingrequest.obj \
     $(SLO)/lessoperators.obj \
+    $(SLO)/main.obj \
     $(SLO)/marshal.obj \
     $(SLO)/outgoingrequests.obj \
     $(SLO)/proxy.obj \
     $(SLO)/reader.obj \
     $(SLO)/unmarshal.obj \
     $(SLO)/writer.obj
-SHL2RPATH = NONE
-SHL2STDLIBS = \
+APP2RPATH = NONE
+APP2STDLIBS = \
     $(CPPUHELPERLIB) \
     $(CPPULIB) \
-    $(CPPUNITLIB) \
+    $(GTESTLIB) \
     $(SALHELPERLIB) \
     $(SALLIB)
 .IF "$(GUI)" != "OS2"
-SHL2TARGET = test-unmarshal
+APP2TARGET = test-unmarshal
 .ELSE
-SHL2TARGET = test-u
+APP2TARGET = test-u
 .ENDIF
-SHL2VERSIONMAP = version.map
-DEF2NAME = $(SHL2TARGET)
-
-.ENDIF # "$(GUI)" == "OS2"
+APP2TEST = enabled
 
 .INCLUDE: target.mk
-.INCLUDE: _cppunit.mk
 
+.ENDIF # "$(ENABLE_UNIT_TESTS)" != "YES"

Modified: openoffice/trunk/main/binaryurp/qa/test-cache.cxx
URL: 
http://svn.apache.org/viewvc/openoffice/trunk/main/binaryurp/qa/test-cache.cxx?rev=1700039&r1=1700038&r2=1700039&view=diff
==============================================================================
--- openoffice/trunk/main/binaryurp/qa/test-cache.cxx (original)
+++ openoffice/trunk/main/binaryurp/qa/test-cache.cxx Sat Aug 29 14:29:12 2015
@@ -23,26 +23,18 @@
 
 #include "sal/config.h"
 
-#include "cppunit/TestAssert.h"
-#include "cppunit/TestFixture.h"
-#include "cppunit/extensions/HelperMacros.h"
-#include "cppunit/plugin/TestPlugIn.h"
+#include "gtest/gtest.h"
 
 #include "../source/cache.hxx"
 
 namespace {
 
-class Test: public CppUnit::TestFixture {
-private:
-    CPPUNIT_TEST_SUITE(Test);
-    CPPUNIT_TEST(testNothingLostFromLruList);
-    CPPUNIT_TEST_SUITE_END();
-
-    void testNothingLostFromLruList();
+class Test: public ::testing::Test {
+public:
 };
 
 // cf. jurt/test/com/sun/star/lib/uno/protocols/urp/Cache_Test.java:
-void Test::testNothingLostFromLruList() {
+TEST_F(Test, testNothingLostFromLruList) {
     int a[8];
     for (int i = 0; i != sizeof a / sizeof a[0]; ++i) {
         for (int j = 0; j != i; ++j) {
@@ -55,7 +47,7 @@ void Test::testNothingLostFromLruList()
                 c.add(a[k], &f);
             }
             bool f;
-            CPPUNIT_ASSERT_EQUAL(
+            ASSERT_EQ(
                 6,
                 c.add(-1, &f) + c.add(-2, &f) + c.add(-3, &f) + c.add(-4, &f));
             int j = i - 1;
@@ -73,8 +65,5 @@ void Test::testNothingLostFromLruList()
     }
 }
 
-CPPUNIT_TEST_SUITE_REGISTRATION(Test);
 
 }
-
-CPPUNIT_PLUGIN_IMPLEMENT();

Modified: openoffice/trunk/main/binaryurp/qa/test-unmarshal.cxx
URL: 
http://svn.apache.org/viewvc/openoffice/trunk/main/binaryurp/qa/test-unmarshal.cxx?rev=1700039&r1=1700038&r2=1700039&view=diff
==============================================================================
--- openoffice/trunk/main/binaryurp/qa/test-unmarshal.cxx (original)
+++ openoffice/trunk/main/binaryurp/qa/test-unmarshal.cxx Sat Aug 29 14:29:12 
2015
@@ -26,10 +26,7 @@
 #include "com/sun/star/io/IOException.hpp"
 #include "com/sun/star/uno/Sequence.hxx"
 #include "cppu/unotype.hxx"
-#include "cppunit/TestAssert.h"
-#include "cppunit/TestFixture.h"
-#include "cppunit/extensions/HelperMacros.h"
-#include "cppunit/plugin/TestPlugIn.h"
+#include "gtest/gtest.h"
 #include "rtl/ref.hxx"
 #include "rtl/string.h"
 #include "sal/types.h"
@@ -44,19 +41,11 @@ namespace {
 
 namespace css = com::sun::star;
 
-class Test: public CppUnit::TestFixture {
-private:
-    CPPUNIT_TEST_SUITE(Test);
-    CPPUNIT_TEST(testTypeOfBooleanSequence);
-    CPPUNIT_TEST(testTypeOfVoidSequence);
-    CPPUNIT_TEST_SUITE_END();
-
-    void testTypeOfBooleanSequence();
-
-    void testTypeOfVoidSequence();
+class Test: public ::testing::Test {
+public:
 };
 
-void Test::testTypeOfBooleanSequence() {
+TEST_F(Test, testTypeOfBooleanSequence) {
     binaryurp::ReaderState state;
     css::uno::Sequence< sal_Int8 > buf(13);
     buf[0] = static_cast< sal_Int8 >(20 | 0x80); // sequence type | cache flag
@@ -74,14 +63,14 @@ void Test::testTypeOfBooleanSequence() {
     buf[12] = 'n';
     binaryurp::Unmarshal m(rtl::Reference< binaryurp::Bridge >(), state, buf);
     css::uno::TypeDescription t(m.readType());
-    CPPUNIT_ASSERT(
+    ASSERT_TRUE(
         t.equals(
             css::uno::TypeDescription(
                 cppu::UnoType< css::uno::Sequence< bool > >::get())));
     m.done();
 }
 
-void Test::testTypeOfVoidSequence() {
+TEST_F(Test, testTypeOfVoidSequence) {
     binaryurp::ReaderState state;
     css::uno::Sequence< sal_Int8 > buf(10);
     buf[0] = static_cast< sal_Int8 >(20 | 0x80); // sequence type | cache flag
@@ -97,12 +86,9 @@ void Test::testTypeOfVoidSequence() {
     binaryurp::Unmarshal m(rtl::Reference< binaryurp::Bridge >(), state, buf);
     try {
         m.readType();
-        CPPUNIT_FAIL("exception expected");
+        FAIL() << "exception expected";
     } catch (css::io::IOException &) {}
 }
 
-CPPUNIT_TEST_SUITE_REGISTRATION(Test);
 
 }
-
-CPPUNIT_PLUGIN_IMPLEMENT();


Reply via email to