1*87d2adbcSAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*87d2adbcSAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*87d2adbcSAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*87d2adbcSAndrew Rist  * distributed with this work for additional information
6*87d2adbcSAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*87d2adbcSAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*87d2adbcSAndrew Rist  * "License"); you may not use this file except in compliance
9*87d2adbcSAndrew Rist  * with the License.  You may obtain a copy of the License at
10*87d2adbcSAndrew Rist  *
11*87d2adbcSAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*87d2adbcSAndrew Rist  *
13*87d2adbcSAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*87d2adbcSAndrew Rist  * software distributed under the License is distributed on an
15*87d2adbcSAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*87d2adbcSAndrew Rist  * KIND, either express or implied.  See the License for the
17*87d2adbcSAndrew Rist  * specific language governing permissions and limitations
18*87d2adbcSAndrew Rist  * under the License.
19*87d2adbcSAndrew Rist  *
20*87d2adbcSAndrew Rist  *************************************************************/
21*87d2adbcSAndrew Rist 
22*87d2adbcSAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_sal.hxx"
26cdf0e10cSrcweir 
27cdf0e10cSrcweir #ifndef _SAL_TYPES_H_
28cdf0e10cSrcweir     #include <sal/types.h>
29cdf0e10cSrcweir #endif
30cdf0e10cSrcweir 
31cdf0e10cSrcweir // #ifndef _RTL_TRES_H_
32cdf0e10cSrcweir //     #include <rtl/tres.h>
33cdf0e10cSrcweir // #endif
34cdf0e10cSrcweir #include <testshl/tresstatewrapper.hxx>
35cdf0e10cSrcweir 
36cdf0e10cSrcweir #ifndef _RTL_STRING_HXX_
37cdf0e10cSrcweir     #include <rtl/string.hxx>
38cdf0e10cSrcweir #endif
39cdf0e10cSrcweir 
40cdf0e10cSrcweir #ifndef _RTL_USTRING_H_
41cdf0e10cSrcweir 	#include <rtl/ustring.h>
42cdf0e10cSrcweir #endif
43cdf0e10cSrcweir 
44cdf0e10cSrcweir #ifndef _RTL_USTRING_HXX_
45cdf0e10cSrcweir 	#include <rtl/ustring.hxx>
46cdf0e10cSrcweir #endif
47cdf0e10cSrcweir 
48cdf0e10cSrcweir #ifndef _RTL_USTRBUF_H_
49cdf0e10cSrcweir         #include <rtl/ustrbuf.h>
50cdf0e10cSrcweir #endif
51cdf0e10cSrcweir 
52cdf0e10cSrcweir #ifndef _RTL_USTRBUF_HXX
53cdf0e10cSrcweir         #include <rtl/ustrbuf.hxx>
54cdf0e10cSrcweir #endif
55cdf0e10cSrcweir //------------------------------------------------------------------------
56cdf0e10cSrcweir //------------------------------------------------------------------------
57cdf0e10cSrcweir #ifndef _OSL_THREAD_H_
58cdf0e10cSrcweir 	#include <osl/thread.h>
59cdf0e10cSrcweir #endif
60cdf0e10cSrcweir 
61cdf0e10cSrcweir #ifndef _RTL_STRING_CONST_H_
62cdf0e10cSrcweir     #include <rtl_String_Const.h>
63cdf0e10cSrcweir #endif
64cdf0e10cSrcweir 
65cdf0e10cSrcweir #ifndef _RTL_STRING_UTILS_HXX_
66cdf0e10cSrcweir     #include <rtl_String_Utils.hxx>
67cdf0e10cSrcweir #endif
68cdf0e10cSrcweir 
69cdf0e10cSrcweir #include "stdio.h"
70cdf0e10cSrcweir using namespace rtl;
71cdf0e10cSrcweir 
72cdf0e10cSrcweir //------------------------------------------------------------------------
73cdf0e10cSrcweir // test classes
74cdf0e10cSrcweir //------------------------------------------------------------------------
75cdf0e10cSrcweir const int MAXBUFLENGTH = 255;
76cdf0e10cSrcweir //------------------------------------------------------------------------
77cdf0e10cSrcweir // helper functions
78cdf0e10cSrcweir //------------------------------------------------------------------------
unused()79cdf0e10cSrcweir static void unused()
80cdf0e10cSrcweir {
81cdf0e10cSrcweir     (void)kBinaryNumsStr;
82cdf0e10cSrcweir     (void)kOctolNumsStr;
83cdf0e10cSrcweir     (void)kDecimalNumsStr;
84cdf0e10cSrcweir     (void)kHexDecimalNumsStr;
85cdf0e10cSrcweir     (void)kBase36NumsStr;
86cdf0e10cSrcweir     (void)inputChar;
87cdf0e10cSrcweir     (void)input1StrDefault;
88cdf0e10cSrcweir     (void)input1StrNormal;
89cdf0e10cSrcweir     (void)input1StrLastDefault;
90cdf0e10cSrcweir     (void)input1StrLastNormal;
91cdf0e10cSrcweir     unused();
92cdf0e10cSrcweir }
93cdf0e10cSrcweir 
94cdf0e10cSrcweir //------------------------------------------------------------------------
95cdf0e10cSrcweir // testing constructors
96cdf0e10cSrcweir //------------------------------------------------------------------------
test_rtl_OUStringBuffer_ctor_001(hTestResult hRtlTestResult)97cdf0e10cSrcweir static sal_Bool test_rtl_OUStringBuffer_ctor_001( hTestResult hRtlTestResult )
98cdf0e10cSrcweir {
99cdf0e10cSrcweir 
100cdf0e10cSrcweir     ::rtl::OUStringBuffer aUStrBuf;
101cdf0e10cSrcweir 
102cdf0e10cSrcweir     bool b1 =
103cdf0e10cSrcweir         aUStrBuf.getLength() == 0 &&
104cdf0e10cSrcweir         ! *(aUStrBuf.getStr()) && aUStrBuf.getCapacity() == 16;
105cdf0e10cSrcweir 
106cdf0e10cSrcweir     ::rtl::OUStringBuffer aUStrBuf2(0);
107cdf0e10cSrcweir 
108cdf0e10cSrcweir     bool b2 =
109cdf0e10cSrcweir         aUStrBuf2.getLength() == 0 &&
110cdf0e10cSrcweir         ! *(aUStrBuf2.getStr()) && aUStrBuf2.getCapacity() == /* LLA: !!! */ 0;
111cdf0e10cSrcweir 
112cdf0e10cSrcweir     return
113cdf0e10cSrcweir     (
114cdf0e10cSrcweir         c_rtl_tres_state
115cdf0e10cSrcweir         (
116cdf0e10cSrcweir             hRtlTestResult,
117cdf0e10cSrcweir             b1 && b2,
118cdf0e10cSrcweir             "New OUStringBuffer containing no characters",
119cdf0e10cSrcweir             "ctor_001"
120cdf0e10cSrcweir         )
121cdf0e10cSrcweir     );
122cdf0e10cSrcweir }
123cdf0e10cSrcweir 
124cdf0e10cSrcweir //------------------------------------------------------------------------
125cdf0e10cSrcweir 
test_rtl_OUStringBuffer_ctor_002(hTestResult hRtlTestResult)126cdf0e10cSrcweir static sal_Bool SAL_CALL test_rtl_OUStringBuffer_ctor_002(
127cdf0e10cSrcweir                                                hTestResult hRtlTestResult )
128cdf0e10cSrcweir {
129cdf0e10cSrcweir     ::rtl::OUStringBuffer aUStrBuftmp( aUStr1 );
130cdf0e10cSrcweir     ::rtl::OUStringBuffer aUStrBuf( aUStrBuftmp );
131cdf0e10cSrcweir     sal_Bool res = cmpustr(aUStrBuftmp.getStr(),aUStrBuf.getStr());
132cdf0e10cSrcweir     return
133cdf0e10cSrcweir     (
134cdf0e10cSrcweir         c_rtl_tres_state
135cdf0e10cSrcweir         (
136cdf0e10cSrcweir             hRtlTestResult,
137cdf0e10cSrcweir             aUStrBuf.getLength()==aUStrBuftmp.getLength() &&
138cdf0e10cSrcweir             aUStrBuf.getCapacity() == aUStrBuftmp.getCapacity() && res ,
139cdf0e10cSrcweir             "New OUStringBuffer from another OUStringBuffer",
140cdf0e10cSrcweir             "ctor_002"
141cdf0e10cSrcweir         )
142cdf0e10cSrcweir     );
143cdf0e10cSrcweir }
144cdf0e10cSrcweir //------------------------------------------------------------------------
145cdf0e10cSrcweir 
146cdf0e10cSrcweir /* static */
test_rtl_OUStringBuffer_ctor_003(hTestResult hRtlTestResult)147cdf0e10cSrcweir sal_Bool SAL_CALL test_rtl_OUStringBuffer_ctor_003(
148cdf0e10cSrcweir                                                hTestResult hRtlTestResult )
149cdf0e10cSrcweir {
150cdf0e10cSrcweir     ::rtl::OUStringBuffer aUStrBuf1(kTestStr2Len);
151cdf0e10cSrcweir #ifdef WITH_CORE
152cdf0e10cSrcweir     ::rtl::OUStringBuffer aUStrBuf2(kSInt32Max);     //will core dump
153cdf0e10cSrcweir #else
154cdf0e10cSrcweir     ::rtl::OUStringBuffer aUStrBuf2(0);
155cdf0e10cSrcweir #endif
156cdf0e10cSrcweir     ::rtl::OUStringBuffer aUStrBuf3(kNonSInt32Max);
157cdf0e10cSrcweir 
158cdf0e10cSrcweir 
159cdf0e10cSrcweir     bool b1 =
160cdf0e10cSrcweir         aUStrBuf1.getLength() == 0 &&
161cdf0e10cSrcweir         ! *(aUStrBuf1.getStr()) && aUStrBuf1.getCapacity() == kTestStr2Len ;
162cdf0e10cSrcweir 
163cdf0e10cSrcweir     bool b2 =
164cdf0e10cSrcweir #ifdef WITH_CORE
165cdf0e10cSrcweir         aUStrBuf2.getLength() == 0 &&
166cdf0e10cSrcweir         ! *(aUStrBuf2.getStr()) && aUStrBuf2.getCapacity() == kSInt32Max ;
167cdf0e10cSrcweir #else
168cdf0e10cSrcweir         aUStrBuf2.getLength() == 0 &&
169cdf0e10cSrcweir             ! *(aUStrBuf2.getStr()) && aUStrBuf2.getCapacity() == /* LLA: ??? 16 */ 0;
170cdf0e10cSrcweir #endif
171cdf0e10cSrcweir     bool b3 =
172cdf0e10cSrcweir         aUStrBuf3.getLength() == 0 &&
173cdf0e10cSrcweir         ! *(aUStrBuf3.getStr()) && aUStrBuf3.getCapacity() == kNonSInt32Max;
174cdf0e10cSrcweir 
175cdf0e10cSrcweir     return
176cdf0e10cSrcweir         (
177cdf0e10cSrcweir             c_rtl_tres_state
178cdf0e10cSrcweir             (
179cdf0e10cSrcweir                 hRtlTestResult,
180cdf0e10cSrcweir                 b1 && b2 && b3,
181cdf0e10cSrcweir                 "New OUStringBuffer containing no characters and contain assigned capacity",
182cdf0e10cSrcweir                 "ctor_003( will core dump,because the kSInt32Max )"
183cdf0e10cSrcweir                 )
184cdf0e10cSrcweir             );
185cdf0e10cSrcweir 
186cdf0e10cSrcweir }
187cdf0e10cSrcweir 
188cdf0e10cSrcweir //------------------------------------------------------------------------
189cdf0e10cSrcweir 
test_rtl_OUStringBuffer_ctor_004(hTestResult hRtlTestResult)190cdf0e10cSrcweir static sal_Bool SAL_CALL test_rtl_OUStringBuffer_ctor_004(
191cdf0e10cSrcweir                                                hTestResult hRtlTestResult)
192cdf0e10cSrcweir {
193cdf0e10cSrcweir     ::rtl::OUString aUStrtmp( aUStr1 );
194cdf0e10cSrcweir     ::rtl::OUStringBuffer aUStrBuf( aUStrtmp );
195cdf0e10cSrcweir     sal_Int32 leg = aUStrBuf.getLength();
196cdf0e10cSrcweir     return
197cdf0e10cSrcweir     (
198cdf0e10cSrcweir         c_rtl_tres_state
199cdf0e10cSrcweir         (
200cdf0e10cSrcweir             hRtlTestResult,
201cdf0e10cSrcweir             aUStrBuf.getStr() == aUStrtmp &&
202cdf0e10cSrcweir             leg == aUStrtmp.pData->length &&
203cdf0e10cSrcweir             aUStrBuf.getCapacity() == leg+16 ,
204cdf0e10cSrcweir             "New OUStringBuffer from OUstring",
205cdf0e10cSrcweir             "ctor_004"
206cdf0e10cSrcweir         )
207cdf0e10cSrcweir     );
208cdf0e10cSrcweir }
209cdf0e10cSrcweir 
test_rtl_OUStringBuffer_ctor_005(hTestResult hRtlTestResult)210cdf0e10cSrcweir static sal_Bool SAL_CALL test_rtl_OUStringBuffer_ctor_005(
211cdf0e10cSrcweir                                                hTestResult hRtlTestResult)
212cdf0e10cSrcweir {
213cdf0e10cSrcweir     ::rtl::OUStringBuffer aUStrBuftmp( aUStr1 );
214cdf0e10cSrcweir     ::rtl::OUString aUStrtmp = aUStrBuftmp.makeStringAndClear();
215cdf0e10cSrcweir     ::rtl::OUStringBuffer aUStrBuf( aUStrBuftmp );
216cdf0e10cSrcweir     sal_Bool res = cmpustr(aUStrBuftmp.getStr(),aUStrBuf.getStr());
217cdf0e10cSrcweir     sal_Int32 leg = aUStrBuf.getLength();
218cdf0e10cSrcweir     return
219cdf0e10cSrcweir     (
220cdf0e10cSrcweir         c_rtl_tres_state
221cdf0e10cSrcweir         (
222cdf0e10cSrcweir             hRtlTestResult,
223cdf0e10cSrcweir             aUStrBuf.getLength()==aUStrBuftmp.getLength() &&
224cdf0e10cSrcweir             aUStrBuf.getCapacity() == aUStrBuftmp.getCapacity() &&
225cdf0e10cSrcweir             res && leg == 0,
226cdf0e10cSrcweir             "New OUStringBuffer from another OUStringBuffer after makeClearFromString",
227cdf0e10cSrcweir             "ctor_005"
228cdf0e10cSrcweir         )
229cdf0e10cSrcweir     );
230cdf0e10cSrcweir }
231cdf0e10cSrcweir 
test_rtl_OUStringBuffer_ctors(hTestResult hRtlTestResult)232cdf0e10cSrcweir extern "C" void /* sal_Bool */ SAL_CALL test_rtl_OUStringBuffer_ctors(
233cdf0e10cSrcweir 	                                          hTestResult hRtlTestResult )
234cdf0e10cSrcweir {
235cdf0e10cSrcweir     c_rtl_tres_state_start( hRtlTestResult, "ctors");
236cdf0e10cSrcweir     sal_Bool DCState = test_ini_uString();
237cdf0e10cSrcweir     (void)DCState;
238cdf0e10cSrcweir     sal_Bool bTSState = test_rtl_OUStringBuffer_ctor_001( hRtlTestResult );
239cdf0e10cSrcweir     bTSState &= test_rtl_OUStringBuffer_ctor_002( hRtlTestResult);
240cdf0e10cSrcweir     bTSState &= test_rtl_OUStringBuffer_ctor_003( hRtlTestResult);
241cdf0e10cSrcweir     bTSState &= test_rtl_OUStringBuffer_ctor_004( hRtlTestResult);
242cdf0e10cSrcweir     bTSState &= test_rtl_OUStringBuffer_ctor_005( hRtlTestResult);
243cdf0e10cSrcweir 
244cdf0e10cSrcweir     c_rtl_tres_state_end( hRtlTestResult, "ctors");
245cdf0e10cSrcweir //    return( bTSState );
246cdf0e10cSrcweir }
247cdf0e10cSrcweir 
248cdf0e10cSrcweir //------------------------------------------------------------------------
249cdf0e10cSrcweir // testing the method makeStringAndClear()
250cdf0e10cSrcweir //------------------------------------------------------------------------
test_rtl_OUStringBuffer_makeStringAndClear(hTestResult hRtlTestResult)251cdf0e10cSrcweir extern "C" void /* sal_Bool */ SAL_CALL test_rtl_OUStringBuffer_makeStringAndClear(
252cdf0e10cSrcweir                                               hTestResult hRtlTestResult )
253cdf0e10cSrcweir {
254cdf0e10cSrcweir     c_rtl_tres_state_start( hRtlTestResult, "makeStringAndClear");
255cdf0e10cSrcweir     sal_Char methName[MAXBUFLENGTH];
256cdf0e10cSrcweir     sal_Char* pMeth = methName;
257cdf0e10cSrcweir 
258cdf0e10cSrcweir     typedef struct TestCase
259cdf0e10cSrcweir     {
260cdf0e10cSrcweir 	sal_Char*		comments;
261cdf0e10cSrcweir 	OUString*               expVal;
262cdf0e10cSrcweir     	OUStringBuffer*         input1;
263cdf0e10cSrcweir 
264cdf0e10cSrcweir 	~TestCase()		{ delete input1;}
265cdf0e10cSrcweir     } TestCase;
266cdf0e10cSrcweir 
267cdf0e10cSrcweir     OUString arrOUS[6]={
268cdf0e10cSrcweir         OUString( aUStr1 ),
269cdf0e10cSrcweir         OUString( aUStr14 ),
270cdf0e10cSrcweir         OUString( aUStr25 ),
271cdf0e10cSrcweir         OUString( aUStr27 ),
272cdf0e10cSrcweir         OUString( aUStr29 ),
273cdf0e10cSrcweir         OUString( "\0",0,
274cdf0e10cSrcweir 	          kEncodingRTLTextUSASCII,
275cdf0e10cSrcweir 	          kConvertFlagsOStringToOUString)
276cdf0e10cSrcweir     };
277cdf0e10cSrcweir 
278cdf0e10cSrcweir     TestCase arrTestCase[]={
279cdf0e10cSrcweir 
280cdf0e10cSrcweir 	{"two empty strings(def. constructor)", new OUString(),
281cdf0e10cSrcweir                 new OUStringBuffer()},
282cdf0e10cSrcweir 	{"two empty strings(with a argu)", new OUString(),
283cdf0e10cSrcweir 		new OUStringBuffer(26)},
284cdf0e10cSrcweir 	{"normal string", new OUString(arrOUS[0]),
285cdf0e10cSrcweir                 new OUStringBuffer(arrOUS[0])},
286cdf0e10cSrcweir 	{"string with space ", new OUString(arrOUS[1]),
287cdf0e10cSrcweir 	    	new OUStringBuffer(arrOUS[1])},
288cdf0e10cSrcweir 	{"empty string", new OUString(arrOUS[2]),
289cdf0e10cSrcweir 	    	new OUStringBuffer(arrOUS[2])},
290cdf0e10cSrcweir 	{"string with a character", new OUString(arrOUS[3]),
291cdf0e10cSrcweir 	    	new OUStringBuffer(arrOUS[3])},
292cdf0e10cSrcweir 	{"string with special characters", new OUString(arrOUS[4]),
293cdf0e10cSrcweir                 new OUStringBuffer(arrOUS[4])},
294cdf0e10cSrcweir 	{"string only with (\0)", new OUString(arrOUS[5]),
295cdf0e10cSrcweir                 new OUStringBuffer(arrOUS[5])}
296cdf0e10cSrcweir     };
297cdf0e10cSrcweir 
298cdf0e10cSrcweir     sal_Bool res = sal_True;
299cdf0e10cSrcweir     sal_uInt32 i;
300cdf0e10cSrcweir 
301cdf0e10cSrcweir     for(i = 0; i < (sizeof (arrTestCase))/(sizeof (TestCase)); i++)
302cdf0e10cSrcweir     {
303cdf0e10cSrcweir         sal_Bool lastRes =
304cdf0e10cSrcweir                 ( arrTestCase[i].input1->makeStringAndClear() ==
305cdf0e10cSrcweir                                       		*( arrTestCase[i].expVal ));
306cdf0e10cSrcweir         lastRes = lastRes && ( arrTestCase[i].input1->getCapacity() == 0 );
307cdf0e10cSrcweir         lastRes = lastRes && ( *(arrTestCase[i].input1->getStr()) == '\0' );
308cdf0e10cSrcweir 
309cdf0e10cSrcweir         c_rtl_tres_state
310cdf0e10cSrcweir         (
311cdf0e10cSrcweir             hRtlTestResult,
312cdf0e10cSrcweir             lastRes,
313cdf0e10cSrcweir             arrTestCase[i].comments,
314cdf0e10cSrcweir             createName( pMeth, "makeStringAndClear", i )
315cdf0e10cSrcweir         );
316cdf0e10cSrcweir 
317cdf0e10cSrcweir         res &= lastRes;
318cdf0e10cSrcweir     }
319cdf0e10cSrcweir     c_rtl_tres_state_end( hRtlTestResult, "makeStringAndClear");
320cdf0e10cSrcweir //    return (res);
321cdf0e10cSrcweir }
322cdf0e10cSrcweir //------------------------------------------------------------------------
323cdf0e10cSrcweir // testing the method getLength
324cdf0e10cSrcweir //------------------------------------------------------------------------
325cdf0e10cSrcweir 
test_rtl_OUStringBuffer_getLength(hTestResult hRtlTestResult)326cdf0e10cSrcweir extern "C" void /* sal_Bool */ SAL_CALL test_rtl_OUStringBuffer_getLength(
327cdf0e10cSrcweir                                               hTestResult hRtlTestResult)
328cdf0e10cSrcweir {
329cdf0e10cSrcweir     c_rtl_tres_state_start( hRtlTestResult, "getLength");
330cdf0e10cSrcweir     sal_Char methName[MAXBUFLENGTH];
331cdf0e10cSrcweir     sal_Char* pMeth = methName;
332cdf0e10cSrcweir 
333cdf0e10cSrcweir     OUString arrOUS[6]={OUString( aUStr1 ),
334cdf0e10cSrcweir                         OUString( "1",1,
335cdf0e10cSrcweir 	                kEncodingRTLTextUSASCII,
336cdf0e10cSrcweir 	                kConvertFlagsOStringToOUString),
337cdf0e10cSrcweir                         OUString(),
338cdf0e10cSrcweir                         OUString( "",0,
339cdf0e10cSrcweir 	                kEncodingRTLTextUSASCII,
340cdf0e10cSrcweir 	                kConvertFlagsOStringToOUString),
341cdf0e10cSrcweir                         OUString( "\0",0,
342cdf0e10cSrcweir 	                kEncodingRTLTextUSASCII,
343cdf0e10cSrcweir 	                kConvertFlagsOStringToOUString),
344cdf0e10cSrcweir                         OUString( aUStr2 )};
345cdf0e10cSrcweir 
346cdf0e10cSrcweir     typedef struct TestCase
347cdf0e10cSrcweir     {
348cdf0e10cSrcweir 	sal_Char*		comments;
349cdf0e10cSrcweir 	sal_Int32 		expVal;
350cdf0e10cSrcweir     	OUStringBuffer*         input;
351cdf0e10cSrcweir     	~TestCase()             { delete input;}
352cdf0e10cSrcweir     } TestCase;
353cdf0e10cSrcweir 
354cdf0e10cSrcweir     TestCase arrTestCase[]={
355cdf0e10cSrcweir 
356cdf0e10cSrcweir 	{"length of ascii string", kTestStr1Len,
357cdf0e10cSrcweir 			new OUStringBuffer(arrOUS[0]) },
358cdf0e10cSrcweir     	{"length of ascci string of size 1", 1,
359cdf0e10cSrcweir     			new OUStringBuffer(arrOUS[1])},
360cdf0e10cSrcweir     	{"length of empty string", 0,
361cdf0e10cSrcweir                         new OUStringBuffer(arrOUS[2])},
362cdf0e10cSrcweir 	{"length of empty string (empty ascii string arg)",0,
363cdf0e10cSrcweir 			new OUStringBuffer(arrOUS[3])},
364cdf0e10cSrcweir 	{"length of empty string (string arg = '\\0')", 0,
365cdf0e10cSrcweir 			new OUStringBuffer(arrOUS[4])},
366cdf0e10cSrcweir         {"length(>16) of ascii string", kTestStr2Len,
367cdf0e10cSrcweir 			new OUStringBuffer(arrOUS[5]) },
368cdf0e10cSrcweir         {"length of empty string (default constructor)", 0,
369cdf0e10cSrcweir                         new OUStringBuffer()},
370cdf0e10cSrcweir         {"length of empty string (with capacity)", 0,
371cdf0e10cSrcweir                         new OUStringBuffer(26)}
372cdf0e10cSrcweir 	};
373cdf0e10cSrcweir 
374cdf0e10cSrcweir 
375cdf0e10cSrcweir     sal_Bool res = sal_True;
376cdf0e10cSrcweir     sal_uInt32 i;
377cdf0e10cSrcweir 
378cdf0e10cSrcweir     for (i = 0; i < (sizeof (arrTestCase))/(sizeof (TestCase)); i++)
379cdf0e10cSrcweir     {
380cdf0e10cSrcweir 	sal_Int32 length = arrTestCase[i].input->getLength();
381cdf0e10cSrcweir         sal_Bool lastRes = (length == arrTestCase[i].expVal);
382cdf0e10cSrcweir         c_rtl_tres_state
383cdf0e10cSrcweir         (
384cdf0e10cSrcweir             hRtlTestResult,
385cdf0e10cSrcweir             lastRes,
386cdf0e10cSrcweir             arrTestCase[i].comments,
387cdf0e10cSrcweir             createName( pMeth, "getLength", i )
388cdf0e10cSrcweir 
389cdf0e10cSrcweir         );
390cdf0e10cSrcweir 	res &= lastRes;
391cdf0e10cSrcweir     }
392cdf0e10cSrcweir     c_rtl_tres_state_end( hRtlTestResult, "getLength");
393cdf0e10cSrcweir //    return ( res );
394cdf0e10cSrcweir }
395cdf0e10cSrcweir //------------------------------------------------------------------------
396cdf0e10cSrcweir // testing the method getCapacity()
397cdf0e10cSrcweir //------------------------------------------------------------------------
398cdf0e10cSrcweir 
test_rtl_OUStringBuffer_getCapacity(hTestResult hRtlTestResult)399cdf0e10cSrcweir extern "C" void /* sal_Bool */ SAL_CALL test_rtl_OUStringBuffer_getCapacity(
400cdf0e10cSrcweir                                               hTestResult hRtlTestResult)
401cdf0e10cSrcweir {
402cdf0e10cSrcweir     c_rtl_tres_state_start( hRtlTestResult, "getCapacity");
403cdf0e10cSrcweir     sal_Char methName[MAXBUFLENGTH];
404cdf0e10cSrcweir     sal_Char* pMeth = methName;
405cdf0e10cSrcweir 
406cdf0e10cSrcweir     OUString arrOUS[6]={OUString( aUStr1 ),
407cdf0e10cSrcweir                         OUString( "1",1,
408cdf0e10cSrcweir 	                kEncodingRTLTextUSASCII,
409cdf0e10cSrcweir 	                kConvertFlagsOStringToOUString),
410cdf0e10cSrcweir                         OUString(),
411cdf0e10cSrcweir                         OUString( "",0,
412cdf0e10cSrcweir 	                kEncodingRTLTextUSASCII,
413cdf0e10cSrcweir 	                kConvertFlagsOStringToOUString),
414cdf0e10cSrcweir                         OUString( "\0",0,
415cdf0e10cSrcweir 	                kEncodingRTLTextUSASCII,
416cdf0e10cSrcweir 	                kConvertFlagsOStringToOUString),
417cdf0e10cSrcweir                         OUString( aUStr2 )};
418cdf0e10cSrcweir 
419cdf0e10cSrcweir     typedef struct TestCase
420cdf0e10cSrcweir     {
421cdf0e10cSrcweir 	sal_Char*		comments;
422cdf0e10cSrcweir 	sal_Int32 		expVal;
423cdf0e10cSrcweir     	OUStringBuffer*         input;
424cdf0e10cSrcweir     	~TestCase()             { delete input;}
425cdf0e10cSrcweir     } TestCase;
426cdf0e10cSrcweir 
427cdf0e10cSrcweir     TestCase arrTestCase[]={
428cdf0e10cSrcweir 
429cdf0e10cSrcweir 	{"capacity of ascii string", kTestStr1Len+16,
430cdf0e10cSrcweir 			new OUStringBuffer(arrOUS[0]) },
431cdf0e10cSrcweir     	{"capacity of ascci string of size 1", 1+16,
432cdf0e10cSrcweir     			new OUStringBuffer(arrOUS[1]) },
433cdf0e10cSrcweir     	{"capacity of empty string", 0+16,
434cdf0e10cSrcweir                         new OUStringBuffer(arrOUS[2]) },
435cdf0e10cSrcweir 	{"capacity of empty string (empty ascii string arg)",0+16,
436cdf0e10cSrcweir 			new OUStringBuffer(arrOUS[3]) },
437cdf0e10cSrcweir 	{"capacity of empty string (string arg = '\\0')", 0+16,
438cdf0e10cSrcweir 			new OUStringBuffer(arrOUS[4]) },
439cdf0e10cSrcweir         {"capacity(>16) of ascii string", kTestStr2Len+16,
440cdf0e10cSrcweir 			new OUStringBuffer(arrOUS[5]) },
441cdf0e10cSrcweir         {"capacity of empty string (default constructor)", 16,
442cdf0e10cSrcweir                         new OUStringBuffer() },
443cdf0e10cSrcweir #ifdef WITH_CORE
444cdf0e10cSrcweir         {"capacity of empty string (with capacity 2147483647)(code will core dump)", kSInt32Max,
445cdf0e10cSrcweir                         new OUStringBuffer(kSInt32Max) },// will core dump
446cdf0e10cSrcweir #endif
447cdf0e10cSrcweir         {"capacity of empty string (with capacity -2147483648)", kNonSInt32Max,
448cdf0e10cSrcweir                         new OUStringBuffer(kNonSInt32Max) },
449cdf0e10cSrcweir         {"capacity of empty string (with capacity 16)", 16,
450cdf0e10cSrcweir                         new OUStringBuffer(16) },
451cdf0e10cSrcweir         {"capacity of empty string (with capacity 6)", 6,
452cdf0e10cSrcweir                         new OUStringBuffer(6) },
453cdf0e10cSrcweir         {"capacity of empty string (with capacity 0)", 0,
454cdf0e10cSrcweir                         new OUStringBuffer(0) },
455cdf0e10cSrcweir         {"capacity of empty string (with capacity -2)", -2,
456cdf0e10cSrcweir                         new OUStringBuffer(-2) }
457cdf0e10cSrcweir 	};
458cdf0e10cSrcweir 
459cdf0e10cSrcweir 
460cdf0e10cSrcweir     sal_Bool res = sal_True;
461cdf0e10cSrcweir     sal_uInt32 i;
462cdf0e10cSrcweir 
463cdf0e10cSrcweir     for (i = 0; i < (sizeof (arrTestCase))/(sizeof (TestCase)); i++)
464cdf0e10cSrcweir     {
465cdf0e10cSrcweir 	sal_Int32 length = arrTestCase[i].input->getCapacity();
466cdf0e10cSrcweir         sal_Bool lastRes = (length == arrTestCase[i].expVal);
467cdf0e10cSrcweir         c_rtl_tres_state
468cdf0e10cSrcweir         (
469cdf0e10cSrcweir             hRtlTestResult,
470cdf0e10cSrcweir             lastRes,
471cdf0e10cSrcweir             arrTestCase[i].comments,
472cdf0e10cSrcweir             createName( pMeth, "getCapacity", i )
473cdf0e10cSrcweir 
474cdf0e10cSrcweir         );
475cdf0e10cSrcweir 	res &= lastRes;
476cdf0e10cSrcweir     }
477cdf0e10cSrcweir     c_rtl_tres_state_end( hRtlTestResult, "getCapacity");
478cdf0e10cSrcweir //    return ( res );
479cdf0e10cSrcweir }
480cdf0e10cSrcweir //------------------------------------------------------------------------
481cdf0e10cSrcweir // testing the method ensureCapacity(sal_Int32 minimumCapacity)
482cdf0e10cSrcweir //------------------------------------------------------------------------
483cdf0e10cSrcweir 
test_rtl_OUStringBuffer_ensureCapacity(hTestResult hRtlTestResult)484cdf0e10cSrcweir extern "C" void /* sal_Bool */ SAL_CALL test_rtl_OUStringBuffer_ensureCapacity(
485cdf0e10cSrcweir                                               hTestResult hRtlTestResult)
486cdf0e10cSrcweir {
487cdf0e10cSrcweir     c_rtl_tres_state_start( hRtlTestResult, "ensureCapacity");
488cdf0e10cSrcweir     sal_Char methName[MAXBUFLENGTH];
489cdf0e10cSrcweir     sal_Char* pMeth = methName;
490cdf0e10cSrcweir 
491cdf0e10cSrcweir     typedef struct TestCase
492cdf0e10cSrcweir     {
493cdf0e10cSrcweir 	sal_Char*		comments;
494cdf0e10cSrcweir 	sal_Int32 		expVal;
495cdf0e10cSrcweir     	OUStringBuffer*         input1;
496cdf0e10cSrcweir         sal_Int32               input2;
497cdf0e10cSrcweir     	~TestCase()             { delete input1;}
498cdf0e10cSrcweir     } TestCase;
499cdf0e10cSrcweir 
500cdf0e10cSrcweir     TestCase arrTestCase[]={
501cdf0e10cSrcweir 
502cdf0e10cSrcweir 	{"capacity equal to 16, minimum is 5 ", 16,
503cdf0e10cSrcweir 			new OUStringBuffer(), 5 },
504cdf0e10cSrcweir     	{"capacity equal to 16, minimum is -5", 16,
505cdf0e10cSrcweir     			new OUStringBuffer(), -5},
506cdf0e10cSrcweir     	{"capacity equal to 16, minimum is 0", 16,
507cdf0e10cSrcweir                         new OUStringBuffer(), 0},
508cdf0e10cSrcweir 	{"capacity equal to 16, minimum is 20", 20, //the testcase is based on comments
509cdf0e10cSrcweir 			new OUStringBuffer(), 20},
510cdf0e10cSrcweir 	{"capacity equal to 16, minimum is 50", 50,
511cdf0e10cSrcweir 			new OUStringBuffer(), 50},
512cdf0e10cSrcweir         {"capacity equal to 6, minimum is 20", 20,
513cdf0e10cSrcweir 			new OUStringBuffer(6), 20 },
514cdf0e10cSrcweir         {"capacity equal to 6, minimum is 2", 6,
515cdf0e10cSrcweir                         new OUStringBuffer(6), 2},
516cdf0e10cSrcweir         {"capacity equal to 6, minimum is -6", 6,
517cdf0e10cSrcweir                         new OUStringBuffer(6), -6},
518cdf0e10cSrcweir         {"capacity equal to 6, minimum is -6", 10, //the testcase is based on comments
519cdf0e10cSrcweir                         new OUStringBuffer(6), 10},
520cdf0e10cSrcweir         {"capacity equal to 0, minimum is 6", 6,
521cdf0e10cSrcweir                         new OUStringBuffer(0), 6},
522cdf0e10cSrcweir         {"capacity equal to 0, minimum is 1", 2, //the testcase is based on comments
523cdf0e10cSrcweir                         new OUStringBuffer(0), 1},
524cdf0e10cSrcweir     /*
525cdf0e10cSrcweir       {"capacity equal to 0, minimum is -1", 0,
526cdf0e10cSrcweir                         new OUStringBuffer(0), -1},
527cdf0e10cSrcweir     */
528cdf0e10cSrcweir #ifdef WITH_CORE
529cdf0e10cSrcweir         {"capacity equal to 2147483647, minimum is 65535", kSInt32Max,//will core dump
530cdf0e10cSrcweir                         new OUStringBuffer(kSInt32Max), 65535},
531cdf0e10cSrcweir         {"capacity equal to 2147483647, minimum is 2147483647", kSInt32Max,//will core dump
532cdf0e10cSrcweir                         new OUStringBuffer(kSInt32Max), kSInt32Max},
533cdf0e10cSrcweir         {"capacity equal to 2147483647, minimum is -1", kSInt32Max,//will core dump
534cdf0e10cSrcweir                         new OUStringBuffer(kSInt32Max), -1},
535cdf0e10cSrcweir         {"capacity equal to 2147483647, minimum is 0", kSInt32Max,//will core dump
536cdf0e10cSrcweir                         new OUStringBuffer(kSInt32Max), 0},
537cdf0e10cSrcweir         {"capacity equal to 2147483647, minimum is -2147483648", kSInt32Max,//will core dump
538cdf0e10cSrcweir                         new OUStringBuffer(kSInt32Max), kNonSInt32Max},
539cdf0e10cSrcweir #endif
540cdf0e10cSrcweir         {"capacity equal to -2147483648, minimum is 65535", 65535,
541cdf0e10cSrcweir                         new OUStringBuffer(kNonSInt32Max), 65535},
542cdf0e10cSrcweir #ifdef WITH_CORE
543cdf0e10cSrcweir         {"capacity equal to -2147483648, minimum is 2147483647", 2147483647,//will core dump
544cdf0e10cSrcweir                         new OUStringBuffer(kNonSInt32Max), 2147483647},
545cdf0e10cSrcweir #endif
546cdf0e10cSrcweir         {"capacity equal to -2147483648, minimum is -1", 2,
547cdf0e10cSrcweir                         new OUStringBuffer(kNonSInt32Max), -1},
548cdf0e10cSrcweir         {"capacity equal to -2147483648, minimum is 0", 2,
549cdf0e10cSrcweir                         new OUStringBuffer(kNonSInt32Max), 0},
550cdf0e10cSrcweir         {"capacity equal to -2147483648, minimum is -2147483648", kNonSInt32Max,
551cdf0e10cSrcweir                         new OUStringBuffer(kNonSInt32Max), kNonSInt32Max}
552cdf0e10cSrcweir  	};
553cdf0e10cSrcweir 
554cdf0e10cSrcweir 
555cdf0e10cSrcweir     sal_Bool res = sal_True;
556cdf0e10cSrcweir     sal_uInt32 i;
557cdf0e10cSrcweir 
558cdf0e10cSrcweir     for (i = 0; i < (sizeof (arrTestCase))/(sizeof (TestCase)); i++)
559cdf0e10cSrcweir     {
560cdf0e10cSrcweir 	arrTestCase[i].input1->ensureCapacity(arrTestCase[i].input2);
561cdf0e10cSrcweir         sal_Int32 length = arrTestCase[i].input1->getCapacity();
562cdf0e10cSrcweir         sal_Bool lastRes = (length == arrTestCase[i].expVal);
563cdf0e10cSrcweir 
564cdf0e10cSrcweir         c_rtl_tres_state
565cdf0e10cSrcweir         (
566cdf0e10cSrcweir             hRtlTestResult,
567cdf0e10cSrcweir             lastRes,
568cdf0e10cSrcweir             arrTestCase[i].comments,
569cdf0e10cSrcweir             createName( pMeth, "ensureCapacity", i )
570cdf0e10cSrcweir 
571cdf0e10cSrcweir         );
572cdf0e10cSrcweir 	res &= lastRes;
573cdf0e10cSrcweir     }
574cdf0e10cSrcweir     c_rtl_tres_state_end( hRtlTestResult, "ensureCapacity");
575cdf0e10cSrcweir //    return ( res );
576cdf0e10cSrcweir }
577cdf0e10cSrcweir //------------------------------------------------------------------------
578cdf0e10cSrcweir // testing the method setLength(sal_Int32 newLength)
579cdf0e10cSrcweir //------------------------------------------------------------------------
580cdf0e10cSrcweir 
test_rtl_OUStringBuffer_setLength(hTestResult hRtlTestResult)581cdf0e10cSrcweir extern "C" void /* sal_Bool */ SAL_CALL test_rtl_OUStringBuffer_setLength(
582cdf0e10cSrcweir                                               hTestResult hRtlTestResult)
583cdf0e10cSrcweir {
584cdf0e10cSrcweir     c_rtl_tres_state_start( hRtlTestResult, "setLength");
585cdf0e10cSrcweir     sal_Char methName[MAXBUFLENGTH];
586cdf0e10cSrcweir     sal_Char* pMeth = methName;
587cdf0e10cSrcweir 
588cdf0e10cSrcweir     OUString arrOUS[6]={OUString( aUStr1 ),
589cdf0e10cSrcweir                         OUString( aUStr27),
590cdf0e10cSrcweir                         OUString(),
591cdf0e10cSrcweir                         OUString( "",0,
592cdf0e10cSrcweir 	                kEncodingRTLTextUSASCII,
593cdf0e10cSrcweir 	                kConvertFlagsOStringToOUString),
594cdf0e10cSrcweir                         OUString( "\0",0,
595cdf0e10cSrcweir 	                kEncodingRTLTextUSASCII,
596cdf0e10cSrcweir 	                kConvertFlagsOStringToOUString),
597cdf0e10cSrcweir                         OUString( aUStr2 )};
598cdf0e10cSrcweir 
599cdf0e10cSrcweir     typedef struct TestCase
600cdf0e10cSrcweir     {
601cdf0e10cSrcweir 	sal_Char*		comments;
602cdf0e10cSrcweir 	sal_Int32 		expVal1;
603cdf0e10cSrcweir     	OUString*               expVal2;
604cdf0e10cSrcweir 	sal_Int32 		expVal3;
605cdf0e10cSrcweir         OUStringBuffer*         input1;
606cdf0e10cSrcweir         sal_Int32               input2;
607cdf0e10cSrcweir     	~TestCase()             { delete input1; delete expVal2;}
608cdf0e10cSrcweir     } TestCase;
609cdf0e10cSrcweir 
610cdf0e10cSrcweir     TestCase arrTestCase[]={
611cdf0e10cSrcweir 
612cdf0e10cSrcweir 	{"newLength more than the capacity of OUStringBuffer(aUStr1)",
613cdf0e10cSrcweir                 50, new OUString(aUStr1), 50,
614cdf0e10cSrcweir                 new OUStringBuffer(arrOUS[0]), 50 },
615cdf0e10cSrcweir 	{"newLength more than the length of OUStringBuffer(aUStr1)",
616cdf0e10cSrcweir                 kTestStr13Len, new OUString(aUStr1), 32,
617cdf0e10cSrcweir                 new OUStringBuffer(arrOUS[0]), kTestStr13Len },
618cdf0e10cSrcweir         {"newLength equal to the length of OUStringBuffer(aUStr1)",
619cdf0e10cSrcweir                 kTestStr1Len, new OUString(aUStr1), 32,
620cdf0e10cSrcweir                 new OUStringBuffer(arrOUS[0]), kTestStr1Len },
621cdf0e10cSrcweir     	{"newLength less than the length of OUStringBuffer(aUStr1)",
622cdf0e10cSrcweir                 kTestStr7Len, new OUString(aUStr7), 32,
623cdf0e10cSrcweir                 new OUStringBuffer(arrOUS[0]), kTestStr7Len},
624cdf0e10cSrcweir     	{"newLength equal to 0",
625cdf0e10cSrcweir                 0, new OUString(), 32,
626cdf0e10cSrcweir                 new OUStringBuffer(arrOUS[0]), 0},
627cdf0e10cSrcweir 	{"newLength more than the capacity of OUStringBuffer(1)",
628cdf0e10cSrcweir                 25, new OUString(arrOUS[1]), 25,
629cdf0e10cSrcweir                 new OUStringBuffer(arrOUS[1]), 25},
630cdf0e10cSrcweir 	{"newLength more than the length of OUStringBuffer(1)",
631cdf0e10cSrcweir                 5, new OUString(arrOUS[1]), 17,
632cdf0e10cSrcweir                 new OUStringBuffer(arrOUS[1]), 5},
633cdf0e10cSrcweir 	{"newLength equal to the length of OUStringBuffer(1)",
634cdf0e10cSrcweir                 kTestStr27Len, new OUString(arrOUS[1]), 17,
635cdf0e10cSrcweir                 new OUStringBuffer(arrOUS[1]), kTestStr27Len},
636cdf0e10cSrcweir 	{"newLength less than the length of OUStringBuffer(1)",
637cdf0e10cSrcweir                 0, new OUString(), 17,
638cdf0e10cSrcweir                 new OUStringBuffer(arrOUS[1]), 0},
639cdf0e10cSrcweir 	{"newLength more than the capacity of OUStringBuffer()",
640cdf0e10cSrcweir                 20, new OUString(), 20,
641cdf0e10cSrcweir                 new OUStringBuffer(arrOUS[2]), 20},
642cdf0e10cSrcweir 	{"newLength more than the length of OUStringBuffer()",
643cdf0e10cSrcweir                 3, new OUString(), 16,
644cdf0e10cSrcweir                 new OUStringBuffer(arrOUS[2]), 3},
645cdf0e10cSrcweir 	{"newLength less than the length of OUStringBuffer()",
646cdf0e10cSrcweir                 0, new OUString(), 16,
647cdf0e10cSrcweir                 new OUStringBuffer(arrOUS[2]), 0},
648cdf0e10cSrcweir 	{"newLength more than the capacity of OUStringBuffer("")",
649cdf0e10cSrcweir                 20, new OUString(), 20,
650cdf0e10cSrcweir                 new OUStringBuffer(arrOUS[3]), 20},
651cdf0e10cSrcweir 	{"newLength more than the length of OUStringBuffer("")",
652cdf0e10cSrcweir                 5, new OUString(), 16,
653cdf0e10cSrcweir                 new OUStringBuffer(arrOUS[3]), 5},
654cdf0e10cSrcweir 	{"newLength less than the length of OUStringBuffer("")",
655cdf0e10cSrcweir                 0, new OUString(), 16,
656cdf0e10cSrcweir                 new OUStringBuffer(arrOUS[3]), 0},
657cdf0e10cSrcweir 	{"newLength more than the length of OUStringBuffer(\0)",
658cdf0e10cSrcweir                 20, new OUString(), 20,
659cdf0e10cSrcweir                 new OUStringBuffer(arrOUS[4]), 20},
660cdf0e10cSrcweir 	{"newLength more than the length of OUStringBuffer(\0)",
661cdf0e10cSrcweir                 5, new OUString(), 16,
662cdf0e10cSrcweir                 new OUStringBuffer(arrOUS[4]), 5},
663cdf0e10cSrcweir 	{"newLength less than the length of OUStringBuffer(\0)",
664cdf0e10cSrcweir                 0, new OUString(), 16,
665cdf0e10cSrcweir                 new OUStringBuffer(arrOUS[4]), 0},
666cdf0e10cSrcweir 	{"newLength more than the capacity of OUStringBuffer(aUStr2)",
667cdf0e10cSrcweir                 50, new OUString(aUStr2), 66,
668cdf0e10cSrcweir                 new OUStringBuffer(arrOUS[5]), 50,},
669cdf0e10cSrcweir 	{"newLength more than the length of OUStringBuffer(aUStr2)",
670cdf0e10cSrcweir                 40, new OUString(aUStr2), 48,
671cdf0e10cSrcweir                 new OUStringBuffer(arrOUS[5]), 40,},
672cdf0e10cSrcweir 	{"newLength equal to the length of OUStringBuffer(aUStr2)",
673cdf0e10cSrcweir                 kTestStr2Len, new OUString(aUStr2), 48,
674cdf0e10cSrcweir                 new OUStringBuffer(arrOUS[5]), kTestStr2Len,},
675cdf0e10cSrcweir     	{"newLength less than the length of OUStringBuffer(aUStr2)",
676cdf0e10cSrcweir                 kTestStr7Len, new OUString(aUStr7), 48,
677cdf0e10cSrcweir                 new OUStringBuffer(arrOUS[5]), kTestStr7Len},
678cdf0e10cSrcweir     	{"newLength equal to 0",
679cdf0e10cSrcweir                 0, new OUString(), 48,
680cdf0e10cSrcweir                 new OUStringBuffer(arrOUS[5]), 0}
681cdf0e10cSrcweir 
682cdf0e10cSrcweir 	};
683cdf0e10cSrcweir 
684cdf0e10cSrcweir 
685cdf0e10cSrcweir     sal_Bool res = sal_True;
686cdf0e10cSrcweir     sal_uInt32 i;
687cdf0e10cSrcweir 
688cdf0e10cSrcweir     for (i = 0; i < (sizeof (arrTestCase))/(sizeof (TestCase)); i++)
689cdf0e10cSrcweir     {
690cdf0e10cSrcweir 	arrTestCase[i].input1->setLength(arrTestCase[i].input2);
691cdf0e10cSrcweir         sal_Bool lastRes =
692cdf0e10cSrcweir             ( arrTestCase[i].input1->getStr() == *(arrTestCase[i].expVal2) &&
693cdf0e10cSrcweir               arrTestCase[i].input1->getLength() == arrTestCase[i].expVal1 &&
694cdf0e10cSrcweir               arrTestCase[i].input1->getCapacity() == arrTestCase[i].expVal3 );
695cdf0e10cSrcweir 
696cdf0e10cSrcweir         c_rtl_tres_state
697cdf0e10cSrcweir         (
698cdf0e10cSrcweir             hRtlTestResult,
699cdf0e10cSrcweir             lastRes,
700cdf0e10cSrcweir             arrTestCase[i].comments,
701cdf0e10cSrcweir             createName( pMeth, "setLength", i )
702cdf0e10cSrcweir 
703cdf0e10cSrcweir         );
704cdf0e10cSrcweir 	res &= lastRes;
705cdf0e10cSrcweir     }
706cdf0e10cSrcweir     c_rtl_tres_state_end( hRtlTestResult, "setLength");
707cdf0e10cSrcweir //    return ( res );
708cdf0e10cSrcweir }
709cdf0e10cSrcweir //------------------------------------------------------------------------
710cdf0e10cSrcweir // testing the method charAt( sal_Int32 index )
711cdf0e10cSrcweir //------------------------------------------------------------------------
712cdf0e10cSrcweir 
test_rtl_OUStringBuffer_charAt(hTestResult hRtlTestResult)713cdf0e10cSrcweir extern "C" void /* sal_Bool */ SAL_CALL test_rtl_OUStringBuffer_charAt(
714cdf0e10cSrcweir                                               hTestResult hRtlTestResult)
715cdf0e10cSrcweir {
716cdf0e10cSrcweir     c_rtl_tres_state_start( hRtlTestResult, "charAt");
717cdf0e10cSrcweir     sal_Char methName[MAXBUFLENGTH];
718cdf0e10cSrcweir     sal_Char* pMeth = methName;
719cdf0e10cSrcweir 
720cdf0e10cSrcweir     OUString arrOUS[4]={OUString( aUStr1 ), // "Sun Microsystems";
721cdf0e10cSrcweir                         OUString( aUStr27), // "s";
722cdf0e10cSrcweir                         OUString( aUStr28), // "\50\3\5\7\11\13\15\17sun";
723cdf0e10cSrcweir                         OUString( )};
724cdf0e10cSrcweir 
725cdf0e10cSrcweir     typedef struct TestCase
726cdf0e10cSrcweir     {
727cdf0e10cSrcweir         sal_Char*		comments;
728cdf0e10cSrcweir         sal_Unicode 		expVal;
729cdf0e10cSrcweir         OUStringBuffer*         input1;
730cdf0e10cSrcweir         sal_Int32               input2;
731cdf0e10cSrcweir     	~TestCase()             { delete input1;}
732cdf0e10cSrcweir     } TestCase;
733cdf0e10cSrcweir 
734cdf0e10cSrcweir     TestCase arrTestCase[]={
735cdf0e10cSrcweir 
736cdf0e10cSrcweir 	{"return the first character of OUStringBuffer(aUStr1)",
737cdf0e10cSrcweir                 83, new OUStringBuffer(arrOUS[0]), 0 },
738cdf0e10cSrcweir 	{"return the middle character of OUStringBuffer(aUStr1)",
739cdf0e10cSrcweir                 32, new OUStringBuffer(arrOUS[0]), 3 },
740cdf0e10cSrcweir         {"return the last character of OUStringBuffer(aUStr1)",
741cdf0e10cSrcweir                 115, new OUStringBuffer(arrOUS[0]), 15 },
742cdf0e10cSrcweir 	{"return the only character of OUStringBuffer(aUStr27)",
743cdf0e10cSrcweir                 115, new OUStringBuffer(arrOUS[1]), 0},
744cdf0e10cSrcweir 	{"return the first of OUStringBuffer(aUStr28) with special character",
745cdf0e10cSrcweir                 40, new OUStringBuffer(arrOUS[2]), 0},
746cdf0e10cSrcweir 	/*
747cdf0e10cSrcweir {"return the mid of OUStringBuffer(aUStr28) with special character",
748cdf0e10cSrcweir                 11, new OUStringBuffer(arrOUS[2]), 5},
749cdf0e10cSrcweir */
750cdf0e10cSrcweir /*
751cdf0e10cSrcweir         {"invalid character of OUStringBuffer()",
752cdf0e10cSrcweir                 0, new OUStringBuffer(arrOUS[3]), 0},
753cdf0e10cSrcweir */
754cdf0e10cSrcweir /*
755cdf0e10cSrcweir         {"invalid character of OUStringBuffer()",
756cdf0e10cSrcweir                 0, new OUStringBuffer(arrOUS[3]), -2}
757cdf0e10cSrcweir */
758cdf0e10cSrcweir 
759cdf0e10cSrcweir 	};
760cdf0e10cSrcweir 
761cdf0e10cSrcweir 
762cdf0e10cSrcweir     sal_Bool res = sal_True;
763cdf0e10cSrcweir     sal_uInt32 i;
764cdf0e10cSrcweir 
765cdf0e10cSrcweir     for (i = 0; i < (sizeof (arrTestCase))/(sizeof (TestCase)); i++)
766cdf0e10cSrcweir     {
767cdf0e10cSrcweir         sal_Bool lastRes =
768cdf0e10cSrcweir             ( arrTestCase[i].input1->charAt(arrTestCase[i].input2) ==
769cdf0e10cSrcweir               arrTestCase[i].expVal );
770cdf0e10cSrcweir         // LLA: last case removed, due to the fact of complexity of the test code :-(
771cdf0e10cSrcweir         // LLA: if(i<=7)
772cdf0e10cSrcweir         // LLA: {
773cdf0e10cSrcweir         c_rtl_tres_state
774cdf0e10cSrcweir             (
775cdf0e10cSrcweir                 hRtlTestResult,
776cdf0e10cSrcweir                 lastRes,
777cdf0e10cSrcweir                 arrTestCase[i].comments,
778cdf0e10cSrcweir                 createName( pMeth, "charAt", i )
779cdf0e10cSrcweir 
780cdf0e10cSrcweir                 );
781cdf0e10cSrcweir         // LLA: }
782cdf0e10cSrcweir         // LLA: else
783cdf0e10cSrcweir         // LLA: {
784cdf0e10cSrcweir         // LLA:     c_rtl_tres_state
785cdf0e10cSrcweir         // LLA:     (
786cdf0e10cSrcweir         // LLA:         hRtlTestResult,
787cdf0e10cSrcweir         // LLA:         sal_True,
788cdf0e10cSrcweir         // LLA:         arrTestCase[i].comments,
789cdf0e10cSrcweir         // LLA:         createName( pMeth, "charAt", i )
790cdf0e10cSrcweir         // LLA:
791cdf0e10cSrcweir         // LLA:     );
792cdf0e10cSrcweir         // LLA: }
793cdf0e10cSrcweir 	res &= lastRes;
794cdf0e10cSrcweir     }
795cdf0e10cSrcweir     c_rtl_tres_state_end( hRtlTestResult, "charAt");
796cdf0e10cSrcweir //    return ( res );
797cdf0e10cSrcweir }
798cdf0e10cSrcweir //------------------------------------------------------------------------
799cdf0e10cSrcweir // testing the operator const sal_Unicode * (csuc for short)
800cdf0e10cSrcweir //------------------------------------------------------------------------
test_rtl_OUStringBuffer_csuc(hTestResult hRtlTestResult)801cdf0e10cSrcweir extern "C" void /* sal_Bool */ SAL_CALL test_rtl_OUStringBuffer_csuc(
802cdf0e10cSrcweir                                               hTestResult hRtlTestResult)
803cdf0e10cSrcweir {
804cdf0e10cSrcweir     c_rtl_tres_state_start( hRtlTestResult, "csuc");
805cdf0e10cSrcweir 	sal_Char methName[MAXBUFLENGTH];
806cdf0e10cSrcweir 	sal_Char* pMeth = methName;
807cdf0e10cSrcweir 
808cdf0e10cSrcweir 	const sal_Unicode tmpUC=0x0;
809cdf0e10cSrcweir 	rtl_uString* tmpUstring = NULL;
810cdf0e10cSrcweir 	const sal_Char *tmpStr=kTestStr1;
811cdf0e10cSrcweir 	sal_Int32 tmpLen=(sal_Int32) kTestStr1Len;
812cdf0e10cSrcweir 	//sal_Int32 cmpLen = 0;
813cdf0e10cSrcweir         OUString tempString(aUStr1);
814cdf0e10cSrcweir 
815cdf0e10cSrcweir 	rtl_string2UString( &tmpUstring, tmpStr,  tmpLen,
816cdf0e10cSrcweir 		osl_getThreadTextEncoding(), OSTRING_TO_OUSTRING_CVTFLAGS );
817cdf0e10cSrcweir     OSL_ASSERT(tmpUstring != NULL);
818cdf0e10cSrcweir 
819cdf0e10cSrcweir 
820cdf0e10cSrcweir 	typedef struct TestCase
821cdf0e10cSrcweir         {
822cdf0e10cSrcweir             sal_Char*		           comments;
823cdf0e10cSrcweir             const sal_Unicode*             expVal;
824cdf0e10cSrcweir             sal_Int32                      cmpLen;
825cdf0e10cSrcweir             OUStringBuffer*                input1;
826cdf0e10cSrcweir             ~TestCase()                    {  delete input1; }
827cdf0e10cSrcweir  	} TestCase;
828cdf0e10cSrcweir 
829cdf0e10cSrcweir     TestCase arrTestCase[] =
830cdf0e10cSrcweir     {
831cdf0e10cSrcweir       	{"test normal ustring",(*tmpUstring).buffer,kTestStr1Len,
832cdf0e10cSrcweir       				new OUStringBuffer(tempString)},
833cdf0e10cSrcweir         {"test empty ustring",&tmpUC, 1, new OUStringBuffer()}
834cdf0e10cSrcweir     };
835cdf0e10cSrcweir 
836cdf0e10cSrcweir     sal_Bool res = sal_True;
837cdf0e10cSrcweir     sal_uInt32 i;
838cdf0e10cSrcweir     for(i = 0; i < (sizeof (arrTestCase))/(sizeof (TestCase)); i++)
839cdf0e10cSrcweir     {
840cdf0e10cSrcweir        const sal_Unicode* pstr = *arrTestCase[i].input1;
841cdf0e10cSrcweir 
842cdf0e10cSrcweir        res &= c_rtl_tres_state
843cdf0e10cSrcweir        (
844cdf0e10cSrcweir             hRtlTestResult,
845cdf0e10cSrcweir             cmpustr( pstr, arrTestCase[i].expVal, arrTestCase[i].cmpLen ),
846cdf0e10cSrcweir             arrTestCase[i].comments,
847cdf0e10cSrcweir             createName( pMeth, "const sal_Unicode*", i )
848cdf0e10cSrcweir        );
849cdf0e10cSrcweir     }
850cdf0e10cSrcweir     c_rtl_tres_state_end( hRtlTestResult, "csuc");
851cdf0e10cSrcweir //    return ( res );
852cdf0e10cSrcweir }
853cdf0e10cSrcweir //------------------------------------------------------------------------
854cdf0e10cSrcweir // testing the method const sal_Unicode * getStr()
855cdf0e10cSrcweir //------------------------------------------------------------------------
test_rtl_OUStringBuffer_getStr(hTestResult hRtlTestResult)856cdf0e10cSrcweir extern "C" void /* sal_Bool */ SAL_CALL test_rtl_OUStringBuffer_getStr(
857cdf0e10cSrcweir                                               hTestResult hRtlTestResult)
858cdf0e10cSrcweir {
859cdf0e10cSrcweir     c_rtl_tres_state_start( hRtlTestResult, "getStr");
860cdf0e10cSrcweir 	sal_Char methName[MAXBUFLENGTH];
861cdf0e10cSrcweir 	sal_Char* pMeth = methName;
862cdf0e10cSrcweir 
863cdf0e10cSrcweir 	const sal_Unicode tmpUC=0x0;
864cdf0e10cSrcweir 	rtl_uString* tmpUstring = NULL;
865cdf0e10cSrcweir 	const sal_Char *tmpStr=kTestStr1;
866cdf0e10cSrcweir 	sal_Int32 tmpLen=(sal_Int32) kTestStr1Len;
867cdf0e10cSrcweir 	//sal_Int32 cmpLen = 0;
868cdf0e10cSrcweir         OUString tempString(aUStr1);
869cdf0e10cSrcweir 
870cdf0e10cSrcweir 	rtl_string2UString( &tmpUstring, tmpStr,  tmpLen,
871cdf0e10cSrcweir 		osl_getThreadTextEncoding(), OSTRING_TO_OUSTRING_CVTFLAGS );
872cdf0e10cSrcweir     OSL_ASSERT(tmpUstring != NULL);
873cdf0e10cSrcweir 
874cdf0e10cSrcweir 
875cdf0e10cSrcweir     typedef struct TestCase
876cdf0e10cSrcweir     {
877cdf0e10cSrcweir         sal_Char*			comments;
878cdf0e10cSrcweir         const sal_Unicode*		expVal;
879cdf0e10cSrcweir         sal_Int32			cmpLen;
880cdf0e10cSrcweir         OUStringBuffer*                 input1;
881cdf0e10cSrcweir         ~TestCase()                     {  delete input1;}
882cdf0e10cSrcweir     } TestCase;
883cdf0e10cSrcweir 
884cdf0e10cSrcweir     TestCase arrTestCase[] =
885cdf0e10cSrcweir     {
886cdf0e10cSrcweir       	{"test normal ustring",(*tmpUstring).buffer,kTestStr1Len,
887cdf0e10cSrcweir       				new OUStringBuffer(tempString)},
888cdf0e10cSrcweir         {"test empty ustring",&tmpUC, 1, new OUStringBuffer()}
889cdf0e10cSrcweir     };
890cdf0e10cSrcweir 
891cdf0e10cSrcweir     sal_Bool res = sal_True;
892cdf0e10cSrcweir     sal_uInt32 i;
893cdf0e10cSrcweir     for(i = 0; i < (sizeof (arrTestCase))/(sizeof (TestCase)); i++)
894cdf0e10cSrcweir     {
895cdf0e10cSrcweir        const sal_Unicode* pstr = arrTestCase[i].input1->getStr();
896cdf0e10cSrcweir 
897cdf0e10cSrcweir        res &= c_rtl_tres_state
898cdf0e10cSrcweir        (
899cdf0e10cSrcweir             hRtlTestResult,
900cdf0e10cSrcweir             cmpustr( pstr, arrTestCase[i].expVal, arrTestCase[i].cmpLen ),
901cdf0e10cSrcweir             arrTestCase[i].comments,
902cdf0e10cSrcweir             createName( pMeth, "getStr", i )
903cdf0e10cSrcweir        );
904cdf0e10cSrcweir     }
905cdf0e10cSrcweir     c_rtl_tres_state_end( hRtlTestResult, "getStr");
906cdf0e10cSrcweir //    return ( res );
907cdf0e10cSrcweir }
908cdf0e10cSrcweir //------------------------------------------------------------------------
909cdf0e10cSrcweir // testing the method setCharAt(sal_Int32 index, sal_Unicode ch)
910cdf0e10cSrcweir //------------------------------------------------------------------------
911cdf0e10cSrcweir 
test_rtl_OUStringBuffer_setCharAt(hTestResult hRtlTestResult)912cdf0e10cSrcweir extern "C" void /* sal_Bool */ SAL_CALL test_rtl_OUStringBuffer_setCharAt(
913cdf0e10cSrcweir                                               hTestResult hRtlTestResult)
914cdf0e10cSrcweir {
915cdf0e10cSrcweir     c_rtl_tres_state_start( hRtlTestResult, "setCharAt");
916cdf0e10cSrcweir     sal_Char methName[MAXBUFLENGTH];
917cdf0e10cSrcweir     sal_Char* pMeth = methName;
918cdf0e10cSrcweir 
919cdf0e10cSrcweir     OUString arrOUS[4]={OUString( aUStr1 ),
920cdf0e10cSrcweir                         OUString( aUStr27),
921cdf0e10cSrcweir                         OUString( aUStr28),
922cdf0e10cSrcweir                         OUString( )};
923cdf0e10cSrcweir 
924cdf0e10cSrcweir     typedef struct TestCase
925cdf0e10cSrcweir     {
926cdf0e10cSrcweir 	sal_Char*		comments;
927cdf0e10cSrcweir 	OUString*               expVal;
928cdf0e10cSrcweir         OUStringBuffer*         input1;
929cdf0e10cSrcweir         sal_Int32               input2;
930cdf0e10cSrcweir         sal_Unicode             input3;
931cdf0e10cSrcweir     	~TestCase()             { delete input1; delete expVal; }
932cdf0e10cSrcweir     } TestCase;
933cdf0e10cSrcweir 
934cdf0e10cSrcweir     TestCase arrTestCase[]={
935cdf0e10cSrcweir 
936cdf0e10cSrcweir 	{"set the first character of OUStringBuffer(aUStr1) with s",
937cdf0e10cSrcweir                 new OUString(aUStr31),
938cdf0e10cSrcweir                 new OUStringBuffer(arrOUS[0]), 0, 115 },
939cdf0e10cSrcweir 	{"set the middle character of OUStringBuffer(aUStr1) with m",
940cdf0e10cSrcweir                 new OUString(aUStr3),
941cdf0e10cSrcweir                 new OUStringBuffer(arrOUS[0]), 4, 109 },
942cdf0e10cSrcweir         {"set the last character of OUStringBuffer(aUStr1) with ' '",
943cdf0e10cSrcweir                 new OUString(aUStr32),
944cdf0e10cSrcweir                 new OUStringBuffer(arrOUS[0]), 15, 32 },
945cdf0e10cSrcweir 	{"set the only character of OUStringBuffer(aUStr27) with ' '",
946cdf0e10cSrcweir                 new OUString(aUStr33),
947cdf0e10cSrcweir                 new OUStringBuffer(arrOUS[1]), 0, 32},
948cdf0e10cSrcweir 	{"set the only of OUStringBuffer(aUStr28) with special character",
949cdf0e10cSrcweir                 new OUString(aUStr34),
950cdf0e10cSrcweir                 new OUStringBuffer(arrOUS[2]), 1, 5},
951cdf0e10cSrcweir /*
952cdf0e10cSrcweir         {"set the only of OUStringBuffer(aUStr28) with special character",
953cdf0e10cSrcweir                 new OUString(aUStr35),
954cdf0e10cSrcweir                 new OUStringBuffer(arrOUS[2]), 1, -5}
955cdf0e10cSrcweir */
956cdf0e10cSrcweir #ifdef WITH_CORE
957cdf0e10cSrcweir 	,{"invalid character of OUStringBuffer()",
958cdf0e10cSrcweir                 0,
959cdf0e10cSrcweir                 new OUStringBuffer(arrOUS[3]), 0, 5},
960cdf0e10cSrcweir         {"invalid character of OUStringBuffer()",
961cdf0e10cSrcweir                 0,
962cdf0e10cSrcweir                 new OUStringBuffer(arrOUS[3]), -2, 5},
963cdf0e10cSrcweir         {"invalid character of OUStringBuffer()",
964cdf0e10cSrcweir                 0,
965cdf0e10cSrcweir                 new OUStringBuffer(arrOUS[3]), 3, 5}
966cdf0e10cSrcweir #endif
967cdf0e10cSrcweir 
968cdf0e10cSrcweir 	};
969cdf0e10cSrcweir 
970cdf0e10cSrcweir 
971cdf0e10cSrcweir     sal_Bool res = sal_True;
972cdf0e10cSrcweir     sal_uInt32 i;
973cdf0e10cSrcweir 
974cdf0e10cSrcweir     for (i = 0; i < (sizeof (arrTestCase))/(sizeof (TestCase)); i++)
975cdf0e10cSrcweir     {
976cdf0e10cSrcweir         sal_Bool lastRes =
977cdf0e10cSrcweir             ( (arrTestCase[i].input1->setCharAt(arrTestCase[i].input2,
978cdf0e10cSrcweir                 arrTestCase[i].input3)).getStr() == *(arrTestCase[i].expVal) );
979cdf0e10cSrcweir         if(i<=4)
980cdf0e10cSrcweir         {
981cdf0e10cSrcweir             c_rtl_tres_state
982cdf0e10cSrcweir             (
983cdf0e10cSrcweir                 hRtlTestResult,
984cdf0e10cSrcweir                 lastRes,
985cdf0e10cSrcweir                 arrTestCase[i].comments,
986cdf0e10cSrcweir                 createName( pMeth, "setCharAt", i )
987cdf0e10cSrcweir 
988cdf0e10cSrcweir             );
989cdf0e10cSrcweir         }
990cdf0e10cSrcweir         else
991cdf0e10cSrcweir         {
992cdf0e10cSrcweir             c_rtl_tres_state
993cdf0e10cSrcweir             (
994cdf0e10cSrcweir                 hRtlTestResult,
995cdf0e10cSrcweir                 sal_True,
996cdf0e10cSrcweir                 arrTestCase[i].comments,
997cdf0e10cSrcweir                 createName( pMeth, "setCharAt", i )
998cdf0e10cSrcweir 
999cdf0e10cSrcweir             );
1000cdf0e10cSrcweir         }
1001cdf0e10cSrcweir 	res &= lastRes;
1002cdf0e10cSrcweir     }
1003cdf0e10cSrcweir     c_rtl_tres_state_end( hRtlTestResult, "setCharAt");
1004cdf0e10cSrcweir //    return ( res );
1005cdf0e10cSrcweir }
1006cdf0e10cSrcweir //------------------------------------------------------------------------
1007cdf0e10cSrcweir // testing the method append(const OUString &str)
1008cdf0e10cSrcweir //------------------------------------------------------------------------
1009cdf0e10cSrcweir 
test_rtl_OUStringBuffer_append_001(hTestResult hRtlTestResult)1010cdf0e10cSrcweir sal_Bool SAL_CALL test_rtl_OUStringBuffer_append_001(
1011cdf0e10cSrcweir                                               hTestResult hRtlTestResult)
1012cdf0e10cSrcweir {
1013cdf0e10cSrcweir     sal_Char methName[MAXBUFLENGTH];
1014cdf0e10cSrcweir     sal_Char* pMeth = methName;
1015cdf0e10cSrcweir 
1016cdf0e10cSrcweir     OUString arrOUS[5]={OUString( aUStr7 ),
1017cdf0e10cSrcweir                         OUString(),
1018cdf0e10cSrcweir                         OUString( aUStr25 ),
1019cdf0e10cSrcweir                         OUString( "\0",0,
1020cdf0e10cSrcweir 	                kEncodingRTLTextUSASCII,
1021cdf0e10cSrcweir 	                kConvertFlagsOStringToOUString),
1022cdf0e10cSrcweir                         OUString( aUStr28 )};
1023cdf0e10cSrcweir 
1024cdf0e10cSrcweir     typedef struct TestCase
1025cdf0e10cSrcweir     {
1026cdf0e10cSrcweir 	sal_Char*		comments;
1027cdf0e10cSrcweir 	OUString*               expVal;
1028cdf0e10cSrcweir         OUStringBuffer*         input1;
1029cdf0e10cSrcweir         OUString*               input2;
1030cdf0e10cSrcweir 
1031cdf0e10cSrcweir     	~TestCase()             { delete input1; delete input2; delete expVal; }
1032cdf0e10cSrcweir     } TestCase;
1033cdf0e10cSrcweir 
1034cdf0e10cSrcweir     TestCase arrTestCase[]={
1035cdf0e10cSrcweir 
1036cdf0e10cSrcweir 	{"Appends the string(length less than 16) to the string buffer arrOUS[0]",
1037cdf0e10cSrcweir                 new OUString(aUStr1),
1038cdf0e10cSrcweir                 new OUStringBuffer(arrOUS[0]), new OUString(aUStr8) },
1039cdf0e10cSrcweir 	{"Appends the string(length more than 16) to the string buffer arrOUS[0]",
1040cdf0e10cSrcweir                 new OUString(aUStr2),
1041cdf0e10cSrcweir                 new OUStringBuffer(arrOUS[0]), new OUString(aUStr36) },
1042cdf0e10cSrcweir         {"Appends the string(length equal to 16) to the string buffer arrOUS[0]",
1043cdf0e10cSrcweir                 new OUString(aUStr37),
1044cdf0e10cSrcweir                 new OUStringBuffer(arrOUS[0]), new OUString(aUStr23) },
1045cdf0e10cSrcweir 	{"Appends the string(length equal to 0) to the string buffer arrOUS[0]",
1046cdf0e10cSrcweir                 new OUString(aUStr7),
1047cdf0e10cSrcweir                 new OUStringBuffer(arrOUS[0]), new OUString()},
1048cdf0e10cSrcweir 	{"Appends the string(length less than 16) to the string buffer arrOUS[1]",
1049cdf0e10cSrcweir                 new OUString(aUStr7),
1050cdf0e10cSrcweir                 new OUStringBuffer(arrOUS[1]), new OUString(aUStr7)},
1051cdf0e10cSrcweir         {"Appends the string(length more than 16) to the string buffer arrOUS[1]",
1052cdf0e10cSrcweir                 new OUString(aUStr2),
1053cdf0e10cSrcweir                 new OUStringBuffer(arrOUS[1]), new OUString(aUStr2)},
1054cdf0e10cSrcweir 	{"Appends the string(length equal to 16) to the string buffer arrOUS[1]",
1055cdf0e10cSrcweir                 new OUString(aUStr1),
1056cdf0e10cSrcweir                 new OUStringBuffer(arrOUS[1]), new OUString(aUStr1) },
1057cdf0e10cSrcweir         {"Appends the string(length equal to 0) to the string buffer arrOUS[1]",
1058cdf0e10cSrcweir                 new OUString(),
1059cdf0e10cSrcweir                 new OUStringBuffer(arrOUS[1]), new OUString()},
1060cdf0e10cSrcweir         {"Appends the string(length less than 16) to the string buffer arrOUS[2]",
1061cdf0e10cSrcweir                 new OUString(aUStr7),
1062cdf0e10cSrcweir                 new OUStringBuffer(arrOUS[2]), new OUString(aUStr7)},
1063cdf0e10cSrcweir         {"Appends the string(length more than 16) to the string buffer arrOUS[2]",
1064cdf0e10cSrcweir                 new OUString(aUStr2),
1065cdf0e10cSrcweir                 new OUStringBuffer(arrOUS[2]), new OUString(aUStr2)},
1066cdf0e10cSrcweir 	{"Appends the string(length equal to 16) to the string buffer arrOUS[2]",
1067cdf0e10cSrcweir                 new OUString(aUStr1),
1068cdf0e10cSrcweir                 new OUStringBuffer(arrOUS[2]), new OUString(aUStr1) },
1069cdf0e10cSrcweir         {"Appends the string(length equal to 0) to the string buffer arrOUS[2]",
1070cdf0e10cSrcweir                 new OUString(),
1071cdf0e10cSrcweir                 new OUStringBuffer(arrOUS[2]), new OUString()},
1072cdf0e10cSrcweir         {"Appends the string(length less than 16) to the string buffer arrOUS[3]",
1073cdf0e10cSrcweir                 new OUString(aUStr7),
1074cdf0e10cSrcweir                 new OUStringBuffer(arrOUS[3]), new OUString(aUStr7)},
1075cdf0e10cSrcweir         {"Appends the string(length more than 16) to the string buffer arrOUS[3]",
1076cdf0e10cSrcweir                 new OUString(aUStr2),
1077cdf0e10cSrcweir                 new OUStringBuffer(arrOUS[3]), new OUString(aUStr2)},
1078cdf0e10cSrcweir 	{"Appends the string(length equal to 16) to the string buffer arrOUS[3]",
1079cdf0e10cSrcweir                 new OUString(aUStr1),
1080cdf0e10cSrcweir                 new OUStringBuffer(arrOUS[3]), new OUString(aUStr1) },
1081cdf0e10cSrcweir         {"Appends the string(length equal to 0) to the string buffer arrOUS[3]",
1082cdf0e10cSrcweir                 new OUString(),
1083cdf0e10cSrcweir                 new OUStringBuffer(arrOUS[3]), new OUString()},
1084cdf0e10cSrcweir         {"Appends the string(length less than 16) to the string buffer arrOUS[4]",
1085cdf0e10cSrcweir                 new OUString(aUStr29),
1086cdf0e10cSrcweir                 new OUStringBuffer(arrOUS[4]), new OUString(aUStr38)},
1087cdf0e10cSrcweir         {"Appends the string(length more than 16) to the string buffer arrOUS[4]",
1088cdf0e10cSrcweir                 new OUString(aUStr39),
1089cdf0e10cSrcweir                 new OUStringBuffer(arrOUS[4]), new OUString(aUStr17)},
1090cdf0e10cSrcweir 	{"Appends the string(length equal to 16) to the string buffer arrOUS[4]",
1091cdf0e10cSrcweir                 new OUString(aUStr40),
1092cdf0e10cSrcweir                 new OUStringBuffer(arrOUS[4]), new OUString(aUStr31) },
1093cdf0e10cSrcweir         {"Appends the string(length equal to 0) to the string buffer arrOUS[4]",
1094cdf0e10cSrcweir                 new OUString(aUStr28),
1095cdf0e10cSrcweir                 new OUStringBuffer(arrOUS[4]), new OUString()}
1096cdf0e10cSrcweir #ifdef WITH_CORE
1097cdf0e10cSrcweir         ,{"Appends the string(length equal to 0) to the string buffer(with INT_MAX) ",
1098cdf0e10cSrcweir                 new OUString(),
1099cdf0e10cSrcweir                 new OUStringBuffer(kSInt32Max), new OUString()}
1100cdf0e10cSrcweir #endif
1101cdf0e10cSrcweir 	};
1102cdf0e10cSrcweir 
1103cdf0e10cSrcweir 
1104cdf0e10cSrcweir     sal_Bool res = sal_True;
1105cdf0e10cSrcweir     sal_uInt32 i;
1106cdf0e10cSrcweir 
1107cdf0e10cSrcweir     for (i = 0; i < (sizeof (arrTestCase))/(sizeof (TestCase)); i++)
1108cdf0e10cSrcweir     {
1109cdf0e10cSrcweir         arrTestCase[i].input1->append( *(arrTestCase[i].input2) );
1110cdf0e10cSrcweir         sal_Bool lastRes =
1111cdf0e10cSrcweir             ( arrTestCase[i].input1->getStr()== *(arrTestCase[i].expVal) &&
1112cdf0e10cSrcweir               arrTestCase[i].input1->getLength() == arrTestCase[i].expVal->getLength()  );
1113cdf0e10cSrcweir 
1114cdf0e10cSrcweir         c_rtl_tres_state
1115cdf0e10cSrcweir         (
1116cdf0e10cSrcweir             hRtlTestResult,
1117cdf0e10cSrcweir             lastRes,
1118cdf0e10cSrcweir             arrTestCase[i].comments,
1119cdf0e10cSrcweir             createName( pMeth, "append(const OUString &str)_001", i )
1120cdf0e10cSrcweir 
1121cdf0e10cSrcweir         );
1122cdf0e10cSrcweir 
1123cdf0e10cSrcweir         res &= lastRes;
1124cdf0e10cSrcweir     }
1125cdf0e10cSrcweir 
1126cdf0e10cSrcweir     return ( res );
1127cdf0e10cSrcweir }
1128cdf0e10cSrcweir //------------------------------------------------------------------------
1129cdf0e10cSrcweir // testing the method append( const sal_Unicode * str )
1130cdf0e10cSrcweir //------------------------------------------------------------------------
1131cdf0e10cSrcweir 
test_rtl_OUStringBuffer_append_002(hTestResult hRtlTestResult)1132cdf0e10cSrcweir sal_Bool SAL_CALL test_rtl_OUStringBuffer_append_002(
1133cdf0e10cSrcweir                                               hTestResult hRtlTestResult)
1134cdf0e10cSrcweir {
1135cdf0e10cSrcweir     sal_Char methName[MAXBUFLENGTH];
1136cdf0e10cSrcweir     sal_Char* pMeth = methName;
1137cdf0e10cSrcweir 
1138cdf0e10cSrcweir     OUString arrOUS[5]={OUString( aUStr7 ),
1139cdf0e10cSrcweir                         OUString(),
1140cdf0e10cSrcweir                         OUString( aUStr25 ),
1141cdf0e10cSrcweir                         OUString( "\0",0,
1142cdf0e10cSrcweir 	                kEncodingRTLTextUSASCII,
1143cdf0e10cSrcweir 	                kConvertFlagsOStringToOUString),
1144cdf0e10cSrcweir                         OUString( aUStr28 )};
1145cdf0e10cSrcweir 
1146cdf0e10cSrcweir     typedef struct TestCase
1147cdf0e10cSrcweir     {
1148cdf0e10cSrcweir 	sal_Char*		comments;
1149cdf0e10cSrcweir 	OUString*               expVal;
1150cdf0e10cSrcweir         OUStringBuffer*         input1;
1151cdf0e10cSrcweir         sal_Unicode*            input2;
1152cdf0e10cSrcweir 
1153cdf0e10cSrcweir     	~TestCase()             { delete input1; delete expVal; }
1154cdf0e10cSrcweir     } TestCase;
1155cdf0e10cSrcweir 
1156cdf0e10cSrcweir     TestCase arrTestCase[]={
1157cdf0e10cSrcweir 
1158cdf0e10cSrcweir 	{"Appends the string(length less than 16) to the string buffer arrOUS[0]",
1159cdf0e10cSrcweir                 new OUString(aUStr1),
1160cdf0e10cSrcweir                 new OUStringBuffer(arrOUS[0]), aUStr8 },
1161cdf0e10cSrcweir 	{"Appends the string(length more than 16) to the string buffer arrOUS[0]",
1162cdf0e10cSrcweir                 new OUString(aUStr2),
1163cdf0e10cSrcweir                 new OUStringBuffer(arrOUS[0]), aUStr36 },
1164cdf0e10cSrcweir         {"Appends the string(length equal to 16) to the string buffer arrOUS[0]",
1165cdf0e10cSrcweir                 new OUString(aUStr37),
1166cdf0e10cSrcweir                 new OUStringBuffer(arrOUS[0]), aUStr23 },
1167cdf0e10cSrcweir 	{"Appends the string(length equal to 0) to the string buffer arrOUS[0]",
1168cdf0e10cSrcweir                 new OUString(aUStr7),
1169cdf0e10cSrcweir                 new OUStringBuffer(arrOUS[0]), aUStr25 },
1170cdf0e10cSrcweir 	{"Appends the string(length less than 16) to the string buffer arrOUS[1]",
1171cdf0e10cSrcweir                 new OUString(aUStr7),
1172cdf0e10cSrcweir                 new OUStringBuffer(arrOUS[1]), aUStr7 },
1173cdf0e10cSrcweir         {"Appends the string(length more than 16) to the string buffer arrOUS[1]",
1174cdf0e10cSrcweir                 new OUString(aUStr2),
1175cdf0e10cSrcweir                 new OUStringBuffer(arrOUS[1]), aUStr2 },
1176cdf0e10cSrcweir 	{"Appends the string(length equal to 16) to the string buffer arrOUS[1]",
1177cdf0e10cSrcweir                 new OUString(aUStr1),
1178cdf0e10cSrcweir                 new OUStringBuffer(arrOUS[1]), aUStr1 },
1179cdf0e10cSrcweir         {"Appends the string(length equal to 0) to the string buffer arrOUS[1]",
1180cdf0e10cSrcweir                 new OUString(),
1181cdf0e10cSrcweir                 new OUStringBuffer(arrOUS[1]), aUStr25 },
1182cdf0e10cSrcweir         {"Appends the string(length less than 16) to the string buffer arrOUS[2]",
1183cdf0e10cSrcweir                 new OUString(aUStr7),
1184cdf0e10cSrcweir                 new OUStringBuffer(arrOUS[2]), aUStr7 },
1185cdf0e10cSrcweir         {"Appends the string(length more than 16) to the string buffer arrOUS[2]",
1186cdf0e10cSrcweir                 new OUString(aUStr2),
1187cdf0e10cSrcweir                 new OUStringBuffer(arrOUS[2]), aUStr2 },
1188cdf0e10cSrcweir 	{"Appends the string(length equal to 16) to the string buffer arrOUS[2]",
1189cdf0e10cSrcweir                 new OUString(aUStr1),
1190cdf0e10cSrcweir                 new OUStringBuffer(arrOUS[2]), aUStr1 },
1191cdf0e10cSrcweir         {"Appends the string(length equal to 0) to the string buffer arrOUS[2]",
1192cdf0e10cSrcweir                 new OUString(),
1193cdf0e10cSrcweir                 new OUStringBuffer(arrOUS[2]), aUStr25 },
1194cdf0e10cSrcweir         {"Appends the string(length less than 16) to the string buffer arrOUS[3]",
1195cdf0e10cSrcweir                 new OUString(aUStr7),
1196cdf0e10cSrcweir                 new OUStringBuffer(arrOUS[3]), aUStr7 },
1197cdf0e10cSrcweir         {"Appends the string(length more than 16) to the string buffer arrOUS[3]",
1198cdf0e10cSrcweir                 new OUString(aUStr2),
1199cdf0e10cSrcweir                 new OUStringBuffer(arrOUS[3]), aUStr2 },
1200cdf0e10cSrcweir 	{"Appends the string(length equal to 16) to the string buffer arrOUS[3]",
1201cdf0e10cSrcweir                 new OUString(aUStr1),
1202cdf0e10cSrcweir                 new OUStringBuffer(arrOUS[3]), aUStr1 },
1203cdf0e10cSrcweir         {"Appends the string(length equal to 0) to the string buffer arrOUS[3]",
1204cdf0e10cSrcweir                 new OUString(),
1205cdf0e10cSrcweir                 new OUStringBuffer(arrOUS[3]), aUStr25 },
1206cdf0e10cSrcweir         {"Appends the string(length less than 16) to the string buffer arrOUS[4]",
1207cdf0e10cSrcweir                 new OUString(aUStr29),
1208cdf0e10cSrcweir                 new OUStringBuffer(arrOUS[4]), aUStr38 },
1209cdf0e10cSrcweir         {"Appends the string(length more than 16) to the string buffer arrOUS[4]",
1210cdf0e10cSrcweir                 new OUString(aUStr39),
1211cdf0e10cSrcweir                 new OUStringBuffer(arrOUS[4]), aUStr17 },
1212cdf0e10cSrcweir 	{"Appends the string(length equal to 16) to the string buffer arrOUS[4]",
1213cdf0e10cSrcweir                 new OUString(aUStr40),
1214cdf0e10cSrcweir                 new OUStringBuffer(arrOUS[4]), aUStr31 },
1215cdf0e10cSrcweir         {"Appends the string(length equal to 0) to the string buffer arrOUS[4]",
1216cdf0e10cSrcweir                 new OUString(aUStr28),
1217cdf0e10cSrcweir                 new OUStringBuffer(arrOUS[4]), aUStr25 }
1218cdf0e10cSrcweir #ifdef WITH_CORE
1219cdf0e10cSrcweir         ,{"Appends the string(length equal to 0) to the string buffer(with INT_MAX) ",
1220cdf0e10cSrcweir                 new OUString(),
1221cdf0e10cSrcweir                 new OUStringBuffer(kSInt32Max), aUStr25 }
1222cdf0e10cSrcweir #endif
1223cdf0e10cSrcweir 	};
1224cdf0e10cSrcweir 
1225cdf0e10cSrcweir 
1226cdf0e10cSrcweir     sal_Bool res = sal_True;
1227cdf0e10cSrcweir     sal_uInt32 i;
1228cdf0e10cSrcweir 
1229cdf0e10cSrcweir     for (i = 0; i < (sizeof (arrTestCase))/(sizeof (TestCase)); i++)
1230cdf0e10cSrcweir     {
1231cdf0e10cSrcweir         arrTestCase[i].input1->append( arrTestCase[i].input2 );
1232cdf0e10cSrcweir         sal_Bool lastRes =
1233cdf0e10cSrcweir             ( arrTestCase[i].input1->getStr()== *(arrTestCase[i].expVal) &&
1234cdf0e10cSrcweir               arrTestCase[i].input1->getLength() == arrTestCase[i].expVal->getLength()  );
1235cdf0e10cSrcweir 
1236cdf0e10cSrcweir         c_rtl_tres_state
1237cdf0e10cSrcweir         (
1238cdf0e10cSrcweir             hRtlTestResult,
1239cdf0e10cSrcweir             lastRes,
1240cdf0e10cSrcweir             arrTestCase[i].comments,
1241cdf0e10cSrcweir             createName( pMeth, "append( const sal_Unicode * str )_002", i )
1242cdf0e10cSrcweir 
1243cdf0e10cSrcweir         );
1244cdf0e10cSrcweir 
1245cdf0e10cSrcweir         res &= lastRes;
1246cdf0e10cSrcweir     }
1247cdf0e10cSrcweir 
1248cdf0e10cSrcweir     return ( res );
1249cdf0e10cSrcweir }
1250cdf0e10cSrcweir //------------------------------------------------------------------------
1251cdf0e10cSrcweir // testing the method append( const sal_Unicode * str, sal_Int32 len)
1252cdf0e10cSrcweir //------------------------------------------------------------------------
1253cdf0e10cSrcweir 
test_rtl_OUStringBuffer_append_003(hTestResult hRtlTestResult)1254cdf0e10cSrcweir sal_Bool SAL_CALL test_rtl_OUStringBuffer_append_003(
1255cdf0e10cSrcweir                                               hTestResult hRtlTestResult)
1256cdf0e10cSrcweir {
1257cdf0e10cSrcweir     sal_Char methName[MAXBUFLENGTH];
1258cdf0e10cSrcweir     sal_Char* pMeth = methName;
1259cdf0e10cSrcweir 
1260cdf0e10cSrcweir     OUString arrOUS[5]={OUString( aUStr7 ),
1261cdf0e10cSrcweir                         OUString(),
1262cdf0e10cSrcweir                         OUString( aUStr25 ),
1263cdf0e10cSrcweir                         OUString( "\0",0,
1264cdf0e10cSrcweir 	                kEncodingRTLTextUSASCII,
1265cdf0e10cSrcweir 	                kConvertFlagsOStringToOUString),
1266cdf0e10cSrcweir                         OUString( aUStr28 )};
1267cdf0e10cSrcweir 
1268cdf0e10cSrcweir     typedef struct TestCase
1269cdf0e10cSrcweir     {
1270cdf0e10cSrcweir 	sal_Char*		comments;
1271cdf0e10cSrcweir 	OUString*               expVal;
1272cdf0e10cSrcweir         OUStringBuffer*         input1;
1273cdf0e10cSrcweir         sal_Unicode*            input2;
1274cdf0e10cSrcweir         sal_Int32               input3;
1275cdf0e10cSrcweir 
1276cdf0e10cSrcweir     	~TestCase()             { delete input1; delete expVal; }
1277cdf0e10cSrcweir     } TestCase;
1278cdf0e10cSrcweir 
1279cdf0e10cSrcweir     TestCase arrTestCase[]={
1280cdf0e10cSrcweir 
1281cdf0e10cSrcweir 	{"Appends the string(length less than 16) to the string buffer arrOUS[0]",
1282cdf0e10cSrcweir                 new OUString(aUStr1),
1283cdf0e10cSrcweir                 new OUStringBuffer(arrOUS[0]), aUStr36, 12 },
1284cdf0e10cSrcweir 	{"Appends the string(length more than 16) to the string buffer arrOUS[0]",
1285cdf0e10cSrcweir                 new OUString(aUStr2),
1286cdf0e10cSrcweir                 new OUStringBuffer(arrOUS[0]), aUStr36, 28 },
1287cdf0e10cSrcweir         {"Appends the string(length equal to 16) to the string buffer arrOUS[0]",
1288cdf0e10cSrcweir                 new OUString(aUStr37),
1289cdf0e10cSrcweir                 new OUStringBuffer(arrOUS[0]), aUStr23, 16 },
1290cdf0e10cSrcweir 	{"Appends the string(length equal to 0) to the string buffer arrOUS[0]",
1291cdf0e10cSrcweir                 new OUString(aUStr7),
1292cdf0e10cSrcweir                 new OUStringBuffer(arrOUS[0]), aUStr2, 0 },
1293cdf0e10cSrcweir     /* LLA: input3 must null < 0
1294cdf0e10cSrcweir         {"Appends the string(length less than 0) to the string buffer arrOUS[0]",
1295cdf0e10cSrcweir                 new OUString(aUStr41),
1296cdf0e10cSrcweir                 new OUStringBuffer(arrOUS[0]), aUStr2, -1 },
1297cdf0e10cSrcweir     */
1298cdf0e10cSrcweir 	{"Appends the string(length less than 16) to the string buffer arrOUS[1]",
1299cdf0e10cSrcweir                 new OUString(aUStr7),
1300cdf0e10cSrcweir                 new OUStringBuffer(arrOUS[1]), aUStr2, 4 },
1301cdf0e10cSrcweir         {"Appends the string(length more than 16) to the string buffer arrOUS[1]",
1302cdf0e10cSrcweir                 new OUString(aUStr2),
1303cdf0e10cSrcweir                 new OUStringBuffer(arrOUS[1]), aUStr2, 32 },
1304cdf0e10cSrcweir 	{"Appends the string(length equal to 16) to the string buffer arrOUS[1]",
1305cdf0e10cSrcweir                 new OUString(aUStr1),
1306cdf0e10cSrcweir                 new OUStringBuffer(arrOUS[1]), aUStr2, 16 },
1307cdf0e10cSrcweir         {"Appends the string(length equal to 0) to the string buffer arrOUS[1]",
1308cdf0e10cSrcweir                 new OUString(),
1309cdf0e10cSrcweir                 new OUStringBuffer(arrOUS[1]), aUStr2, 0 },
1310cdf0e10cSrcweir     /* LLA: input3 must null < 0
1311cdf0e10cSrcweir         {"Appends the string(length less than 0) to the string buffer arrOUS[1]",
1312cdf0e10cSrcweir                 new OUString(),
1313cdf0e10cSrcweir                 new OUStringBuffer(arrOUS[1]), aUStr2, -1 },
1314cdf0e10cSrcweir     */
1315cdf0e10cSrcweir         {"Appends the string(length less than 16) to the string buffer arrOUS[2]",
1316cdf0e10cSrcweir                 new OUString(aUStr7),
1317cdf0e10cSrcweir                 new OUStringBuffer(arrOUS[2]), aUStr2, 4 },
1318cdf0e10cSrcweir         {"Appends the string(length more than 16) to the string buffer arrOUS[2]",
1319cdf0e10cSrcweir                 new OUString(aUStr2),
1320cdf0e10cSrcweir                 new OUStringBuffer(arrOUS[2]), aUStr2, 32 },
1321cdf0e10cSrcweir 	{"Appends the string(length equal to 16) to the string buffer arrOUS[2]",
1322cdf0e10cSrcweir                 new OUString(aUStr1),
1323cdf0e10cSrcweir                 new OUStringBuffer(arrOUS[2]), aUStr2, 16 },
1324cdf0e10cSrcweir         {"Appends the string(length equal to 0) to the string buffer arrOUS[2]",
1325cdf0e10cSrcweir                 new OUString(),
1326cdf0e10cSrcweir                 new OUStringBuffer(arrOUS[2]), aUStr2, 0 },
1327cdf0e10cSrcweir     /* LLA: input3 must null < 0
1328cdf0e10cSrcweir         {"Appends the string(length less than 0) to the string buffer arrOUS[2]",
1329cdf0e10cSrcweir                 new OUString(),
1330cdf0e10cSrcweir                 new OUStringBuffer(arrOUS[2]), aUStr2, -1 },
1331cdf0e10cSrcweir     */
1332cdf0e10cSrcweir         {"Appends the string(length less than 16) to the string buffer arrOUS[3]",
1333cdf0e10cSrcweir                 new OUString(aUStr7),
1334cdf0e10cSrcweir                 new OUStringBuffer(arrOUS[3]), aUStr2, 4 },
1335cdf0e10cSrcweir         {"Appends the string(length more than 16) to the string buffer arrOUS[3]",
1336cdf0e10cSrcweir                 new OUString(aUStr2),
1337cdf0e10cSrcweir                 new OUStringBuffer(arrOUS[3]), aUStr2, 32 },
1338cdf0e10cSrcweir 	{"Appends the string(length equal to 16) to the string buffer arrOUS[3]",
1339cdf0e10cSrcweir                 new OUString(aUStr1),
1340cdf0e10cSrcweir                 new OUStringBuffer(arrOUS[3]), aUStr2, 16 },
1341cdf0e10cSrcweir         {"Appends the string(length equal to 0) to the string buffer arrOUS[3]",
1342cdf0e10cSrcweir                 new OUString(),
1343cdf0e10cSrcweir                 new OUStringBuffer(arrOUS[3]), aUStr2, 0 },
1344cdf0e10cSrcweir     /* LLA: input3 must null < 0
1345cdf0e10cSrcweir         {"Appends the string(length less than 0) to the string buffer arrOUS[3]",
1346cdf0e10cSrcweir                 new OUString(),
1347cdf0e10cSrcweir                 new OUStringBuffer(arrOUS[3]), aUStr2, -1 },
1348cdf0e10cSrcweir     */
1349cdf0e10cSrcweir         {"Appends the string(length less than 16) to the string buffer arrOUS[4]",
1350cdf0e10cSrcweir                 new OUString(aUStr29),
1351cdf0e10cSrcweir                 new OUStringBuffer(arrOUS[4]), aUStr38, 7 },
1352cdf0e10cSrcweir         {"Appends the string(length more than 16) to the string buffer arrOUS[4]",
1353cdf0e10cSrcweir                 new OUString(aUStr39),
1354cdf0e10cSrcweir                 new OUStringBuffer(arrOUS[4]), aUStr17, 22 },
1355cdf0e10cSrcweir 	{"Appends the string(length equal to 16) to the string buffer arrOUS[4]",
1356cdf0e10cSrcweir                 new OUString(aUStr40),
1357cdf0e10cSrcweir                 new OUStringBuffer(arrOUS[4]), aUStr31, 16 },
1358cdf0e10cSrcweir         {"Appends the string(length equal to 0) to the string buffer arrOUS[4]",
1359cdf0e10cSrcweir                 new OUString(aUStr28),
1360cdf0e10cSrcweir                 new OUStringBuffer(arrOUS[4]), aUStr2, 0 },
1361cdf0e10cSrcweir     /* LLA: input3 must null < 0
1362cdf0e10cSrcweir       {"Appends the string(length less than 0) to the string buffer arrOUS[4]",
1363cdf0e10cSrcweir                 new OUString(aUStr42),
1364cdf0e10cSrcweir                 new OUStringBuffer(arrOUS[4]), aUStr2, -1 }
1365cdf0e10cSrcweir     */
1366cdf0e10cSrcweir #ifdef WITH_CORE
1367cdf0e10cSrcweir         ,{"Appends the string(length equal to 0) to the string buffer(with INT_MAX) ",
1368cdf0e10cSrcweir                 new OUString(),
1369cdf0e10cSrcweir                 new OUStringBuffer(kSInt32Max), aUStr25 }
1370cdf0e10cSrcweir #endif
1371cdf0e10cSrcweir 	};
1372cdf0e10cSrcweir 
1373cdf0e10cSrcweir 
1374cdf0e10cSrcweir     sal_Bool res = sal_True;
1375cdf0e10cSrcweir     sal_uInt32 i;
1376cdf0e10cSrcweir 
1377cdf0e10cSrcweir     for (i = 0; i < (sizeof (arrTestCase))/(sizeof (TestCase)); i++)
1378cdf0e10cSrcweir     {
1379cdf0e10cSrcweir         arrTestCase[i].input1->append(
1380cdf0e10cSrcweir                     arrTestCase[i].input2, arrTestCase[i].input3);
1381cdf0e10cSrcweir         sal_Bool lastRes =
1382cdf0e10cSrcweir             ( arrTestCase[i].input1->getStr()== *(arrTestCase[i].expVal) &&
1383cdf0e10cSrcweir               arrTestCase[i].input1->getLength() == arrTestCase[i].expVal->getLength()  );
1384cdf0e10cSrcweir 
1385cdf0e10cSrcweir         c_rtl_tres_state
1386cdf0e10cSrcweir         (
1387cdf0e10cSrcweir             hRtlTestResult,
1388cdf0e10cSrcweir             lastRes,
1389cdf0e10cSrcweir             arrTestCase[i].comments,
1390cdf0e10cSrcweir             createName( pMeth, "append( const sal_Unicode * str, sal_Int32 len)_003", i )
1391cdf0e10cSrcweir 
1392cdf0e10cSrcweir         );
1393cdf0e10cSrcweir 
1394cdf0e10cSrcweir         res &= lastRes;
1395cdf0e10cSrcweir     }
1396cdf0e10cSrcweir 
1397cdf0e10cSrcweir     return ( res );
1398cdf0e10cSrcweir }
1399cdf0e10cSrcweir //------------------------------------------------------------------------
1400cdf0e10cSrcweir // testing the method append(sal_Bool b)
1401cdf0e10cSrcweir //------------------------------------------------------------------------
1402cdf0e10cSrcweir 
test_rtl_OUStringBuffer_append_004(hTestResult hRtlTestResult)1403cdf0e10cSrcweir sal_Bool SAL_CALL test_rtl_OUStringBuffer_append_004(
1404cdf0e10cSrcweir                                               hTestResult hRtlTestResult)
1405cdf0e10cSrcweir {
1406cdf0e10cSrcweir     sal_Char methName[MAXBUFLENGTH];
1407cdf0e10cSrcweir     sal_Char* pMeth = methName;
1408cdf0e10cSrcweir 
1409cdf0e10cSrcweir     OUString arrOUS[5]={OUString( aUStr7 ),
1410cdf0e10cSrcweir                         OUString(),
1411cdf0e10cSrcweir                         OUString( aUStr25 ),
1412cdf0e10cSrcweir                         OUString( "\0",0,
1413cdf0e10cSrcweir 	                kEncodingRTLTextUSASCII,
1414cdf0e10cSrcweir 	                kConvertFlagsOStringToOUString),
1415cdf0e10cSrcweir                         OUString( aUStr28 )};
1416cdf0e10cSrcweir 
1417cdf0e10cSrcweir     typedef struct TestCase
1418cdf0e10cSrcweir     {
1419cdf0e10cSrcweir 	sal_Char*		comments;
1420cdf0e10cSrcweir 	OUString*               expVal;
1421cdf0e10cSrcweir         OUStringBuffer*         input1;
1422cdf0e10cSrcweir         sal_Bool                input2;
1423cdf0e10cSrcweir 
1424cdf0e10cSrcweir     	~TestCase()             { delete input1; delete expVal; }
1425cdf0e10cSrcweir     } TestCase;
1426cdf0e10cSrcweir 
1427cdf0e10cSrcweir     TestCase arrTestCase[]={
1428cdf0e10cSrcweir 
1429cdf0e10cSrcweir 	{"Appends the sal_Bool(sal_True) to the string buffer arrOUS[0]",
1430cdf0e10cSrcweir                 new OUString(aUStr45),
1431cdf0e10cSrcweir                 new OUStringBuffer(arrOUS[0]), sal_True },
1432cdf0e10cSrcweir 	{"Appends the sal_Bool(sal_False) to the string buffer arrOUS[0]",
1433cdf0e10cSrcweir                 new OUString(aUStr46),
1434cdf0e10cSrcweir                 new OUStringBuffer(arrOUS[0]), sal_False },
1435cdf0e10cSrcweir 	{"Appends the sal_Bool(sal_True) to the string buffer arrOUS[1]",
1436cdf0e10cSrcweir                 new OUString(aUStr47),
1437cdf0e10cSrcweir                 new OUStringBuffer(arrOUS[1]), sal_True },
1438cdf0e10cSrcweir         {"Appends the sal_Bool(sal_False) to the string buffer arrOUS[1]",
1439cdf0e10cSrcweir                 new OUString(aUStr48),
1440cdf0e10cSrcweir                 new OUStringBuffer(arrOUS[1]), sal_False },
1441cdf0e10cSrcweir         {"Appends the sal_Bool(sal_True) to the string buffer arrOUS[2]",
1442cdf0e10cSrcweir                 new OUString(aUStr47),
1443cdf0e10cSrcweir                 new OUStringBuffer(arrOUS[2]), sal_True },
1444cdf0e10cSrcweir         {"Appends the sal_Bool(sal_False) to the string buffer arrOUS[2]",
1445cdf0e10cSrcweir                 new OUString(aUStr48),
1446cdf0e10cSrcweir                 new OUStringBuffer(arrOUS[2]), sal_False },
1447cdf0e10cSrcweir         {"Appends the sal_Bool(sal_True) to the string buffer arrOUS[3]",
1448cdf0e10cSrcweir                 new OUString(aUStr47),
1449cdf0e10cSrcweir                 new OUStringBuffer(arrOUS[3]), sal_True },
1450cdf0e10cSrcweir         {"Appends the sal_Bool(sal_False) to the string buffer arrOUS[3]",
1451cdf0e10cSrcweir                 new OUString(aUStr48),
1452cdf0e10cSrcweir                 new OUStringBuffer(arrOUS[3]), sal_False },
1453cdf0e10cSrcweir         {"Appends the sal_Bool(sal_True) to the string buffer arrOUS[4]",
1454cdf0e10cSrcweir                 new OUString(aUStr49),
1455cdf0e10cSrcweir                 new OUStringBuffer(arrOUS[4]), sal_True },
1456cdf0e10cSrcweir         {"Appends the sal_Bool(sal_False) to the string buffer arrOUS[4]",
1457cdf0e10cSrcweir                 new OUString(aUStr50),
1458cdf0e10cSrcweir                 new OUStringBuffer(arrOUS[4]), sal_False }
1459cdf0e10cSrcweir #ifdef WITH_CORE
1460cdf0e10cSrcweir         ,{"Appends the sal_Bool(sal_True) to the string buffer(with INT_MAX) ",
1461cdf0e10cSrcweir                 new OUString(aUStr47),
1462cdf0e10cSrcweir                 new OUStringBuffer(kSInt32Max), sal_True },
1463cdf0e10cSrcweir         {"Appends the sal_Bool(sal_False) to the string buffer(with INT_MAX) ",
1464cdf0e10cSrcweir                 new OUString(aUStr48),
1465cdf0e10cSrcweir                 new OUStringBuffer(kSInt32Max), sal_False }
1466cdf0e10cSrcweir #endif
1467cdf0e10cSrcweir 	};
1468cdf0e10cSrcweir 
1469cdf0e10cSrcweir 
1470cdf0e10cSrcweir     sal_Bool res = sal_True;
1471cdf0e10cSrcweir     sal_uInt32 i;
1472cdf0e10cSrcweir 
1473cdf0e10cSrcweir     for (i = 0; i < (sizeof (arrTestCase))/(sizeof (TestCase)); i++)
1474cdf0e10cSrcweir     {
1475cdf0e10cSrcweir         arrTestCase[i].input1->append(
1476cdf0e10cSrcweir                     arrTestCase[i].input2 );
1477cdf0e10cSrcweir         sal_Bool lastRes =
1478cdf0e10cSrcweir             ( arrTestCase[i].input1->getStr()== *(arrTestCase[i].expVal) &&
1479cdf0e10cSrcweir               arrTestCase[i].input1->getLength() == arrTestCase[i].expVal->getLength()  );
1480cdf0e10cSrcweir 
1481cdf0e10cSrcweir         c_rtl_tres_state
1482cdf0e10cSrcweir         (
1483cdf0e10cSrcweir             hRtlTestResult,
1484cdf0e10cSrcweir             lastRes,
1485cdf0e10cSrcweir             arrTestCase[i].comments,
1486cdf0e10cSrcweir             createName( pMeth, "append( sal_Bool b)_004", i )
1487cdf0e10cSrcweir 
1488cdf0e10cSrcweir         );
1489cdf0e10cSrcweir 
1490cdf0e10cSrcweir         res &= lastRes;
1491cdf0e10cSrcweir     }
1492cdf0e10cSrcweir 
1493cdf0e10cSrcweir     return ( res );
1494cdf0e10cSrcweir }
1495cdf0e10cSrcweir 
test_rtl_OUStringBuffer_appends(hTestResult hRtlTestResult)1496cdf0e10cSrcweir extern "C" void /* sal_Bool */ SAL_CALL test_rtl_OUStringBuffer_appends(
1497cdf0e10cSrcweir 	                                          hTestResult hRtlTestResult )
1498cdf0e10cSrcweir {
1499cdf0e10cSrcweir     c_rtl_tres_state_start( hRtlTestResult, "appends");
1500cdf0e10cSrcweir     sal_Bool bTSState = test_rtl_OUStringBuffer_append_001( hRtlTestResult );
1501cdf0e10cSrcweir     bTSState &= test_rtl_OUStringBuffer_append_002( hRtlTestResult);
1502cdf0e10cSrcweir     bTSState &= test_rtl_OUStringBuffer_append_003( hRtlTestResult);
1503cdf0e10cSrcweir     bTSState &= test_rtl_OUStringBuffer_append_004( hRtlTestResult);
1504cdf0e10cSrcweir 
1505cdf0e10cSrcweir     c_rtl_tres_state_end( hRtlTestResult, "appends");
1506cdf0e10cSrcweir //    return( bTSState );
1507cdf0e10cSrcweir }
1508cdf0e10cSrcweir //------------------------------------------------------------------------
1509cdf0e10cSrcweir // testing the method appendAscii( const sal_Char * str )
1510cdf0e10cSrcweir //------------------------------------------------------------------------
1511cdf0e10cSrcweir 
test_rtl_OUStringBuffer_appendAscii_001(hTestResult hRtlTestResult)1512cdf0e10cSrcweir sal_Bool SAL_CALL test_rtl_OUStringBuffer_appendAscii_001(
1513cdf0e10cSrcweir                                               hTestResult hRtlTestResult)
1514cdf0e10cSrcweir {
1515cdf0e10cSrcweir     sal_Char methName[MAXBUFLENGTH];
1516cdf0e10cSrcweir     sal_Char* pMeth = methName;
1517cdf0e10cSrcweir 
1518cdf0e10cSrcweir     OUString arrOUS[5]={OUString( aUStr7 ),
1519cdf0e10cSrcweir                         OUString(),
1520cdf0e10cSrcweir                         OUString( aUStr25 ),
1521cdf0e10cSrcweir                         OUString( "\0",0,
1522cdf0e10cSrcweir 	                kEncodingRTLTextUSASCII,
1523cdf0e10cSrcweir 	                kConvertFlagsOStringToOUString),
1524cdf0e10cSrcweir                         OUString( aUStr28 )};
1525cdf0e10cSrcweir 
1526cdf0e10cSrcweir     typedef struct TestCase
1527cdf0e10cSrcweir     {
1528cdf0e10cSrcweir 	sal_Char*		comments;
1529cdf0e10cSrcweir 	OUString*               expVal;
1530cdf0e10cSrcweir         OUStringBuffer*         input1;
1531cdf0e10cSrcweir         const sal_Char*         input2;
1532cdf0e10cSrcweir 
1533cdf0e10cSrcweir     	~TestCase()             { delete input1; delete expVal; }
1534cdf0e10cSrcweir     } TestCase;
1535cdf0e10cSrcweir 
1536cdf0e10cSrcweir     TestCase arrTestCase[]={
1537cdf0e10cSrcweir 
1538cdf0e10cSrcweir         {"Appends the string(length less than 16) to the string buffer arrOUS[0]",
1539cdf0e10cSrcweir                 new OUString(aUStr1),
1540cdf0e10cSrcweir                 new OUStringBuffer(arrOUS[0]), kTestStr8 },
1541cdf0e10cSrcweir 	{"Appends the string(length more than 16) to the string buffer arrOUS[0]",
1542cdf0e10cSrcweir                 new OUString(aUStr2),
1543cdf0e10cSrcweir                 new OUStringBuffer(arrOUS[0]), kTestStr36 },
1544cdf0e10cSrcweir         {"Appends the string(length equal to 16) to the string buffer arrOUS[0]",
1545cdf0e10cSrcweir                 new OUString(aUStr37),
1546cdf0e10cSrcweir                 new OUStringBuffer(arrOUS[0]), kTestStr23 },
1547cdf0e10cSrcweir 	{"Appends the string(length equal to 0) to the string buffer arrOUS[0]",
1548cdf0e10cSrcweir                 new OUString(aUStr7),
1549cdf0e10cSrcweir                 new OUStringBuffer(arrOUS[0]), kTestStr25 },
1550cdf0e10cSrcweir 	{"Appends the string(length less than 16) to the string buffer arrOUS[1]",
1551cdf0e10cSrcweir                 new OUString(aUStr7),
1552cdf0e10cSrcweir                 new OUStringBuffer(arrOUS[1]), kTestStr7 },
1553cdf0e10cSrcweir         {"Appends the string(length more than 16) to the string buffer arrOUS[1]",
1554cdf0e10cSrcweir                 new OUString(aUStr2),
1555cdf0e10cSrcweir                 new OUStringBuffer(arrOUS[1]), kTestStr2 },
1556cdf0e10cSrcweir 	{"Appends the string(length equal to 16) to the string buffer arrOUS[1]",
1557cdf0e10cSrcweir                 new OUString(aUStr1),
1558cdf0e10cSrcweir                 new OUStringBuffer(arrOUS[1]), kTestStr1 },
1559cdf0e10cSrcweir         {"Appends the string(length equal to 0) to the string buffer arrOUS[1]",
1560cdf0e10cSrcweir                 new OUString(),
1561cdf0e10cSrcweir                 new OUStringBuffer(arrOUS[1]), kTestStr25 },
1562cdf0e10cSrcweir         {"Appends the string(length less than 16) to the string buffer arrOUS[2]",
1563cdf0e10cSrcweir                 new OUString(aUStr7),
1564cdf0e10cSrcweir                 new OUStringBuffer(arrOUS[2]), kTestStr7 },
1565cdf0e10cSrcweir         {"Appends the string(length more than 16) to the string buffer arrOUS[2]",
1566cdf0e10cSrcweir                 new OUString(aUStr2),
1567cdf0e10cSrcweir                 new OUStringBuffer(arrOUS[2]), kTestStr2 },
1568cdf0e10cSrcweir 	{"Appends the string(length equal to 16) to the string buffer arrOUS[2]",
1569cdf0e10cSrcweir                 new OUString(aUStr1),
1570cdf0e10cSrcweir                 new OUStringBuffer(arrOUS[2]), kTestStr1 },
1571cdf0e10cSrcweir         {"Appends the string(length equal to 0) to the string buffer arrOUS[2]",
1572cdf0e10cSrcweir                 new OUString(),
1573cdf0e10cSrcweir                 new OUStringBuffer(arrOUS[2]), kTestStr25 },
1574cdf0e10cSrcweir         {"Appends the string(length less than 16) to the string buffer arrOUS[3]",
1575cdf0e10cSrcweir                 new OUString(aUStr7),
1576cdf0e10cSrcweir                 new OUStringBuffer(arrOUS[3]), kTestStr7 },
1577cdf0e10cSrcweir         {"Appends the string(length more than 16) to the string buffer arrOUS[3]",
1578cdf0e10cSrcweir                 new OUString(aUStr2),
1579cdf0e10cSrcweir                 new OUStringBuffer(arrOUS[3]), kTestStr2 },
1580cdf0e10cSrcweir 	{"Appends the string(length equal to 16) to the string buffer arrOUS[3]",
1581cdf0e10cSrcweir                 new OUString(aUStr1),
1582cdf0e10cSrcweir                 new OUStringBuffer(arrOUS[3]), kTestStr1 },
1583cdf0e10cSrcweir         {"Appends the string(length equal to 0) to the string buffer arrOUS[3]",
1584cdf0e10cSrcweir                 new OUString(),
1585cdf0e10cSrcweir                 new OUStringBuffer(arrOUS[3]), kTestStr25 },
1586cdf0e10cSrcweir         {"Appends the string(length less than 16) to the string buffer arrOUS[4]",
1587cdf0e10cSrcweir                 new OUString(aUStr29),
1588cdf0e10cSrcweir                 new OUStringBuffer(arrOUS[4]), kTestStr38 },
1589cdf0e10cSrcweir         {"Appends the string(length more than 16) to the string buffer arrOUS[4]",
1590cdf0e10cSrcweir                 new OUString(aUStr39),
1591cdf0e10cSrcweir                 new OUStringBuffer(arrOUS[4]), kTestStr17 },
1592cdf0e10cSrcweir 	{"Appends the string(length equal to 16) to the string buffer arrOUS[4]",
1593cdf0e10cSrcweir                 new OUString(aUStr40),
1594cdf0e10cSrcweir                 new OUStringBuffer(arrOUS[4]), kTestStr31 },
1595cdf0e10cSrcweir         {"Appends the string(length equal to 0) to the string buffer arrOUS[4]",
1596cdf0e10cSrcweir                 new OUString(aUStr28),
1597cdf0e10cSrcweir                 new OUStringBuffer(arrOUS[4]), kTestStr25 }
1598cdf0e10cSrcweir         /*{"Appends the string(with special characters) to the string buffer arrOUS[4]",
1599cdf0e10cSrcweir                 new OUString(aUStr43),
1600cdf0e10cSrcweir                 new OUStringBuffer(arrOUS[4]), kTestStr44 }*/
1601cdf0e10cSrcweir #ifdef WITH_CORE
1602cdf0e10cSrcweir         ,{"Appends the string(length equal to 0) to the string buffer(with INT_MAX) ",
1603cdf0e10cSrcweir                 new OUString(),
1604cdf0e10cSrcweir                 new OUStringBuffer(kSInt32Max), kTestStr25 }
1605cdf0e10cSrcweir #endif
1606cdf0e10cSrcweir 
1607cdf0e10cSrcweir 	};
1608cdf0e10cSrcweir 
1609cdf0e10cSrcweir 
1610cdf0e10cSrcweir     sal_Bool res = sal_True;
1611cdf0e10cSrcweir     sal_uInt32 i;
1612cdf0e10cSrcweir 
1613cdf0e10cSrcweir     for (i = 0; i < (sizeof (arrTestCase))/(sizeof (TestCase)); i++)
1614cdf0e10cSrcweir     {
1615cdf0e10cSrcweir         arrTestCase[i].input1->appendAscii( arrTestCase[i].input2 );
1616cdf0e10cSrcweir         sal_Bool lastRes =
1617cdf0e10cSrcweir             ( arrTestCase[i].input1->getStr()== *(arrTestCase[i].expVal) &&
1618cdf0e10cSrcweir               arrTestCase[i].input1->getLength() == arrTestCase[i].expVal->getLength()  );
1619cdf0e10cSrcweir 
1620cdf0e10cSrcweir             c_rtl_tres_state
1621cdf0e10cSrcweir             (
1622cdf0e10cSrcweir                 hRtlTestResult,
1623cdf0e10cSrcweir                 lastRes,
1624cdf0e10cSrcweir                 arrTestCase[i].comments,
1625cdf0e10cSrcweir                 createName( pMeth, "appendAscii_001", i )
1626cdf0e10cSrcweir             );
1627cdf0e10cSrcweir 
1628cdf0e10cSrcweir         res &= lastRes;
1629cdf0e10cSrcweir     }
1630cdf0e10cSrcweir     return ( res );
1631cdf0e10cSrcweir }
1632cdf0e10cSrcweir //------------------------------------------------------------------------
1633cdf0e10cSrcweir // testing the method appendAscii( const sal_Char * str, sal_Int32 len)
1634cdf0e10cSrcweir //------------------------------------------------------------------------
1635cdf0e10cSrcweir 
test_rtl_OUStringBuffer_appendAscii_002(hTestResult hRtlTestResult)1636cdf0e10cSrcweir sal_Bool SAL_CALL test_rtl_OUStringBuffer_appendAscii_002(
1637cdf0e10cSrcweir                                               hTestResult hRtlTestResult)
1638cdf0e10cSrcweir {
1639cdf0e10cSrcweir     sal_Char methName[MAXBUFLENGTH];
1640cdf0e10cSrcweir     sal_Char* pMeth = methName;
1641cdf0e10cSrcweir 
1642cdf0e10cSrcweir     OUString arrOUS[5]={OUString( aUStr7 ),
1643cdf0e10cSrcweir                         OUString(),
1644cdf0e10cSrcweir                         OUString( aUStr25 ),
1645cdf0e10cSrcweir                         OUString( "\0",0,
1646cdf0e10cSrcweir 	                kEncodingRTLTextUSASCII,
1647cdf0e10cSrcweir 	                kConvertFlagsOStringToOUString),
1648cdf0e10cSrcweir                         OUString( aUStr28 )};
1649cdf0e10cSrcweir 
1650cdf0e10cSrcweir     typedef struct TestCase
1651cdf0e10cSrcweir     {
1652cdf0e10cSrcweir 	sal_Char*		comments;
1653cdf0e10cSrcweir 	OUString*               expVal;
1654cdf0e10cSrcweir         OUStringBuffer*         input1;
1655cdf0e10cSrcweir         const sal_Char*         input2;
1656cdf0e10cSrcweir         sal_Int32               input3;
1657cdf0e10cSrcweir 
1658cdf0e10cSrcweir     	~TestCase()             { delete input1; delete expVal; }
1659cdf0e10cSrcweir     } TestCase;
1660cdf0e10cSrcweir 
1661cdf0e10cSrcweir     TestCase arrTestCase[]={
1662cdf0e10cSrcweir 
1663cdf0e10cSrcweir 	{"Appends the string(length less than 16) to the string buffer arrOUS[0]",
1664cdf0e10cSrcweir                 new OUString(aUStr1),
1665cdf0e10cSrcweir                 new OUStringBuffer(arrOUS[0]), kTestStr36, 12 },
1666cdf0e10cSrcweir 	{"Appends the string(length more than 16) to the string buffer arrOUS[0]",
1667cdf0e10cSrcweir                 new OUString(aUStr2),
1668cdf0e10cSrcweir                 new OUStringBuffer(arrOUS[0]), kTestStr36, 28 },
1669cdf0e10cSrcweir         {"Appends the string(length equal to 16) to the string buffer arrOUS[0]",
1670cdf0e10cSrcweir                 new OUString(aUStr37),
1671cdf0e10cSrcweir                 new OUStringBuffer(arrOUS[0]), kTestStr23, 16 },
1672cdf0e10cSrcweir 	{"Appends the string(length equal to 0) to the string buffer arrOUS[0]",
1673cdf0e10cSrcweir                 new OUString(aUStr7),
1674cdf0e10cSrcweir                 new OUStringBuffer(arrOUS[0]), kTestStr2, 0 },
1675cdf0e10cSrcweir     /* LLA: input3 must null < 0
1676cdf0e10cSrcweir         {"Appends the string(length less than 0) to the string buffer arrOUS[0]",
1677cdf0e10cSrcweir                 new OUString(aUStr41),
1678cdf0e10cSrcweir                 new OUStringBuffer(arrOUS[0]), kTestStr2, -1 },
1679cdf0e10cSrcweir     */
1680cdf0e10cSrcweir 	{"Appends the string(length less than 16) to the string buffer arrOUS[1]",
1681cdf0e10cSrcweir                 new OUString(aUStr7),
1682cdf0e10cSrcweir                 new OUStringBuffer(arrOUS[1]), kTestStr2, 4 },
1683cdf0e10cSrcweir         {"Appends the string(length more than 16) to the string buffer arrOUS[1]",
1684cdf0e10cSrcweir                 new OUString(aUStr2),
1685cdf0e10cSrcweir                 new OUStringBuffer(arrOUS[1]), kTestStr2, 32 },
1686cdf0e10cSrcweir 	{"Appends the string(length equal to 16) to the string buffer arrOUS[1]",
1687cdf0e10cSrcweir                 new OUString(aUStr1),
1688cdf0e10cSrcweir                 new OUStringBuffer(arrOUS[1]), kTestStr2, 16 },
1689cdf0e10cSrcweir         {"Appends the string(length equal to 0) to the string buffer arrOUS[1]",
1690cdf0e10cSrcweir                 new OUString(),
1691cdf0e10cSrcweir                 new OUStringBuffer(arrOUS[1]), kTestStr2, 0 },
1692cdf0e10cSrcweir     /* LLA: input3 must null < 0
1693cdf0e10cSrcweir         {"Appends the string(length less than 0) to the string buffer arrOUS[1]",
1694cdf0e10cSrcweir                 new OUString(),
1695cdf0e10cSrcweir                 new OUStringBuffer(arrOUS[1]), kTestStr2, -1 },
1696cdf0e10cSrcweir     */
1697cdf0e10cSrcweir         {"Appends the string(length less than 16) to the string buffer arrOUS[2]",
1698cdf0e10cSrcweir                 new OUString(aUStr7),
1699cdf0e10cSrcweir                 new OUStringBuffer(arrOUS[2]), kTestStr2, 4 },
1700cdf0e10cSrcweir         {"Appends the string(length more than 16) to the string buffer arrOUS[2]",
1701cdf0e10cSrcweir                 new OUString(aUStr2),
1702cdf0e10cSrcweir                 new OUStringBuffer(arrOUS[2]), kTestStr2, 32 },
1703cdf0e10cSrcweir 	{"Appends the string(length equal to 16) to the string buffer arrOUS[2]",
1704cdf0e10cSrcweir                 new OUString(aUStr1),
1705cdf0e10cSrcweir                 new OUStringBuffer(arrOUS[2]), kTestStr2, 16 },
1706cdf0e10cSrcweir         {"Appends the string(length equal to 0) to the string buffer arrOUS[2]",
1707cdf0e10cSrcweir                 new OUString(),
1708cdf0e10cSrcweir                 new OUStringBuffer(arrOUS[2]), kTestStr2, 0 },
1709cdf0e10cSrcweir     /* LLA: input3 must null < 0
1710cdf0e10cSrcweir        {"Appends the string(length less than 0) to the string buffer arrOUS[2]",
1711cdf0e10cSrcweir                 new OUString(),
1712cdf0e10cSrcweir                 new OUStringBuffer(arrOUS[2]), kTestStr2, -1 },
1713cdf0e10cSrcweir     */
1714cdf0e10cSrcweir         {"Appends the string(length less than 16) to the string buffer arrOUS[3]",
1715cdf0e10cSrcweir                 new OUString(aUStr7),
1716cdf0e10cSrcweir                 new OUStringBuffer(arrOUS[3]), kTestStr2, 4 },
1717cdf0e10cSrcweir         {"Appends the string(length more than 16) to the string buffer arrOUS[3]",
1718cdf0e10cSrcweir                 new OUString(aUStr2),
1719cdf0e10cSrcweir                 new OUStringBuffer(arrOUS[3]), kTestStr2, 32 },
1720cdf0e10cSrcweir 	{"Appends the string(length equal to 16) to the string buffer arrOUS[3]",
1721cdf0e10cSrcweir                 new OUString(aUStr1),
1722cdf0e10cSrcweir                 new OUStringBuffer(arrOUS[3]), kTestStr2, 16 },
1723cdf0e10cSrcweir         {"Appends the string(length equal to 0) to the string buffer arrOUS[3]",
1724cdf0e10cSrcweir                 new OUString(),
1725cdf0e10cSrcweir                 new OUStringBuffer(arrOUS[3]), kTestStr2, 0 },
1726cdf0e10cSrcweir     /* LLA: input3 must null < 0
1727cdf0e10cSrcweir         {"Appends the string(length less than 0) to the string buffer arrOUS[3]",
1728cdf0e10cSrcweir                 new OUString(),
1729cdf0e10cSrcweir                 new OUStringBuffer(arrOUS[3]), kTestStr2, -1 },
1730cdf0e10cSrcweir     */
1731cdf0e10cSrcweir         {"Appends the string(length less than 16) to the string buffer arrOUS[4]",
1732cdf0e10cSrcweir                 new OUString(aUStr29),
1733cdf0e10cSrcweir                 new OUStringBuffer(arrOUS[4]), kTestStr38, 7 },
1734cdf0e10cSrcweir         {"Appends the string(length more than 16) to the string buffer arrOUS[4]",
1735cdf0e10cSrcweir                 new OUString(aUStr39),
1736cdf0e10cSrcweir                 new OUStringBuffer(arrOUS[4]), kTestStr17, 22 },
1737cdf0e10cSrcweir 	{"Appends the string(length equal to 16) to the string buffer arrOUS[4]",
1738cdf0e10cSrcweir                 new OUString(aUStr40),
1739cdf0e10cSrcweir                 new OUStringBuffer(arrOUS[4]), kTestStr31, 16 },
1740cdf0e10cSrcweir         {"Appends the string(length equal to 0) to the string buffer arrOUS[4]",
1741cdf0e10cSrcweir                 new OUString(aUStr28),
1742cdf0e10cSrcweir                 new OUStringBuffer(arrOUS[4]), kTestStr2, 0 },
1743cdf0e10cSrcweir     /* LLA: input3 must null < 0
1744cdf0e10cSrcweir         {"Appends the string(length less than 0) to the string buffer arrOUS[4]",
1745cdf0e10cSrcweir                 new OUString(aUStr42),
1746cdf0e10cSrcweir                 new OUStringBuffer(arrOUS[4]), kTestStr2, -1 }
1747cdf0e10cSrcweir     */
1748cdf0e10cSrcweir #ifdef WITH_CORE
1749cdf0e10cSrcweir         ,{"Appends the string(length equal to 0) to the string buffer(with INT_MAX) ",
1750cdf0e10cSrcweir                 new OUString(),
1751cdf0e10cSrcweir                 new OUStringBuffer(kSInt32Max), kTestStr25 }
1752cdf0e10cSrcweir #endif
1753cdf0e10cSrcweir 	};
1754cdf0e10cSrcweir 
1755cdf0e10cSrcweir 
1756cdf0e10cSrcweir     sal_Bool res = sal_True;
1757cdf0e10cSrcweir     sal_uInt32 i;
1758cdf0e10cSrcweir 
1759cdf0e10cSrcweir     for (i = 0; i < (sizeof (arrTestCase))/(sizeof (TestCase)); i++)
1760cdf0e10cSrcweir     {
1761cdf0e10cSrcweir         arrTestCase[i].input1->appendAscii(
1762cdf0e10cSrcweir                     arrTestCase[i].input2, arrTestCase[i].input3);
1763cdf0e10cSrcweir         sal_Bool lastRes =
1764cdf0e10cSrcweir             ( arrTestCase[i].input1->getStr()== *(arrTestCase[i].expVal) &&
1765cdf0e10cSrcweir               arrTestCase[i].input1->getLength() == arrTestCase[i].expVal->getLength()  );
1766cdf0e10cSrcweir 
1767cdf0e10cSrcweir         c_rtl_tres_state
1768cdf0e10cSrcweir         (
1769cdf0e10cSrcweir             hRtlTestResult,
1770cdf0e10cSrcweir             lastRes,
1771cdf0e10cSrcweir             arrTestCase[i].comments,
1772cdf0e10cSrcweir             createName( pMeth, "appendAscii_002", i )
1773cdf0e10cSrcweir 
1774cdf0e10cSrcweir         );
1775cdf0e10cSrcweir 
1776cdf0e10cSrcweir         res &= lastRes;
1777cdf0e10cSrcweir     }
1778cdf0e10cSrcweir     return ( res );
1779cdf0e10cSrcweir }
test_rtl_OUStringBuffer_appendAsciis(hTestResult hRtlTestResult)1780cdf0e10cSrcweir extern "C" void /* sal_Bool */ SAL_CALL test_rtl_OUStringBuffer_appendAsciis(
1781cdf0e10cSrcweir 	                                          hTestResult hRtlTestResult )
1782cdf0e10cSrcweir {
1783cdf0e10cSrcweir     c_rtl_tres_state_start( hRtlTestResult, "appendAsciis");
1784cdf0e10cSrcweir     sal_Bool bTSState = test_rtl_OUStringBuffer_appendAscii_001( hRtlTestResult );
1785cdf0e10cSrcweir     bTSState &= test_rtl_OUStringBuffer_appendAscii_002( hRtlTestResult);
1786cdf0e10cSrcweir 
1787cdf0e10cSrcweir     c_rtl_tres_state_end( hRtlTestResult, "appendAsciis");
1788cdf0e10cSrcweir //    return( bTSState );
1789cdf0e10cSrcweir }
1790cdf0e10cSrcweir // -----------------------------------------------------------------------------
test_rtl_OUStringBuffer(hTestResult hRtlTestResult)1791cdf0e10cSrcweir extern "C" void /* sal_Bool */ SAL_CALL test_rtl_OUStringBuffer( hTestResult hRtlTestResult )
1792cdf0e10cSrcweir {
1793cdf0e10cSrcweir 
1794cdf0e10cSrcweir     c_rtl_tres_state_start(hRtlTestResult, "rtl_OUStringBuffer" );
1795cdf0e10cSrcweir 
1796cdf0e10cSrcweir     test_rtl_OUStringBuffer_ctors( hRtlTestResult );
1797cdf0e10cSrcweir     test_rtl_OUStringBuffer_makeStringAndClear( hRtlTestResult );
1798cdf0e10cSrcweir     test_rtl_OUStringBuffer_getLength( hRtlTestResult );
1799cdf0e10cSrcweir     test_rtl_OUStringBuffer_getCapacity( hRtlTestResult );
1800cdf0e10cSrcweir     test_rtl_OUStringBuffer_ensureCapacity( hRtlTestResult );
1801cdf0e10cSrcweir     test_rtl_OUStringBuffer_setLength( hRtlTestResult );
1802cdf0e10cSrcweir     test_rtl_OUStringBuffer_charAt( hRtlTestResult );
1803cdf0e10cSrcweir     test_rtl_OUStringBuffer_csuc( hRtlTestResult );
1804cdf0e10cSrcweir     test_rtl_OUStringBuffer_getStr( hRtlTestResult );
1805cdf0e10cSrcweir     test_rtl_OUStringBuffer_setCharAt( hRtlTestResult );
1806cdf0e10cSrcweir     test_rtl_OUStringBuffer_appends( hRtlTestResult );
1807cdf0e10cSrcweir     test_rtl_OUStringBuffer_appendAsciis( hRtlTestResult );
1808cdf0e10cSrcweir 
1809cdf0e10cSrcweir     c_rtl_tres_state_end(hRtlTestResult, "rtl_OUStringBuffer");
1810cdf0e10cSrcweir }
1811cdf0e10cSrcweir 
1812cdf0e10cSrcweir // -----------------------------------------------------------------------------
RegisterAdditionalFunctions(FktRegFuncPtr _pFunc)1813cdf0e10cSrcweir void RegisterAdditionalFunctions(FktRegFuncPtr _pFunc)
1814cdf0e10cSrcweir {
1815cdf0e10cSrcweir     if (_pFunc)
1816cdf0e10cSrcweir     {
1817cdf0e10cSrcweir         (_pFunc)(&test_rtl_OUStringBuffer, "");
1818cdf0e10cSrcweir     }
1819cdf0e10cSrcweir }
1820