diff options
author | Thorsten Behrens <thb@openoffice.org> | 2006-01-25 15:18:16 +0000 |
---|---|---|
committer | Thorsten Behrens <thb@openoffice.org> | 2006-01-25 15:18:16 +0000 |
commit | 20d9324fa786000e8d243b3ef8f1b08d2b31d7ca (patch) | |
tree | b18c186eca9e6ac152c466573a99eb30aacde2a5 /o3tl | |
parent | 560b68bb63b6777ba7357fc23089b02835596a10 (diff) |
Initial revision. Note that tests for template tools are run during the normal build.
Diffstat (limited to 'o3tl')
-rw-r--r-- | o3tl/qa/cow_wrapper_clients.cxx | 145 | ||||
-rw-r--r-- | o3tl/qa/cow_wrapper_clients.hxx | 133 | ||||
-rw-r--r-- | o3tl/qa/export.map | 42 | ||||
-rw-r--r-- | o3tl/qa/makefile.mk | 82 |
4 files changed, 402 insertions, 0 deletions
diff --git a/o3tl/qa/cow_wrapper_clients.cxx b/o3tl/qa/cow_wrapper_clients.cxx new file mode 100644 index 000000000000..bbabfa7ca440 --- /dev/null +++ b/o3tl/qa/cow_wrapper_clients.cxx @@ -0,0 +1,145 @@ +/************************************************************************* + * + * $RCSfile: cow_wrapper_clients.cxx,v $ + * + * $Revision: 1.1 $ + * + * last change: $Author: thb $ $Date: 2006-01-25 16:17:20 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (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.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#include "cow_wrapper_clients.hxx" + +namespace o3tltests { + +class cow_wrapper_client2_impl +{ +public: + cow_wrapper_client2_impl() : mnValue(0) {} + explicit cow_wrapper_client2_impl( int nVal ) : mnValue(nVal) {} + void setValue( int nVal ) { mnValue = nVal; } + int getValue() const { return mnValue; } + + bool operator==( const cow_wrapper_client2_impl& rRHS ) const { return mnValue == rRHS.mnValue; } + bool operator!=( const cow_wrapper_client2_impl& rRHS ) const { return mnValue != rRHS.mnValue; } + bool operator<( const cow_wrapper_client2_impl& rRHS ) const { return mnValue < rRHS.mnValue; } + +private: + int mnValue; +}; + +cow_wrapper_client2::cow_wrapper_client2() : maImpl() +{ +} + +cow_wrapper_client2::cow_wrapper_client2( int nVal ) : + maImpl( cow_wrapper_client2_impl(nVal) ) +{ +} + +cow_wrapper_client2::~cow_wrapper_client2() +{ +} + +cow_wrapper_client2::cow_wrapper_client2( const cow_wrapper_client2& rSrc ) : + maImpl(rSrc.maImpl) +{ +} + +cow_wrapper_client2& cow_wrapper_client2::operator=( const cow_wrapper_client2& rSrc ) +{ + maImpl = rSrc.maImpl; +} + +void cow_wrapper_client2::modify( int nVal ) +{ + maImpl->setValue( nVal ); +} + +int cow_wrapper_client2::queryUnmodified() const +{ + return maImpl->getValue(); +} + +void cow_wrapper_client2::makeUnique() +{ + maImpl.make_unique(); +} +bool cow_wrapper_client2::is_unique() const +{ + return maImpl.is_unique(); +} +oslInterlockedCount cow_wrapper_client2::use_count() const +{ + return maImpl.use_count(); +} +void cow_wrapper_client2::swap( cow_wrapper_client2& r ) +{ + o3tl::swap(maImpl, r.maImpl); +} + +bool cow_wrapper_client2::operator==( const cow_wrapper_client2& rRHS ) const +{ + return maImpl == rRHS.maImpl; +} +bool cow_wrapper_client2::operator!=( const cow_wrapper_client2& rRHS ) const +{ + return maImpl != rRHS.maImpl; +} +bool cow_wrapper_client2::operator<( const cow_wrapper_client2& rRHS ) const +{ + return maImpl < rRHS.maImpl; +} + +} // namespace o3tltests diff --git a/o3tl/qa/cow_wrapper_clients.hxx b/o3tl/qa/cow_wrapper_clients.hxx new file mode 100644 index 000000000000..49a9cb5023d5 --- /dev/null +++ b/o3tl/qa/cow_wrapper_clients.hxx @@ -0,0 +1,133 @@ +/************************************************************************* + * + * $RCSfile: cow_wrapper_clients.hxx,v $ + * + * $Revision: 1.1 $ + * + * last change: $Author: thb $ $Date: 2006-01-25 16:17:38 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (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.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef INCLUDED_COW_WRAPPER_CLIENTS_HXX +#define INCLUDED_COW_WRAPPER_CLIENTS_HXX + +#include "o3tl/cow_wrapper.hxx" + +/* Definition of Cow_Wrapper_Clients classes */ + +namespace o3tltests { + +/** This is a header and a separate compilation unit on purpose - + cow_wrapper needs destructor, copy constructor and assignment + operator to be outline, when pimpl idiom is used + */ + +/// test non-opaque impl type +class cow_wrapper_client1 +{ +public: + cow_wrapper_client1() : maImpl() {} + explicit cow_wrapper_client1( int nVal ) : maImpl(nVal) {} + + void modify( int nVal ) { *maImpl = nVal; } + int queryUnmodified() const { return *maImpl; } + + void makeUnique() { maImpl.make_unique(); } + bool is_unique() const { return maImpl.is_unique(); } + oslInterlockedCount use_count() const { return maImpl.use_count(); } + void swap( cow_wrapper_client1& r ) { o3tl::swap(maImpl, r.maImpl); } + + bool operator==( const cow_wrapper_client1& rRHS ) const { return maImpl == rRHS.maImpl; } + bool operator!=( const cow_wrapper_client1& rRHS ) const { return maImpl != rRHS.maImpl; } + bool operator<( const cow_wrapper_client1& rRHS ) const { return maImpl < rRHS.maImpl; } + +private: + o3tl::cow_wrapper< int > maImpl; +}; + + +class cow_wrapper_client2_impl; + +/** test opaque impl type - need to explicitely declare lifetime + methods + */ +class cow_wrapper_client2 +{ +public: + cow_wrapper_client2(); + explicit cow_wrapper_client2( int nVal ); + ~cow_wrapper_client2(); + + cow_wrapper_client2( const cow_wrapper_client2& ); + cow_wrapper_client2& operator=( const cow_wrapper_client2& ); + + void modify( int nVal ); + int queryUnmodified() const; + + void makeUnique(); + bool is_unique() const; + oslInterlockedCount use_count() const; + void swap( cow_wrapper_client2& r ); + + bool operator==( const cow_wrapper_client2& rRHS ) const; + bool operator!=( const cow_wrapper_client2& rRHS ) const; + bool operator<( const cow_wrapper_client2& rRHS ) const; + +private: + o3tl::cow_wrapper< cow_wrapper_client2_impl > maImpl; +}; + +} // namespace o3tltests + +#endif /* INCLUDED_COW_WRAPPER_CLIENTS_HXX */ diff --git a/o3tl/qa/export.map b/o3tl/qa/export.map new file mode 100644 index 000000000000..00983e417419 --- /dev/null +++ b/o3tl/qa/export.map @@ -0,0 +1,42 @@ +#************************************************************************* +# +# OpenOffice.org - a multi-platform office productivity suite +# +# $RCSfile: export.map,v $ +# +# $Revision: 1.1 $ +# +# last change: $Author: thb $ $Date: 2006-01-25 16:17:58 $ +# +# The Contents of this file are made available subject to +# the terms of GNU Lesser General Public License Version 2.1. +# +# +# GNU Lesser General Public License Version 2.1 +# ============================================= +# Copyright 2005 by Sun Microsystems, Inc. +# 901 San Antonio Road, Palo Alto, CA 94303, USA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License version 2.1, as published by the Free Software Foundation. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, +# MA 02111-1307 USA +# +#************************************************************************* + +UDK_3.1 { + global: + registerAllTestFunction; + + local: + *; +}; diff --git a/o3tl/qa/makefile.mk b/o3tl/qa/makefile.mk new file mode 100644 index 000000000000..98fd3b27dcd3 --- /dev/null +++ b/o3tl/qa/makefile.mk @@ -0,0 +1,82 @@ +#************************************************************************* +# +# OpenOffice.org - a multi-platform office productivity suite +# +# $RCSfile: makefile.mk,v $ +# +# $Revision: 1.1 $ +# +# last change: $Author: thb $ $Date: 2006-01-25 16:18:16 $ +# +# The Contents of this file are made available subject to +# the terms of GNU Lesser General Public License Version 2.1. +# +# +# GNU Lesser General Public License Version 2.1 +# ============================================= +# Copyright 2005 by Sun Microsystems, Inc. +# 901 San Antonio Road, Palo Alto, CA 94303, USA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License version 2.1, as published by the Free Software Foundation. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, +# MA 02111-1307 USA +# +#************************************************************************* + +PRJ=.. + +PRJNAME=o3tl +TARGET=tests + +ENABLE_EXCEPTIONS=TRUE + +# --- Settings ----------------------------------------------------- + +.INCLUDE : settings.mk + +# --- Common ---------------------------------------------------------- + +# BEGIN ---------------------------------------------------------------- +SHL1OBJS= \ + $(SLO)$/tests.obj \ + $(SLO)$/cow_wrapper_clients.obj + +SHL1TARGET= tests +SHL1STDLIBS= $(SALLIB) \ + $(CPPUNITLIB) + +SHL1IMPLIB= i$(SHL1TARGET) + +DEF1NAME =$(SHL1TARGET) +SHL1VERSIONMAP = export.map + +# END ------------------------------------------------------------------ + +#------------------------------- All object files ------------------------------- +# do this here, so we get right dependencies +SLOFILES=$(SHL1OBJS) + +# --- Targets ------------------------------------------------------ + +.INCLUDE : target.mk +.INCLUDE : _cppunit.mk + +# --- Enable test execution in normal build ------------------------ + +unittest : $(SHL1TARGETN) + @+echo ---------------------------------------------------------- + @+echo - start unit test on library $(SHL1TARGETN) + @+echo ---------------------------------------------------------- + testshl2 $(SHL1TARGETN) + +ALLTAR : unittest |