summaryrefslogtreecommitdiff
path: root/o3tl
diff options
context:
space:
mode:
authorIvo Hinkelmann <ihi@openoffice.org>2007-08-20 14:50:47 +0000
committerIvo Hinkelmann <ihi@openoffice.org>2007-08-20 14:50:47 +0000
commit3665e496c9a68fe6bba282c3a41f9066d3ada3d0 (patch)
treedfeb0e31c55a9ae2f04ca655f29cc2cbf63128b8 /o3tl
parentc6839ba23b62eb0347a5de002e347366a14b0b55 (diff)
INTEGRATION: CWS np1 (1.1.2); FILE ADDED
2007/07/16 09:23:52 thb 1.1.2.1: #i76768# Aligned naming conventions to other tests; removed senseless namespace
Diffstat (limited to 'o3tl')
-rw-r--r--o3tl/qa/test-cow_wrapper.cxx133
1 files changed, 133 insertions, 0 deletions
diff --git a/o3tl/qa/test-cow_wrapper.cxx b/o3tl/qa/test-cow_wrapper.cxx
new file mode 100644
index 000000000000..6bb169e951a4
--- /dev/null
+++ b/o3tl/qa/test-cow_wrapper.cxx
@@ -0,0 +1,133 @@
+// autogenerated file with codegen.pl
+
+#include <cppunit/simpleheader.hxx>
+
+#include "cow_wrapper_clients.hxx"
+
+using namespace ::o3tl;
+using namespace ::o3tltests;
+
+
+class cow_wrapper_test : public CppUnit::TestFixture
+{
+public:
+ template< class T > void test( T& rTestObj1, T& rTestObj2, T& rTestObj3 )
+ {
+ CPPUNIT_ASSERT_MESSAGE("rTestObj1 is unique",
+ rTestObj1.is_unique() );
+ CPPUNIT_ASSERT_MESSAGE("rTestObj2 is unique",
+ rTestObj2.is_unique() );
+ CPPUNIT_ASSERT_MESSAGE("rTestObj3 is unique",
+ rTestObj3.is_unique() );
+
+ CPPUNIT_ASSERT_MESSAGE("rTestObj1 != rTestObj2",
+ rTestObj1 != rTestObj2 );
+ CPPUNIT_ASSERT_MESSAGE("rTestObj2 != rTestObj3",
+ rTestObj2 != rTestObj3 );
+ CPPUNIT_ASSERT_MESSAGE("rTestObj1 != rTestObj3",
+ rTestObj1 != rTestObj3 );
+ CPPUNIT_ASSERT_MESSAGE("rTestObj1 < rTestObj2",
+ rTestObj1 < rTestObj2 );
+ CPPUNIT_ASSERT_MESSAGE("rTestObj2 < rTestObj3",
+ rTestObj2 < rTestObj3 );
+
+ rTestObj2 = rTestObj1;
+ rTestObj3 = rTestObj1;
+ CPPUNIT_ASSERT_MESSAGE("rTestObj1 == rTestObj2",
+ rTestObj1 == rTestObj2 );
+ CPPUNIT_ASSERT_MESSAGE("rTestObj1 == rTestObj3",
+ rTestObj1 == rTestObj3 );
+ CPPUNIT_ASSERT_MESSAGE("rTestObj1.use_count() == 3",
+ rTestObj1.use_count() == 3 );
+ CPPUNIT_ASSERT_MESSAGE("rTestObj2.use_count() == 3",
+ rTestObj2.use_count() == 3 );
+ CPPUNIT_ASSERT_MESSAGE("rTestObj3.use_count() == 3",
+ rTestObj3.use_count() == 3 );
+
+ rTestObj2.makeUnique();
+ CPPUNIT_ASSERT_MESSAGE("rTestObj1 == rTestObj2",
+ rTestObj1 == rTestObj2 );
+ CPPUNIT_ASSERT_MESSAGE("rTestObj1 == rTestObj3",
+ rTestObj1 == rTestObj3 );
+ CPPUNIT_ASSERT_MESSAGE("rTestObj1.use_count() == 2",
+ rTestObj1.use_count() == 2 );
+ CPPUNIT_ASSERT_MESSAGE("rTestObj2.use_count() == 1",
+ rTestObj2.use_count() == 1 );
+ CPPUNIT_ASSERT_MESSAGE("rTestObj2.is_unique()",
+ rTestObj2.is_unique() );
+ CPPUNIT_ASSERT_MESSAGE("rTestObj3.use_count() == 2",
+ rTestObj3.use_count() == 2 );
+
+ rTestObj2.swap( rTestObj3 );
+ CPPUNIT_ASSERT_MESSAGE("rTestObj1 == rTestObj2",
+ rTestObj1 == rTestObj2 );
+ CPPUNIT_ASSERT_MESSAGE("rTestObj1 == rTestObj3",
+ rTestObj1 == rTestObj3 );
+ CPPUNIT_ASSERT_MESSAGE("rTestObj1.use_count() == 2",
+ rTestObj1.use_count() == 2 );
+ CPPUNIT_ASSERT_MESSAGE("rTestObj2.use_count() == 2",
+ rTestObj2.use_count() == 2 );
+ CPPUNIT_ASSERT_MESSAGE("rTestObj3.use_count() == 1",
+ rTestObj3.use_count() == 1 );
+ CPPUNIT_ASSERT_MESSAGE("rTestObj3.is_unique()",
+ rTestObj3.is_unique() );
+ }
+
+ void testCowWrapper()
+ {
+ // setup
+ cow_wrapper_client1 aTestObj1;
+ cow_wrapper_client1 aTestObj2;
+ cow_wrapper_client1 aTestObj3;
+
+ cow_wrapper_client2 aTestObj4;
+ cow_wrapper_client2 aTestObj5;
+ cow_wrapper_client2 aTestObj6;
+
+ cow_wrapper_client3 aTestObj7;
+ cow_wrapper_client3 aTestObj8;
+ cow_wrapper_client3 aTestObj9;
+
+ {
+ aTestObj1 = cow_wrapper_client1( 1 );
+ aTestObj2.modify( 2 );
+ aTestObj3.modify( 3 );
+
+ aTestObj4 = cow_wrapper_client2( 4 );
+ aTestObj5.modify( 5 );
+ aTestObj6.modify( 6 );
+
+ aTestObj7 = cow_wrapper_client3( 7 );
+ aTestObj8.modify( 8 );
+ aTestObj9.modify( 9 );
+ }
+ // all three temporaries are dead now
+
+ // test
+ test( aTestObj1, aTestObj2, aTestObj3 );
+ test( aTestObj4, aTestObj5, aTestObj6 );
+ test( aTestObj7, aTestObj8, aTestObj9 );
+ }
+
+ // Change the following lines only, if you add, remove or rename
+ // member functions of the current class,
+ // because these macros are need by auto register mechanism.
+
+ CPPUNIT_TEST_SUITE(cow_wrapper_test);
+ CPPUNIT_TEST(testCowWrapper);
+ CPPUNIT_TEST_SUITE_END();
+};
+
+// -----------------------------------------------------------------------------
+CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(cow_wrapper_test, "cow_wrapper_test");
+
+
+// -----------------------------------------------------------------------------
+
+// this macro creates an empty function, which will called by the RegisterAllFunctions()
+// to let the user the possibility to also register some functions by hand.
+void RegisterAdditionalFunctions(FktRegFuncPtr )
+{
+}
+// NOADDITIONAL;
+