summaryrefslogtreecommitdiff
path: root/sal
diff options
context:
space:
mode:
authortono <tono@openoffice.org>2010-06-05 22:39:55 +0900
committertono <tono@openoffice.org>2010-06-05 22:39:55 +0900
commitf4afd8f3eaf885cfd3ab5de8f0e22ea14bdba9ae (patch)
tree06261210384955c0f7a03052bb2de4da051d4b57 /sal
parentcdce30bdbfe22f4b24ff2b2d96881506dd65e277 (diff)
parent5c92fa80fcce16bb9dd0da89f9f5eafed3cb97b5 (diff)
mingwport30: merge with DEV300 m80
Diffstat (limited to 'sal')
-rw-r--r--sal/prj/build.lst1
-rw-r--r--sal/qa/ByteSequence/ByteSequence.cxx729
-rw-r--r--sal/qa/ByteSequence/Byte_Const.h95
-rw-r--r--sal/qa/ByteSequence/makefile.mk64
-rw-r--r--sal/qa/ByteSequence/rtl_old_testbyteseq.cxx134
-rwxr-xr-xsal/qa/osl/mutex/osl_Mutex.cxx6
-rw-r--r--sal/rtl/source/bootstrap.cxx8
7 files changed, 178 insertions, 859 deletions
diff --git a/sal/prj/build.lst b/sal/prj/build.lst
index c96c3977f725..638252ad4ee8 100644
--- a/sal/prj/build.lst
+++ b/sal/prj/build.lst
@@ -18,5 +18,4 @@ sa sal\cppunittester nmake - all sa_cppunittester sa_cpprt.u sa_util NULL
sa sal\qa\ByteSequence nmake - all sa_qa_ByteSequence sa_cppunittester sa_util NULL
sa sal\qa\OStringBuffer nmake - all sa_qa_OStringBuffer sa_cppunittester sa_util NULL
sa sal\qa\osl\mutex nmake - all sa_qa_osl_mutex sa_cppunittester sa_util NULL
-sa sal\qa\osl\pipe nmake - all sa_qa_osl_pipe sa_cppunittester sa_util NULL
sa sal\qa\osl\profile nmake - all sa_qa_osl_profile sa_cppunittester sa_util NULL
diff --git a/sal/qa/ByteSequence/ByteSequence.cxx b/sal/qa/ByteSequence/ByteSequence.cxx
index 3a408edb3ef0..7c9ff2eaef94 100644
--- a/sal/qa/ByteSequence/ByteSequence.cxx
+++ b/sal/qa/ByteSequence/ByteSequence.cxx
@@ -1,605 +1,194 @@
/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org 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 version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
+*
+* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+*
+* Copyright 2000, 2010 Oracle and/or its affiliates.
+*
+* OpenOffice.org - a multi-platform office productivity suite
+*
+* This file is part of OpenOffice.org.
+*
+* OpenOffice.org is free software: you can redistribute it and/or modify
+* it under the terms of the GNU Lesser General Public License version 3
+* only, as published by the Free Software Foundation.
+*
+* OpenOffice.org 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 version 3 for more details
+* (a copy is included in the LICENSE file that accompanied this code).
+*
+* You should have received a copy of the GNU Lesser General Public License
+* version 3 along with OpenOffice.org. If not, see
+* <http://www.openoffice.org/license.html>
+* for a copy of the LGPLv3 License.
+*
+************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_sal.hxx"
-#include <Byte_Const.h>
-#include <rtl/byteseq.h>
-
-#include <rtl/byteseq.hxx>
+#include "sal/config.h"
#include "cppunit/TestAssert.h"
#include "cppunit/TestFixture.h"
#include "cppunit/extensions/HelperMacros.h"
#include "cppunit/plugin/TestPlugIn.h"
+#include "rtl/byteseq.hxx"
+#include "sal/types.h"
-using namespace rtl;
-
-namespace rtl_ByteSequence
-{
-
-//------------------------------------------------------------------------
-// testing constructors
-//------------------------------------------------------------------------
-
-class ctor : public CppUnit::TestFixture
- {
- public:
-
- void ctor_001()
- {
- ::rtl::ByteSequence aByteSeq1;
- ::rtl::ByteSequence aByteSeq2( &kTestEmptyByteSeq );
- CPPUNIT_ASSERT_MESSAGE
- (
- "Creates an empty sequence",
- aByteSeq1.getLength() == 0 &&
- aByteSeq1 == aByteSeq2
- );
- }
-
- void ctor_002()
- {
- ::rtl::ByteSequence aByteSeq;
- ::rtl::ByteSequence aByteSeqtmp( aByteSeq );
- CPPUNIT_ASSERT_MESSAGE
- (
- "Creates a copy of given sequence",
- aByteSeq == aByteSeqtmp
- );
-
- }
-
- void ctor_003()
- {
- ::rtl::ByteSequence aByteSeq( &kTestByteSeq1 );
- sal_Int32 nNewLen = aByteSeq.getLength();
- CPPUNIT_ASSERT_MESSAGE
- (
- "Copy constructor Creates a copy from the C-Handle ",
- nNewLen == kTestSeqLen1
- );
- }
-
- void ctor_003_1()
- {
- ::rtl::ByteSequence aByteSeq( &kTestByteSeq2 );
- sal_Int32 nNewLen = aByteSeq.getLength();
- CPPUNIT_ASSERT_MESSAGE
- (
- "Copy constructor Creates a copy from the C-Handle: reference count > 1 ",
- nNewLen == kTestSeqLen2
- );
- }
-
- void ctor_004()
- {
- sal_Int8 * pElements = &kTestByte4;
- sal_Int32 len = kTestByteCount1;
- ::rtl::ByteSequence aByteSeq( pElements, len);
- sal_Int32 nNewLen = aByteSeq.getLength();
- CPPUNIT_ASSERT_MESSAGE
- (
- "Creates a copy of given data bytes",
- aByteSeq[1] == pElements[1] &&
- len == nNewLen
-
- );
- }
-
- void ctor_005()
- {
- sal_Int32 len = 50;
- ::rtl::ByteSequence aByteSeq( len );
- sal_Int32 nNewLen = aByteSeq.getLength();
- sal_Bool res = sal_True;
- for (sal_Int32 i=0; i<len; i++)
- {
- if (aByteSeq[i] != 0)
- res = sal_False;
- }
- CPPUNIT_ASSERT_MESSAGE
- (
- "Creates sequence of given length and initializes all bytes to 0",
- nNewLen == len && res
-
- );
- }
-
- void ctor_006()
- {
- sal_Int32 len = 39;
- ::rtl::ByteSequence aByteSeq( len , BYTESEQ_NODEFAULT );
- sal_Int32 nNewLen = aByteSeq.getLength();
- CPPUNIT_ASSERT_MESSAGE
- (
- "Creates sequence of given length and does NOT initialize data",
- nNewLen == len
-
- );
- }
-
- void ctor_007()
- {
- ::rtl::ByteSequence aByteSeq( &kTestByteSeq3, BYTESEQ_NOACQUIRE );
- sal_Int32 nNewLen = aByteSeq.getLength();
- CPPUNIT_ASSERT_MESSAGE
- (
- "Creates a sequence from a C-Handle without acquiring the handle, thus taking over ownership",
- nNewLen == kTestSeqLen3
- );
- }
-
- CPPUNIT_TEST_SUITE(ctor);
- CPPUNIT_TEST(ctor_001);
- CPPUNIT_TEST(ctor_002);
- CPPUNIT_TEST(ctor_003);
- CPPUNIT_TEST(ctor_003_1);
- CPPUNIT_TEST(ctor_004);
- CPPUNIT_TEST(ctor_005);
- CPPUNIT_TEST(ctor_006);
- CPPUNIT_TEST(ctor_007);
- CPPUNIT_TEST_SUITE_END();
- };
-
-class assign : public CppUnit::TestFixture
-{
-public:
- // initialise your test code values here.
- void setUp()
- {
- }
-
- void tearDown()
- {
- }
-
- // insert your test code here.
- void assign_001()
- {
- sal_Int32 len = kTestByteCount1;
- sal_Int32 len2 = len - 1;
- sal_Int8 * pElements = &kTestByte;
- ::rtl::ByteSequence aByteSeq1( kTestByte5, len);
- ::rtl::ByteSequence aByteSeq2( pElements, len2);
- aByteSeq2 = aByteSeq1;
- sal_Int32 nNewLen = aByteSeq2.getLength();
- CPPUNIT_ASSERT_MESSAGE
- (
- "Assignment operator: assign longer sequence to another",
- aByteSeq1 == aByteSeq2 &&
- nNewLen == len
- );
- }
-
- void assign_002()
- {
- sal_Int32 len = kTestByteCount1 - 1 ;
- ::rtl::ByteSequence aByteSeq1( len );
- sal_Int8 * pElements = &kTestByte1;
- ::rtl::ByteSequence aByteSeq2( pElements, len + 1);
- aByteSeq2 = aByteSeq1;
- sal_Int32 nNewLen = aByteSeq2.getLength();
- CPPUNIT_ASSERT_MESSAGE
- (
- "Assignment operator: assign shorter sequence to another",
- aByteSeq1 == aByteSeq2 &&
- nNewLen == len
- );
- }
-
- void assign_003()
- {
- sal_Int32 len = kTestByteCount1 - 1 ;
- const sal_Int8 * pElements = &kTestByte2;
- ::rtl::ByteSequence aByteSeq1( pElements, len + 1 );
- ::rtl::ByteSequence aByteSeq2( len, BYTESEQ_NODEFAULT );
- aByteSeq2 = aByteSeq1;
- sal_Int32 nNewLen = aByteSeq2.getLength();
- CPPUNIT_ASSERT_MESSAGE
- (
- "Assignment operator: assign sequence to another sequence having no data initialized",
- aByteSeq1 == aByteSeq2 &&
- nNewLen == kTestByteCount1
- );
- }
-
- void assign_004()
- {
- ::rtl::ByteSequence aByteSeq1;
- sal_Int32 len = kTestByteCount1 ;
- const sal_Int8 * pElements = &kTestByte;
- ::rtl::ByteSequence aByteSeq2( pElements, len);
- aByteSeq2 = aByteSeq1;
- sal_Int32 nNewLen = aByteSeq2.getLength();
- CPPUNIT_ASSERT_MESSAGE
- (
- "Assignment operator: assign empty sequence to another not empty sequence",
- aByteSeq1 == aByteSeq2 &&
- nNewLen == 0
- );
- }
-
- CPPUNIT_TEST_SUITE(assign);
- CPPUNIT_TEST(assign_001);
- CPPUNIT_TEST(assign_002);
- CPPUNIT_TEST(assign_003);
- CPPUNIT_TEST(assign_004);
- CPPUNIT_TEST_SUITE_END();
-}; // class operator=
-
-
-class equal : public CppUnit::TestFixture
-{
-public:
- // initialise your test code values here.
- void setUp()
- {
- }
-
- void tearDown()
- {
- }
-
- // insert your test code here.
- void equal_001()
- {
- sal_Int32 len = kTestByteCount1 ;
- sal_Int8 * pElements = &kTestByte;
- ::rtl::ByteSequence aByteSeq1( pElements, len-1);
- ::rtl::ByteSequence aByteSeq2( pElements, len);
- sal_Bool res = aByteSeq1 == aByteSeq2;
- CPPUNIT_ASSERT_MESSAGE
- (
- "Equality operator: compare two sequences 1",
- !res
- );
- }
-
- void equal_002()
- {
- sal_Int32 len = kTestByteCount1 ;
- const sal_Int8 * pElements = &kTestByte;
- ::rtl::ByteSequence aByteSeq1( pElements, len);
- ::rtl::ByteSequence aByteSeq2( pElements, len);
- sal_Bool res = aByteSeq1 == aByteSeq2;
- CPPUNIT_ASSERT_MESSAGE
- (
- "Equality operator: compare two sequences 2",
- res
- );
- }
-
- void equal_003()
- {
- sal_Int32 len = kTestByteCount1 ;
- const sal_Int8 * pElements = kTestByte5;
- ::rtl::ByteSequence aByteSeq1( pElements, len);
- pElements = kTestByte6;
- ::rtl::ByteSequence aByteSeq2( pElements, len);
- sal_Bool res = aByteSeq1 == aByteSeq2;
- CPPUNIT_ASSERT_MESSAGE
- (
- "Equality operator: compare two sequences 2",
- !res
- );
- }
- CPPUNIT_TEST_SUITE(equal);
- CPPUNIT_TEST(equal_001);
- CPPUNIT_TEST(equal_002);
- CPPUNIT_TEST(equal_003);
- CPPUNIT_TEST_SUITE_END();
-}; // class equal
+namespace {
-
-class notequal : public CppUnit::TestFixture
-{
+class Test: public CppUnit::TestFixture {
public:
- // initialise your test code values here.
- void setUp()
- {
+ void test_default() {
+ rtl::ByteSequence s;
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(0), s.getLength());
}
- void tearDown()
- {
+ void test_size0() {
+ rtl::ByteSequence s(sal_Int32(0));
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(0), s.getLength());
}
- // insert your test code here.
- void notequal_001()
- {
- sal_Int32 len = kTestByteCount1 ;
- const sal_Int8 * pElements = &kTestByte;
- ::rtl::ByteSequence aByteSeq1( pElements, len-1);
- ::rtl::ByteSequence aByteSeq2( pElements, len);
- sal_Bool res = aByteSeq1 != aByteSeq2;
- CPPUNIT_ASSERT_MESSAGE
- (
- "Equality operator: compare two sequences 1",
- res
- );
+ void test_size5() {
+ rtl::ByteSequence s(5);
+ sal_Int8 const * p = s.getConstArray();
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(5), s.getLength());
+ CPPUNIT_ASSERT_EQUAL(sal_Int8(0), p[0]);
+ CPPUNIT_ASSERT_EQUAL(sal_Int8(0), p[1]);
+ CPPUNIT_ASSERT_EQUAL(sal_Int8(0), p[2]);
+ CPPUNIT_ASSERT_EQUAL(sal_Int8(0), p[3]);
+ CPPUNIT_ASSERT_EQUAL(sal_Int8(0), p[4]);
}
- void notequal_002()
- {
- sal_Int32 len = kTestByteCount1 ;
- const sal_Int8 * pElements = &kTestByte;
- ::rtl::ByteSequence aByteSeq1( pElements, len);
- ::rtl::ByteSequence aByteSeq2( pElements, len);
- sal_Bool res = aByteSeq1 != aByteSeq2;
- CPPUNIT_ASSERT_MESSAGE
- (
- "Equality operator: compare two sequences 2",
- !res
- );
- }
-
- CPPUNIT_TEST_SUITE(notequal);
- CPPUNIT_TEST(notequal_001);
- CPPUNIT_TEST(notequal_002);
- CPPUNIT_TEST_SUITE_END();
-}; // class notequal
-
-
-class getArray : public CppUnit::TestFixture
-{
-public:
- // initialise your test code values here.
- void setUp()
- {
- }
-
- void tearDown()
- {
- }
-
- // insert your test code here.
- void getArray_001()
- {
- sal_Int32 len = kTestByteCount1 ;
- sal_Int8 * pElements = &kTestByte;
- ::rtl::ByteSequence aByteSeq1( pElements, len);
- sal_Int8 * pArray = aByteSeq1.getArray();
- sal_Bool res = sal_True;
- for (sal_Int32 i = 0; i < len; i++)
- {
- if (pElements[i] != pArray[i])
- res = sal_False;
- }
- CPPUNIT_ASSERT_MESSAGE
- (
- "Gets the pointer to byte array: one element sequence",
- res == sal_True
- );
- }
-
- void getArray_002()
- {
- sal_Int8 * pElements = kTestByte6;
- ::rtl::ByteSequence aByteSeq(pElements, 5);
- sal_Int8 * pArray = aByteSeq.getArray();
- sal_Bool res = sal_True;
- for (sal_Int32 i = 0; i < 5; i++)
- {
- if (pElements[i] != pArray[i])
- res = sal_False;
- }
- CPPUNIT_ASSERT_MESSAGE
- (
- "Gets the pointer to byte array: more elements sequence",
- res == sal_True
- );
- }
-
- CPPUNIT_TEST_SUITE(getArray);
- CPPUNIT_TEST(getArray_001);
- CPPUNIT_TEST(getArray_002);
- CPPUNIT_TEST_SUITE_END();
-}; // class getArray
-
-
-class realloc : public CppUnit::TestFixture
-{
-public:
- // initialise your test code values here.
- void setUp()
- {
+ void test_noinit0() {
+ rtl::ByteSequence s(0, rtl::BYTESEQ_NODEFAULT);
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(0), s.getLength());
}
- void tearDown()
- {
+ void test_noinit5() {
+ rtl::ByteSequence s(5, rtl::BYTESEQ_NODEFAULT);
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(5), s.getLength());
}
- // insert your test code here.
- void realloc_001()
- {
- ::rtl::ByteSequence aByteSeq;
- sal_Int32 nSize = 20;
- aByteSeq.realloc( nSize );
- sal_Int32 nNewLen = aByteSeq.getLength();
- CPPUNIT_ASSERT_MESSAGE
- (
- "Reallocates sequence to new length: empty sequence",
- nNewLen == nSize
- );
+ void test_elem0() {
+ rtl::ByteSequence s(0, 0);
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(0), s.getLength());
}
- void realloc_002()
- {
- //reference count > 1
- ::rtl::ByteSequence aByteSeq( &kTestByteSeq2 ); //34
- sal_Int32 nSize = 20;
- aByteSeq.realloc( nSize );
- sal_Int32 nNewLen = aByteSeq.getLength();
- CPPUNIT_ASSERT_MESSAGE
- (
- "Reallocates sequence: reference count > 1 && nSize < nElements",
- nNewLen == nSize
- );
+ void test_elem5() {
+ sal_Int8 const a[5] = { 0, 1, 2, 3, 4 };
+ rtl::ByteSequence s(a, 5);
+ sal_Int8 const * p = s.getConstArray();
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(5), s.getLength());
+ CPPUNIT_ASSERT_EQUAL(sal_Int8(0), p[0]);
+ CPPUNIT_ASSERT_EQUAL(sal_Int8(1), p[1]);
+ CPPUNIT_ASSERT_EQUAL(sal_Int8(2), p[2]);
+ CPPUNIT_ASSERT_EQUAL(sal_Int8(3), p[3]);
+ CPPUNIT_ASSERT_EQUAL(sal_Int8(4), p[4]);
}
- void realloc_003()
- {
- //reference count > 1
- ::rtl::ByteSequence aByteSeq( &kTestByteSeq2 ); //34
- sal_Int32 nSize = kTestSeqLen2 + 5;
- sal_Int32 nElements = kTestSeqLen2;
- aByteSeq.realloc( nSize );
- sal_Int32 nNewLen = aByteSeq.getLength();
- sal_Bool res = sal_True;
- for (int i = nSize; i < nElements; i++)
- {
- sal_Int8 nValue = aByteSeq[i];
- if (nValue != 0)
- res = sal_False;
+ void test_copy() {
+ rtl::ByteSequence s1(5);
+ {
+ rtl::ByteSequence s2(s1);
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(5), s2.getLength());
+ CPPUNIT_ASSERT_EQUAL(s1.getConstArray(), s2.getConstArray());
+ CPPUNIT_ASSERT_EQUAL(s1.getHandle(), s2.getHandle());
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(2), s1.getHandle()->nRefCount);
}
- CPPUNIT_ASSERT_MESSAGE
- (
- "Reallocates sequence: reference count > 1 && nSize > nElements",
- nNewLen == nSize
- && res == sal_True
- );
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(1), s1.getHandle()->nRefCount);
}
- void realloc_004()
- {
- sal_Int8 * pElements = &kTestByte3;
- sal_Int32 len = kTestByteCount3;
- ::rtl::ByteSequence aByteSeq( pElements, len);
- sal_Int32 nSize = kTestByteCount3 - 10 ;
- aByteSeq.realloc( nSize );
- sal_Int32 nNewLen = aByteSeq.getLength();
- CPPUNIT_ASSERT_MESSAGE
- (
- "Reallocates sequence: nSize < nElements",
- nNewLen == nSize
- );
- }
-
- void realloc_005()
- {
- sal_Int8 * pElements = kTestByte6;
- sal_Int32 len = 4;
- ::rtl::ByteSequence aByteSeq( pElements, len);
- sal_Int32 nSize = len + 10 ;
- aByteSeq.realloc( nSize );
- sal_Int32 nNewLen = aByteSeq.getLength();
- CPPUNIT_ASSERT_MESSAGE
- (
- "Reallocates sequence: nSize > nElements",
- nNewLen == nSize
- );
+ void test_fromC() {
+ sal_Sequence c = { 1, 1, { 0 } };
+ {
+ rtl::ByteSequence s(&c);
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(1), s.getLength());
+ CPPUNIT_ASSERT_EQUAL(
+ static_cast< void const * >(c.elements),
+ static_cast< void const * >(s.getConstArray()));
+ CPPUNIT_ASSERT_EQUAL(&c, s.getHandle());
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(2), c.nRefCount);
+ }
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(1), c.nRefCount);
}
- CPPUNIT_TEST_SUITE(realloc);
- CPPUNIT_TEST(realloc_001);
- CPPUNIT_TEST(realloc_002);
- CPPUNIT_TEST(realloc_003);
- CPPUNIT_TEST(realloc_004);
- CPPUNIT_TEST(realloc_005);
- //CPPUNIT_TEST(realloc_006);
+ void test_noacquire() {
+ sal_Sequence c = { 2, 1, { 0 } };
+ {
+ rtl::ByteSequence s(&c, rtl::BYTESEQ_NOACQUIRE);
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(1), s.getLength());
+ CPPUNIT_ASSERT_EQUAL(
+ static_cast< void const * >(c.elements),
+ static_cast< void const * >(s.getConstArray()));
+ CPPUNIT_ASSERT_EQUAL(&c, s.getHandle());
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(2), c.nRefCount);
+ }
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(1), c.nRefCount);
+ }
+
+ void test_getArray() {
+ sal_Int8 const a[5] = { 0, 1, 2, 3, 4 };
+ rtl::ByteSequence s1(a, 5);
+ rtl::ByteSequence s2(s1);
+ sal_Int8 * p = s2.getArray();
+ p[2] = 10;
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(1), s1.getHandle()->nRefCount);
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(1), s2.getHandle()->nRefCount);
+ CPPUNIT_ASSERT_EQUAL(sal_Int8(2), s1.getConstArray()[2]);
+ CPPUNIT_ASSERT_EQUAL(sal_Int8(10), s2.getConstArray()[2]);
+ }
+
+ void test_same0() {
+ rtl::ByteSequence s1;
+ rtl::ByteSequence s2;
+ CPPUNIT_ASSERT_EQUAL(sal_True, s1 == s2);
+ CPPUNIT_ASSERT_EQUAL(sal_True, s2 == s1);
+ CPPUNIT_ASSERT_EQUAL(sal_False, s1 != s2);
+ CPPUNIT_ASSERT_EQUAL(sal_False, s2 != s1);
+ }
+
+ void test_diffLen() {
+ sal_Int8 const a[5] = { 0, 1, 2, 3, 4 };
+ rtl::ByteSequence s1(a, 5);
+ rtl::ByteSequence s2(a, 4);
+ CPPUNIT_ASSERT_EQUAL(sal_False, s1 == s2);
+ CPPUNIT_ASSERT_EQUAL(sal_False, s2 == s1);
+ CPPUNIT_ASSERT_EQUAL(sal_True, s1 != s2);
+ CPPUNIT_ASSERT_EQUAL(sal_True, s2 != s1);
+ }
+
+ void test_diffElem() {
+ sal_Int8 const a1[5] = { 0, 1, 2, 3, 4 };
+ rtl::ByteSequence s1(a1, 5);
+ sal_Int8 const a2[5] = { 0, 1, 10, 3, 4 };
+ rtl::ByteSequence s2(a2, 5);
+ CPPUNIT_ASSERT_EQUAL(sal_False, s1 == s2);
+ CPPUNIT_ASSERT_EQUAL(sal_False, s2 == s1);
+ CPPUNIT_ASSERT_EQUAL(sal_True, s1 != s2);
+ CPPUNIT_ASSERT_EQUAL(sal_True, s2 != s1);
+ }
+
+ CPPUNIT_TEST_SUITE(Test);
+ CPPUNIT_TEST(test_default);
+ CPPUNIT_TEST(test_size0);
+ CPPUNIT_TEST(test_size5);
+ CPPUNIT_TEST(test_noinit0);
+ CPPUNIT_TEST(test_noinit5);
+ CPPUNIT_TEST(test_elem0);
+ CPPUNIT_TEST(test_elem5);
+ CPPUNIT_TEST(test_copy);
+ CPPUNIT_TEST(test_fromC);
+ CPPUNIT_TEST(test_noacquire);
+ CPPUNIT_TEST(test_getArray);
+ CPPUNIT_TEST(test_same0);
+ CPPUNIT_TEST(test_diffLen);
+ CPPUNIT_TEST(test_diffElem);
CPPUNIT_TEST_SUITE_END();
-}; // class realloc
-
-
-class getData : public CppUnit::TestFixture
-{
-public:
- // initialise your test code values here.
- void setUp()
- {
- }
+};
- void tearDown()
- {
- }
-
- // insert your test code here.
- void getData_001()
- {
- sal_Int8 * pElements = kTestByte5;
- ::rtl::ByteSequence aByteSeq(pElements, 4);
- sal_Bool res = sal_True;
- if (aByteSeq[0] != kTestByte)
- res = sal_False;
-
- if (aByteSeq[1] != kTestByte1)
- res = sal_False;
-
- if (aByteSeq[2] != kTestByte2)
- res = sal_False;
-
- if (aByteSeq[3] != kTestByte3)
- res = sal_False;
-
- CPPUNIT_ASSERT_MESSAGE
- (
- "Obtains a reference to byte indexed at given position: empty sequence",
- res == sal_True
- );
- }
-
- void getData_002()
- {
- ::rtl::ByteSequence aByteSeq( &kTestByteSeq2 );
- sal_Int8 nValue = aByteSeq[0];
- CPPUNIT_ASSERT_MESSAGE
- (
- "Obtains a reference to byte indexed at given position: reference count > 1",
- nValue == kTestChar2 //not sure what is right,hehe
- );
- }
-
- void getData_003()
- {
- ::rtl::ByteSequence aByteSeq( &kTestByteSeq3 );
- sal_Int8 nValue = aByteSeq[0];
- CPPUNIT_ASSERT_MESSAGE
- (
- "Obtains a reference to byte indexed at given position: reference count = 1",
- nValue == kTestChar3 //not sure what is right,hehe
- );
- }
-
- CPPUNIT_TEST_SUITE(getData);
- CPPUNIT_TEST(getData_001);
- CPPUNIT_TEST(getData_002);
- CPPUNIT_TEST(getData_003);
- CPPUNIT_TEST_SUITE_END();
-}; // class getData
+CPPUNIT_TEST_SUITE_REGISTRATION(Test);
-// -----------------------------------------------------------------------------
-CPPUNIT_TEST_SUITE_REGISTRATION(rtl_ByteSequence::ctor);
-CPPUNIT_TEST_SUITE_REGISTRATION(rtl_ByteSequence::assign);
-CPPUNIT_TEST_SUITE_REGISTRATION(rtl_ByteSequence::equal);
-CPPUNIT_TEST_SUITE_REGISTRATION(rtl_ByteSequence::notequal);
-CPPUNIT_TEST_SUITE_REGISTRATION(rtl_ByteSequence::getArray);
-CPPUNIT_TEST_SUITE_REGISTRATION(rtl_ByteSequence::realloc);
-CPPUNIT_TEST_SUITE_REGISTRATION(rtl_ByteSequence::getData);
-} // namespace ByteSequence
+}
CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/sal/qa/ByteSequence/Byte_Const.h b/sal/qa/ByteSequence/Byte_Const.h
deleted file mode 100644
index 2d167b7d673c..000000000000
--- a/sal/qa/ByteSequence/Byte_Const.h
+++ /dev/null
@@ -1,95 +0,0 @@
-#ifndef _BYTE_CONST_H_
-#define _BYTE_CONST_H_
-
-//------------------------------------------------------------------------
-//------------------------------------------------------------------------
-#include <sal/types.h>
-
-//------------------------------------------------------------------------
-//------------------------------------------------------------------------
-
-#ifdef __cplusplus
-extern "C"
-{
-#endif
-
-//------------------------------------------------------------------------
-//------------------------------------------------------------------------
-const sal_Int32 kTestByteCount1 = 7;
-const sal_Int32 kTestByteCount2 = 0;
-const sal_Int32 kTestByteCount3 = 45;
-const sal_Int32 kTestByteCount4 = 100;
-const sal_Int32 kTestByteCount5 = 23;
-const sal_Int32 kTestByteCount6 = 90;
-
-
-sal_Int8 kTestByte = 100;
-sal_Int8 kTestByte1 = 0;
-sal_Int8 kTestByte2 = 1;
-sal_Int8 kTestByte3 = 2;
-sal_Int8 kTestByte4 = -98;
-
-sal_Int8 kTestByte5[] = {kTestByte, kTestByte1, kTestByte2, kTestByte3, kTestByte4};
-
-sal_Int8 kTestByte60 = 56;
-sal_Int8 kTestByte61 = -1;
-sal_Int8 kTestByte62 = -23;
-sal_Int8 kTestByte63 = 21;
-sal_Int8 kTestByte64 = -128;
-sal_Int8 kTestByte65 = 127;
-sal_Int8 kTestByte6[] = {kTestByte60, kTestByte61, kTestByte62, kTestByte63, kTestByte64, kTestByte65};
-
-//------------------------------------------------------------------------
-
-char kTestChar = 45;
-char kTestChar0 = 0;
- char kTestChar1 = (char)((500 & 0xff) - 256);
-char kTestChar2 = 78;
- char kTestChar3 = (char)(-155 & 0xff);
-
-sal_Int32 kTestSeqLen0 = 0;
-sal_Int32 kTestSeqLen1 = 5;
-sal_Int32 kTestSeqLen2 = 34;
-sal_Int32 kTestSeqLen3 = 270;
-
-sal_Sequence kTestEmptyByteSeq =
-{
- 1, /* sal_Int32 refCount; */
- kTestSeqLen0, /* sal_Int32 length; */
- { kTestChar0 } /* sal_Unicode buffer[1]; */
-};
-
-sal_Sequence kTestByteSeq1 =
-{
- 1, /* sal_Int32 refCount; */
- kTestSeqLen1, /* sal_Int32 length; */
- { kTestChar1 } /* sal_Unicode buffer[1]; */
-};
-
-sal_Sequence kTestByteSeq2 =
-{
- 3, /* sal_Int32 refCount; */
- kTestSeqLen2, /* sal_Int32 length; */
- { kTestChar2 } /* sal_Unicode buffer[1]; */
-};
-
-sal_Sequence kTestByteSeq3 =
-{
- 2, /* sal_Int32 refCount; */
- kTestSeqLen3, /* sal_Int32 length; */
- { kTestChar3 } /* sal_Unicode buffer[1]; */
-};
-
-//------------------------------------------------------------------------
-//------------------------------------------------------------------------
-
-#ifdef __cplusplus
-}
-#endif
-
-//------------------------------------------------------------------------
-//------------------------------------------------------------------------
-
-#endif /* _BYTE_CONST_H_ */
-
-
diff --git a/sal/qa/ByteSequence/makefile.mk b/sal/qa/ByteSequence/makefile.mk
index 972444ca8b57..9f7bfcfd25ce 100644
--- a/sal/qa/ByteSequence/makefile.mk
+++ b/sal/qa/ByteSequence/makefile.mk
@@ -1,7 +1,7 @@
#*************************************************************************
#
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
+#
# Copyright 2000, 2010 Oracle and/or its affiliates.
#
# OpenOffice.org - a multi-platform office productivity suite
@@ -23,65 +23,33 @@
# <http://www.openoffice.org/license.html>
# for a copy of the LGPLv3 License.
#
-#*************************************************************************
+#***********************************************************************/
.IF "$(OOO_SUBSEQUENT_TESTS)" == ""
nothing .PHONY:
.ELSE
-PRJ=..$/..
-
-PRJNAME=sal
-TARGET=qa_bytesequence
-# this is removed at the moment because we need some enhancements
-# TESTDIR=TRUE
-
-ENABLE_EXCEPTIONS=TRUE
+PRJ = ../..
+PRJNAME = sal
+TARGET = qa_ByteSequence
-# --- Settings -----------------------------------------------------
+ENABLE_EXCEPTIONS = TRUE
-.INCLUDE : settings.mk
-
-CFLAGS+= $(LFS_CFLAGS)
-CXXFLAGS+= $(LFS_CFLAGS)
+.INCLUDE: settings.mk
CFLAGSCXX += $(CPPUNIT_CFLAGS)
-#----------------------------------- OStringBuffer -----------------------------------
-
-SHL1OBJS= \
- $(SLO)$/ByteSequence.obj
-
-SHL1TARGET= rtl_ByteSequence
-SHL1STDLIBS= $(SALLIB) $(CPPUNITLIB)
-
-SHL1IMPLIB= i$(SHL1TARGET)
-# SHL1DEF= $(MISC)$/$(SHL1TARGET).def
-
-DEF1NAME =$(SHL1TARGET)
-SHL1VERSIONMAP = $(PRJ)$/qa$/export.map
+SHL1IMPLIB = i$(SHL1TARGET)
+SHL1OBJS = $(SLO)/ByteSequence.obj
SHL1RPATH = NONE
+SHL1STDLIBS = $(CPPUNITLIB) $(SALLIB)
+SHL1TARGET = rtl_ByteSequence
+SHL1VERSIONMAP = $(PRJ)/qa/export.map
+DEF1NAME = $(SHL1TARGET)
-# --- BEGIN --------------------------------------------------------
-SHL2OBJS= \
- $(SLO)$/rtl_old_testbyteseq.obj
-SHL2TARGET= rtl_old_testbyteseq
-SHL2STDLIBS= $(SALLIB) $(CPPUNITLIB)
-
-SHL2IMPLIB= i$(SHL2TARGET)
-
-DEF2NAME =$(SHL2TARGET)
-SHL2VERSIONMAP = $(PRJ)$/qa$/export.map
-SHL2RPATH = NONE
-# END --------------------------------------------------------------
-
-#------------------------------- All object files -------------------------------
-# do this here, so we get right dependencies
-SLOFILES=$(SHL1OBJS)
-
-# --- Targets ------------------------------------------------------
+SLOFILES = $(SHL1OBJS)
-.INCLUDE : target.mk
-.INCLUDE : _cppunit.mk
+.INCLUDE: target.mk
+.INCLUDE: _cppunit.mk
.END
diff --git a/sal/qa/ByteSequence/rtl_old_testbyteseq.cxx b/sal/qa/ByteSequence/rtl_old_testbyteseq.cxx
deleted file mode 100644
index 61c312162c78..000000000000
--- a/sal/qa/ByteSequence/rtl_old_testbyteseq.cxx
+++ /dev/null
@@ -1,134 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org 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 version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_sal.hxx"
-// LLA:
-// this file is converted to use with testshl2
-// original was placed in sal/test/textenc.cxx
-// -----------------------------------------------------------------------------
-
-#include <stdio.h>
-
-#include <osl/diagnose.h>
-#include <rtl/byteseq.hxx>
-
-using namespace ::rtl;
-
-#include "cppunit/TestAssert.h"
-#include "cppunit/TestFixture.h"
-#include "cppunit/extensions/HelperMacros.h"
-#include "cppunit/plugin/TestPlugIn.h"
-
-namespace rtl_testbyteseq
-{
-
-// -----------------------------------------------------------------------------
-
-class oldbyteseq : public CppUnit::TestFixture
-{
-public:
- void test_bytesequence_001();
-
- CPPUNIT_TEST_SUITE( oldbyteseq );
- CPPUNIT_TEST( test_bytesequence_001 );
- CPPUNIT_TEST_SUITE_END( );
-};
-
-// -----------------------------------------------------------------------------
-
-void oldbyteseq::test_bytesequence_001()
-{
- signed char a[5] = { 1 , 2 , 3 , 4 , 5 };
-
- // test the c++ wrapper
- {
- ByteSequence seq;
- OSL_ENSURE( ! seq.getLength() , "" );
-
- ByteSequence seq2( a , 5 );
-
- OSL_ENSURE( !( seq == seq2) , "" );
-
- seq = seq2;
- OSL_ENSURE( seq == seq2 , "" );
-
- seq[0] = 2;
- OSL_ENSURE( !(seq == seq2) , "" );
-
- seq = ByteSequence( a , 5 );
- OSL_ENSURE( seq == seq2 , "" );
-
- seq = ByteSequence( 5 ); // default value is 0 for each byte
- OSL_ENSURE( !( seq == seq2 ) , "" );
- }
-
- {
- sal_Sequence *pSeq = 0;
- rtl_byte_sequence_construct( &pSeq , 0 );
-
- // implementation dependent test.
- OSL_ENSURE( pSeq->nRefCount == 2 , "invalid refcount for empty sequence" );
-
- sal_Sequence *pSeq2 = 0;
- rtl_byte_sequence_constructFromArray( &pSeq2 , a , 5 );
-
- OSL_ENSURE( ! rtl_byte_sequence_equals( pSeq , pSeq2 ) , "" );
-
- rtl_byte_sequence_assign( &pSeq , pSeq2 );
- OSL_ENSURE( pSeq == pSeq2 , "" );
- OSL_ENSURE( rtl_byte_sequence_equals( pSeq , pSeq2 ) , "" );
-
- rtl_byte_sequence_reference2One( &pSeq );
- (( sal_Int8*) rtl_byte_sequence_getConstArray( pSeq ) )[0] = 2;
-
- OSL_ENSURE( ! rtl_byte_sequence_equals( pSeq , pSeq2 ) , "" );
-
- rtl_byte_sequence_constructFromArray( &pSeq , a , 5 );
- OSL_ENSURE( rtl_byte_sequence_equals( pSeq , pSeq2 ) , "" );
-
- rtl_byte_sequence_construct( &pSeq , 5 );
- OSL_ENSURE( ! rtl_byte_sequence_equals( pSeq , pSeq2 ) , "" );
-
-
-
- rtl_byte_sequence_release( pSeq2 );
- rtl_byte_sequence_release( pSeq );
- }
-
-
- printf( "test bytesequence OK\n" );
-
-}
-
-} // namespace osl_test_file
-
-// -----------------------------------------------------------------------------
-CPPUNIT_TEST_SUITE_REGISTRATION( rtl_testbyteseq::oldbyteseq );
-
-// -----------------------------------------------------------------------------
-CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/sal/qa/osl/mutex/osl_Mutex.cxx b/sal/qa/osl/mutex/osl_Mutex.cxx
index df0d2fe8ef6b..4b1b078785d3 100755
--- a/sal/qa/osl/mutex/osl_Mutex.cxx
+++ b/sal/qa/osl/mutex/osl_Mutex.cxx
@@ -838,7 +838,7 @@ protected:
void SAL_CALL run( )
{
// acquire the mutex
- printf("# ResettableGuard" );
+ printf("# ResettableGuard\n" );
ResettableMutexGuard aGuard( pMyMutex );
// release the mutex
aGuard.clear( );
@@ -894,13 +894,13 @@ namespace osl_ResettableGuard
{
Mutex aMutex;
ResetGuardThread myThread( &aMutex );
- myThread.create( );
ResettableMutexGuard myMutexGuard( aMutex );
+ myThread.create( );
/// is it running? and clear done?
+ sal_Bool bRes = myThread.isRunning( );
myMutexGuard.clear( );
ThreadHelper::thread_sleep_tenth_sec( 1 );
- sal_Bool bRes = myThread.isRunning( );
/// if reset is not success, the release will return sal_False
myMutexGuard.reset( );
diff --git a/sal/rtl/source/bootstrap.cxx b/sal/rtl/source/bootstrap.cxx
index 2ac61e9aaef5..cc7d3336c2d2 100644
--- a/sal/rtl/source/bootstrap.cxx
+++ b/sal/rtl/source/bootstrap.cxx
@@ -281,10 +281,6 @@ static OUString & getIniFileName_Impl()
fileName += OUString(RTL_CONSTASCII_USTRINGPARAM(SAL_CONFIGFILE("")));
}
- OUString workDir;
- osl_getProcessWorkingDir(&workDir.pData);
- osl::FileBase::getAbsoluteFileURL(workDir, fileName, fileName);
-
static OUString theFileName;
if(fileName.getLength())
theFileName = fileName;
@@ -653,12 +649,8 @@ rtlBootstrapHandle SAL_CALL rtl_bootstrap_args_open (
rtl_uString * pIniName
) SAL_THROW_EXTERN_C()
{
- OUString workDir;
OUString iniName( pIniName );
- osl_getProcessWorkingDir( &workDir.pData );
- osl::FileBase::getAbsoluteFileURL( workDir, iniName, iniName );
-
// normalize path
FileStatus status( FileStatusMask_FileURL );
DirectoryItem dirItem;