You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openoffice.apache.org by da...@apache.org on 2019/03/31 18:17:42 UTC

svn commit: r1856677 - in /openoffice/trunk/main/tools: GoogleTest_tools_pathutils.mk Module_tools.mk qa/test_pathutils.cxx

Author: damjan
Date: Sun Mar 31 18:17:42 2019
New Revision: 1856677

URL: http://svn.apache.org/viewvc?rev=1856677&view=rev
Log:
Port a main/tools unit test from cppunit to gtest.

Patch by: me


Added:
    openoffice/trunk/main/tools/GoogleTest_tools_pathutils.mk
Modified:
    openoffice/trunk/main/tools/Module_tools.mk
    openoffice/trunk/main/tools/qa/test_pathutils.cxx

Added: openoffice/trunk/main/tools/GoogleTest_tools_pathutils.mk
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/tools/GoogleTest_tools_pathutils.mk?rev=1856677&view=auto
==============================================================================
--- openoffice/trunk/main/tools/GoogleTest_tools_pathutils.mk (added)
+++ openoffice/trunk/main/tools/GoogleTest_tools_pathutils.mk Sun Mar 31 18:17:42 2019
@@ -0,0 +1,46 @@
+#**************************************************************
+#  
+#  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.
+#  
+#**************************************************************
+
+
+$(eval $(call gb_GoogleTest_GoogleTest,tools_pathutils))
+ 
+$(eval $(call gb_GoogleTest_add_exception_objects,tools_pathutils, \
+	tools/qa/test_pathutils \
+))
+ 
+$(eval $(call gb_GoogleTest_add_linked_libs,tools_pathutils, \
+    stl \
+    tl \
+    $(gb_STDLIBS) \
+))
+
+
+$(eval $(call gb_GoogleTest_add_linked_static_libs,tools_pathutils, \
+    ooopathutils \
+))
+ 
+$(eval $(call gb_GoogleTest_set_include,tools_pathutils,\
+	$$(INCLUDE) \
+	-I$(SRCDIR)/inc \
+	-I$(SRCDIR)/tools/inc/pch \
+))
+ 
+# vim: set noet sw=4 ts=4:

Modified: openoffice/trunk/main/tools/Module_tools.mk
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/tools/Module_tools.mk?rev=1856677&r1=1856676&r2=1856677&view=diff
==============================================================================
--- openoffice/trunk/main/tools/Module_tools.mk (original)
+++ openoffice/trunk/main/tools/Module_tools.mk Sun Mar 31 18:17:42 2019
@@ -37,6 +37,7 @@ $(eval $(call gb_Module_add_targets,tool
 ifeq ($(ENABLE_UNIT_TESTS),YES)
 $(eval $(call gb_Module_add_check_targets,tools,\
 	GoogleTest_tools_fractiontest \
+	GoogleTest_tools_pathutils \
 ))
 endif
 

Modified: openoffice/trunk/main/tools/qa/test_pathutils.cxx
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/tools/qa/test_pathutils.cxx?rev=1856677&r1=1856676&r2=1856677&view=diff
==============================================================================
--- openoffice/trunk/main/tools/qa/test_pathutils.cxx (original)
+++ openoffice/trunk/main/tools/qa/test_pathutils.cxx Sun Mar 31 18:17:42 2019
@@ -26,7 +26,7 @@
 
 #include <cwchar>
 
-#include "testshl/simpleheader.hxx"
+#include "gtest/gtest.h"
 #include "tools/pathutils.hxx"
 
 namespace {
@@ -38,8 +38,8 @@ void buildPath(
     wchar_t p[MAX_PATH];
     wchar_t * e = tools::buildPath(
         p, front, front + std::wcslen(front), back, std::wcslen(back));
-    CPPUNIT_ASSERT_EQUAL(p + std::wcslen(path), e);
-    CPPUNIT_ASSERT_EQUAL(0, std::wcscmp(path, p));
+    ASSERT_EQ(p + std::wcslen(path), e);
+    ASSERT_EQ(0, std::wcscmp(path, p));
 #else
     (void) front;
     (void) back;
@@ -47,16 +47,18 @@ void buildPath(
 #endif
 }
 
-class Test: public CppUnit::TestFixture {
+class Test: public ::testing::Test {
 public:
-    void testBuildPath();
-
-    CPPUNIT_TEST_SUITE(Test);
-    CPPUNIT_TEST(testBuildPath);
-    CPPUNIT_TEST_SUITE_END();
+    void SetUp()
+    {
+    }
+
+    void TearDown()
+    {
+    }
 };
 
-void Test::testBuildPath() {
+TEST_F(Test, testBuildPath) {
     buildPath(L"a:\\b\\", L"..", L"a:\\");
     buildPath(L"a:\\b\\", L"..\\", L"a:\\");
     buildPath(L"a:\\b\\c\\", L"..\\..\\..\\d", L"a:\\..\\d");
@@ -65,8 +67,11 @@ void Test::testBuildPath() {
     buildPath(L"", L"..\\a", L"..\\a");
 }
 
-CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(Test, "alltests");
+}
 
+int main(int argc, char **argv)
+{
+    ::testing::InitGoogleTest(&argc, argv);
+    return RUN_ALL_TESTS();
 }
 
-NOADDITIONAL;



Re: svn commit: r1856677 - in /openoffice/trunk/main/tools: GoogleTest_tools_pathutils.mk Module_tools.mk qa/test_pathutils.cxx

Posted by Matthias Seidel <ma...@hamburg.de>.
Am 02.04.19 um 19:01 schrieb Damjan Jovanovic:
> On Tue, Apr 2, 2019 at 3:24 PM Matthias Seidel <ma...@hamburg.de>
> wrote:
>
>> Hi Damjan,
>>
>> Just for clarification, these tests are done automatically while
>> building unless I disable them explicitly with --disable-unit-tests?
>>
>> Regards,
>>
>>    Matthias
>>
>>
> That's right.

Then all buildbots have passed the (new) test...
We could merge it into 42x.

Regards,

   Matthias

>
> Regards
> Damjan
>


Re: svn commit: r1856677 - in /openoffice/trunk/main/tools: GoogleTest_tools_pathutils.mk Module_tools.mk qa/test_pathutils.cxx

Posted by Damjan Jovanovic <da...@apache.org>.
On Tue, Apr 2, 2019 at 3:24 PM Matthias Seidel <ma...@hamburg.de>
wrote:

> Hi Damjan,
>
> Just for clarification, these tests are done automatically while
> building unless I disable them explicitly with --disable-unit-tests?
>
> Regards,
>
>    Matthias
>
>
That's right.

Regards
Damjan

Re: svn commit: r1856677 - in /openoffice/trunk/main/tools: GoogleTest_tools_pathutils.mk Module_tools.mk qa/test_pathutils.cxx

Posted by Matthias Seidel <ma...@hamburg.de>.
Hi Damjan,

Just for clarification, these tests are done automatically while
building unless I disable them explicitly with --disable-unit-tests?

Regards,

   Matthias

Am 31.03.19 um 20:17 schrieb damjan@apache.org:
> Author: damjan
> Date: Sun Mar 31 18:17:42 2019
> New Revision: 1856677
>
> URL: http://svn.apache.org/viewvc?rev=1856677&view=rev
> Log:
> Port a main/tools unit test from cppunit to gtest.
>
> Patch by: me
>
>
> Added:
>     openoffice/trunk/main/tools/GoogleTest_tools_pathutils.mk
> Modified:
>     openoffice/trunk/main/tools/Module_tools.mk
>     openoffice/trunk/main/tools/qa/test_pathutils.cxx
>
> Added: openoffice/trunk/main/tools/GoogleTest_tools_pathutils.mk
> URL: http://svn.apache.org/viewvc/openoffice/trunk/main/tools/GoogleTest_tools_pathutils.mk?rev=1856677&view=auto
> ==============================================================================
> --- openoffice/trunk/main/tools/GoogleTest_tools_pathutils.mk (added)
> +++ openoffice/trunk/main/tools/GoogleTest_tools_pathutils.mk Sun Mar 31 18:17:42 2019
> @@ -0,0 +1,46 @@
> +#**************************************************************
> +#  
> +#  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.
> +#  
> +#**************************************************************
> +
> +
> +$(eval $(call gb_GoogleTest_GoogleTest,tools_pathutils))
> + 
> +$(eval $(call gb_GoogleTest_add_exception_objects,tools_pathutils, \
> +	tools/qa/test_pathutils \
> +))
> + 
> +$(eval $(call gb_GoogleTest_add_linked_libs,tools_pathutils, \
> +    stl \
> +    tl \
> +    $(gb_STDLIBS) \
> +))
> +
> +
> +$(eval $(call gb_GoogleTest_add_linked_static_libs,tools_pathutils, \
> +    ooopathutils \
> +))
> + 
> +$(eval $(call gb_GoogleTest_set_include,tools_pathutils,\
> +	$$(INCLUDE) \
> +	-I$(SRCDIR)/inc \
> +	-I$(SRCDIR)/tools/inc/pch \
> +))
> + 
> +# vim: set noet sw=4 ts=4:
>
> Modified: openoffice/trunk/main/tools/Module_tools.mk
> URL: http://svn.apache.org/viewvc/openoffice/trunk/main/tools/Module_tools.mk?rev=1856677&r1=1856676&r2=1856677&view=diff
> ==============================================================================
> --- openoffice/trunk/main/tools/Module_tools.mk (original)
> +++ openoffice/trunk/main/tools/Module_tools.mk Sun Mar 31 18:17:42 2019
> @@ -37,6 +37,7 @@ $(eval $(call gb_Module_add_targets,tool
>  ifeq ($(ENABLE_UNIT_TESTS),YES)
>  $(eval $(call gb_Module_add_check_targets,tools,\
>  	GoogleTest_tools_fractiontest \
> +	GoogleTest_tools_pathutils \
>  ))
>  endif
>  
>
> Modified: openoffice/trunk/main/tools/qa/test_pathutils.cxx
> URL: http://svn.apache.org/viewvc/openoffice/trunk/main/tools/qa/test_pathutils.cxx?rev=1856677&r1=1856676&r2=1856677&view=diff
> ==============================================================================
> --- openoffice/trunk/main/tools/qa/test_pathutils.cxx (original)
> +++ openoffice/trunk/main/tools/qa/test_pathutils.cxx Sun Mar 31 18:17:42 2019
> @@ -26,7 +26,7 @@
>  
>  #include <cwchar>
>  
> -#include "testshl/simpleheader.hxx"
> +#include "gtest/gtest.h"
>  #include "tools/pathutils.hxx"
>  
>  namespace {
> @@ -38,8 +38,8 @@ void buildPath(
>      wchar_t p[MAX_PATH];
>      wchar_t * e = tools::buildPath(
>          p, front, front + std::wcslen(front), back, std::wcslen(back));
> -    CPPUNIT_ASSERT_EQUAL(p + std::wcslen(path), e);
> -    CPPUNIT_ASSERT_EQUAL(0, std::wcscmp(path, p));
> +    ASSERT_EQ(p + std::wcslen(path), e);
> +    ASSERT_EQ(0, std::wcscmp(path, p));
>  #else
>      (void) front;
>      (void) back;
> @@ -47,16 +47,18 @@ void buildPath(
>  #endif
>  }
>  
> -class Test: public CppUnit::TestFixture {
> +class Test: public ::testing::Test {
>  public:
> -    void testBuildPath();
> -
> -    CPPUNIT_TEST_SUITE(Test);
> -    CPPUNIT_TEST(testBuildPath);
> -    CPPUNIT_TEST_SUITE_END();
> +    void SetUp()
> +    {
> +    }
> +
> +    void TearDown()
> +    {
> +    }
>  };
>  
> -void Test::testBuildPath() {
> +TEST_F(Test, testBuildPath) {
>      buildPath(L"a:\\b\\", L"..", L"a:\\");
>      buildPath(L"a:\\b\\", L"..\\", L"a:\\");
>      buildPath(L"a:\\b\\c\\", L"..\\..\\..\\d", L"a:\\..\\d");
> @@ -65,8 +67,11 @@ void Test::testBuildPath() {
>      buildPath(L"", L"..\\a", L"..\\a");
>  }
>  
> -CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(Test, "alltests");
> +}
>  
> +int main(int argc, char **argv)
> +{
> +    ::testing::InitGoogleTest(&argc, argv);
> +    return RUN_ALL_TESTS();
>  }
>  
> -NOADDITIONAL;
>
>
>