summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThorsten Behrens <thb@openoffice.org>2006-01-25 15:18:16 +0000
committerThorsten Behrens <thb@openoffice.org>2006-01-25 15:18:16 +0000
commit625a8e0c06582d91def51b72dd0040c0cd90d411 (patch)
tree74de612c406d2f07168e5513a5bac836591e74ac
parent965f2f68c980a7364059edd8663c3e20e23047ce (diff)
Initial revision. Note that tests for template tools are run during the normal build.
-rw-r--r--o3tl/qa/cow_wrapper_clients.cxx145
-rw-r--r--o3tl/qa/cow_wrapper_clients.hxx133
-rw-r--r--o3tl/qa/export.map42
-rw-r--r--o3tl/qa/makefile.mk82
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 0000000000..cf6f8b9f04
--- /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 0000000000..1820802e71
--- /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 0000000000..00983e4174
--- /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 0000000000..98fd3b27dc
--- /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