update dev300-m58
[ooovba.git] / sal / qa / rtl_strings / rtl_OUStringBuffer.cxx
blob653f725bc4ac2176387d826f27e2da3d4e29f34d
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: rtl_OUStringBuffer.cxx,v $
10 * $Revision: 1.11 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_sal.hxx"
34 #ifndef _SAL_TYPES_H_
35 #include <sal/types.h>
36 #endif
38 // #ifndef _RTL_TRES_H_
39 // #include <rtl/tres.h>
40 // #endif
41 #include <testshl/tresstatewrapper.hxx>
43 #ifndef _RTL_STRING_HXX_
44 #include <rtl/string.hxx>
45 #endif
47 #ifndef _RTL_USTRING_H_
48 #include <rtl/ustring.h>
49 #endif
51 #ifndef _RTL_USTRING_HXX_
52 #include <rtl/ustring.hxx>
53 #endif
55 #ifndef _RTL_USTRBUF_H_
56 #include <rtl/ustrbuf.h>
57 #endif
59 #ifndef _RTL_USTRBUF_HXX
60 #include <rtl/ustrbuf.hxx>
61 #endif
62 //------------------------------------------------------------------------
63 //------------------------------------------------------------------------
64 #ifndef _OSL_THREAD_H_
65 #include <osl/thread.h>
66 #endif
68 #ifndef _RTL_STRING_CONST_H_
69 #include <rtl_String_Const.h>
70 #endif
72 #ifndef _RTL_STRING_UTILS_HXX_
73 #include <rtl_String_Utils.hxx>
74 #endif
76 #include "stdio.h"
77 using namespace rtl;
79 //------------------------------------------------------------------------
80 // test classes
81 //------------------------------------------------------------------------
82 const int MAXBUFLENGTH = 255;
83 //------------------------------------------------------------------------
84 // helper functions
85 //------------------------------------------------------------------------
86 static void unused()
88 (void)kBinaryNumsStr;
89 (void)kOctolNumsStr;
90 (void)kDecimalNumsStr;
91 (void)kHexDecimalNumsStr;
92 (void)kBase36NumsStr;
93 (void)inputChar;
94 (void)input1StrDefault;
95 (void)input1StrNormal;
96 (void)input1StrLastDefault;
97 (void)input1StrLastNormal;
98 unused();
101 //------------------------------------------------------------------------
102 // testing constructors
103 //------------------------------------------------------------------------
104 static sal_Bool test_rtl_OUStringBuffer_ctor_001( hTestResult hRtlTestResult )
107 ::rtl::OUStringBuffer aUStrBuf;
109 bool b1 =
110 aUStrBuf.getLength() == 0 &&
111 ! *(aUStrBuf.getStr()) && aUStrBuf.getCapacity() == 16;
113 ::rtl::OUStringBuffer aUStrBuf2(0);
115 bool b2 =
116 aUStrBuf2.getLength() == 0 &&
117 ! *(aUStrBuf2.getStr()) && aUStrBuf2.getCapacity() == /* LLA: !!! */ 0;
119 return
121 c_rtl_tres_state
123 hRtlTestResult,
124 b1 && b2,
125 "New OUStringBuffer containing no characters",
126 "ctor_001"
131 //------------------------------------------------------------------------
133 static sal_Bool SAL_CALL test_rtl_OUStringBuffer_ctor_002(
134 hTestResult hRtlTestResult )
136 ::rtl::OUStringBuffer aUStrBuftmp( aUStr1 );
137 ::rtl::OUStringBuffer aUStrBuf( aUStrBuftmp );
138 sal_Bool res = cmpustr(aUStrBuftmp.getStr(),aUStrBuf.getStr());
139 return
141 c_rtl_tres_state
143 hRtlTestResult,
144 aUStrBuf.getLength()==aUStrBuftmp.getLength() &&
145 aUStrBuf.getCapacity() == aUStrBuftmp.getCapacity() && res ,
146 "New OUStringBuffer from another OUStringBuffer",
147 "ctor_002"
151 //------------------------------------------------------------------------
153 /* static */
154 sal_Bool SAL_CALL test_rtl_OUStringBuffer_ctor_003(
155 hTestResult hRtlTestResult )
157 ::rtl::OUStringBuffer aUStrBuf1(kTestStr2Len);
158 #ifdef WITH_CORE
159 ::rtl::OUStringBuffer aUStrBuf2(kSInt32Max); //will core dump
160 #else
161 ::rtl::OUStringBuffer aUStrBuf2(0);
162 #endif
163 ::rtl::OUStringBuffer aUStrBuf3(kNonSInt32Max);
166 bool b1 =
167 aUStrBuf1.getLength() == 0 &&
168 ! *(aUStrBuf1.getStr()) && aUStrBuf1.getCapacity() == kTestStr2Len ;
170 bool b2 =
171 #ifdef WITH_CORE
172 aUStrBuf2.getLength() == 0 &&
173 ! *(aUStrBuf2.getStr()) && aUStrBuf2.getCapacity() == kSInt32Max ;
174 #else
175 aUStrBuf2.getLength() == 0 &&
176 ! *(aUStrBuf2.getStr()) && aUStrBuf2.getCapacity() == /* LLA: ??? 16 */ 0;
177 #endif
178 bool b3 =
179 aUStrBuf3.getLength() == 0 &&
180 ! *(aUStrBuf3.getStr()) && aUStrBuf3.getCapacity() == kNonSInt32Max;
182 return
184 c_rtl_tres_state
186 hRtlTestResult,
187 b1 && b2 && b3,
188 "New OUStringBuffer containing no characters and contain assigned capacity",
189 "ctor_003( will core dump,because the kSInt32Max )"
195 //------------------------------------------------------------------------
197 static sal_Bool SAL_CALL test_rtl_OUStringBuffer_ctor_004(
198 hTestResult hRtlTestResult)
200 ::rtl::OUString aUStrtmp( aUStr1 );
201 ::rtl::OUStringBuffer aUStrBuf( aUStrtmp );
202 sal_Int32 leg = aUStrBuf.getLength();
203 return
205 c_rtl_tres_state
207 hRtlTestResult,
208 aUStrBuf.getStr() == aUStrtmp &&
209 leg == aUStrtmp.pData->length &&
210 aUStrBuf.getCapacity() == leg+16 ,
211 "New OUStringBuffer from OUstring",
212 "ctor_004"
217 static sal_Bool SAL_CALL test_rtl_OUStringBuffer_ctor_005(
218 hTestResult hRtlTestResult)
220 ::rtl::OUStringBuffer aUStrBuftmp( aUStr1 );
221 ::rtl::OUString aUStrtmp = aUStrBuftmp.makeStringAndClear();
222 ::rtl::OUStringBuffer aUStrBuf( aUStrBuftmp );
223 sal_Bool res = cmpustr(aUStrBuftmp.getStr(),aUStrBuf.getStr());
224 sal_Int32 leg = aUStrBuf.getLength();
225 return
227 c_rtl_tres_state
229 hRtlTestResult,
230 aUStrBuf.getLength()==aUStrBuftmp.getLength() &&
231 aUStrBuf.getCapacity() == aUStrBuftmp.getCapacity() &&
232 res && leg == 0,
233 "New OUStringBuffer from another OUStringBuffer after makeClearFromString",
234 "ctor_005"
239 extern "C" void /* sal_Bool */ SAL_CALL test_rtl_OUStringBuffer_ctors(
240 hTestResult hRtlTestResult )
242 c_rtl_tres_state_start( hRtlTestResult, "ctors");
243 sal_Bool DCState = test_ini_uString();
244 (void)DCState;
245 sal_Bool bTSState = test_rtl_OUStringBuffer_ctor_001( hRtlTestResult );
246 bTSState &= test_rtl_OUStringBuffer_ctor_002( hRtlTestResult);
247 bTSState &= test_rtl_OUStringBuffer_ctor_003( hRtlTestResult);
248 bTSState &= test_rtl_OUStringBuffer_ctor_004( hRtlTestResult);
249 bTSState &= test_rtl_OUStringBuffer_ctor_005( hRtlTestResult);
251 c_rtl_tres_state_end( hRtlTestResult, "ctors");
252 // return( bTSState );
255 //------------------------------------------------------------------------
256 // testing the method makeStringAndClear()
257 //------------------------------------------------------------------------
258 extern "C" void /* sal_Bool */ SAL_CALL test_rtl_OUStringBuffer_makeStringAndClear(
259 hTestResult hRtlTestResult )
261 c_rtl_tres_state_start( hRtlTestResult, "makeStringAndClear");
262 sal_Char methName[MAXBUFLENGTH];
263 sal_Char* pMeth = methName;
265 typedef struct TestCase
267 sal_Char* comments;
268 OUString* expVal;
269 OUStringBuffer* input1;
271 ~TestCase() { delete input1;}
272 } TestCase;
274 OUString arrOUS[6]={
275 OUString( aUStr1 ),
276 OUString( aUStr14 ),
277 OUString( aUStr25 ),
278 OUString( aUStr27 ),
279 OUString( aUStr29 ),
280 OUString( "\0",0,
281 kEncodingRTLTextUSASCII,
282 kConvertFlagsOStringToOUString)
285 TestCase arrTestCase[]={
287 {"two empty strings(def. constructor)", new OUString(),
288 new OUStringBuffer()},
289 {"two empty strings(with a argu)", new OUString(),
290 new OUStringBuffer(26)},
291 {"normal string", new OUString(arrOUS[0]),
292 new OUStringBuffer(arrOUS[0])},
293 {"string with space ", new OUString(arrOUS[1]),
294 new OUStringBuffer(arrOUS[1])},
295 {"empty string", new OUString(arrOUS[2]),
296 new OUStringBuffer(arrOUS[2])},
297 {"string with a character", new OUString(arrOUS[3]),
298 new OUStringBuffer(arrOUS[3])},
299 {"string with special characters", new OUString(arrOUS[4]),
300 new OUStringBuffer(arrOUS[4])},
301 {"string only with (\0)", new OUString(arrOUS[5]),
302 new OUStringBuffer(arrOUS[5])}
305 sal_Bool res = sal_True;
306 sal_uInt32 i;
308 for(i = 0; i < (sizeof (arrTestCase))/(sizeof (TestCase)); i++)
310 sal_Bool lastRes =
311 ( arrTestCase[i].input1->makeStringAndClear() ==
312 *( arrTestCase[i].expVal ));
313 lastRes = lastRes && ( arrTestCase[i].input1->getCapacity() == 0 );
314 lastRes = lastRes && ( *(arrTestCase[i].input1->getStr()) == '\0' );
316 c_rtl_tres_state
318 hRtlTestResult,
319 lastRes,
320 arrTestCase[i].comments,
321 createName( pMeth, "makeStringAndClear", i )
324 res &= lastRes;
326 c_rtl_tres_state_end( hRtlTestResult, "makeStringAndClear");
327 // return (res);
329 //------------------------------------------------------------------------
330 // testing the method getLength
331 //------------------------------------------------------------------------
333 extern "C" void /* sal_Bool */ SAL_CALL test_rtl_OUStringBuffer_getLength(
334 hTestResult hRtlTestResult)
336 c_rtl_tres_state_start( hRtlTestResult, "getLength");
337 sal_Char methName[MAXBUFLENGTH];
338 sal_Char* pMeth = methName;
340 OUString arrOUS[6]={OUString( aUStr1 ),
341 OUString( "1",1,
342 kEncodingRTLTextUSASCII,
343 kConvertFlagsOStringToOUString),
344 OUString(),
345 OUString( "",0,
346 kEncodingRTLTextUSASCII,
347 kConvertFlagsOStringToOUString),
348 OUString( "\0",0,
349 kEncodingRTLTextUSASCII,
350 kConvertFlagsOStringToOUString),
351 OUString( aUStr2 )};
353 typedef struct TestCase
355 sal_Char* comments;
356 sal_Int32 expVal;
357 OUStringBuffer* input;
358 ~TestCase() { delete input;}
359 } TestCase;
361 TestCase arrTestCase[]={
363 {"length of ascii string", kTestStr1Len,
364 new OUStringBuffer(arrOUS[0]) },
365 {"length of ascci string of size 1", 1,
366 new OUStringBuffer(arrOUS[1])},
367 {"length of empty string", 0,
368 new OUStringBuffer(arrOUS[2])},
369 {"length of empty string (empty ascii string arg)",0,
370 new OUStringBuffer(arrOUS[3])},
371 {"length of empty string (string arg = '\\0')", 0,
372 new OUStringBuffer(arrOUS[4])},
373 {"length(>16) of ascii string", kTestStr2Len,
374 new OUStringBuffer(arrOUS[5]) },
375 {"length of empty string (default constructor)", 0,
376 new OUStringBuffer()},
377 {"length of empty string (with capacity)", 0,
378 new OUStringBuffer(26)}
382 sal_Bool res = sal_True;
383 sal_uInt32 i;
385 for (i = 0; i < (sizeof (arrTestCase))/(sizeof (TestCase)); i++)
387 sal_Int32 length = arrTestCase[i].input->getLength();
388 sal_Bool lastRes = (length == arrTestCase[i].expVal);
389 c_rtl_tres_state
391 hRtlTestResult,
392 lastRes,
393 arrTestCase[i].comments,
394 createName( pMeth, "getLength", i )
397 res &= lastRes;
399 c_rtl_tres_state_end( hRtlTestResult, "getLength");
400 // return ( res );
402 //------------------------------------------------------------------------
403 // testing the method getCapacity()
404 //------------------------------------------------------------------------
406 extern "C" void /* sal_Bool */ SAL_CALL test_rtl_OUStringBuffer_getCapacity(
407 hTestResult hRtlTestResult)
409 c_rtl_tres_state_start( hRtlTestResult, "getCapacity");
410 sal_Char methName[MAXBUFLENGTH];
411 sal_Char* pMeth = methName;
413 OUString arrOUS[6]={OUString( aUStr1 ),
414 OUString( "1",1,
415 kEncodingRTLTextUSASCII,
416 kConvertFlagsOStringToOUString),
417 OUString(),
418 OUString( "",0,
419 kEncodingRTLTextUSASCII,
420 kConvertFlagsOStringToOUString),
421 OUString( "\0",0,
422 kEncodingRTLTextUSASCII,
423 kConvertFlagsOStringToOUString),
424 OUString( aUStr2 )};
426 typedef struct TestCase
428 sal_Char* comments;
429 sal_Int32 expVal;
430 OUStringBuffer* input;
431 ~TestCase() { delete input;}
432 } TestCase;
434 TestCase arrTestCase[]={
436 {"capacity of ascii string", kTestStr1Len+16,
437 new OUStringBuffer(arrOUS[0]) },
438 {"capacity of ascci string of size 1", 1+16,
439 new OUStringBuffer(arrOUS[1]) },
440 {"capacity of empty string", 0+16,
441 new OUStringBuffer(arrOUS[2]) },
442 {"capacity of empty string (empty ascii string arg)",0+16,
443 new OUStringBuffer(arrOUS[3]) },
444 {"capacity of empty string (string arg = '\\0')", 0+16,
445 new OUStringBuffer(arrOUS[4]) },
446 {"capacity(>16) of ascii string", kTestStr2Len+16,
447 new OUStringBuffer(arrOUS[5]) },
448 {"capacity of empty string (default constructor)", 16,
449 new OUStringBuffer() },
450 #ifdef WITH_CORE
451 {"capacity of empty string (with capacity 2147483647)(code will core dump)", kSInt32Max,
452 new OUStringBuffer(kSInt32Max) },// will core dump
453 #endif
454 {"capacity of empty string (with capacity -2147483648)", kNonSInt32Max,
455 new OUStringBuffer(kNonSInt32Max) },
456 {"capacity of empty string (with capacity 16)", 16,
457 new OUStringBuffer(16) },
458 {"capacity of empty string (with capacity 6)", 6,
459 new OUStringBuffer(6) },
460 {"capacity of empty string (with capacity 0)", 0,
461 new OUStringBuffer(0) },
462 {"capacity of empty string (with capacity -2)", -2,
463 new OUStringBuffer(-2) }
467 sal_Bool res = sal_True;
468 sal_uInt32 i;
470 for (i = 0; i < (sizeof (arrTestCase))/(sizeof (TestCase)); i++)
472 sal_Int32 length = arrTestCase[i].input->getCapacity();
473 sal_Bool lastRes = (length == arrTestCase[i].expVal);
474 c_rtl_tres_state
476 hRtlTestResult,
477 lastRes,
478 arrTestCase[i].comments,
479 createName( pMeth, "getCapacity", i )
482 res &= lastRes;
484 c_rtl_tres_state_end( hRtlTestResult, "getCapacity");
485 // return ( res );
487 //------------------------------------------------------------------------
488 // testing the method ensureCapacity(sal_Int32 minimumCapacity)
489 //------------------------------------------------------------------------
491 extern "C" void /* sal_Bool */ SAL_CALL test_rtl_OUStringBuffer_ensureCapacity(
492 hTestResult hRtlTestResult)
494 c_rtl_tres_state_start( hRtlTestResult, "ensureCapacity");
495 sal_Char methName[MAXBUFLENGTH];
496 sal_Char* pMeth = methName;
498 typedef struct TestCase
500 sal_Char* comments;
501 sal_Int32 expVal;
502 OUStringBuffer* input1;
503 sal_Int32 input2;
504 ~TestCase() { delete input1;}
505 } TestCase;
507 TestCase arrTestCase[]={
509 {"capacity equal to 16, minimum is 5 ", 16,
510 new OUStringBuffer(), 5 },
511 {"capacity equal to 16, minimum is -5", 16,
512 new OUStringBuffer(), -5},
513 {"capacity equal to 16, minimum is 0", 16,
514 new OUStringBuffer(), 0},
515 {"capacity equal to 16, minimum is 20", 20, //the testcase is based on comments
516 new OUStringBuffer(), 20},
517 {"capacity equal to 16, minimum is 50", 50,
518 new OUStringBuffer(), 50},
519 {"capacity equal to 6, minimum is 20", 20,
520 new OUStringBuffer(6), 20 },
521 {"capacity equal to 6, minimum is 2", 6,
522 new OUStringBuffer(6), 2},
523 {"capacity equal to 6, minimum is -6", 6,
524 new OUStringBuffer(6), -6},
525 {"capacity equal to 6, minimum is -6", 10, //the testcase is based on comments
526 new OUStringBuffer(6), 10},
527 {"capacity equal to 0, minimum is 6", 6,
528 new OUStringBuffer(0), 6},
529 {"capacity equal to 0, minimum is 1", 2, //the testcase is based on comments
530 new OUStringBuffer(0), 1},
532 {"capacity equal to 0, minimum is -1", 0,
533 new OUStringBuffer(0), -1},
535 #ifdef WITH_CORE
536 {"capacity equal to 2147483647, minimum is 65535", kSInt32Max,//will core dump
537 new OUStringBuffer(kSInt32Max), 65535},
538 {"capacity equal to 2147483647, minimum is 2147483647", kSInt32Max,//will core dump
539 new OUStringBuffer(kSInt32Max), kSInt32Max},
540 {"capacity equal to 2147483647, minimum is -1", kSInt32Max,//will core dump
541 new OUStringBuffer(kSInt32Max), -1},
542 {"capacity equal to 2147483647, minimum is 0", kSInt32Max,//will core dump
543 new OUStringBuffer(kSInt32Max), 0},
544 {"capacity equal to 2147483647, minimum is -2147483648", kSInt32Max,//will core dump
545 new OUStringBuffer(kSInt32Max), kNonSInt32Max},
546 #endif
547 {"capacity equal to -2147483648, minimum is 65535", 65535,
548 new OUStringBuffer(kNonSInt32Max), 65535},
549 #ifdef WITH_CORE
550 {"capacity equal to -2147483648, minimum is 2147483647", 2147483647,//will core dump
551 new OUStringBuffer(kNonSInt32Max), 2147483647},
552 #endif
553 {"capacity equal to -2147483648, minimum is -1", 2,
554 new OUStringBuffer(kNonSInt32Max), -1},
555 {"capacity equal to -2147483648, minimum is 0", 2,
556 new OUStringBuffer(kNonSInt32Max), 0},
557 {"capacity equal to -2147483648, minimum is -2147483648", kNonSInt32Max,
558 new OUStringBuffer(kNonSInt32Max), kNonSInt32Max}
562 sal_Bool res = sal_True;
563 sal_uInt32 i;
565 for (i = 0; i < (sizeof (arrTestCase))/(sizeof (TestCase)); i++)
567 arrTestCase[i].input1->ensureCapacity(arrTestCase[i].input2);
568 sal_Int32 length = arrTestCase[i].input1->getCapacity();
569 sal_Bool lastRes = (length == arrTestCase[i].expVal);
571 c_rtl_tres_state
573 hRtlTestResult,
574 lastRes,
575 arrTestCase[i].comments,
576 createName( pMeth, "ensureCapacity", i )
579 res &= lastRes;
581 c_rtl_tres_state_end( hRtlTestResult, "ensureCapacity");
582 // return ( res );
584 //------------------------------------------------------------------------
585 // testing the method setLength(sal_Int32 newLength)
586 //------------------------------------------------------------------------
588 extern "C" void /* sal_Bool */ SAL_CALL test_rtl_OUStringBuffer_setLength(
589 hTestResult hRtlTestResult)
591 c_rtl_tres_state_start( hRtlTestResult, "setLength");
592 sal_Char methName[MAXBUFLENGTH];
593 sal_Char* pMeth = methName;
595 OUString arrOUS[6]={OUString( aUStr1 ),
596 OUString( aUStr27),
597 OUString(),
598 OUString( "",0,
599 kEncodingRTLTextUSASCII,
600 kConvertFlagsOStringToOUString),
601 OUString( "\0",0,
602 kEncodingRTLTextUSASCII,
603 kConvertFlagsOStringToOUString),
604 OUString( aUStr2 )};
606 typedef struct TestCase
608 sal_Char* comments;
609 sal_Int32 expVal1;
610 OUString* expVal2;
611 sal_Int32 expVal3;
612 OUStringBuffer* input1;
613 sal_Int32 input2;
614 ~TestCase() { delete input1; delete expVal2;}
615 } TestCase;
617 TestCase arrTestCase[]={
619 {"newLength more than the capacity of OUStringBuffer(aUStr1)",
620 50, new OUString(aUStr1), 50,
621 new OUStringBuffer(arrOUS[0]), 50 },
622 {"newLength more than the length of OUStringBuffer(aUStr1)",
623 kTestStr13Len, new OUString(aUStr1), 32,
624 new OUStringBuffer(arrOUS[0]), kTestStr13Len },
625 {"newLength equal to the length of OUStringBuffer(aUStr1)",
626 kTestStr1Len, new OUString(aUStr1), 32,
627 new OUStringBuffer(arrOUS[0]), kTestStr1Len },
628 {"newLength less than the length of OUStringBuffer(aUStr1)",
629 kTestStr7Len, new OUString(aUStr7), 32,
630 new OUStringBuffer(arrOUS[0]), kTestStr7Len},
631 {"newLength equal to 0",
632 0, new OUString(), 32,
633 new OUStringBuffer(arrOUS[0]), 0},
634 {"newLength more than the capacity of OUStringBuffer(1)",
635 25, new OUString(arrOUS[1]), 25,
636 new OUStringBuffer(arrOUS[1]), 25},
637 {"newLength more than the length of OUStringBuffer(1)",
638 5, new OUString(arrOUS[1]), 17,
639 new OUStringBuffer(arrOUS[1]), 5},
640 {"newLength equal to the length of OUStringBuffer(1)",
641 kTestStr27Len, new OUString(arrOUS[1]), 17,
642 new OUStringBuffer(arrOUS[1]), kTestStr27Len},
643 {"newLength less than the length of OUStringBuffer(1)",
644 0, new OUString(), 17,
645 new OUStringBuffer(arrOUS[1]), 0},
646 {"newLength more than the capacity of OUStringBuffer()",
647 20, new OUString(), 20,
648 new OUStringBuffer(arrOUS[2]), 20},
649 {"newLength more than the length of OUStringBuffer()",
650 3, new OUString(), 16,
651 new OUStringBuffer(arrOUS[2]), 3},
652 {"newLength less than the length of OUStringBuffer()",
653 0, new OUString(), 16,
654 new OUStringBuffer(arrOUS[2]), 0},
655 {"newLength more than the capacity of OUStringBuffer("")",
656 20, new OUString(), 20,
657 new OUStringBuffer(arrOUS[3]), 20},
658 {"newLength more than the length of OUStringBuffer("")",
659 5, new OUString(), 16,
660 new OUStringBuffer(arrOUS[3]), 5},
661 {"newLength less than the length of OUStringBuffer("")",
662 0, new OUString(), 16,
663 new OUStringBuffer(arrOUS[3]), 0},
664 {"newLength more than the length of OUStringBuffer(\0)",
665 20, new OUString(), 20,
666 new OUStringBuffer(arrOUS[4]), 20},
667 {"newLength more than the length of OUStringBuffer(\0)",
668 5, new OUString(), 16,
669 new OUStringBuffer(arrOUS[4]), 5},
670 {"newLength less than the length of OUStringBuffer(\0)",
671 0, new OUString(), 16,
672 new OUStringBuffer(arrOUS[4]), 0},
673 {"newLength more than the capacity of OUStringBuffer(aUStr2)",
674 50, new OUString(aUStr2), 66,
675 new OUStringBuffer(arrOUS[5]), 50,},
676 {"newLength more than the length of OUStringBuffer(aUStr2)",
677 40, new OUString(aUStr2), 48,
678 new OUStringBuffer(arrOUS[5]), 40,},
679 {"newLength equal to the length of OUStringBuffer(aUStr2)",
680 kTestStr2Len, new OUString(aUStr2), 48,
681 new OUStringBuffer(arrOUS[5]), kTestStr2Len,},
682 {"newLength less than the length of OUStringBuffer(aUStr2)",
683 kTestStr7Len, new OUString(aUStr7), 48,
684 new OUStringBuffer(arrOUS[5]), kTestStr7Len},
685 {"newLength equal to 0",
686 0, new OUString(), 48,
687 new OUStringBuffer(arrOUS[5]), 0}
692 sal_Bool res = sal_True;
693 sal_uInt32 i;
695 for (i = 0; i < (sizeof (arrTestCase))/(sizeof (TestCase)); i++)
697 arrTestCase[i].input1->setLength(arrTestCase[i].input2);
698 sal_Bool lastRes =
699 ( arrTestCase[i].input1->getStr() == *(arrTestCase[i].expVal2) &&
700 arrTestCase[i].input1->getLength() == arrTestCase[i].expVal1 &&
701 arrTestCase[i].input1->getCapacity() == arrTestCase[i].expVal3 );
703 c_rtl_tres_state
705 hRtlTestResult,
706 lastRes,
707 arrTestCase[i].comments,
708 createName( pMeth, "setLength", i )
711 res &= lastRes;
713 c_rtl_tres_state_end( hRtlTestResult, "setLength");
714 // return ( res );
716 //------------------------------------------------------------------------
717 // testing the method charAt( sal_Int32 index )
718 //------------------------------------------------------------------------
720 extern "C" void /* sal_Bool */ SAL_CALL test_rtl_OUStringBuffer_charAt(
721 hTestResult hRtlTestResult)
723 c_rtl_tres_state_start( hRtlTestResult, "charAt");
724 sal_Char methName[MAXBUFLENGTH];
725 sal_Char* pMeth = methName;
727 OUString arrOUS[4]={OUString( aUStr1 ), // "Sun Microsystems";
728 OUString( aUStr27), // "s";
729 OUString( aUStr28), // "\50\3\5\7\11\13\15\17sun";
730 OUString( )};
732 typedef struct TestCase
734 sal_Char* comments;
735 sal_Unicode expVal;
736 OUStringBuffer* input1;
737 sal_Int32 input2;
738 ~TestCase() { delete input1;}
739 } TestCase;
741 TestCase arrTestCase[]={
743 {"return the first character of OUStringBuffer(aUStr1)",
744 83, new OUStringBuffer(arrOUS[0]), 0 },
745 {"return the middle character of OUStringBuffer(aUStr1)",
746 32, new OUStringBuffer(arrOUS[0]), 3 },
747 {"return the last character of OUStringBuffer(aUStr1)",
748 115, new OUStringBuffer(arrOUS[0]), 15 },
749 {"return the only character of OUStringBuffer(aUStr27)",
750 115, new OUStringBuffer(arrOUS[1]), 0},
751 {"return the first of OUStringBuffer(aUStr28) with special character",
752 40, new OUStringBuffer(arrOUS[2]), 0},
754 {"return the mid of OUStringBuffer(aUStr28) with special character",
755 11, new OUStringBuffer(arrOUS[2]), 5},
758 {"invalid character of OUStringBuffer()",
759 0, new OUStringBuffer(arrOUS[3]), 0},
762 {"invalid character of OUStringBuffer()",
763 0, new OUStringBuffer(arrOUS[3]), -2}
769 sal_Bool res = sal_True;
770 sal_uInt32 i;
772 for (i = 0; i < (sizeof (arrTestCase))/(sizeof (TestCase)); i++)
774 sal_Bool lastRes =
775 ( arrTestCase[i].input1->charAt(arrTestCase[i].input2) ==
776 arrTestCase[i].expVal );
777 // LLA: last case removed, due to the fact of complexity of the test code :-(
778 // LLA: if(i<=7)
779 // LLA: {
780 c_rtl_tres_state
782 hRtlTestResult,
783 lastRes,
784 arrTestCase[i].comments,
785 createName( pMeth, "charAt", i )
788 // LLA: }
789 // LLA: else
790 // LLA: {
791 // LLA: c_rtl_tres_state
792 // LLA: (
793 // LLA: hRtlTestResult,
794 // LLA: sal_True,
795 // LLA: arrTestCase[i].comments,
796 // LLA: createName( pMeth, "charAt", i )
797 // LLA:
798 // LLA: );
799 // LLA: }
800 res &= lastRes;
802 c_rtl_tres_state_end( hRtlTestResult, "charAt");
803 // return ( res );
805 //------------------------------------------------------------------------
806 // testing the operator const sal_Unicode * (csuc for short)
807 //------------------------------------------------------------------------
808 extern "C" void /* sal_Bool */ SAL_CALL test_rtl_OUStringBuffer_csuc(
809 hTestResult hRtlTestResult)
811 c_rtl_tres_state_start( hRtlTestResult, "csuc");
812 sal_Char methName[MAXBUFLENGTH];
813 sal_Char* pMeth = methName;
815 const sal_Unicode tmpUC=0x0;
816 rtl_uString* tmpUstring = NULL;
817 const sal_Char *tmpStr=kTestStr1;
818 sal_Int32 tmpLen=(sal_Int32) kTestStr1Len;
819 //sal_Int32 cmpLen = 0;
820 OUString tempString(aUStr1);
822 rtl_string2UString( &tmpUstring, tmpStr, tmpLen,
823 osl_getThreadTextEncoding(), OSTRING_TO_OUSTRING_CVTFLAGS );
824 OSL_ASSERT(tmpUstring != NULL);
827 typedef struct TestCase
829 sal_Char* comments;
830 const sal_Unicode* expVal;
831 sal_Int32 cmpLen;
832 OUStringBuffer* input1;
833 ~TestCase() { delete input1; }
834 } TestCase;
836 TestCase arrTestCase[] =
838 {"test normal ustring",(*tmpUstring).buffer,kTestStr1Len,
839 new OUStringBuffer(tempString)},
840 {"test empty ustring",&tmpUC, 1, new OUStringBuffer()}
843 sal_Bool res = sal_True;
844 sal_uInt32 i;
845 for(i = 0; i < (sizeof (arrTestCase))/(sizeof (TestCase)); i++)
847 const sal_Unicode* pstr = *arrTestCase[i].input1;
849 res &= c_rtl_tres_state
851 hRtlTestResult,
852 cmpustr( pstr, arrTestCase[i].expVal, arrTestCase[i].cmpLen ),
853 arrTestCase[i].comments,
854 createName( pMeth, "const sal_Unicode*", i )
857 c_rtl_tres_state_end( hRtlTestResult, "csuc");
858 // return ( res );
860 //------------------------------------------------------------------------
861 // testing the method const sal_Unicode * getStr()
862 //------------------------------------------------------------------------
863 extern "C" void /* sal_Bool */ SAL_CALL test_rtl_OUStringBuffer_getStr(
864 hTestResult hRtlTestResult)
866 c_rtl_tres_state_start( hRtlTestResult, "getStr");
867 sal_Char methName[MAXBUFLENGTH];
868 sal_Char* pMeth = methName;
870 const sal_Unicode tmpUC=0x0;
871 rtl_uString* tmpUstring = NULL;
872 const sal_Char *tmpStr=kTestStr1;
873 sal_Int32 tmpLen=(sal_Int32) kTestStr1Len;
874 //sal_Int32 cmpLen = 0;
875 OUString tempString(aUStr1);
877 rtl_string2UString( &tmpUstring, tmpStr, tmpLen,
878 osl_getThreadTextEncoding(), OSTRING_TO_OUSTRING_CVTFLAGS );
879 OSL_ASSERT(tmpUstring != NULL);
882 typedef struct TestCase
884 sal_Char* comments;
885 const sal_Unicode* expVal;
886 sal_Int32 cmpLen;
887 OUStringBuffer* input1;
888 ~TestCase() { delete input1;}
889 } TestCase;
891 TestCase arrTestCase[] =
893 {"test normal ustring",(*tmpUstring).buffer,kTestStr1Len,
894 new OUStringBuffer(tempString)},
895 {"test empty ustring",&tmpUC, 1, new OUStringBuffer()}
898 sal_Bool res = sal_True;
899 sal_uInt32 i;
900 for(i = 0; i < (sizeof (arrTestCase))/(sizeof (TestCase)); i++)
902 const sal_Unicode* pstr = arrTestCase[i].input1->getStr();
904 res &= c_rtl_tres_state
906 hRtlTestResult,
907 cmpustr( pstr, arrTestCase[i].expVal, arrTestCase[i].cmpLen ),
908 arrTestCase[i].comments,
909 createName( pMeth, "getStr", i )
912 c_rtl_tres_state_end( hRtlTestResult, "getStr");
913 // return ( res );
915 //------------------------------------------------------------------------
916 // testing the method setCharAt(sal_Int32 index, sal_Unicode ch)
917 //------------------------------------------------------------------------
919 extern "C" void /* sal_Bool */ SAL_CALL test_rtl_OUStringBuffer_setCharAt(
920 hTestResult hRtlTestResult)
922 c_rtl_tres_state_start( hRtlTestResult, "setCharAt");
923 sal_Char methName[MAXBUFLENGTH];
924 sal_Char* pMeth = methName;
926 OUString arrOUS[4]={OUString( aUStr1 ),
927 OUString( aUStr27),
928 OUString( aUStr28),
929 OUString( )};
931 typedef struct TestCase
933 sal_Char* comments;
934 OUString* expVal;
935 OUStringBuffer* input1;
936 sal_Int32 input2;
937 sal_Unicode input3;
938 ~TestCase() { delete input1; delete expVal; }
939 } TestCase;
941 TestCase arrTestCase[]={
943 {"set the first character of OUStringBuffer(aUStr1) with s",
944 new OUString(aUStr31),
945 new OUStringBuffer(arrOUS[0]), 0, 115 },
946 {"set the middle character of OUStringBuffer(aUStr1) with m",
947 new OUString(aUStr3),
948 new OUStringBuffer(arrOUS[0]), 4, 109 },
949 {"set the last character of OUStringBuffer(aUStr1) with ' '",
950 new OUString(aUStr32),
951 new OUStringBuffer(arrOUS[0]), 15, 32 },
952 {"set the only character of OUStringBuffer(aUStr27) with ' '",
953 new OUString(aUStr33),
954 new OUStringBuffer(arrOUS[1]), 0, 32},
955 {"set the only of OUStringBuffer(aUStr28) with special character",
956 new OUString(aUStr34),
957 new OUStringBuffer(arrOUS[2]), 1, 5},
959 {"set the only of OUStringBuffer(aUStr28) with special character",
960 new OUString(aUStr35),
961 new OUStringBuffer(arrOUS[2]), 1, -5}
963 #ifdef WITH_CORE
964 ,{"invalid character of OUStringBuffer()",
966 new OUStringBuffer(arrOUS[3]), 0, 5},
967 {"invalid character of OUStringBuffer()",
969 new OUStringBuffer(arrOUS[3]), -2, 5},
970 {"invalid character of OUStringBuffer()",
972 new OUStringBuffer(arrOUS[3]), 3, 5}
973 #endif
978 sal_Bool res = sal_True;
979 sal_uInt32 i;
981 for (i = 0; i < (sizeof (arrTestCase))/(sizeof (TestCase)); i++)
983 sal_Bool lastRes =
984 ( (arrTestCase[i].input1->setCharAt(arrTestCase[i].input2,
985 arrTestCase[i].input3)).getStr() == *(arrTestCase[i].expVal) );
986 if(i<=4)
988 c_rtl_tres_state
990 hRtlTestResult,
991 lastRes,
992 arrTestCase[i].comments,
993 createName( pMeth, "setCharAt", i )
997 else
999 c_rtl_tres_state
1001 hRtlTestResult,
1002 sal_True,
1003 arrTestCase[i].comments,
1004 createName( pMeth, "setCharAt", i )
1008 res &= lastRes;
1010 c_rtl_tres_state_end( hRtlTestResult, "setCharAt");
1011 // return ( res );
1013 //------------------------------------------------------------------------
1014 // testing the method append(const OUString &str)
1015 //------------------------------------------------------------------------
1017 sal_Bool SAL_CALL test_rtl_OUStringBuffer_append_001(
1018 hTestResult hRtlTestResult)
1020 sal_Char methName[MAXBUFLENGTH];
1021 sal_Char* pMeth = methName;
1023 OUString arrOUS[5]={OUString( aUStr7 ),
1024 OUString(),
1025 OUString( aUStr25 ),
1026 OUString( "\0",0,
1027 kEncodingRTLTextUSASCII,
1028 kConvertFlagsOStringToOUString),
1029 OUString( aUStr28 )};
1031 typedef struct TestCase
1033 sal_Char* comments;
1034 OUString* expVal;
1035 OUStringBuffer* input1;
1036 OUString* input2;
1038 ~TestCase() { delete input1; delete input2; delete expVal; }
1039 } TestCase;
1041 TestCase arrTestCase[]={
1043 {"Appends the string(length less than 16) to the string buffer arrOUS[0]",
1044 new OUString(aUStr1),
1045 new OUStringBuffer(arrOUS[0]), new OUString(aUStr8) },
1046 {"Appends the string(length more than 16) to the string buffer arrOUS[0]",
1047 new OUString(aUStr2),
1048 new OUStringBuffer(arrOUS[0]), new OUString(aUStr36) },
1049 {"Appends the string(length equal to 16) to the string buffer arrOUS[0]",
1050 new OUString(aUStr37),
1051 new OUStringBuffer(arrOUS[0]), new OUString(aUStr23) },
1052 {"Appends the string(length equal to 0) to the string buffer arrOUS[0]",
1053 new OUString(aUStr7),
1054 new OUStringBuffer(arrOUS[0]), new OUString()},
1055 {"Appends the string(length less than 16) to the string buffer arrOUS[1]",
1056 new OUString(aUStr7),
1057 new OUStringBuffer(arrOUS[1]), new OUString(aUStr7)},
1058 {"Appends the string(length more than 16) to the string buffer arrOUS[1]",
1059 new OUString(aUStr2),
1060 new OUStringBuffer(arrOUS[1]), new OUString(aUStr2)},
1061 {"Appends the string(length equal to 16) to the string buffer arrOUS[1]",
1062 new OUString(aUStr1),
1063 new OUStringBuffer(arrOUS[1]), new OUString(aUStr1) },
1064 {"Appends the string(length equal to 0) to the string buffer arrOUS[1]",
1065 new OUString(),
1066 new OUStringBuffer(arrOUS[1]), new OUString()},
1067 {"Appends the string(length less than 16) to the string buffer arrOUS[2]",
1068 new OUString(aUStr7),
1069 new OUStringBuffer(arrOUS[2]), new OUString(aUStr7)},
1070 {"Appends the string(length more than 16) to the string buffer arrOUS[2]",
1071 new OUString(aUStr2),
1072 new OUStringBuffer(arrOUS[2]), new OUString(aUStr2)},
1073 {"Appends the string(length equal to 16) to the string buffer arrOUS[2]",
1074 new OUString(aUStr1),
1075 new OUStringBuffer(arrOUS[2]), new OUString(aUStr1) },
1076 {"Appends the string(length equal to 0) to the string buffer arrOUS[2]",
1077 new OUString(),
1078 new OUStringBuffer(arrOUS[2]), new OUString()},
1079 {"Appends the string(length less than 16) to the string buffer arrOUS[3]",
1080 new OUString(aUStr7),
1081 new OUStringBuffer(arrOUS[3]), new OUString(aUStr7)},
1082 {"Appends the string(length more than 16) to the string buffer arrOUS[3]",
1083 new OUString(aUStr2),
1084 new OUStringBuffer(arrOUS[3]), new OUString(aUStr2)},
1085 {"Appends the string(length equal to 16) to the string buffer arrOUS[3]",
1086 new OUString(aUStr1),
1087 new OUStringBuffer(arrOUS[3]), new OUString(aUStr1) },
1088 {"Appends the string(length equal to 0) to the string buffer arrOUS[3]",
1089 new OUString(),
1090 new OUStringBuffer(arrOUS[3]), new OUString()},
1091 {"Appends the string(length less than 16) to the string buffer arrOUS[4]",
1092 new OUString(aUStr29),
1093 new OUStringBuffer(arrOUS[4]), new OUString(aUStr38)},
1094 {"Appends the string(length more than 16) to the string buffer arrOUS[4]",
1095 new OUString(aUStr39),
1096 new OUStringBuffer(arrOUS[4]), new OUString(aUStr17)},
1097 {"Appends the string(length equal to 16) to the string buffer arrOUS[4]",
1098 new OUString(aUStr40),
1099 new OUStringBuffer(arrOUS[4]), new OUString(aUStr31) },
1100 {"Appends the string(length equal to 0) to the string buffer arrOUS[4]",
1101 new OUString(aUStr28),
1102 new OUStringBuffer(arrOUS[4]), new OUString()}
1103 #ifdef WITH_CORE
1104 ,{"Appends the string(length equal to 0) to the string buffer(with INT_MAX) ",
1105 new OUString(),
1106 new OUStringBuffer(kSInt32Max), new OUString()}
1107 #endif
1111 sal_Bool res = sal_True;
1112 sal_uInt32 i;
1114 for (i = 0; i < (sizeof (arrTestCase))/(sizeof (TestCase)); i++)
1116 arrTestCase[i].input1->append( *(arrTestCase[i].input2) );
1117 sal_Bool lastRes =
1118 ( arrTestCase[i].input1->getStr()== *(arrTestCase[i].expVal) &&
1119 arrTestCase[i].input1->getLength() == arrTestCase[i].expVal->getLength() );
1121 c_rtl_tres_state
1123 hRtlTestResult,
1124 lastRes,
1125 arrTestCase[i].comments,
1126 createName( pMeth, "append(const OUString &str)_001", i )
1130 res &= lastRes;
1133 return ( res );
1135 //------------------------------------------------------------------------
1136 // testing the method append( const sal_Unicode * str )
1137 //------------------------------------------------------------------------
1139 sal_Bool SAL_CALL test_rtl_OUStringBuffer_append_002(
1140 hTestResult hRtlTestResult)
1142 sal_Char methName[MAXBUFLENGTH];
1143 sal_Char* pMeth = methName;
1145 OUString arrOUS[5]={OUString( aUStr7 ),
1146 OUString(),
1147 OUString( aUStr25 ),
1148 OUString( "\0",0,
1149 kEncodingRTLTextUSASCII,
1150 kConvertFlagsOStringToOUString),
1151 OUString( aUStr28 )};
1153 typedef struct TestCase
1155 sal_Char* comments;
1156 OUString* expVal;
1157 OUStringBuffer* input1;
1158 sal_Unicode* input2;
1160 ~TestCase() { delete input1; delete expVal; }
1161 } TestCase;
1163 TestCase arrTestCase[]={
1165 {"Appends the string(length less than 16) to the string buffer arrOUS[0]",
1166 new OUString(aUStr1),
1167 new OUStringBuffer(arrOUS[0]), aUStr8 },
1168 {"Appends the string(length more than 16) to the string buffer arrOUS[0]",
1169 new OUString(aUStr2),
1170 new OUStringBuffer(arrOUS[0]), aUStr36 },
1171 {"Appends the string(length equal to 16) to the string buffer arrOUS[0]",
1172 new OUString(aUStr37),
1173 new OUStringBuffer(arrOUS[0]), aUStr23 },
1174 {"Appends the string(length equal to 0) to the string buffer arrOUS[0]",
1175 new OUString(aUStr7),
1176 new OUStringBuffer(arrOUS[0]), aUStr25 },
1177 {"Appends the string(length less than 16) to the string buffer arrOUS[1]",
1178 new OUString(aUStr7),
1179 new OUStringBuffer(arrOUS[1]), aUStr7 },
1180 {"Appends the string(length more than 16) to the string buffer arrOUS[1]",
1181 new OUString(aUStr2),
1182 new OUStringBuffer(arrOUS[1]), aUStr2 },
1183 {"Appends the string(length equal to 16) to the string buffer arrOUS[1]",
1184 new OUString(aUStr1),
1185 new OUStringBuffer(arrOUS[1]), aUStr1 },
1186 {"Appends the string(length equal to 0) to the string buffer arrOUS[1]",
1187 new OUString(),
1188 new OUStringBuffer(arrOUS[1]), aUStr25 },
1189 {"Appends the string(length less than 16) to the string buffer arrOUS[2]",
1190 new OUString(aUStr7),
1191 new OUStringBuffer(arrOUS[2]), aUStr7 },
1192 {"Appends the string(length more than 16) to the string buffer arrOUS[2]",
1193 new OUString(aUStr2),
1194 new OUStringBuffer(arrOUS[2]), aUStr2 },
1195 {"Appends the string(length equal to 16) to the string buffer arrOUS[2]",
1196 new OUString(aUStr1),
1197 new OUStringBuffer(arrOUS[2]), aUStr1 },
1198 {"Appends the string(length equal to 0) to the string buffer arrOUS[2]",
1199 new OUString(),
1200 new OUStringBuffer(arrOUS[2]), aUStr25 },
1201 {"Appends the string(length less than 16) to the string buffer arrOUS[3]",
1202 new OUString(aUStr7),
1203 new OUStringBuffer(arrOUS[3]), aUStr7 },
1204 {"Appends the string(length more than 16) to the string buffer arrOUS[3]",
1205 new OUString(aUStr2),
1206 new OUStringBuffer(arrOUS[3]), aUStr2 },
1207 {"Appends the string(length equal to 16) to the string buffer arrOUS[3]",
1208 new OUString(aUStr1),
1209 new OUStringBuffer(arrOUS[3]), aUStr1 },
1210 {"Appends the string(length equal to 0) to the string buffer arrOUS[3]",
1211 new OUString(),
1212 new OUStringBuffer(arrOUS[3]), aUStr25 },
1213 {"Appends the string(length less than 16) to the string buffer arrOUS[4]",
1214 new OUString(aUStr29),
1215 new OUStringBuffer(arrOUS[4]), aUStr38 },
1216 {"Appends the string(length more than 16) to the string buffer arrOUS[4]",
1217 new OUString(aUStr39),
1218 new OUStringBuffer(arrOUS[4]), aUStr17 },
1219 {"Appends the string(length equal to 16) to the string buffer arrOUS[4]",
1220 new OUString(aUStr40),
1221 new OUStringBuffer(arrOUS[4]), aUStr31 },
1222 {"Appends the string(length equal to 0) to the string buffer arrOUS[4]",
1223 new OUString(aUStr28),
1224 new OUStringBuffer(arrOUS[4]), aUStr25 }
1225 #ifdef WITH_CORE
1226 ,{"Appends the string(length equal to 0) to the string buffer(with INT_MAX) ",
1227 new OUString(),
1228 new OUStringBuffer(kSInt32Max), aUStr25 }
1229 #endif
1233 sal_Bool res = sal_True;
1234 sal_uInt32 i;
1236 for (i = 0; i < (sizeof (arrTestCase))/(sizeof (TestCase)); i++)
1238 arrTestCase[i].input1->append( arrTestCase[i].input2 );
1239 sal_Bool lastRes =
1240 ( arrTestCase[i].input1->getStr()== *(arrTestCase[i].expVal) &&
1241 arrTestCase[i].input1->getLength() == arrTestCase[i].expVal->getLength() );
1243 c_rtl_tres_state
1245 hRtlTestResult,
1246 lastRes,
1247 arrTestCase[i].comments,
1248 createName( pMeth, "append( const sal_Unicode * str )_002", i )
1252 res &= lastRes;
1255 return ( res );
1257 //------------------------------------------------------------------------
1258 // testing the method append( const sal_Unicode * str, sal_Int32 len)
1259 //------------------------------------------------------------------------
1261 sal_Bool SAL_CALL test_rtl_OUStringBuffer_append_003(
1262 hTestResult hRtlTestResult)
1264 sal_Char methName[MAXBUFLENGTH];
1265 sal_Char* pMeth = methName;
1267 OUString arrOUS[5]={OUString( aUStr7 ),
1268 OUString(),
1269 OUString( aUStr25 ),
1270 OUString( "\0",0,
1271 kEncodingRTLTextUSASCII,
1272 kConvertFlagsOStringToOUString),
1273 OUString( aUStr28 )};
1275 typedef struct TestCase
1277 sal_Char* comments;
1278 OUString* expVal;
1279 OUStringBuffer* input1;
1280 sal_Unicode* input2;
1281 sal_Int32 input3;
1283 ~TestCase() { delete input1; delete expVal; }
1284 } TestCase;
1286 TestCase arrTestCase[]={
1288 {"Appends the string(length less than 16) to the string buffer arrOUS[0]",
1289 new OUString(aUStr1),
1290 new OUStringBuffer(arrOUS[0]), aUStr36, 12 },
1291 {"Appends the string(length more than 16) to the string buffer arrOUS[0]",
1292 new OUString(aUStr2),
1293 new OUStringBuffer(arrOUS[0]), aUStr36, 28 },
1294 {"Appends the string(length equal to 16) to the string buffer arrOUS[0]",
1295 new OUString(aUStr37),
1296 new OUStringBuffer(arrOUS[0]), aUStr23, 16 },
1297 {"Appends the string(length equal to 0) to the string buffer arrOUS[0]",
1298 new OUString(aUStr7),
1299 new OUStringBuffer(arrOUS[0]), aUStr2, 0 },
1300 /* LLA: input3 must null < 0
1301 {"Appends the string(length less than 0) to the string buffer arrOUS[0]",
1302 new OUString(aUStr41),
1303 new OUStringBuffer(arrOUS[0]), aUStr2, -1 },
1305 {"Appends the string(length less than 16) to the string buffer arrOUS[1]",
1306 new OUString(aUStr7),
1307 new OUStringBuffer(arrOUS[1]), aUStr2, 4 },
1308 {"Appends the string(length more than 16) to the string buffer arrOUS[1]",
1309 new OUString(aUStr2),
1310 new OUStringBuffer(arrOUS[1]), aUStr2, 32 },
1311 {"Appends the string(length equal to 16) to the string buffer arrOUS[1]",
1312 new OUString(aUStr1),
1313 new OUStringBuffer(arrOUS[1]), aUStr2, 16 },
1314 {"Appends the string(length equal to 0) to the string buffer arrOUS[1]",
1315 new OUString(),
1316 new OUStringBuffer(arrOUS[1]), aUStr2, 0 },
1317 /* LLA: input3 must null < 0
1318 {"Appends the string(length less than 0) to the string buffer arrOUS[1]",
1319 new OUString(),
1320 new OUStringBuffer(arrOUS[1]), aUStr2, -1 },
1322 {"Appends the string(length less than 16) to the string buffer arrOUS[2]",
1323 new OUString(aUStr7),
1324 new OUStringBuffer(arrOUS[2]), aUStr2, 4 },
1325 {"Appends the string(length more than 16) to the string buffer arrOUS[2]",
1326 new OUString(aUStr2),
1327 new OUStringBuffer(arrOUS[2]), aUStr2, 32 },
1328 {"Appends the string(length equal to 16) to the string buffer arrOUS[2]",
1329 new OUString(aUStr1),
1330 new OUStringBuffer(arrOUS[2]), aUStr2, 16 },
1331 {"Appends the string(length equal to 0) to the string buffer arrOUS[2]",
1332 new OUString(),
1333 new OUStringBuffer(arrOUS[2]), aUStr2, 0 },
1334 /* LLA: input3 must null < 0
1335 {"Appends the string(length less than 0) to the string buffer arrOUS[2]",
1336 new OUString(),
1337 new OUStringBuffer(arrOUS[2]), aUStr2, -1 },
1339 {"Appends the string(length less than 16) to the string buffer arrOUS[3]",
1340 new OUString(aUStr7),
1341 new OUStringBuffer(arrOUS[3]), aUStr2, 4 },
1342 {"Appends the string(length more than 16) to the string buffer arrOUS[3]",
1343 new OUString(aUStr2),
1344 new OUStringBuffer(arrOUS[3]), aUStr2, 32 },
1345 {"Appends the string(length equal to 16) to the string buffer arrOUS[3]",
1346 new OUString(aUStr1),
1347 new OUStringBuffer(arrOUS[3]), aUStr2, 16 },
1348 {"Appends the string(length equal to 0) to the string buffer arrOUS[3]",
1349 new OUString(),
1350 new OUStringBuffer(arrOUS[3]), aUStr2, 0 },
1351 /* LLA: input3 must null < 0
1352 {"Appends the string(length less than 0) to the string buffer arrOUS[3]",
1353 new OUString(),
1354 new OUStringBuffer(arrOUS[3]), aUStr2, -1 },
1356 {"Appends the string(length less than 16) to the string buffer arrOUS[4]",
1357 new OUString(aUStr29),
1358 new OUStringBuffer(arrOUS[4]), aUStr38, 7 },
1359 {"Appends the string(length more than 16) to the string buffer arrOUS[4]",
1360 new OUString(aUStr39),
1361 new OUStringBuffer(arrOUS[4]), aUStr17, 22 },
1362 {"Appends the string(length equal to 16) to the string buffer arrOUS[4]",
1363 new OUString(aUStr40),
1364 new OUStringBuffer(arrOUS[4]), aUStr31, 16 },
1365 {"Appends the string(length equal to 0) to the string buffer arrOUS[4]",
1366 new OUString(aUStr28),
1367 new OUStringBuffer(arrOUS[4]), aUStr2, 0 },
1368 /* LLA: input3 must null < 0
1369 {"Appends the string(length less than 0) to the string buffer arrOUS[4]",
1370 new OUString(aUStr42),
1371 new OUStringBuffer(arrOUS[4]), aUStr2, -1 }
1373 #ifdef WITH_CORE
1374 ,{"Appends the string(length equal to 0) to the string buffer(with INT_MAX) ",
1375 new OUString(),
1376 new OUStringBuffer(kSInt32Max), aUStr25 }
1377 #endif
1381 sal_Bool res = sal_True;
1382 sal_uInt32 i;
1384 for (i = 0; i < (sizeof (arrTestCase))/(sizeof (TestCase)); i++)
1386 arrTestCase[i].input1->append(
1387 arrTestCase[i].input2, arrTestCase[i].input3);
1388 sal_Bool lastRes =
1389 ( arrTestCase[i].input1->getStr()== *(arrTestCase[i].expVal) &&
1390 arrTestCase[i].input1->getLength() == arrTestCase[i].expVal->getLength() );
1392 c_rtl_tres_state
1394 hRtlTestResult,
1395 lastRes,
1396 arrTestCase[i].comments,
1397 createName( pMeth, "append( const sal_Unicode * str, sal_Int32 len)_003", i )
1401 res &= lastRes;
1404 return ( res );
1406 //------------------------------------------------------------------------
1407 // testing the method append(sal_Bool b)
1408 //------------------------------------------------------------------------
1410 sal_Bool SAL_CALL test_rtl_OUStringBuffer_append_004(
1411 hTestResult hRtlTestResult)
1413 sal_Char methName[MAXBUFLENGTH];
1414 sal_Char* pMeth = methName;
1416 OUString arrOUS[5]={OUString( aUStr7 ),
1417 OUString(),
1418 OUString( aUStr25 ),
1419 OUString( "\0",0,
1420 kEncodingRTLTextUSASCII,
1421 kConvertFlagsOStringToOUString),
1422 OUString( aUStr28 )};
1424 typedef struct TestCase
1426 sal_Char* comments;
1427 OUString* expVal;
1428 OUStringBuffer* input1;
1429 sal_Bool input2;
1431 ~TestCase() { delete input1; delete expVal; }
1432 } TestCase;
1434 TestCase arrTestCase[]={
1436 {"Appends the sal_Bool(sal_True) to the string buffer arrOUS[0]",
1437 new OUString(aUStr45),
1438 new OUStringBuffer(arrOUS[0]), sal_True },
1439 {"Appends the sal_Bool(sal_False) to the string buffer arrOUS[0]",
1440 new OUString(aUStr46),
1441 new OUStringBuffer(arrOUS[0]), sal_False },
1442 {"Appends the sal_Bool(sal_True) to the string buffer arrOUS[1]",
1443 new OUString(aUStr47),
1444 new OUStringBuffer(arrOUS[1]), sal_True },
1445 {"Appends the sal_Bool(sal_False) to the string buffer arrOUS[1]",
1446 new OUString(aUStr48),
1447 new OUStringBuffer(arrOUS[1]), sal_False },
1448 {"Appends the sal_Bool(sal_True) to the string buffer arrOUS[2]",
1449 new OUString(aUStr47),
1450 new OUStringBuffer(arrOUS[2]), sal_True },
1451 {"Appends the sal_Bool(sal_False) to the string buffer arrOUS[2]",
1452 new OUString(aUStr48),
1453 new OUStringBuffer(arrOUS[2]), sal_False },
1454 {"Appends the sal_Bool(sal_True) to the string buffer arrOUS[3]",
1455 new OUString(aUStr47),
1456 new OUStringBuffer(arrOUS[3]), sal_True },
1457 {"Appends the sal_Bool(sal_False) to the string buffer arrOUS[3]",
1458 new OUString(aUStr48),
1459 new OUStringBuffer(arrOUS[3]), sal_False },
1460 {"Appends the sal_Bool(sal_True) to the string buffer arrOUS[4]",
1461 new OUString(aUStr49),
1462 new OUStringBuffer(arrOUS[4]), sal_True },
1463 {"Appends the sal_Bool(sal_False) to the string buffer arrOUS[4]",
1464 new OUString(aUStr50),
1465 new OUStringBuffer(arrOUS[4]), sal_False }
1466 #ifdef WITH_CORE
1467 ,{"Appends the sal_Bool(sal_True) to the string buffer(with INT_MAX) ",
1468 new OUString(aUStr47),
1469 new OUStringBuffer(kSInt32Max), sal_True },
1470 {"Appends the sal_Bool(sal_False) to the string buffer(with INT_MAX) ",
1471 new OUString(aUStr48),
1472 new OUStringBuffer(kSInt32Max), sal_False }
1473 #endif
1477 sal_Bool res = sal_True;
1478 sal_uInt32 i;
1480 for (i = 0; i < (sizeof (arrTestCase))/(sizeof (TestCase)); i++)
1482 arrTestCase[i].input1->append(
1483 arrTestCase[i].input2 );
1484 sal_Bool lastRes =
1485 ( arrTestCase[i].input1->getStr()== *(arrTestCase[i].expVal) &&
1486 arrTestCase[i].input1->getLength() == arrTestCase[i].expVal->getLength() );
1488 c_rtl_tres_state
1490 hRtlTestResult,
1491 lastRes,
1492 arrTestCase[i].comments,
1493 createName( pMeth, "append( sal_Bool b)_004", i )
1497 res &= lastRes;
1500 return ( res );
1503 extern "C" void /* sal_Bool */ SAL_CALL test_rtl_OUStringBuffer_appends(
1504 hTestResult hRtlTestResult )
1506 c_rtl_tres_state_start( hRtlTestResult, "appends");
1507 sal_Bool bTSState = test_rtl_OUStringBuffer_append_001( hRtlTestResult );
1508 bTSState &= test_rtl_OUStringBuffer_append_002( hRtlTestResult);
1509 bTSState &= test_rtl_OUStringBuffer_append_003( hRtlTestResult);
1510 bTSState &= test_rtl_OUStringBuffer_append_004( hRtlTestResult);
1512 c_rtl_tres_state_end( hRtlTestResult, "appends");
1513 // return( bTSState );
1515 //------------------------------------------------------------------------
1516 // testing the method appendAscii( const sal_Char * str )
1517 //------------------------------------------------------------------------
1519 sal_Bool SAL_CALL test_rtl_OUStringBuffer_appendAscii_001(
1520 hTestResult hRtlTestResult)
1522 sal_Char methName[MAXBUFLENGTH];
1523 sal_Char* pMeth = methName;
1525 OUString arrOUS[5]={OUString( aUStr7 ),
1526 OUString(),
1527 OUString( aUStr25 ),
1528 OUString( "\0",0,
1529 kEncodingRTLTextUSASCII,
1530 kConvertFlagsOStringToOUString),
1531 OUString( aUStr28 )};
1533 typedef struct TestCase
1535 sal_Char* comments;
1536 OUString* expVal;
1537 OUStringBuffer* input1;
1538 const sal_Char* input2;
1540 ~TestCase() { delete input1; delete expVal; }
1541 } TestCase;
1543 TestCase arrTestCase[]={
1545 {"Appends the string(length less than 16) to the string buffer arrOUS[0]",
1546 new OUString(aUStr1),
1547 new OUStringBuffer(arrOUS[0]), kTestStr8 },
1548 {"Appends the string(length more than 16) to the string buffer arrOUS[0]",
1549 new OUString(aUStr2),
1550 new OUStringBuffer(arrOUS[0]), kTestStr36 },
1551 {"Appends the string(length equal to 16) to the string buffer arrOUS[0]",
1552 new OUString(aUStr37),
1553 new OUStringBuffer(arrOUS[0]), kTestStr23 },
1554 {"Appends the string(length equal to 0) to the string buffer arrOUS[0]",
1555 new OUString(aUStr7),
1556 new OUStringBuffer(arrOUS[0]), kTestStr25 },
1557 {"Appends the string(length less than 16) to the string buffer arrOUS[1]",
1558 new OUString(aUStr7),
1559 new OUStringBuffer(arrOUS[1]), kTestStr7 },
1560 {"Appends the string(length more than 16) to the string buffer arrOUS[1]",
1561 new OUString(aUStr2),
1562 new OUStringBuffer(arrOUS[1]), kTestStr2 },
1563 {"Appends the string(length equal to 16) to the string buffer arrOUS[1]",
1564 new OUString(aUStr1),
1565 new OUStringBuffer(arrOUS[1]), kTestStr1 },
1566 {"Appends the string(length equal to 0) to the string buffer arrOUS[1]",
1567 new OUString(),
1568 new OUStringBuffer(arrOUS[1]), kTestStr25 },
1569 {"Appends the string(length less than 16) to the string buffer arrOUS[2]",
1570 new OUString(aUStr7),
1571 new OUStringBuffer(arrOUS[2]), kTestStr7 },
1572 {"Appends the string(length more than 16) to the string buffer arrOUS[2]",
1573 new OUString(aUStr2),
1574 new OUStringBuffer(arrOUS[2]), kTestStr2 },
1575 {"Appends the string(length equal to 16) to the string buffer arrOUS[2]",
1576 new OUString(aUStr1),
1577 new OUStringBuffer(arrOUS[2]), kTestStr1 },
1578 {"Appends the string(length equal to 0) to the string buffer arrOUS[2]",
1579 new OUString(),
1580 new OUStringBuffer(arrOUS[2]), kTestStr25 },
1581 {"Appends the string(length less than 16) to the string buffer arrOUS[3]",
1582 new OUString(aUStr7),
1583 new OUStringBuffer(arrOUS[3]), kTestStr7 },
1584 {"Appends the string(length more than 16) to the string buffer arrOUS[3]",
1585 new OUString(aUStr2),
1586 new OUStringBuffer(arrOUS[3]), kTestStr2 },
1587 {"Appends the string(length equal to 16) to the string buffer arrOUS[3]",
1588 new OUString(aUStr1),
1589 new OUStringBuffer(arrOUS[3]), kTestStr1 },
1590 {"Appends the string(length equal to 0) to the string buffer arrOUS[3]",
1591 new OUString(),
1592 new OUStringBuffer(arrOUS[3]), kTestStr25 },
1593 {"Appends the string(length less than 16) to the string buffer arrOUS[4]",
1594 new OUString(aUStr29),
1595 new OUStringBuffer(arrOUS[4]), kTestStr38 },
1596 {"Appends the string(length more than 16) to the string buffer arrOUS[4]",
1597 new OUString(aUStr39),
1598 new OUStringBuffer(arrOUS[4]), kTestStr17 },
1599 {"Appends the string(length equal to 16) to the string buffer arrOUS[4]",
1600 new OUString(aUStr40),
1601 new OUStringBuffer(arrOUS[4]), kTestStr31 },
1602 {"Appends the string(length equal to 0) to the string buffer arrOUS[4]",
1603 new OUString(aUStr28),
1604 new OUStringBuffer(arrOUS[4]), kTestStr25 }
1605 /*{"Appends the string(with special characters) to the string buffer arrOUS[4]",
1606 new OUString(aUStr43),
1607 new OUStringBuffer(arrOUS[4]), kTestStr44 }*/
1608 #ifdef WITH_CORE
1609 ,{"Appends the string(length equal to 0) to the string buffer(with INT_MAX) ",
1610 new OUString(),
1611 new OUStringBuffer(kSInt32Max), kTestStr25 }
1612 #endif
1617 sal_Bool res = sal_True;
1618 sal_uInt32 i;
1620 for (i = 0; i < (sizeof (arrTestCase))/(sizeof (TestCase)); i++)
1622 arrTestCase[i].input1->appendAscii( arrTestCase[i].input2 );
1623 sal_Bool lastRes =
1624 ( arrTestCase[i].input1->getStr()== *(arrTestCase[i].expVal) &&
1625 arrTestCase[i].input1->getLength() == arrTestCase[i].expVal->getLength() );
1627 c_rtl_tres_state
1629 hRtlTestResult,
1630 lastRes,
1631 arrTestCase[i].comments,
1632 createName( pMeth, "appendAscii_001", i )
1635 res &= lastRes;
1637 return ( res );
1639 //------------------------------------------------------------------------
1640 // testing the method appendAscii( const sal_Char * str, sal_Int32 len)
1641 //------------------------------------------------------------------------
1643 sal_Bool SAL_CALL test_rtl_OUStringBuffer_appendAscii_002(
1644 hTestResult hRtlTestResult)
1646 sal_Char methName[MAXBUFLENGTH];
1647 sal_Char* pMeth = methName;
1649 OUString arrOUS[5]={OUString( aUStr7 ),
1650 OUString(),
1651 OUString( aUStr25 ),
1652 OUString( "\0",0,
1653 kEncodingRTLTextUSASCII,
1654 kConvertFlagsOStringToOUString),
1655 OUString( aUStr28 )};
1657 typedef struct TestCase
1659 sal_Char* comments;
1660 OUString* expVal;
1661 OUStringBuffer* input1;
1662 const sal_Char* input2;
1663 sal_Int32 input3;
1665 ~TestCase() { delete input1; delete expVal; }
1666 } TestCase;
1668 TestCase arrTestCase[]={
1670 {"Appends the string(length less than 16) to the string buffer arrOUS[0]",
1671 new OUString(aUStr1),
1672 new OUStringBuffer(arrOUS[0]), kTestStr36, 12 },
1673 {"Appends the string(length more than 16) to the string buffer arrOUS[0]",
1674 new OUString(aUStr2),
1675 new OUStringBuffer(arrOUS[0]), kTestStr36, 28 },
1676 {"Appends the string(length equal to 16) to the string buffer arrOUS[0]",
1677 new OUString(aUStr37),
1678 new OUStringBuffer(arrOUS[0]), kTestStr23, 16 },
1679 {"Appends the string(length equal to 0) to the string buffer arrOUS[0]",
1680 new OUString(aUStr7),
1681 new OUStringBuffer(arrOUS[0]), kTestStr2, 0 },
1682 /* LLA: input3 must null < 0
1683 {"Appends the string(length less than 0) to the string buffer arrOUS[0]",
1684 new OUString(aUStr41),
1685 new OUStringBuffer(arrOUS[0]), kTestStr2, -1 },
1687 {"Appends the string(length less than 16) to the string buffer arrOUS[1]",
1688 new OUString(aUStr7),
1689 new OUStringBuffer(arrOUS[1]), kTestStr2, 4 },
1690 {"Appends the string(length more than 16) to the string buffer arrOUS[1]",
1691 new OUString(aUStr2),
1692 new OUStringBuffer(arrOUS[1]), kTestStr2, 32 },
1693 {"Appends the string(length equal to 16) to the string buffer arrOUS[1]",
1694 new OUString(aUStr1),
1695 new OUStringBuffer(arrOUS[1]), kTestStr2, 16 },
1696 {"Appends the string(length equal to 0) to the string buffer arrOUS[1]",
1697 new OUString(),
1698 new OUStringBuffer(arrOUS[1]), kTestStr2, 0 },
1699 /* LLA: input3 must null < 0
1700 {"Appends the string(length less than 0) to the string buffer arrOUS[1]",
1701 new OUString(),
1702 new OUStringBuffer(arrOUS[1]), kTestStr2, -1 },
1704 {"Appends the string(length less than 16) to the string buffer arrOUS[2]",
1705 new OUString(aUStr7),
1706 new OUStringBuffer(arrOUS[2]), kTestStr2, 4 },
1707 {"Appends the string(length more than 16) to the string buffer arrOUS[2]",
1708 new OUString(aUStr2),
1709 new OUStringBuffer(arrOUS[2]), kTestStr2, 32 },
1710 {"Appends the string(length equal to 16) to the string buffer arrOUS[2]",
1711 new OUString(aUStr1),
1712 new OUStringBuffer(arrOUS[2]), kTestStr2, 16 },
1713 {"Appends the string(length equal to 0) to the string buffer arrOUS[2]",
1714 new OUString(),
1715 new OUStringBuffer(arrOUS[2]), kTestStr2, 0 },
1716 /* LLA: input3 must null < 0
1717 {"Appends the string(length less than 0) to the string buffer arrOUS[2]",
1718 new OUString(),
1719 new OUStringBuffer(arrOUS[2]), kTestStr2, -1 },
1721 {"Appends the string(length less than 16) to the string buffer arrOUS[3]",
1722 new OUString(aUStr7),
1723 new OUStringBuffer(arrOUS[3]), kTestStr2, 4 },
1724 {"Appends the string(length more than 16) to the string buffer arrOUS[3]",
1725 new OUString(aUStr2),
1726 new OUStringBuffer(arrOUS[3]), kTestStr2, 32 },
1727 {"Appends the string(length equal to 16) to the string buffer arrOUS[3]",
1728 new OUString(aUStr1),
1729 new OUStringBuffer(arrOUS[3]), kTestStr2, 16 },
1730 {"Appends the string(length equal to 0) to the string buffer arrOUS[3]",
1731 new OUString(),
1732 new OUStringBuffer(arrOUS[3]), kTestStr2, 0 },
1733 /* LLA: input3 must null < 0
1734 {"Appends the string(length less than 0) to the string buffer arrOUS[3]",
1735 new OUString(),
1736 new OUStringBuffer(arrOUS[3]), kTestStr2, -1 },
1738 {"Appends the string(length less than 16) to the string buffer arrOUS[4]",
1739 new OUString(aUStr29),
1740 new OUStringBuffer(arrOUS[4]), kTestStr38, 7 },
1741 {"Appends the string(length more than 16) to the string buffer arrOUS[4]",
1742 new OUString(aUStr39),
1743 new OUStringBuffer(arrOUS[4]), kTestStr17, 22 },
1744 {"Appends the string(length equal to 16) to the string buffer arrOUS[4]",
1745 new OUString(aUStr40),
1746 new OUStringBuffer(arrOUS[4]), kTestStr31, 16 },
1747 {"Appends the string(length equal to 0) to the string buffer arrOUS[4]",
1748 new OUString(aUStr28),
1749 new OUStringBuffer(arrOUS[4]), kTestStr2, 0 },
1750 /* LLA: input3 must null < 0
1751 {"Appends the string(length less than 0) to the string buffer arrOUS[4]",
1752 new OUString(aUStr42),
1753 new OUStringBuffer(arrOUS[4]), kTestStr2, -1 }
1755 #ifdef WITH_CORE
1756 ,{"Appends the string(length equal to 0) to the string buffer(with INT_MAX) ",
1757 new OUString(),
1758 new OUStringBuffer(kSInt32Max), kTestStr25 }
1759 #endif
1763 sal_Bool res = sal_True;
1764 sal_uInt32 i;
1766 for (i = 0; i < (sizeof (arrTestCase))/(sizeof (TestCase)); i++)
1768 arrTestCase[i].input1->appendAscii(
1769 arrTestCase[i].input2, arrTestCase[i].input3);
1770 sal_Bool lastRes =
1771 ( arrTestCase[i].input1->getStr()== *(arrTestCase[i].expVal) &&
1772 arrTestCase[i].input1->getLength() == arrTestCase[i].expVal->getLength() );
1774 c_rtl_tres_state
1776 hRtlTestResult,
1777 lastRes,
1778 arrTestCase[i].comments,
1779 createName( pMeth, "appendAscii_002", i )
1783 res &= lastRes;
1785 return ( res );
1787 extern "C" void /* sal_Bool */ SAL_CALL test_rtl_OUStringBuffer_appendAsciis(
1788 hTestResult hRtlTestResult )
1790 c_rtl_tres_state_start( hRtlTestResult, "appendAsciis");
1791 sal_Bool bTSState = test_rtl_OUStringBuffer_appendAscii_001( hRtlTestResult );
1792 bTSState &= test_rtl_OUStringBuffer_appendAscii_002( hRtlTestResult);
1794 c_rtl_tres_state_end( hRtlTestResult, "appendAsciis");
1795 // return( bTSState );
1797 // -----------------------------------------------------------------------------
1798 extern "C" void /* sal_Bool */ SAL_CALL test_rtl_OUStringBuffer( hTestResult hRtlTestResult )
1801 c_rtl_tres_state_start(hRtlTestResult, "rtl_OUStringBuffer" );
1803 test_rtl_OUStringBuffer_ctors( hRtlTestResult );
1804 test_rtl_OUStringBuffer_makeStringAndClear( hRtlTestResult );
1805 test_rtl_OUStringBuffer_getLength( hRtlTestResult );
1806 test_rtl_OUStringBuffer_getCapacity( hRtlTestResult );
1807 test_rtl_OUStringBuffer_ensureCapacity( hRtlTestResult );
1808 test_rtl_OUStringBuffer_setLength( hRtlTestResult );
1809 test_rtl_OUStringBuffer_charAt( hRtlTestResult );
1810 test_rtl_OUStringBuffer_csuc( hRtlTestResult );
1811 test_rtl_OUStringBuffer_getStr( hRtlTestResult );
1812 test_rtl_OUStringBuffer_setCharAt( hRtlTestResult );
1813 test_rtl_OUStringBuffer_appends( hRtlTestResult );
1814 test_rtl_OUStringBuffer_appendAsciis( hRtlTestResult );
1816 c_rtl_tres_state_end(hRtlTestResult, "rtl_OUStringBuffer");
1819 // -----------------------------------------------------------------------------
1820 void RegisterAdditionalFunctions(FktRegFuncPtr _pFunc)
1822 if (_pFunc)
1824 (_pFunc)(&test_rtl_OUStringBuffer, "");