openoffice-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dam...@apache.org
Subject svn commit: r1700388 - in /openoffice/trunk/main/sal/qa/rtl/math: makefile.mk test-rtl-math.cxx
Date Tue, 01 Sep 2015 04:59:52 GMT
Author: damjan
Date: Tue Sep  1 04:59:51 2015
New Revision: 1700388

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


Modified:
    openoffice/trunk/main/sal/qa/rtl/math/makefile.mk
    openoffice/trunk/main/sal/qa/rtl/math/test-rtl-math.cxx

Modified: openoffice/trunk/main/sal/qa/rtl/math/makefile.mk
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/sal/qa/rtl/math/makefile.mk?rev=1700388&r1=1700387&r2=1700388&view=diff
==============================================================================
--- openoffice/trunk/main/sal/qa/rtl/math/makefile.mk (original)
+++ openoffice/trunk/main/sal/qa/rtl/math/makefile.mk Tue Sep  1 04:59:51 2015
@@ -33,19 +33,21 @@ ENABLE_EXCEPTIONS = TRUE
 
 .INCLUDE: settings.mk
 
-CFLAGSCXX += $(CPPUNIT_CFLAGS)
+.IF "$(ENABLE_UNIT_TESTS)" != "YES"
+all:
+	@echo unit tests are disabled. Nothing to do.
+
+.ELSE
 
-SHL1IMPLIB = i$(SHL1TARGET)
-SHL1OBJS = $(SLO)/test-rtl-math.obj
-SHL1RPATH = NONE
-SHL1STDLIBS = $(CPPUNITLIB) $(SALLIB)
-SHL1TARGET = test-rtl-math
-SHL1VERSIONMAP = $(PRJ)/qa/export.map
-DEF1NAME = $(SHL1TARGET)
 
-SLOFILES = $(SHL1OBJS)
+APP1OBJS = $(SLO)/test-rtl-math.obj
+APP1RPATH = NONE
+APP1STDLIBS = $(GTESTLIB) $(SALLIB)
+APP1TARGET = test-rtl-math
+APP1TEST = enabled
 
 .INCLUDE: target.mk
-.INCLUDE: _cppunit.mk
 
-.END
+.ENDIF # "$(ENABLE_UNIT_TESTS)" != "YES"
+
+.END # "$(OOO_SUBSEQUENT_TESTS)" == ""

Modified: openoffice/trunk/main/sal/qa/rtl/math/test-rtl-math.cxx
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/sal/qa/rtl/math/test-rtl-math.cxx?rev=1700388&r1=1700387&r2=1700388&view=diff
==============================================================================
--- openoffice/trunk/main/sal/qa/rtl/math/test-rtl-math.cxx (original)
+++ openoffice/trunk/main/sal/qa/rtl/math/test-rtl-math.cxx Tue Sep  1 04:59:51 2015
@@ -24,10 +24,7 @@
 #include "precompiled_sal.hxx"
 #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 "rtl/math.hxx"
 #include "rtl/ustring.h"
 #include "rtl/ustring.hxx"
@@ -35,38 +32,35 @@
 
 namespace {
 
-class Test: public CppUnit::TestFixture {
-public:
-    void test_stringToDouble_good() {
-        rtl_math_ConversionStatus status;
-        sal_Int32 end;
-        double res = rtl::math::stringToDouble(
-            rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("  +1.E01foo")),
-            sal_Unicode('.'), sal_Unicode(','), &status, &end);
-        CPPUNIT_ASSERT_EQUAL(rtl_math_ConversionStatus_Ok, status);
-        CPPUNIT_ASSERT_EQUAL(sal_Int32(RTL_CONSTASCII_LENGTH("  +1.E01")), end);
-        CPPUNIT_ASSERT_EQUAL(10.0, res);
-    }
-
-    void test_stringToDouble_bad() {
-        rtl_math_ConversionStatus status;
-        sal_Int32 end;
-        double res = rtl::math::stringToDouble(
-            rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("  +Efoo")),
-            sal_Unicode('.'), sal_Unicode(','), &status, &end);
-        CPPUNIT_ASSERT_EQUAL(rtl_math_ConversionStatus_Ok, status);
-        CPPUNIT_ASSERT_EQUAL(sal_Int32(0), end);
-        CPPUNIT_ASSERT_EQUAL(0.0, res);
-    }
-
-    CPPUNIT_TEST_SUITE(Test);
-    CPPUNIT_TEST(test_stringToDouble_good);
-    CPPUNIT_TEST(test_stringToDouble_bad);
-    CPPUNIT_TEST_SUITE_END();
+class Test: public ::testing::Test {
 };
 
-CPPUNIT_TEST_SUITE_REGISTRATION(Test);
+TEST_F(Test, test_stringToDouble_good) {
+    rtl_math_ConversionStatus status;
+    sal_Int32 end;
+    double res = rtl::math::stringToDouble(
+        rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("  +1.E01foo")),
+        sal_Unicode('.'), sal_Unicode(','), &status, &end);
+    ASSERT_EQ(rtl_math_ConversionStatus_Ok, status);
+    ASSERT_EQ(sal_Int32(RTL_CONSTASCII_LENGTH("  +1.E01")), end);
+    ASSERT_EQ(10.0, res);
+}
+
+TEST_F(Test, test_stringToDouble_bad) {
+    rtl_math_ConversionStatus status;
+    sal_Int32 end;
+    double res = rtl::math::stringToDouble(
+        rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("  +Efoo")),
+        sal_Unicode('.'), sal_Unicode(','), &status, &end);
+    ASSERT_EQ(rtl_math_ConversionStatus_Ok, status);
+    ASSERT_EQ(sal_Int32(0), end);
+    ASSERT_EQ(0.0, res);
+}
 
 }
 
-CPPUNIT_PLUGIN_IMPLEMENT();
+int main(int argc, char **argv)
+{
+    ::testing::InitGoogleTest(&argc, argv);
+    return RUN_ALL_TESTS();
+}



Mime
View raw message