cppuhelper/prj/build.lst | 2 cppuhelper/qa/ifcontainer/cppu_ifcontainer.cxx | 245 +++----- cppuhelper/qa/ifcontainer/export.map | 27 cppuhelper/qa/ifcontainer/main.cxx | 28 cppuhelper/qa/ifcontainer/makefile.mk | 24 cppuhelper/qa/unourl/cppu_unourl.cxx | 757 ++++++++++++------------- cppuhelper/qa/unourl/export.map | 27 cppuhelper/qa/unourl/makefile.mk | 24 cppuhelper/qa/weak/main.cxx | 28 cppuhelper/qa/weak/makefile.mk | 28 cppuhelper/qa/weak/test_weak.cxx | 20 11 files changed, 582 insertions(+), 628 deletions(-)
New commits: commit 0bac131e4d3c36b2e6369877843a95c54e892ef5 Author: Damjan Jovanovic <dam...@apache.org> Date: Sat Aug 29 19:25:11 2015 +0000 #i125003# migrate main/cppuhelper/qa/ifcontainer from cppunit to Google Test, but don't run it on every build as an assertion outside the test fails during the test. diff --git a/cppuhelper/qa/weak/main.cxx b/cppuhelper/qa/weak/main.cxx new file mode 100644 index 0000000..df14e5b --- /dev/null +++ b/cppuhelper/qa/weak/main.cxx @@ -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(); +} diff --git a/cppuhelper/qa/weak/makefile.mk b/cppuhelper/qa/weak/makefile.mk index 705e7fb..edffe20 100644 --- a/cppuhelper/qa/weak/makefile.mk +++ b/cppuhelper/qa/weak/makefile.mk @@ -29,21 +29,19 @@ ENABLE_EXCEPTIONS := TRUE .INCLUDE: settings.mk -CFLAGSCXX += $(CPPUNIT_CFLAGS) -DLLPRE = # no leading "lib" on .so files - -SHL1TARGET = $(TARGET) -SHL1OBJS = $(SLO)$/test_weak.obj -SHL1STDLIBS = $(CPPULIB) $(CPPUHELPERLIB) $(CPPUNITLIB) $(SALLIB) $(TESTSHL2LIB) -SHL1VERSIONMAP = version.map -SHL1IMPLIB = i$(SHL1TARGET) -DEF1NAME = $(SHL1TARGET) - -SLOFILES = $(SHL1OBJS) +.IF "$(ENABLE_UNIT_TESTS)" != "YES" +all: + @echo unit tests are disabled. Nothing to do. + +.ELSE + +APP1TARGET = $(TARGET) +APP1OBJS = $(SLO)$/test_weak.obj \ + $(SLO)$/main.obj +APP1STDLIBS = $(CPPULIB) $(CPPUHELPERLIB) $(GTESTLIB) $(SALLIB) $(TESTSHL2LIB) +APP1RPATH = NONE +APP1TEST = enabled .INCLUDE: target.mk -ALLTAR: test - -test .PHONY: $(SHL1TARGETN) - $(TESTSHL2) $(SHL1TARGETN) +.ENDIF # "$(ENABLE_UNIT_TESTS)" != "YES" diff --git a/cppuhelper/qa/weak/test_weak.cxx b/cppuhelper/qa/weak/test_weak.cxx index d935d6c..e85af65 100644 --- a/cppuhelper/qa/weak/test_weak.cxx +++ b/cppuhelper/qa/weak/test_weak.cxx @@ -34,9 +34,9 @@ #include "com/sun/star/uno/XWeak.hpp" #include "cppuhelper/implbase1.hxx" #include "cppuhelper/weak.hxx" -#include "testshl/simpleheader.hxx" #include "rtl/ref.hxx" #include "sal/types.h" +#include "gtest/gtest.h" namespace { @@ -74,16 +74,11 @@ protected: } }; -class Test: public ::CppUnit::TestFixture { +class Test: public ::testing::Test { public: - void testReferenceDispose(); - - CPPUNIT_TEST_SUITE(Test); - CPPUNIT_TEST(testReferenceDispose); - CPPUNIT_TEST_SUITE_END(); }; -void Test::testReferenceDispose() { +TEST_F(Test, testReferenceDispose) { css::uno::Reference< css::uno::XWeak > w(new ::cppu::OWeakObject); css::uno::Reference< css::uno::XAdapter > a(w->queryAdapter()); ::rtl::Reference< Reference > r1(new RuntimeExceptionReference); @@ -93,13 +88,10 @@ void Test::testReferenceDispose() { a->addReference(r2.get()); a->addReference(r3.get()); w.clear(); - CPPUNIT_ASSERT(r1->isDisposed()); - CPPUNIT_ASSERT(r2->isDisposed()); - CPPUNIT_ASSERT(r3->isDisposed()); + ASSERT_TRUE(r1->isDisposed()); + ASSERT_TRUE(r2->isDisposed()); + ASSERT_TRUE(r3->isDisposed()); } -CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(Test, "alltests"); - } -NOADDITIONAL; commit b2de539e5fd01203c9eacea2fea4679d225130ab Author: Damjan Jovanovic <dam...@apache.org> Date: Sat Aug 29 19:08:31 2015 +0000 #i125003# migrate main/cppuhelper/qa/unourl from cppunit to Google Test and run it on every build. diff --git a/cppuhelper/prj/build.lst b/cppuhelper/prj/build.lst index e43e133..877775b 100644 --- a/cppuhelper/prj/build.lst +++ b/cppuhelper/prj/build.lst @@ -4,4 +4,5 @@ ch cppuhelper\inc nmake - all ch_include NULL ch cppuhelper\source nmake - all ch_source ch_unotypes ch_include NULL ch cppuhelper\unotypes nmake - all ch_unotypes NULL ch cppuhelper\qa\ifcontainer nmake - all ch_qa_ifcontainer ch_source ch_include ch_unotypes NULL +ch cppuhelper\qa\unourl nmake - all ch_qa_unourl ch_source ch_include ch_unotypes NULL ch cppuhelper\qa\propertysetmixin nmake - all ch_qa_propertysetmixin ch_source NULL diff --git a/cppuhelper/qa/unourl/cppu_unourl.cxx b/cppuhelper/qa/unourl/cppu_unourl.cxx index 41d209c..5bdc6e3 100644 --- a/cppuhelper/qa/unourl/cppu_unourl.cxx +++ b/cppuhelper/qa/unourl/cppu_unourl.cxx @@ -21,8 +21,6 @@ -#include <testshl/simpleheader.hxx> - #include "cppuhelper/unourl.hxx" #include "rtl/malformeduriexception.hxx" #include "rtl/strbuf.hxx" @@ -30,448 +28,421 @@ #include "rtl/textenc.h" #include "rtl/ustring.hxx" #include "sal/types.h" +#include "gtest/gtest.h" namespace cppu_unourl { - class UrlTest : public CppUnit::TestFixture + class UrlTest : public ::testing::Test { public: - void testDescriptorParsing() + }; + + TEST_F(UrlTest, testDescriptorParsing) + { + struct Test { - struct Test - { - char const * pInput; - bool bValid; - }; - static Test const aTests[] - = { { "", false }, - { "abc", true }, - { "Abc", true }, - { "aBC", true }, - { "ABC", true }, - { "1abc", true }, - { "123", true }, - { "abc-1", false }, - { "ab%63", false }, - { "abc,", false }, - { "abc,def=", true }, - { "abc,Def=", true }, - { "abc,DEF=", true }, - { "abc,1def=", true }, - { "abc,123=", true }, - { "abc,def-1=", false }, - { "abc,def", false }, - { "abc,def=xxx,def=xxx", false }, - { "abc,def=xxx,ghi=xxx", true }, - { "abc,,def=xxx", false }, - { "abc,def=xxx,,ghi=xxx", false }, - { "abc,def=xxx,ghi=xxx,", false }, - { "abc,def=%", true }, - { "abc,def=%1", true }, - { "abc,def=%00", true }, - { "abc,def=%22", true }, - { "abc,def=\"", true }, - { "abc,def=%ed%a0%80", true } }; - for (int i = 0; i < sizeof aTests / sizeof (Test); ++i) + char const * pInput; + bool bValid; + }; + static Test const aTests[] + = { { "", false }, + { "abc", true }, + { "Abc", true }, + { "aBC", true }, + { "ABC", true }, + { "1abc", true }, + { "123", true }, + { "abc-1", false }, + { "ab%63", false }, + { "abc,", false }, + { "abc,def=", true }, + { "abc,Def=", true }, + { "abc,DEF=", true }, + { "abc,1def=", true }, + { "abc,123=", true }, + { "abc,def-1=", false }, + { "abc,def", false }, + { "abc,def=xxx,def=xxx", false }, + { "abc,def=xxx,ghi=xxx", true }, + { "abc,,def=xxx", false }, + { "abc,def=xxx,,ghi=xxx", false }, + { "abc,def=xxx,ghi=xxx,", false }, + { "abc,def=%", true }, + { "abc,def=%1", true }, + { "abc,def=%00", true }, + { "abc,def=%22", true }, + { "abc,def=\"", true }, + { "abc,def=%ed%a0%80", true } }; + for (int i = 0; i < sizeof aTests / sizeof (Test); ++i) + { + bool bValid = false; + try { - bool bValid = false; - try - { - cppu::UnoUrlDescriptor aDescriptor(rtl::OUString::createFromAscii( - aTests[i].pInput)); - bValid = true; - } - catch (rtl::MalformedUriException &) - {} + cppu::UnoUrlDescriptor aDescriptor(rtl::OUString::createFromAscii( + aTests[i].pInput)); + bValid = true; + } + catch (rtl::MalformedUriException &) + {} - if (aTests[i].bValid) - { - CPPUNIT_ASSERT_MESSAGE("Valid uri parsed as invalid", bValid); - } - else - { - CPPUNIT_ASSERT_MESSAGE("Invalid uri parsed as valid", !bValid); - } + if (aTests[i].bValid) + { + ASSERT_TRUE(bValid) << "Valid uri parsed as invalid"; + } + else + { + ASSERT_TRUE(!bValid) << "Invalid uri parsed as valid"; } } + } - void testDescriptorDescriptor() + TEST_F(UrlTest, testDescriptorDescriptor) + { + struct Test { - struct Test - { - char const * pInput; - char const * pDescriptor; - }; - static Test const aTests[] - = {{ "abc", "abc" }, - { "Abc", "Abc" }, - { "aBC", "aBC" }, - { "ABC", "ABC" }, - { "1abc", "1abc" }, - { "123", "123" }, - { "abc,def=", "abc,def=" }, - { "abc,Def=", "abc,Def=" }, - { "abc,DEF=", "abc,DEF=" }, - { "abc,1def=", "abc,1def=" }, - { "abc,123=", "abc,123=" }, - { "abc,def=xxx,ghi=xxx", "abc,def=xxx,ghi=xxx" }, - { "abc,def=%", "abc,def=%" }, - { "abc,def=%1", "abc,def=%1" }, - { "abc,def=%00", "abc,def=%00" }, - { "abc,def=%22", "abc,def=%22" }, - { "abc,def=\"", "abc,def=\"" }, - { "abc,def=%ed%a0%80", "abc,def=%ed%a0%80" } }; - bool bResult = true; - for (int i = 0; i < sizeof aTests / sizeof (Test); ++i) + char const * pInput; + char const * pDescriptor; + }; + static Test const aTests[] + = {{ "abc", "abc" }, + { "Abc", "Abc" }, + { "aBC", "aBC" }, + { "ABC", "ABC" }, + { "1abc", "1abc" }, + { "123", "123" }, + { "abc,def=", "abc,def=" }, + { "abc,Def=", "abc,Def=" }, + { "abc,DEF=", "abc,DEF=" }, + { "abc,1def=", "abc,1def=" }, + { "abc,123=", "abc,123=" }, + { "abc,def=xxx,ghi=xxx", "abc,def=xxx,ghi=xxx" }, + { "abc,def=%", "abc,def=%" }, + { "abc,def=%1", "abc,def=%1" }, + { "abc,def=%00", "abc,def=%00" }, + { "abc,def=%22", "abc,def=%22" }, + { "abc,def=\"", "abc,def=\"" }, + { "abc,def=%ed%a0%80", "abc,def=%ed%a0%80" } }; + bool bResult = true; + for (int i = 0; i < sizeof aTests / sizeof (Test); ++i) + { + bool bValid = false; + rtl::OUString aDescriptor; + try { - bool bValid = false; - rtl::OUString aDescriptor; - try - { - aDescriptor = cppu::UnoUrlDescriptor(rtl::OUString::createFromAscii( - aTests[i].pInput)). - getDescriptor(); - bValid = true; - } - catch (rtl::MalformedUriException &) - {} - - CPPUNIT_ASSERT_MESSAGE("Failed to parse URI", bValid); - CPPUNIT_ASSERT_MESSAGE("Failed to parse URI correctly", - aDescriptor.equalsAscii( - aTests[i].pDescriptor)); + aDescriptor = cppu::UnoUrlDescriptor(rtl::OUString::createFromAscii( + aTests[i].pInput)). + getDescriptor(); + bValid = true; } + catch (rtl::MalformedUriException &) + {} + + ASSERT_TRUE(bValid) << "Failed to parse URI"; + ASSERT_TRUE(aDescriptor.equalsAscii(aTests[i].pDescriptor)) << "Failed to parse URI correctly"; } + } - void testDescriptorName() + TEST_F(UrlTest, testDescriptorName) + { + struct Test { - struct Test - { - char const * pInput; - char const * pName; - }; - static Test const aTests[] - = { { "abc", "abc" }, - { "Abc", "abc" }, - { "aBC", "abc" }, - { "ABC", "abc" }, - { "1abc", "1abc" }, - { "123", "123" }, - { "abc,def=", "abc" }, - { "abc,Def=", "abc" }, - { "abc,DEF=", "abc" }, - { "abc,1def=", "abc" }, - { "abc,123=", "abc" }, - { "abc,def=xxx,ghi=xxx", "abc" }, - { "abc,def=%", "abc" }, - { "abc,def=%1", "abc" }, - { "abc,def=%00", "abc" }, - { "abc,def=%22", "abc" }, - { "abc,def=\"", "abc" }, - { "abc,def=%ed%a0%80", "abc" } }; - for (int i = 0; i < sizeof aTests / sizeof (Test); ++i) + char const * pInput; + char const * pName; + }; + static Test const aTests[] + = { { "abc", "abc" }, + { "Abc", "abc" }, + { "aBC", "abc" }, + { "ABC", "abc" }, + { "1abc", "1abc" }, + { "123", "123" }, + { "abc,def=", "abc" }, + { "abc,Def=", "abc" }, + { "abc,DEF=", "abc" }, + { "abc,1def=", "abc" }, + { "abc,123=", "abc" }, + { "abc,def=xxx,ghi=xxx", "abc" }, + { "abc,def=%", "abc" }, + { "abc,def=%1", "abc" }, + { "abc,def=%00", "abc" }, + { "abc,def=%22", "abc" }, + { "abc,def=\"", "abc" }, + { "abc,def=%ed%a0%80", "abc" } }; + for (int i = 0; i < sizeof aTests / sizeof (Test); ++i) + { + bool bValid = false; + rtl::OUString aName; + try { - bool bValid = false; - rtl::OUString aName; - try - { - aName = cppu::UnoUrlDescriptor(rtl::OUString::createFromAscii( - aTests[i].pInput)).getName(); - bValid = true; - } - catch (rtl::MalformedUriException &) - {} - - CPPUNIT_ASSERT_MESSAGE("Failed to parse URI", bValid); - CPPUNIT_ASSERT_MESSAGE("Failed to parse URI correctly", - aName.equalsAscii(aTests[i].pName)); + aName = cppu::UnoUrlDescriptor(rtl::OUString::createFromAscii( + aTests[i].pInput)).getName(); + bValid = true; } + catch (rtl::MalformedUriException &) + {} + + ASSERT_TRUE(bValid) << "Failed to parse URI"; + ASSERT_TRUE(aName.equalsAscii(aTests[i].pName)) << "Failed to parse URI correctly"; } + } - void testDescriptorKey(void) + TEST_F(UrlTest, testDescriptorKey) + { + struct Test { - struct Test - { - char const * pInput; - char const * pKey; - bool bPresent; - }; - static Test const aTests[] - = { { "abc", "abc", false }, - { "abc", "def", false }, - { "1abc", "def", false }, - { "123", "def", false }, - { "abc,def=", "abc", false }, - { "abc,def=", "def", true }, - { "abc,def=", "defg", false }, - { "abc,def=", "de", false }, - { "abc,def=", "ghi", false }, - { "abc,Def=", "def", true }, - { "abc,Def=", "Def", true }, - { "abc,Def=", "dEF", true }, - { "abc,Def=", "DEF", true }, - { "abc,def=xxx,ghi=xxx", "abc", false }, - { "abc,def=xxx,ghi=xxx", "def", true }, - { "abc,def=xxx,ghi=xxx", "ghi", true }, - { "abc,def=xxx,ghi=xxx", "jkl", false } }; - for (int i = 0; i < sizeof aTests / sizeof (Test); ++i) + char const * pInput; + char const * pKey; + bool bPresent; + }; + static Test const aTests[] + = { { "abc", "abc", false }, + { "abc", "def", false }, + { "1abc", "def", false }, + { "123", "def", false }, + { "abc,def=", "abc", false }, + { "abc,def=", "def", true }, + { "abc,def=", "defg", false }, + { "abc,def=", "de", false }, + { "abc,def=", "ghi", false }, + { "abc,Def=", "def", true }, + { "abc,Def=", "Def", true }, + { "abc,Def=", "dEF", true }, + { "abc,Def=", "DEF", true }, + { "abc,def=xxx,ghi=xxx", "abc", false }, + { "abc,def=xxx,ghi=xxx", "def", true }, + { "abc,def=xxx,ghi=xxx", "ghi", true }, + { "abc,def=xxx,ghi=xxx", "jkl", false } }; + for (int i = 0; i < sizeof aTests / sizeof (Test); ++i) + { + bool bValid = false; + bool bPresent = false; + try { - bool bValid = false; - bool bPresent = false; - try - { - bPresent = cppu::UnoUrlDescriptor(rtl::OUString::createFromAscii( - aTests[i].pInput)). - hasParameter(rtl::OUString::createFromAscii(aTests[i].pKey)); - bValid = true; - } - catch (rtl::MalformedUriException &) - {} - - CPPUNIT_ASSERT_MESSAGE("Failed to parse URI", bValid); - CPPUNIT_ASSERT_MESSAGE("Failed to detect parameter correctly", - bPresent == aTests[i].bPresent); + bPresent = cppu::UnoUrlDescriptor(rtl::OUString::createFromAscii( + aTests[i].pInput)). + hasParameter(rtl::OUString::createFromAscii(aTests[i].pKey)); + bValid = true; } + catch (rtl::MalformedUriException &) + {} + + ASSERT_TRUE(bValid) << "Failed to parse URI"; + ASSERT_TRUE(bPresent == aTests[i].bPresent) << "Failed to detect parameter correctly"; } + } - void testDescriptorValue() + TEST_F(UrlTest, testDescriptorValue) + { + struct Test { - struct Test - { - char const * pInput; - char const * pKey; - char const * pValue; - }; - static Test const aTests[] - = { { "abc", "abc", "" }, - { "abc", "def", "" }, - { "1abc", "def", "" }, - { "123", "def", "" }, - { "abc,def=", "abc", "" }, - { "abc,def=", "def", "" }, - { "abc,def=", "defg", "" }, - { "abc,def=", "de", "" }, - { "abc,def=", "ghi", "" }, - { "abc,Def=", "def", "" }, - { "abc,Def=", "Def", "" }, - { "abc,Def=", "dEF", "" }, - { "abc,Def=", "DEF", "" }, - { "abc,def=xxx,ghi=xxx", "abc", "" }, - { "abc,def=xxx,ghi=xxx", "def", "xxx" }, - { "abc,def=xxx,ghi=xxx", "ghi", "xxx" }, - { "abc,def=xxx,ghi=xxx", "jkl", "" }, - { "abc,def=%", "def", "%" }, - { "abc,def=%1", "def", "%1" }, - { "abc,def=%22", "def", "\"" }, - { "abc,def=\"", "def", "\"" }, - { "abc,def=abc", "def", "abc" }, - { "abc,def=Abc", "def", "Abc" }, - { "abc,def=aBC", "def", "aBC" }, - { "abc,def=ABC", "def", "ABC" }, - { "abc,def=%,ghi=", "def", "%" }, - { "abc,def=%1,ghi=", "def", "%1" }, - { "abc,def=%22,ghi=", "def", "\"" }, - { "abc,def=\",ghi=", "def", "\"" }, - { "abc,def=abc,ghi=", "def", "abc" }, - { "abc,def=Abc,ghi=", "def", "Abc" }, - { "abc,def=aBC,ghi=", "def", "aBC" }, - { "abc,def=ABC,ghi=", "def", "ABC" }, - { "abc,abc=,def=%", "def", "%" }, - { "abc,abc=,def=%1", "def", "%1" }, - { "abc,abc=,def=%22", "def", "\"" }, - { "abc,abc=,def=\"", "def", "\"" }, - { "abc,abc=,def=abc", "def", "abc" }, - { "abc,abc=,def=Abc", "def", "Abc" }, - { "abc,abc=,def=aBC", "def", "aBC" }, - { "abc,abc=,def=ABC", "def", "ABC" } }; - for (int i = 0; i < sizeof aTests / sizeof (Test); ++i) + char const * pInput; + char const * pKey; + char const * pValue; + }; + static Test const aTests[] + = { { "abc", "abc", "" }, + { "abc", "def", "" }, + { "1abc", "def", "" }, + { "123", "def", "" }, + { "abc,def=", "abc", "" }, + { "abc,def=", "def", "" }, + { "abc,def=", "defg", "" }, + { "abc,def=", "de", "" }, + { "abc,def=", "ghi", "" }, + { "abc,Def=", "def", "" }, + { "abc,Def=", "Def", "" }, + { "abc,Def=", "dEF", "" }, + { "abc,Def=", "DEF", "" }, + { "abc,def=xxx,ghi=xxx", "abc", "" }, + { "abc,def=xxx,ghi=xxx", "def", "xxx" }, + { "abc,def=xxx,ghi=xxx", "ghi", "xxx" }, + { "abc,def=xxx,ghi=xxx", "jkl", "" }, + { "abc,def=%", "def", "%" }, + { "abc,def=%1", "def", "%1" }, + { "abc,def=%22", "def", "\"" }, + { "abc,def=\"", "def", "\"" }, + { "abc,def=abc", "def", "abc" }, + { "abc,def=Abc", "def", "Abc" }, + { "abc,def=aBC", "def", "aBC" }, + { "abc,def=ABC", "def", "ABC" }, + { "abc,def=%,ghi=", "def", "%" }, + { "abc,def=%1,ghi=", "def", "%1" }, + { "abc,def=%22,ghi=", "def", "\"" }, + { "abc,def=\",ghi=", "def", "\"" }, + { "abc,def=abc,ghi=", "def", "abc" }, + { "abc,def=Abc,ghi=", "def", "Abc" }, + { "abc,def=aBC,ghi=", "def", "aBC" }, + { "abc,def=ABC,ghi=", "def", "ABC" }, + { "abc,abc=,def=%", "def", "%" }, + { "abc,abc=,def=%1", "def", "%1" }, + { "abc,abc=,def=%22", "def", "\"" }, + { "abc,abc=,def=\"", "def", "\"" }, + { "abc,abc=,def=abc", "def", "abc" }, + { "abc,abc=,def=Abc", "def", "Abc" }, + { "abc,abc=,def=aBC", "def", "aBC" }, + { "abc,abc=,def=ABC", "def", "ABC" } }; + for (int i = 0; i < sizeof aTests / sizeof (Test); ++i) + { + bool bValid = false; + rtl::OUString aValue; + try { - bool bValid = false; - rtl::OUString aValue; - try - { - aValue = cppu::UnoUrlDescriptor(rtl::OUString::createFromAscii( - aTests[i].pInput)). - getParameter(rtl::OUString::createFromAscii(aTests[i].pKey)); - bValid = true; - } - catch (rtl::MalformedUriException &) - {} - CPPUNIT_ASSERT_MESSAGE("Failed to parse URI", bValid); - CPPUNIT_ASSERT_MESSAGE("Failed to get param correctly", - aValue.equalsAscii(aTests[i].pValue)); + aValue = cppu::UnoUrlDescriptor(rtl::OUString::createFromAscii( + aTests[i].pInput)). + getParameter(rtl::OUString::createFromAscii(aTests[i].pKey)); + bValid = true; } + catch (rtl::MalformedUriException &) + {} + ASSERT_TRUE(bValid) << "Failed to parse URI"; + ASSERT_TRUE(aValue.equalsAscii(aTests[i].pValue)) << "Failed to get param correctly"; } + } - void testUrlParsing() + TEST_F(UrlTest, testUrlParsing) + { + struct Test { - struct Test - { - char const * pInput; - bool bValid; - }; - static Test const aTests[] - = { { "", false }, - { "abc", false }, - { "uno", false }, - { "uno:", false }, - { "uno:abc;def;ghi", true }, - { "Uno:abc;def;ghi", true }, - { "uNO:abc;def;ghi", true }, - { "UNO:abc;def;ghi", true }, - { "uno:abc,def=xxx,ghi=xxx;def,ghi=xxx,jkl=xxx;ghi", true }, - { "uno:abc,def=xxx,ghi=xxx;def,ghi=xxx,jkl=xxx,;ghi", false }, - { "uno:abc;def;", false }, - { "uno:abc;def;a", true }, - { "uno:abc;def;A", true }, - { "uno:abc;def;1", true }, - { "uno:abc;def;$&+,/:=?@", true }, - { "uno:abc;def;%24&+,/:=?@", false } }; - for (int i = 0; i < sizeof aTests / sizeof (Test); ++i) + char const * pInput; + bool bValid; + }; + static Test const aTests[] + = { { "", false }, + { "abc", false }, + { "uno", false }, + { "uno:", false }, + { "uno:abc;def;ghi", true }, + { "Uno:abc;def;ghi", true }, + { "uNO:abc;def;ghi", true }, + { "UNO:abc;def;ghi", true }, + { "uno:abc,def=xxx,ghi=xxx;def,ghi=xxx,jkl=xxx;ghi", true }, + { "uno:abc,def=xxx,ghi=xxx;def,ghi=xxx,jkl=xxx,;ghi", false }, + { "uno:abc;def;", false }, + { "uno:abc;def;a", true }, + { "uno:abc;def;A", true }, + { "uno:abc;def;1", true }, + { "uno:abc;def;$&+,/:=?@", true }, + { "uno:abc;def;%24&+,/:=?@", false } }; + for (int i = 0; i < sizeof aTests / sizeof (Test); ++i) + { + bool bValid = false; + try { - bool bValid = false; - try - { - cppu::UnoUrl aUrl(rtl::OUString::createFromAscii(aTests[i].pInput)); - bValid = true; - } - catch (rtl::MalformedUriException &) - {} - - if (aTests[i].bValid) - { - CPPUNIT_ASSERT_MESSAGE("Valid uri parsed as invalid", bValid); - } - else - { - CPPUNIT_ASSERT_MESSAGE("Invalid uri parsed as valid", !bValid); - } + cppu::UnoUrl aUrl(rtl::OUString::createFromAscii(aTests[i].pInput)); + bValid = true; + } + catch (rtl::MalformedUriException &) + {} + if (aTests[i].bValid) + { + ASSERT_TRUE(bValid) << "Valid uri parsed as invalid"; + } + else + { + ASSERT_TRUE(!bValid) << "Invalid uri parsed as valid"; } + } + } - void testUrlConnection() + TEST_F(UrlTest, testUrlConnection) + { + struct Test { - struct Test - { - char const * pInput; - char const * pConnection; - }; - static Test const aTests[] - = { { "uno:abc;def;ghi", "abc" }, - { "uno:Abc;def;ghi", "Abc" }, - { "uno:aBC;def;ghi", "aBC" }, - { "uno:ABC;def;ghi", "ABC" }, - { "uno:abc,def=xxx,ghi=xxx;def,ghi=xxx,jkl=xxx;ghi", - "abc,def=xxx,ghi=xxx" } }; - for (int i = 0; i < sizeof aTests / sizeof (Test); ++i) + char const * pInput; + char const * pConnection; + }; + static Test const aTests[] + = { { "uno:abc;def;ghi", "abc" }, + { "uno:Abc;def;ghi", "Abc" }, + { "uno:aBC;def;ghi", "aBC" }, + { "uno:ABC;def;ghi", "ABC" }, + { "uno:abc,def=xxx,ghi=xxx;def,ghi=xxx,jkl=xxx;ghi", + "abc,def=xxx,ghi=xxx" } }; + for (int i = 0; i < sizeof aTests / sizeof (Test); ++i) + { + bool bValid = false; + rtl::OUString aConnection; + try { - bool bValid = false; - rtl::OUString aConnection; - try - { - aConnection = cppu::UnoUrl(rtl::OUString::createFromAscii( - aTests[i].pInput)). - getConnection().getDescriptor(); - bValid = true; - } - catch (rtl::MalformedUriException &) - {} - CPPUNIT_ASSERT_MESSAGE("Failed to parse URI", bValid); - CPPUNIT_ASSERT_MESSAGE("Failed to get param correctly", - aConnection.equalsAscii( - aTests[i].pConnection)); + aConnection = cppu::UnoUrl(rtl::OUString::createFromAscii( + aTests[i].pInput)). + getConnection().getDescriptor(); + bValid = true; } + catch (rtl::MalformedUriException &) + {} + ASSERT_TRUE(bValid) << "Failed to parse URI"; + ASSERT_TRUE(aConnection.equalsAscii(aTests[i].pConnection)) << "Failed to get param correctly"; } + } - void testUrlProtocol() + TEST_F(UrlTest, testUrlProtocol) + { + struct Test { - struct Test - { - char const * pInput; - char const * pProtocol; - }; - static Test const aTests[] - = { { "uno:abc;def;ghi", "def" }, - { "uno:abc;Def;ghi", "Def" }, - { "uno:abc;dEF;ghi", "dEF" }, - { "uno:abc;DEF;ghi", "DEF" }, - { "uno:abc,def=xxx,ghi=xxx;def,ghi=xxx,jkl=xxx;ghi", - "def,ghi=xxx,jkl=xxx" } }; - for (int i = 0; i < sizeof aTests / sizeof (Test); ++i) + char const * pInput; + char const * pProtocol; + }; + static Test const aTests[] + = { { "uno:abc;def;ghi", "def" }, + { "uno:abc;Def;ghi", "Def" }, + { "uno:abc;dEF;ghi", "dEF" }, + { "uno:abc;DEF;ghi", "DEF" }, + { "uno:abc,def=xxx,ghi=xxx;def,ghi=xxx,jkl=xxx;ghi", + "def,ghi=xxx,jkl=xxx" } }; + for (int i = 0; i < sizeof aTests / sizeof (Test); ++i) + { + bool bValid = false; + rtl::OUString aProtocol; + try { - bool bValid = false; - rtl::OUString aProtocol; - try - { - aProtocol = cppu::UnoUrl(rtl::OUString::createFromAscii( - aTests[i].pInput)). - getProtocol().getDescriptor(); - bValid = true; - } - catch (rtl::MalformedUriException &) - {} - CPPUNIT_ASSERT_MESSAGE("Failed to parse URI", bValid); - CPPUNIT_ASSERT_MESSAGE("Failed to get protocol correctly", - aProtocol.equalsAscii( - aTests[i].pProtocol)); + aProtocol = cppu::UnoUrl(rtl::OUString::createFromAscii( + aTests[i].pInput)). + getProtocol().getDescriptor(); + bValid = true; } + catch (rtl::MalformedUriException &) + {} + ASSERT_TRUE(bValid) << "Failed to parse URI"; + ASSERT_TRUE(aProtocol.equalsAscii(aTests[i].pProtocol)) << "Failed to get protocol correctly"; } + } - void testUrlObjectName() + TEST_F(UrlTest, testUrlObjectName) + { + struct Test { - struct Test - { - char const * pInput; - char const * pObjectName; - }; - static Test const aTests[] - = { { "uno:abc;def;ghi", "ghi" }, - { "uno:abc;def;Ghi", "Ghi" }, - { "uno:abc;def;gHI", "gHI" }, - { "uno:abc;def;GHI", "GHI" }, - { "uno:abc,def=xxx,ghi=xxx;def,ghi=xxx,jkl=xxx;ghi", "ghi" }, - { "uno:abc;def;a", "a" }, - { "uno:abc;def;A", "A" }, - { "uno:abc;def;1", "1" }, - { "uno:abc;def;$&+,/:=?@", "$&+,/:=?@" } }; - for (int i = 0; i < sizeof aTests / sizeof (Test); ++i) + char const * pInput; + char const * pObjectName; + }; + static Test const aTests[] + = { { "uno:abc;def;ghi", "ghi" }, + { "uno:abc;def;Ghi", "Ghi" }, + { "uno:abc;def;gHI", "gHI" }, + { "uno:abc;def;GHI", "GHI" }, + { "uno:abc,def=xxx,ghi=xxx;def,ghi=xxx,jkl=xxx;ghi", "ghi" }, + { "uno:abc;def;a", "a" }, + { "uno:abc;def;A", "A" }, + { "uno:abc;def;1", "1" }, + { "uno:abc;def;$&+,/:=?@", "$&+,/:=?@" } }; + for (int i = 0; i < sizeof aTests / sizeof (Test); ++i) + { + bool bValid = false; + rtl::OUString aObjectName; + try { - bool bValid = false; - rtl::OUString aObjectName; - try - { - aObjectName = cppu::UnoUrl(rtl::OUString::createFromAscii( - aTests[i].pInput)).getObjectName(); - bValid = true; - } - catch (rtl::MalformedUriException &) - {} - CPPUNIT_ASSERT_MESSAGE("Failed to parse URI", bValid); - CPPUNIT_ASSERT_MESSAGE("Failed to get protocol correctly", - aObjectName.equalsAscii( - aTests[i].pObjectName)); + aObjectName = cppu::UnoUrl(rtl::OUString::createFromAscii( + aTests[i].pInput)).getObjectName(); + bValid = true; } + catch (rtl::MalformedUriException &) + {} + ASSERT_TRUE(bValid) << "Failed to parse URI"; + ASSERT_TRUE(aObjectName.equalsAscii(aTests[i].pObjectName)) << "Failed to get protocol correctly"; } - - // Automatic registration code - CPPUNIT_TEST_SUITE(UrlTest); - CPPUNIT_TEST(testDescriptorParsing); - CPPUNIT_TEST(testDescriptorDescriptor); - CPPUNIT_TEST(testDescriptorName); - CPPUNIT_TEST(testDescriptorKey); - CPPUNIT_TEST(testDescriptorValue); - CPPUNIT_TEST(testUrlParsing); - CPPUNIT_TEST(testUrlConnection); - CPPUNIT_TEST(testUrlProtocol); - CPPUNIT_TEST(testUrlObjectName); - CPPUNIT_TEST_SUITE_END(); - }; + } } // namespace cppu_ifcontainer -CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(cppu_unourl::UrlTest, - "cppu_unourl"); - -NOADDITIONAL; - diff --git a/cppuhelper/qa/unourl/export.map b/cppuhelper/qa/unourl/export.map deleted file mode 100644 index d4e60c3..0000000 --- a/cppuhelper/qa/unourl/export.map +++ /dev/null @@ -1,27 +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: - registerAllTestFunction; - - local: - *; -}; diff --git a/cppuhelper/qa/unourl/makefile.mk b/cppuhelper/qa/unourl/makefile.mk index befbc84..abf0e16 100644 --- a/cppuhelper/qa/unourl/makefile.mk +++ b/cppuhelper/qa/unourl/makefile.mk @@ -31,27 +31,31 @@ ENABLE_EXCEPTIONS=TRUE .INCLUDE : settings.mk -CFLAGSCXX += $(CPPUNIT_CFLAGS) +.IF "$(ENABLE_UNIT_TESTS)" != "YES" +all: + @echo unit tests are disabled. Nothing to do. + +.ELSE # BEGIN ---------------------------------------------------------------- # auto generated Target:joblist by codegen.pl -SHL1OBJS= \ - $(SLO)$/cppu_unourl.obj -SHL1TARGET= cppu_unourl -SHL1STDLIBS=\ +APP1OBJS= \ + $(SLO)$/cppu_unourl.obj \ + $(SLO)$/main.obj +APP1TARGET= cppu_unourl +APP1STDLIBS=\ $(CPPUHELPERLIB) \ $(SALLIB) \ $(CPPULIB) \ $(TESTSHL2LIB)\ - $(CPPUNITLIB) -SHL1IMPLIB= i$(SHL1TARGET) -DEF1NAME =$(SHL1TARGET) -SHL1VERSIONMAP= export.map + $(GTESTLIB) +APP1TEST = enabled + # auto generated Target:joblist # END ------------------------------------------------------------------ # --- Targets ------------------------------------------------------ .INCLUDE : target.mk -.INCLUDE : _cppunit.mk +.ENDIF # "$(ENABLE_UNIT_TESTS)" != "YES" commit a9e5e8a424716411b3282128cd2d7bce87b3250f Author: Damjan Jovanovic <dam...@apache.org> Date: Sat Aug 29 18:39:35 2015 +0000 #i125003# migrate main/cppuhelper/qa/ifcontainer from cppunit to Google Test and run it on every build. diff --git a/cppuhelper/prj/build.lst b/cppuhelper/prj/build.lst index ff837f9..e43e133 100644 --- a/cppuhelper/prj/build.lst +++ b/cppuhelper/prj/build.lst @@ -3,4 +3,5 @@ ch cppuhelper usr1 - all ch_mkout NULL ch cppuhelper\inc nmake - all ch_include NULL ch cppuhelper\source nmake - all ch_source ch_unotypes ch_include NULL ch cppuhelper\unotypes nmake - all ch_unotypes NULL +ch cppuhelper\qa\ifcontainer nmake - all ch_qa_ifcontainer ch_source ch_include ch_unotypes NULL ch cppuhelper\qa\propertysetmixin nmake - all ch_qa_propertysetmixin ch_source NULL diff --git a/cppuhelper/qa/ifcontainer/cppu_ifcontainer.cxx b/cppuhelper/qa/ifcontainer/cppu_ifcontainer.cxx index 6b21e43..402468b 100644 --- a/cppuhelper/qa/ifcontainer/cppu_ifcontainer.cxx +++ b/cppuhelper/qa/ifcontainer/cppu_ifcontainer.cxx @@ -21,13 +21,12 @@ -#include <testshl/simpleheader.hxx> - #include "com/sun/star/lang/XEventListener.hpp" #include "cppuhelper/interfacecontainer.hxx" #include "cppuhelper/queryinterface.hxx" #include "cppuhelper/implbase1.hxx" #include "cppuhelper/propshlp.hxx" +#include "gtest/gtest.h" using namespace com::sun::star; using namespace com::sun::star::uno; @@ -57,79 +56,12 @@ public: namespace cppu_ifcontainer { - class IfTest : public CppUnit::TestFixture + class IfTest : public ::testing::Test { + protected: osl::Mutex m_aGuard; static const int nTests = 10; public: - void testCreateDispose() - { - ContainerStats aStats; - cppu::OInterfaceContainerHelper *pContainer; - - pContainer = new cppu::OInterfaceContainerHelper(m_aGuard); - - CPPUNIT_ASSERT_MESSAGE("Empty container not empty", - pContainer->getLength() == 0); - - int i; - for (i = 0; i < nTests; i++) - { - Reference<XEventListener> xRef = new ContainerListener(&aStats); - int nNewLen = pContainer->addInterface(xRef); - - CPPUNIT_ASSERT_MESSAGE("addition length mismatch", - nNewLen == i + 1); - CPPUNIT_ASSERT_MESSAGE("addition length mismatch", - pContainer->getLength() == i + 1); - } - CPPUNIT_ASSERT_MESSAGE("alive count mismatch", - aStats.m_nAlive == nTests); - - EventObject aObj; - pContainer->disposeAndClear(aObj); - - CPPUNIT_ASSERT_MESSAGE("dispose count mismatch", - aStats.m_nDisposed == nTests); - CPPUNIT_ASSERT_MESSAGE("leaked container left alive", - aStats.m_nAlive == 0); - - delete pContainer; - } - - void testEnumerate() - { - int i; - ContainerStats aStats; - cppu::OInterfaceContainerHelper *pContainer; - pContainer = new cppu::OInterfaceContainerHelper(m_aGuard); - - std::vector< Reference< XEventListener > > aListeners; - for (i = 0; i < nTests; i++) - { - Reference<XEventListener> xRef = new ContainerListener(&aStats); - int nNewLen = pContainer->addInterface(xRef); - aListeners.push_back(xRef); - } - Sequence< Reference< XInterface > > aElements; - aElements = pContainer->getElements(); - - CPPUNIT_ASSERT_MESSAGE("query contents", - (int)aElements.getLength() == nTests); - if ((int)aElements.getLength() == nTests) - { - for (i = 0; i < nTests; i++) - { - CPPUNIT_ASSERT_MESSAGE("mismatching elements", - aElements[i] == aListeners[i]); - } - } - pContainer->clear(); - - CPPUNIT_ASSERT_MESSAGE("non-empty container post clear", - pContainer->getLength() == 0); - delete pContainer; - } template < typename ContainerType, typename ContainedType > void doContainerTest(const ContainedType *pTypes) @@ -155,11 +87,11 @@ namespace cppu_ifcontainer pHelper = pContainer->getContainer(pTypes[i]); - CPPUNIT_ASSERT_MESSAGE("no helper", pHelper != NULL); + ASSERT_TRUE(pHelper != NULL) << "no helper"; Sequence<Reference< XInterface > > aSeq = pHelper->getElements(); - CPPUNIT_ASSERT_MESSAGE("wrong num elements", aSeq.getLength() == 2); - CPPUNIT_ASSERT_MESSAGE("match", aSeq[0] == xRefs[i*2]); - CPPUNIT_ASSERT_MESSAGE("match", aSeq[1] == xRefs[i*2+1]); + ASSERT_TRUE(aSeq.getLength() == 2) << "wrong num elements"; + ASSERT_TRUE(aSeq[0] == xRefs[i*2]) << "match"; + ASSERT_TRUE(aSeq[1] == xRefs[i*2+1]) << "match"; } // remove every other interface @@ -173,10 +105,10 @@ namespace cppu_ifcontainer pHelper = pContainer->getContainer(pTypes[i]); - CPPUNIT_ASSERT_MESSAGE("no helper", pHelper != NULL); + ASSERT_TRUE(pHelper != NULL) << "no helper"; Sequence<Reference< XInterface > > aSeq = pHelper->getElements(); - CPPUNIT_ASSERT_MESSAGE("wrong num elements", aSeq.getLength() == 1); - CPPUNIT_ASSERT_MESSAGE("match", aSeq[0] == xRefs[i*2]); + ASSERT_TRUE(aSeq.getLength() == 1) << "wrong num elements"; + ASSERT_TRUE(aSeq[0] == xRefs[i*2]) << "match"; } // remove the 1st half of the rest @@ -189,75 +121,124 @@ namespace cppu_ifcontainer cppu::OInterfaceContainerHelper *pHelper; pHelper = pContainer->getContainer(pTypes[i]); - CPPUNIT_ASSERT_MESSAGE("no helper", pHelper != NULL); + ASSERT_TRUE(pHelper != NULL) << "no helper"; Sequence<Reference< XInterface > > aSeq = pHelper->getElements(); - CPPUNIT_ASSERT_MESSAGE("wrong num elements", aSeq.getLength() == 0); + ASSERT_TRUE(aSeq.getLength() == 0) << "wrong num elements"; } delete pContainer; } + }; + + TEST_F(IfTest, testCreateDispose) + { + ContainerStats aStats; + cppu::OInterfaceContainerHelper *pContainer; - void testOMultiTypeInterfaceContainerHelper() + pContainer = new cppu::OInterfaceContainerHelper(m_aGuard); + + ASSERT_TRUE(pContainer->getLength() == 0) << "Empty container not empty"; + + int i; + for (i = 0; i < nTests; i++) { - uno::Type pTypes[nTests] = - { - ::cppu::UnoType< bool >::get(), - ::cppu::UnoType< float >::get(), - ::cppu::UnoType< double >::get(), - ::cppu::UnoType< ::sal_uInt64 >::get(), - ::cppu::UnoType< ::sal_Int64 >::get(), - ::cppu::UnoType< ::sal_uInt32 >::get(), - ::cppu::UnoType< ::sal_Int32 >::get(), - ::cppu::UnoType< ::sal_Int16 >::get(), - ::cppu::UnoType< ::rtl::OUString >::get(), - ::cppu::UnoType< ::sal_Int8 >::get() - }; - doContainerTest< cppu::OMultiTypeInterfaceContainerHelper, - uno::Type> (pTypes); + Reference<XEventListener> xRef = new ContainerListener(&aStats); + int nNewLen = pContainer->addInterface(xRef); + + ASSERT_TRUE(nNewLen == i + 1) << "addition length mismatch"; + ASSERT_TRUE(pContainer->getLength() == i + 1) << "addition length mismatch"; } + ASSERT_TRUE(aStats.m_nAlive == nTests) << "alive count mismatch"; + + EventObject aObj; + pContainer->disposeAndClear(aObj); + + ASSERT_TRUE(aStats.m_nDisposed == nTests) << "dispose count mismatch"; + ASSERT_TRUE(aStats.m_nAlive == 0) << "leaked container left alive"; + + delete pContainer; + } - void testOMultiTypeInterfaceContainerHelperInt32() + TEST_F(IfTest, testEnumerate) + { + int i; + ContainerStats aStats; + cppu::OInterfaceContainerHelper *pContainer; + pContainer = new cppu::OInterfaceContainerHelper(m_aGuard); + + std::vector< Reference< XEventListener > > aListeners; + for (i = 0; i < nTests; i++) { - sal_Int32 pTypes[nTests] = - { - 0, - -1, - 1, - 256, - 1024, - 3, - 7, - 8, - 9, - 10 - }; - doContainerTest< cppu::OMultiTypeInterfaceContainerHelperInt32, sal_Int32> (pTypes); + Reference<XEventListener> xRef = new ContainerListener(&aStats); + int nNewLen = pContainer->addInterface(xRef); + aListeners.push_back(xRef); } + Sequence< Reference< XInterface > > aElements; + aElements = pContainer->getElements(); - void testOMultiTypeInterfaceContainerHelperVar() + ASSERT_TRUE((int)aElements.getLength() == nTests) << "query contents"; + if ((int)aElements.getLength() == nTests) { - typedef ::cppu::OMultiTypeInterfaceContainerHelperVar< - const char*, rtl::CStringHash, rtl::CStringEqual> StrContainer; - - const char *pTypes[nTests] = + for (i = 0; i < nTests; i++) { - "this_is", "such", "fun", "writing", "unit", "tests", "when", "it", "works", "anyway" - }; - doContainerTest< StrContainer, const char *> (pTypes); + ASSERT_TRUE(aElements[i] == aListeners[i]) << "mismatching elements"; + } } + pContainer->clear(); - // Automatic registration code - CPPUNIT_TEST_SUITE(IfTest); - CPPUNIT_TEST(testCreateDispose); - CPPUNIT_TEST(testEnumerate); - CPPUNIT_TEST(testOMultiTypeInterfaceContainerHelper); - CPPUNIT_TEST(testOMultiTypeInterfaceContainerHelperVar); - CPPUNIT_TEST(testOMultiTypeInterfaceContainerHelperInt32); - CPPUNIT_TEST_SUITE_END(); - }; -} // namespace cppu_ifcontainer + ASSERT_TRUE(pContainer->getLength() == 0) << "non-empty container post clear"; + delete pContainer; + } + + TEST_F(IfTest, testOMultiTypeInterfaceContainerHelper) + { + uno::Type pTypes[nTests] = + { + ::cppu::UnoType< bool >::get(), + ::cppu::UnoType< float >::get(), + ::cppu::UnoType< double >::get(), + ::cppu::UnoType< ::sal_uInt64 >::get(), + ::cppu::UnoType< ::sal_Int64 >::get(), + ::cppu::UnoType< ::sal_uInt32 >::get(), + ::cppu::UnoType< ::sal_Int32 >::get(), + ::cppu::UnoType< ::sal_Int16 >::get(), + ::cppu::UnoType< ::rtl::OUString >::get(), + ::cppu::UnoType< ::sal_Int8 >::get() + }; + doContainerTest< cppu::OMultiTypeInterfaceContainerHelper, + uno::Type> (pTypes); + } + + TEST_F(IfTest, testOMultiTypeInterfaceContainerHelperInt32) + { + sal_Int32 pTypes[nTests] = + { + 0, + -1, + 1, + 256, + 1024, + 3, + 7, + 8, + 9, + 10 + }; + doContainerTest< cppu::OMultiTypeInterfaceContainerHelperInt32, sal_Int32> (pTypes); + } + + TEST_F(IfTest, testOMultiTypeInterfaceContainerHelperVar) + { + typedef ::cppu::OMultiTypeInterfaceContainerHelperVar< + const char*, rtl::CStringHash, rtl::CStringEqual> StrContainer; + + const char *pTypes[nTests] = + { + "this_is", "such", "fun", "writing", "unit", "tests", "when", "it", "works", "anyway" + }; + doContainerTest< StrContainer, const char *> (pTypes); + } -CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(cppu_ifcontainer::IfTest, - "cppu_ifcontainer"); -NOADDITIONAL; +} // namespace cppu_ifcontainer + diff --git a/cppuhelper/qa/ifcontainer/export.map b/cppuhelper/qa/ifcontainer/export.map deleted file mode 100644 index d4e60c3..0000000 --- a/cppuhelper/qa/ifcontainer/export.map +++ /dev/null @@ -1,27 +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: - registerAllTestFunction; - - local: - *; -}; diff --git a/cppuhelper/qa/ifcontainer/main.cxx b/cppuhelper/qa/ifcontainer/main.cxx new file mode 100644 index 0000000..df14e5b --- /dev/null +++ b/cppuhelper/qa/ifcontainer/main.cxx @@ -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(); +} diff --git a/cppuhelper/qa/ifcontainer/makefile.mk b/cppuhelper/qa/ifcontainer/makefile.mk index 4014f96..7e10f64 100644 --- a/cppuhelper/qa/ifcontainer/makefile.mk +++ b/cppuhelper/qa/ifcontainer/makefile.mk @@ -31,27 +31,31 @@ ENABLE_EXCEPTIONS=TRUE .INCLUDE : settings.mk -CFLAGSCXX += $(CPPUNIT_CFLAGS) +.IF "$(ENABLE_UNIT_TESTS)" != "YES" +all: + @echo unit tests are disabled. Nothing to do. + +.ELSE # BEGIN ---------------------------------------------------------------- # auto generated Target:joblist by codegen.pl -SHL1OBJS= \ - $(SLO)$/cppu_ifcontainer.obj -SHL1TARGET= cppu_ifcontainer -SHL1STDLIBS=\ +APP1OBJS= \ + $(SLO)$/cppu_ifcontainer.obj \ + $(SLO)$/main.obj +APP1TARGET= cppu_ifcontainer +APP1STDLIBS=\ $(CPPUHELPERLIB) \ $(SALLIB) \ $(CPPULIB) \ $(TESTSHL2LIB)\ - $(CPPUNITLIB) -SHL1IMPLIB= i$(SHL1TARGET) -DEF1NAME =$(SHL1TARGET) -SHL1VERSIONMAP= export.map + $(GTESTLIB) +APP1RPATH = NONE +APP1TEST = enabled # auto generated Target:joblist # END ------------------------------------------------------------------ # --- Targets ------------------------------------------------------ .INCLUDE : target.mk -.INCLUDE : _cppunit.mk +.ENDIF # "$(ENABLE_UNIT_TESTS)" != "YES" _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits