merged tag ooo/DEV300_m102
[LibreOffice.git] / sal / qa / rtl_strings / rtl_OUStringBuffer.cxx
blob950231d1651c6db90ceb9cb0daa93af347302e9e
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2000, 2010 Oracle and/or its affiliates.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * This file is part of OpenOffice.org.
11 * OpenOffice.org is free software: you can redistribute it and/or modify
12 * it under the terms of the GNU Lesser General Public License version 3
13 * only, as published by the Free Software Foundation.
15 * OpenOffice.org is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Lesser General Public License version 3 for more details
19 * (a copy is included in the LICENSE file that accompanied this code).
21 * You should have received a copy of the GNU Lesser General Public License
22 * version 3 along with OpenOffice.org. If not, see
23 * <http://www.openoffice.org/license.html>
24 * for a copy of the LGPLv3 License.
26 ************************************************************************/
28 // MARKER(update_precomp.py): autogen include statement, do not remove
29 #include "precompiled_sal.hxx"
31 #ifndef _SAL_TYPES_H_
32 #include <sal/types.h>
33 #endif
35 // #ifndef _RTL_TRES_H_
36 // #include <rtl/tres.h>
37 // #endif
38 #include <testshl/tresstatewrapper.hxx>
40 #ifndef _RTL_STRING_HXX_
41 #include <rtl/string.hxx>
42 #endif
44 #ifndef _RTL_USTRING_H_
45 #include <rtl/ustring.h>
46 #endif
48 #ifndef _RTL_USTRING_HXX_
49 #include <rtl/ustring.hxx>
50 #endif
52 #ifndef _RTL_USTRBUF_H_
53 #include <rtl/ustrbuf.h>
54 #endif
56 #ifndef _RTL_USTRBUF_HXX
57 #include <rtl/ustrbuf.hxx>
58 #endif
59 //------------------------------------------------------------------------
60 //------------------------------------------------------------------------
61 #ifndef _OSL_THREAD_H_
62 #include <osl/thread.h>
63 #endif
65 #ifndef _RTL_STRING_CONST_H_
66 #include <rtl_String_Const.h>
67 #endif
69 #ifndef _RTL_STRING_UTILS_HXX_
70 #include <rtl_String_Utils.hxx>
71 #endif
73 #include "stdio.h"
74 using namespace rtl;
76 //------------------------------------------------------------------------
77 // test classes
78 //------------------------------------------------------------------------
79 const int MAXBUFLENGTH = 255;
80 //------------------------------------------------------------------------
81 // helper functions
82 //------------------------------------------------------------------------
83 static void unused()
85 (void)kBinaryNumsStr;
86 (void)kOctolNumsStr;
87 (void)kDecimalNumsStr;
88 (void)kHexDecimalNumsStr;
89 (void)kBase36NumsStr;
90 (void)inputChar;
91 (void)input1StrDefault;
92 (void)input1StrNormal;
93 (void)input1StrLastDefault;
94 (void)input1StrLastNormal;
95 unused();
98 //------------------------------------------------------------------------
99 // testing constructors
100 //------------------------------------------------------------------------
101 static sal_Bool test_rtl_OUStringBuffer_ctor_001( hTestResult hRtlTestResult )
104 ::rtl::OUStringBuffer aUStrBuf;
106 bool b1 =
107 aUStrBuf.getLength() == 0 &&
108 ! *(aUStrBuf.getStr()) && aUStrBuf.getCapacity() == 16;
110 ::rtl::OUStringBuffer aUStrBuf2(0);
112 bool b2 =
113 aUStrBuf2.getLength() == 0 &&
114 ! *(aUStrBuf2.getStr()) && aUStrBuf2.getCapacity() == /* LLA: !!! */ 0;
116 return
118 c_rtl_tres_state
120 hRtlTestResult,
121 b1 && b2,
122 "New OUStringBuffer containing no characters",
123 "ctor_001"
128 //------------------------------------------------------------------------
130 static sal_Bool SAL_CALL test_rtl_OUStringBuffer_ctor_002(
131 hTestResult hRtlTestResult )
133 ::rtl::OUStringBuffer aUStrBuftmp( aUStr1 );
134 ::rtl::OUStringBuffer aUStrBuf( aUStrBuftmp );
135 sal_Bool res = cmpustr(aUStrBuftmp.getStr(),aUStrBuf.getStr());
136 return
138 c_rtl_tres_state
140 hRtlTestResult,
141 aUStrBuf.getLength()==aUStrBuftmp.getLength() &&
142 aUStrBuf.getCapacity() == aUStrBuftmp.getCapacity() && res ,
143 "New OUStringBuffer from another OUStringBuffer",
144 "ctor_002"
148 //------------------------------------------------------------------------
150 /* static */
151 sal_Bool SAL_CALL test_rtl_OUStringBuffer_ctor_003(
152 hTestResult hRtlTestResult )
154 ::rtl::OUStringBuffer aUStrBuf1(kTestStr2Len);
155 #ifdef WITH_CORE
156 ::rtl::OUStringBuffer aUStrBuf2(kSInt32Max); //will core dump
157 #else
158 ::rtl::OUStringBuffer aUStrBuf2(0);
159 #endif
160 ::rtl::OUStringBuffer aUStrBuf3(kNonSInt32Max);
163 bool b1 =
164 aUStrBuf1.getLength() == 0 &&
165 ! *(aUStrBuf1.getStr()) && aUStrBuf1.getCapacity() == kTestStr2Len ;
167 bool b2 =
168 #ifdef WITH_CORE
169 aUStrBuf2.getLength() == 0 &&
170 ! *(aUStrBuf2.getStr()) && aUStrBuf2.getCapacity() == kSInt32Max ;
171 #else
172 aUStrBuf2.getLength() == 0 &&
173 ! *(aUStrBuf2.getStr()) && aUStrBuf2.getCapacity() == /* LLA: ??? 16 */ 0;
174 #endif
175 bool b3 =
176 aUStrBuf3.getLength() == 0 &&
177 ! *(aUStrBuf3.getStr()) && aUStrBuf3.getCapacity() == kNonSInt32Max;
179 return
181 c_rtl_tres_state
183 hRtlTestResult,
184 b1 && b2 && b3,
185 "New OUStringBuffer containing no characters and contain assigned capacity",
186 "ctor_003( will core dump,because the kSInt32Max )"
192 //------------------------------------------------------------------------
194 static sal_Bool SAL_CALL test_rtl_OUStringBuffer_ctor_004(
195 hTestResult hRtlTestResult)
197 ::rtl::OUString aUStrtmp( aUStr1 );
198 ::rtl::OUStringBuffer aUStrBuf( aUStrtmp );
199 sal_Int32 leg = aUStrBuf.getLength();
200 return
202 c_rtl_tres_state
204 hRtlTestResult,
205 aUStrBuf.getStr() == aUStrtmp &&
206 leg == aUStrtmp.pData->length &&
207 aUStrBuf.getCapacity() == leg+16 ,
208 "New OUStringBuffer from OUstring",
209 "ctor_004"
214 static sal_Bool SAL_CALL test_rtl_OUStringBuffer_ctor_005(
215 hTestResult hRtlTestResult)
217 ::rtl::OUStringBuffer aUStrBuftmp( aUStr1 );
218 ::rtl::OUString aUStrtmp = aUStrBuftmp.makeStringAndClear();
219 ::rtl::OUStringBuffer aUStrBuf( aUStrBuftmp );
220 sal_Bool res = cmpustr(aUStrBuftmp.getStr(),aUStrBuf.getStr());
221 sal_Int32 leg = aUStrBuf.getLength();
222 return
224 c_rtl_tres_state
226 hRtlTestResult,
227 aUStrBuf.getLength()==aUStrBuftmp.getLength() &&
228 aUStrBuf.getCapacity() == aUStrBuftmp.getCapacity() &&
229 res && leg == 0,
230 "New OUStringBuffer from another OUStringBuffer after makeClearFromString",
231 "ctor_005"
236 extern "C" void /* sal_Bool */ SAL_CALL test_rtl_OUStringBuffer_ctors(
237 hTestResult hRtlTestResult )
239 c_rtl_tres_state_start( hRtlTestResult, "ctors");
240 sal_Bool DCState = test_ini_uString();
241 (void)DCState;
242 sal_Bool bTSState = test_rtl_OUStringBuffer_ctor_001( hRtlTestResult );
243 bTSState &= test_rtl_OUStringBuffer_ctor_002( hRtlTestResult);
244 bTSState &= test_rtl_OUStringBuffer_ctor_003( hRtlTestResult);
245 bTSState &= test_rtl_OUStringBuffer_ctor_004( hRtlTestResult);
246 bTSState &= test_rtl_OUStringBuffer_ctor_005( hRtlTestResult);
248 c_rtl_tres_state_end( hRtlTestResult, "ctors");
249 // return( bTSState );
252 //------------------------------------------------------------------------
253 // testing the method makeStringAndClear()
254 //------------------------------------------------------------------------
255 extern "C" void /* sal_Bool */ SAL_CALL test_rtl_OUStringBuffer_makeStringAndClear(
256 hTestResult hRtlTestResult )
258 c_rtl_tres_state_start( hRtlTestResult, "makeStringAndClear");
259 sal_Char methName[MAXBUFLENGTH];
260 sal_Char* pMeth = methName;
262 typedef struct TestCase
264 sal_Char* comments;
265 OUString* expVal;
266 OUStringBuffer* input1;
268 ~TestCase() { delete input1;}
269 } TestCase;
271 OUString arrOUS[6]={
272 OUString( aUStr1 ),
273 OUString( aUStr14 ),
274 OUString( aUStr25 ),
275 OUString( aUStr27 ),
276 OUString( aUStr29 ),
277 OUString( "\0",0,
278 kEncodingRTLTextUSASCII,
279 kConvertFlagsOStringToOUString)
282 TestCase arrTestCase[]={
284 {"two empty strings(def. constructor)", new OUString(),
285 new OUStringBuffer()},
286 {"two empty strings(with a argu)", new OUString(),
287 new OUStringBuffer(26)},
288 {"normal string", new OUString(arrOUS[0]),
289 new OUStringBuffer(arrOUS[0])},
290 {"string with space ", new OUString(arrOUS[1]),
291 new OUStringBuffer(arrOUS[1])},
292 {"empty string", new OUString(arrOUS[2]),
293 new OUStringBuffer(arrOUS[2])},
294 {"string with a character", new OUString(arrOUS[3]),
295 new OUStringBuffer(arrOUS[3])},
296 {"string with special characters", new OUString(arrOUS[4]),
297 new OUStringBuffer(arrOUS[4])},
298 {"string only with (\0)", new OUString(arrOUS[5]),
299 new OUStringBuffer(arrOUS[5])}
302 sal_Bool res = sal_True;
303 sal_uInt32 i;
305 for(i = 0; i < (sizeof (arrTestCase))/(sizeof (TestCase)); i++)
307 sal_Bool lastRes =
308 ( arrTestCase[i].input1->makeStringAndClear() ==
309 *( arrTestCase[i].expVal ));
310 lastRes = lastRes && ( arrTestCase[i].input1->getCapacity() == 0 );
311 lastRes = lastRes && ( *(arrTestCase[i].input1->getStr()) == '\0' );
313 c_rtl_tres_state
315 hRtlTestResult,
316 lastRes,
317 arrTestCase[i].comments,
318 createName( pMeth, "makeStringAndClear", i )
321 res &= lastRes;
323 c_rtl_tres_state_end( hRtlTestResult, "makeStringAndClear");
324 // return (res);
326 //------------------------------------------------------------------------
327 // testing the method getLength
328 //------------------------------------------------------------------------
330 extern "C" void /* sal_Bool */ SAL_CALL test_rtl_OUStringBuffer_getLength(
331 hTestResult hRtlTestResult)
333 c_rtl_tres_state_start( hRtlTestResult, "getLength");
334 sal_Char methName[MAXBUFLENGTH];
335 sal_Char* pMeth = methName;
337 OUString arrOUS[6]={OUString( aUStr1 ),
338 OUString( "1",1,
339 kEncodingRTLTextUSASCII,
340 kConvertFlagsOStringToOUString),
341 OUString(),
342 OUString( "",0,
343 kEncodingRTLTextUSASCII,
344 kConvertFlagsOStringToOUString),
345 OUString( "\0",0,
346 kEncodingRTLTextUSASCII,
347 kConvertFlagsOStringToOUString),
348 OUString( aUStr2 )};
350 typedef struct TestCase
352 sal_Char* comments;
353 sal_Int32 expVal;
354 OUStringBuffer* input;
355 ~TestCase() { delete input;}
356 } TestCase;
358 TestCase arrTestCase[]={
360 {"length of ascii string", kTestStr1Len,
361 new OUStringBuffer(arrOUS[0]) },
362 {"length of ascci string of size 1", 1,
363 new OUStringBuffer(arrOUS[1])},
364 {"length of empty string", 0,
365 new OUStringBuffer(arrOUS[2])},
366 {"length of empty string (empty ascii string arg)",0,
367 new OUStringBuffer(arrOUS[3])},
368 {"length of empty string (string arg = '\\0')", 0,
369 new OUStringBuffer(arrOUS[4])},
370 {"length(>16) of ascii string", kTestStr2Len,
371 new OUStringBuffer(arrOUS[5]) },
372 {"length of empty string (default constructor)", 0,
373 new OUStringBuffer()},
374 {"length of empty string (with capacity)", 0,
375 new OUStringBuffer(26)}
379 sal_Bool res = sal_True;
380 sal_uInt32 i;
382 for (i = 0; i < (sizeof (arrTestCase))/(sizeof (TestCase)); i++)
384 sal_Int32 length = arrTestCase[i].input->getLength();
385 sal_Bool lastRes = (length == arrTestCase[i].expVal);
386 c_rtl_tres_state
388 hRtlTestResult,
389 lastRes,
390 arrTestCase[i].comments,
391 createName( pMeth, "getLength", i )
394 res &= lastRes;
396 c_rtl_tres_state_end( hRtlTestResult, "getLength");
397 // return ( res );
399 //------------------------------------------------------------------------
400 // testing the method getCapacity()
401 //------------------------------------------------------------------------
403 extern "C" void /* sal_Bool */ SAL_CALL test_rtl_OUStringBuffer_getCapacity(
404 hTestResult hRtlTestResult)
406 c_rtl_tres_state_start( hRtlTestResult, "getCapacity");
407 sal_Char methName[MAXBUFLENGTH];
408 sal_Char* pMeth = methName;
410 OUString arrOUS[6]={OUString( aUStr1 ),
411 OUString( "1",1,
412 kEncodingRTLTextUSASCII,
413 kConvertFlagsOStringToOUString),
414 OUString(),
415 OUString( "",0,
416 kEncodingRTLTextUSASCII,
417 kConvertFlagsOStringToOUString),
418 OUString( "\0",0,
419 kEncodingRTLTextUSASCII,
420 kConvertFlagsOStringToOUString),
421 OUString( aUStr2 )};
423 typedef struct TestCase
425 sal_Char* comments;
426 sal_Int32 expVal;
427 OUStringBuffer* input;
428 ~TestCase() { delete input;}
429 } TestCase;
431 TestCase arrTestCase[]={
433 {"capacity of ascii string", kTestStr1Len+16,
434 new OUStringBuffer(arrOUS[0]) },
435 {"capacity of ascci string of size 1", 1+16,
436 new OUStringBuffer(arrOUS[1]) },
437 {"capacity of empty string", 0+16,
438 new OUStringBuffer(arrOUS[2]) },
439 {"capacity of empty string (empty ascii string arg)",0+16,
440 new OUStringBuffer(arrOUS[3]) },
441 {"capacity of empty string (string arg = '\\0')", 0+16,
442 new OUStringBuffer(arrOUS[4]) },
443 {"capacity(>16) of ascii string", kTestStr2Len+16,
444 new OUStringBuffer(arrOUS[5]) },
445 {"capacity of empty string (default constructor)", 16,
446 new OUStringBuffer() },
447 #ifdef WITH_CORE
448 {"capacity of empty string (with capacity 2147483647)(code will core dump)", kSInt32Max,
449 new OUStringBuffer(kSInt32Max) },// will core dump
450 #endif
451 {"capacity of empty string (with capacity -2147483648)", kNonSInt32Max,
452 new OUStringBuffer(kNonSInt32Max) },
453 {"capacity of empty string (with capacity 16)", 16,
454 new OUStringBuffer(16) },
455 {"capacity of empty string (with capacity 6)", 6,
456 new OUStringBuffer(6) },
457 {"capacity of empty string (with capacity 0)", 0,
458 new OUStringBuffer(0) },
459 {"capacity of empty string (with capacity -2)", -2,
460 new OUStringBuffer(-2) }
464 sal_Bool res = sal_True;
465 sal_uInt32 i;
467 for (i = 0; i < (sizeof (arrTestCase))/(sizeof (TestCase)); i++)
469 sal_Int32 length = arrTestCase[i].input->getCapacity();
470 sal_Bool lastRes = (length == arrTestCase[i].expVal);
471 c_rtl_tres_state
473 hRtlTestResult,
474 lastRes,
475 arrTestCase[i].comments,
476 createName( pMeth, "getCapacity", i )
479 res &= lastRes;
481 c_rtl_tres_state_end( hRtlTestResult, "getCapacity");
482 // return ( res );
484 //------------------------------------------------------------------------
485 // testing the method ensureCapacity(sal_Int32 minimumCapacity)
486 //------------------------------------------------------------------------
488 extern "C" void /* sal_Bool */ SAL_CALL test_rtl_OUStringBuffer_ensureCapacity(
489 hTestResult hRtlTestResult)
491 c_rtl_tres_state_start( hRtlTestResult, "ensureCapacity");
492 sal_Char methName[MAXBUFLENGTH];
493 sal_Char* pMeth = methName;
495 typedef struct TestCase
497 sal_Char* comments;
498 sal_Int32 expVal;
499 OUStringBuffer* input1;
500 sal_Int32 input2;
501 ~TestCase() { delete input1;}
502 } TestCase;
504 TestCase arrTestCase[]={
506 {"capacity equal to 16, minimum is 5 ", 16,
507 new OUStringBuffer(), 5 },
508 {"capacity equal to 16, minimum is -5", 16,
509 new OUStringBuffer(), -5},
510 {"capacity equal to 16, minimum is 0", 16,
511 new OUStringBuffer(), 0},
512 {"capacity equal to 16, minimum is 20", 20, //the testcase is based on comments
513 new OUStringBuffer(), 20},
514 {"capacity equal to 16, minimum is 50", 50,
515 new OUStringBuffer(), 50},
516 {"capacity equal to 6, minimum is 20", 20,
517 new OUStringBuffer(6), 20 },
518 {"capacity equal to 6, minimum is 2", 6,
519 new OUStringBuffer(6), 2},
520 {"capacity equal to 6, minimum is -6", 6,
521 new OUStringBuffer(6), -6},
522 {"capacity equal to 6, minimum is -6", 10, //the testcase is based on comments
523 new OUStringBuffer(6), 10},
524 {"capacity equal to 0, minimum is 6", 6,
525 new OUStringBuffer(0), 6},
526 {"capacity equal to 0, minimum is 1", 2, //the testcase is based on comments
527 new OUStringBuffer(0), 1},
529 {"capacity equal to 0, minimum is -1", 0,
530 new OUStringBuffer(0), -1},
532 #ifdef WITH_CORE
533 {"capacity equal to 2147483647, minimum is 65535", kSInt32Max,//will core dump
534 new OUStringBuffer(kSInt32Max), 65535},
535 {"capacity equal to 2147483647, minimum is 2147483647", kSInt32Max,//will core dump
536 new OUStringBuffer(kSInt32Max), kSInt32Max},
537 {"capacity equal to 2147483647, minimum is -1", kSInt32Max,//will core dump
538 new OUStringBuffer(kSInt32Max), -1},
539 {"capacity equal to 2147483647, minimum is 0", kSInt32Max,//will core dump
540 new OUStringBuffer(kSInt32Max), 0},
541 {"capacity equal to 2147483647, minimum is -2147483648", kSInt32Max,//will core dump
542 new OUStringBuffer(kSInt32Max), kNonSInt32Max},
543 #endif
544 {"capacity equal to -2147483648, minimum is 65535", 65535,
545 new OUStringBuffer(kNonSInt32Max), 65535},
546 #ifdef WITH_CORE
547 {"capacity equal to -2147483648, minimum is 2147483647", 2147483647,//will core dump
548 new OUStringBuffer(kNonSInt32Max), 2147483647},
549 #endif
550 {"capacity equal to -2147483648, minimum is -1", 2,
551 new OUStringBuffer(kNonSInt32Max), -1},
552 {"capacity equal to -2147483648, minimum is 0", 2,
553 new OUStringBuffer(kNonSInt32Max), 0},
554 {"capacity equal to -2147483648, minimum is -2147483648", kNonSInt32Max,
555 new OUStringBuffer(kNonSInt32Max), kNonSInt32Max}
559 sal_Bool res = sal_True;
560 sal_uInt32 i;
562 for (i = 0; i < (sizeof (arrTestCase))/(sizeof (TestCase)); i++)
564 arrTestCase[i].input1->ensureCapacity(arrTestCase[i].input2);
565 sal_Int32 length = arrTestCase[i].input1->getCapacity();
566 sal_Bool lastRes = (length == arrTestCase[i].expVal);
568 c_rtl_tres_state
570 hRtlTestResult,
571 lastRes,
572 arrTestCase[i].comments,
573 createName( pMeth, "ensureCapacity", i )
576 res &= lastRes;
578 c_rtl_tres_state_end( hRtlTestResult, "ensureCapacity");
579 // return ( res );
581 //------------------------------------------------------------------------
582 // testing the method setLength(sal_Int32 newLength)
583 //------------------------------------------------------------------------
585 extern "C" void /* sal_Bool */ SAL_CALL test_rtl_OUStringBuffer_setLength(
586 hTestResult hRtlTestResult)
588 c_rtl_tres_state_start( hRtlTestResult, "setLength");
589 sal_Char methName[MAXBUFLENGTH];
590 sal_Char* pMeth = methName;
592 OUString arrOUS[6]={OUString( aUStr1 ),
593 OUString( aUStr27),
594 OUString(),
595 OUString( "",0,
596 kEncodingRTLTextUSASCII,
597 kConvertFlagsOStringToOUString),
598 OUString( "\0",0,
599 kEncodingRTLTextUSASCII,
600 kConvertFlagsOStringToOUString),
601 OUString( aUStr2 )};
603 typedef struct TestCase
605 sal_Char* comments;
606 sal_Int32 expVal1;
607 OUString* expVal2;
608 sal_Int32 expVal3;
609 OUStringBuffer* input1;
610 sal_Int32 input2;
611 ~TestCase() { delete input1; delete expVal2;}
612 } TestCase;
614 TestCase arrTestCase[]={
616 {"newLength more than the capacity of OUStringBuffer(aUStr1)",
617 50, new OUString(aUStr1), 50,
618 new OUStringBuffer(arrOUS[0]), 50 },
619 {"newLength more than the length of OUStringBuffer(aUStr1)",
620 kTestStr13Len, new OUString(aUStr1), 32,
621 new OUStringBuffer(arrOUS[0]), kTestStr13Len },
622 {"newLength equal to the length of OUStringBuffer(aUStr1)",
623 kTestStr1Len, new OUString(aUStr1), 32,
624 new OUStringBuffer(arrOUS[0]), kTestStr1Len },
625 {"newLength less than the length of OUStringBuffer(aUStr1)",
626 kTestStr7Len, new OUString(aUStr7), 32,
627 new OUStringBuffer(arrOUS[0]), kTestStr7Len},
628 {"newLength equal to 0",
629 0, new OUString(), 32,
630 new OUStringBuffer(arrOUS[0]), 0},
631 {"newLength more than the capacity of OUStringBuffer(1)",
632 25, new OUString(arrOUS[1]), 25,
633 new OUStringBuffer(arrOUS[1]), 25},
634 {"newLength more than the length of OUStringBuffer(1)",
635 5, new OUString(arrOUS[1]), 17,
636 new OUStringBuffer(arrOUS[1]), 5},
637 {"newLength equal to the length of OUStringBuffer(1)",
638 kTestStr27Len, new OUString(arrOUS[1]), 17,
639 new OUStringBuffer(arrOUS[1]), kTestStr27Len},
640 {"newLength less than the length of OUStringBuffer(1)",
641 0, new OUString(), 17,
642 new OUStringBuffer(arrOUS[1]), 0},
643 {"newLength more than the capacity of OUStringBuffer()",
644 20, new OUString(), 20,
645 new OUStringBuffer(arrOUS[2]), 20},
646 {"newLength more than the length of OUStringBuffer()",
647 3, new OUString(), 16,
648 new OUStringBuffer(arrOUS[2]), 3},
649 {"newLength less than the length of OUStringBuffer()",
650 0, new OUString(), 16,
651 new OUStringBuffer(arrOUS[2]), 0},
652 {"newLength more than the capacity of OUStringBuffer("")",
653 20, new OUString(), 20,
654 new OUStringBuffer(arrOUS[3]), 20},
655 {"newLength more than the length of OUStringBuffer("")",
656 5, new OUString(), 16,
657 new OUStringBuffer(arrOUS[3]), 5},
658 {"newLength less than the length of OUStringBuffer("")",
659 0, new OUString(), 16,
660 new OUStringBuffer(arrOUS[3]), 0},
661 {"newLength more than the length of OUStringBuffer(\0)",
662 20, new OUString(), 20,
663 new OUStringBuffer(arrOUS[4]), 20},
664 {"newLength more than the length of OUStringBuffer(\0)",
665 5, new OUString(), 16,
666 new OUStringBuffer(arrOUS[4]), 5},
667 {"newLength less than the length of OUStringBuffer(\0)",
668 0, new OUString(), 16,
669 new OUStringBuffer(arrOUS[4]), 0},
670 {"newLength more than the capacity of OUStringBuffer(aUStr2)",
671 50, new OUString(aUStr2), 66,
672 new OUStringBuffer(arrOUS[5]), 50,},
673 {"newLength more than the length of OUStringBuffer(aUStr2)",
674 40, new OUString(aUStr2), 48,
675 new OUStringBuffer(arrOUS[5]), 40,},
676 {"newLength equal to the length of OUStringBuffer(aUStr2)",
677 kTestStr2Len, new OUString(aUStr2), 48,
678 new OUStringBuffer(arrOUS[5]), kTestStr2Len,},
679 {"newLength less than the length of OUStringBuffer(aUStr2)",
680 kTestStr7Len, new OUString(aUStr7), 48,
681 new OUStringBuffer(arrOUS[5]), kTestStr7Len},
682 {"newLength equal to 0",
683 0, new OUString(), 48,
684 new OUStringBuffer(arrOUS[5]), 0}
689 sal_Bool res = sal_True;
690 sal_uInt32 i;
692 for (i = 0; i < (sizeof (arrTestCase))/(sizeof (TestCase)); i++)
694 arrTestCase[i].input1->setLength(arrTestCase[i].input2);
695 sal_Bool lastRes =
696 ( arrTestCase[i].input1->getStr() == *(arrTestCase[i].expVal2) &&
697 arrTestCase[i].input1->getLength() == arrTestCase[i].expVal1 &&
698 arrTestCase[i].input1->getCapacity() == arrTestCase[i].expVal3 );
700 c_rtl_tres_state
702 hRtlTestResult,
703 lastRes,
704 arrTestCase[i].comments,
705 createName( pMeth, "setLength", i )
708 res &= lastRes;
710 c_rtl_tres_state_end( hRtlTestResult, "setLength");
711 // return ( res );
713 //------------------------------------------------------------------------
714 // testing the method charAt( sal_Int32 index )
715 //------------------------------------------------------------------------
717 extern "C" void /* sal_Bool */ SAL_CALL test_rtl_OUStringBuffer_charAt(
718 hTestResult hRtlTestResult)
720 c_rtl_tres_state_start( hRtlTestResult, "charAt");
721 sal_Char methName[MAXBUFLENGTH];
722 sal_Char* pMeth = methName;
724 OUString arrOUS[4]={OUString( aUStr1 ), // "Sun Microsystems";
725 OUString( aUStr27), // "s";
726 OUString( aUStr28), // "\50\3\5\7\11\13\15\17sun";
727 OUString( )};
729 typedef struct TestCase
731 sal_Char* comments;
732 sal_Unicode expVal;
733 OUStringBuffer* input1;
734 sal_Int32 input2;
735 ~TestCase() { delete input1;}
736 } TestCase;
738 TestCase arrTestCase[]={
740 {"return the first character of OUStringBuffer(aUStr1)",
741 83, new OUStringBuffer(arrOUS[0]), 0 },
742 {"return the middle character of OUStringBuffer(aUStr1)",
743 32, new OUStringBuffer(arrOUS[0]), 3 },
744 {"return the last character of OUStringBuffer(aUStr1)",
745 115, new OUStringBuffer(arrOUS[0]), 15 },
746 {"return the only character of OUStringBuffer(aUStr27)",
747 115, new OUStringBuffer(arrOUS[1]), 0},
748 {"return the first of OUStringBuffer(aUStr28) with special character",
749 40, new OUStringBuffer(arrOUS[2]), 0},
751 {"return the mid of OUStringBuffer(aUStr28) with special character",
752 11, new OUStringBuffer(arrOUS[2]), 5},
755 {"invalid character of OUStringBuffer()",
756 0, new OUStringBuffer(arrOUS[3]), 0},
759 {"invalid character of OUStringBuffer()",
760 0, new OUStringBuffer(arrOUS[3]), -2}
766 sal_Bool res = sal_True;
767 sal_uInt32 i;
769 for (i = 0; i < (sizeof (arrTestCase))/(sizeof (TestCase)); i++)
771 sal_Bool lastRes =
772 ( arrTestCase[i].input1->charAt(arrTestCase[i].input2) ==
773 arrTestCase[i].expVal );
774 // LLA: last case removed, due to the fact of complexity of the test code :-(
775 // LLA: if(i<=7)
776 // LLA: {
777 c_rtl_tres_state
779 hRtlTestResult,
780 lastRes,
781 arrTestCase[i].comments,
782 createName( pMeth, "charAt", i )
785 // LLA: }
786 // LLA: else
787 // LLA: {
788 // LLA: c_rtl_tres_state
789 // LLA: (
790 // LLA: hRtlTestResult,
791 // LLA: sal_True,
792 // LLA: arrTestCase[i].comments,
793 // LLA: createName( pMeth, "charAt", i )
794 // LLA:
795 // LLA: );
796 // LLA: }
797 res &= lastRes;
799 c_rtl_tres_state_end( hRtlTestResult, "charAt");
800 // return ( res );
802 //------------------------------------------------------------------------
803 // testing the operator const sal_Unicode * (csuc for short)
804 //------------------------------------------------------------------------
805 extern "C" void /* sal_Bool */ SAL_CALL test_rtl_OUStringBuffer_csuc(
806 hTestResult hRtlTestResult)
808 c_rtl_tres_state_start( hRtlTestResult, "csuc");
809 sal_Char methName[MAXBUFLENGTH];
810 sal_Char* pMeth = methName;
812 const sal_Unicode tmpUC=0x0;
813 rtl_uString* tmpUstring = NULL;
814 const sal_Char *tmpStr=kTestStr1;
815 sal_Int32 tmpLen=(sal_Int32) kTestStr1Len;
816 //sal_Int32 cmpLen = 0;
817 OUString tempString(aUStr1);
819 rtl_string2UString( &tmpUstring, tmpStr, tmpLen,
820 osl_getThreadTextEncoding(), OSTRING_TO_OUSTRING_CVTFLAGS );
821 OSL_ASSERT(tmpUstring != NULL);
824 typedef struct TestCase
826 sal_Char* comments;
827 const sal_Unicode* expVal;
828 sal_Int32 cmpLen;
829 OUStringBuffer* input1;
830 ~TestCase() { delete input1; }
831 } TestCase;
833 TestCase arrTestCase[] =
835 {"test normal ustring",(*tmpUstring).buffer,kTestStr1Len,
836 new OUStringBuffer(tempString)},
837 {"test empty ustring",&tmpUC, 1, new OUStringBuffer()}
840 sal_Bool res = sal_True;
841 sal_uInt32 i;
842 for(i = 0; i < (sizeof (arrTestCase))/(sizeof (TestCase)); i++)
844 const sal_Unicode* pstr = *arrTestCase[i].input1;
846 res &= c_rtl_tres_state
848 hRtlTestResult,
849 cmpustr( pstr, arrTestCase[i].expVal, arrTestCase[i].cmpLen ),
850 arrTestCase[i].comments,
851 createName( pMeth, "const sal_Unicode*", i )
854 c_rtl_tres_state_end( hRtlTestResult, "csuc");
855 // return ( res );
857 //------------------------------------------------------------------------
858 // testing the method const sal_Unicode * getStr()
859 //------------------------------------------------------------------------
860 extern "C" void /* sal_Bool */ SAL_CALL test_rtl_OUStringBuffer_getStr(
861 hTestResult hRtlTestResult)
863 c_rtl_tres_state_start( hRtlTestResult, "getStr");
864 sal_Char methName[MAXBUFLENGTH];
865 sal_Char* pMeth = methName;
867 const sal_Unicode tmpUC=0x0;
868 rtl_uString* tmpUstring = NULL;
869 const sal_Char *tmpStr=kTestStr1;
870 sal_Int32 tmpLen=(sal_Int32) kTestStr1Len;
871 //sal_Int32 cmpLen = 0;
872 OUString tempString(aUStr1);
874 rtl_string2UString( &tmpUstring, tmpStr, tmpLen,
875 osl_getThreadTextEncoding(), OSTRING_TO_OUSTRING_CVTFLAGS );
876 OSL_ASSERT(tmpUstring != NULL);
879 typedef struct TestCase
881 sal_Char* comments;
882 const sal_Unicode* expVal;
883 sal_Int32 cmpLen;
884 OUStringBuffer* input1;
885 ~TestCase() { delete input1;}
886 } TestCase;
888 TestCase arrTestCase[] =
890 {"test normal ustring",(*tmpUstring).buffer,kTestStr1Len,
891 new OUStringBuffer(tempString)},
892 {"test empty ustring",&tmpUC, 1, new OUStringBuffer()}
895 sal_Bool res = sal_True;
896 sal_uInt32 i;
897 for(i = 0; i < (sizeof (arrTestCase))/(sizeof (TestCase)); i++)
899 const sal_Unicode* pstr = arrTestCase[i].input1->getStr();
901 res &= c_rtl_tres_state
903 hRtlTestResult,
904 cmpustr( pstr, arrTestCase[i].expVal, arrTestCase[i].cmpLen ),
905 arrTestCase[i].comments,
906 createName( pMeth, "getStr", i )
909 c_rtl_tres_state_end( hRtlTestResult, "getStr");
910 // return ( res );
912 //------------------------------------------------------------------------
913 // testing the method setCharAt(sal_Int32 index, sal_Unicode ch)
914 //------------------------------------------------------------------------
916 extern "C" void /* sal_Bool */ SAL_CALL test_rtl_OUStringBuffer_setCharAt(
917 hTestResult hRtlTestResult)
919 c_rtl_tres_state_start( hRtlTestResult, "setCharAt");
920 sal_Char methName[MAXBUFLENGTH];
921 sal_Char* pMeth = methName;
923 OUString arrOUS[4]={OUString( aUStr1 ),
924 OUString( aUStr27),
925 OUString( aUStr28),
926 OUString( )};
928 typedef struct TestCase
930 sal_Char* comments;
931 OUString* expVal;
932 OUStringBuffer* input1;
933 sal_Int32 input2;
934 sal_Unicode input3;
935 ~TestCase() { delete input1; delete expVal; }
936 } TestCase;
938 TestCase arrTestCase[]={
940 {"set the first character of OUStringBuffer(aUStr1) with s",
941 new OUString(aUStr31),
942 new OUStringBuffer(arrOUS[0]), 0, 115 },
943 {"set the middle character of OUStringBuffer(aUStr1) with m",
944 new OUString(aUStr3),
945 new OUStringBuffer(arrOUS[0]), 4, 109 },
946 {"set the last character of OUStringBuffer(aUStr1) with ' '",
947 new OUString(aUStr32),
948 new OUStringBuffer(arrOUS[0]), 15, 32 },
949 {"set the only character of OUStringBuffer(aUStr27) with ' '",
950 new OUString(aUStr33),
951 new OUStringBuffer(arrOUS[1]), 0, 32},
952 {"set the only of OUStringBuffer(aUStr28) with special character",
953 new OUString(aUStr34),
954 new OUStringBuffer(arrOUS[2]), 1, 5},
956 {"set the only of OUStringBuffer(aUStr28) with special character",
957 new OUString(aUStr35),
958 new OUStringBuffer(arrOUS[2]), 1, -5}
960 #ifdef WITH_CORE
961 ,{"invalid character of OUStringBuffer()",
963 new OUStringBuffer(arrOUS[3]), 0, 5},
964 {"invalid character of OUStringBuffer()",
966 new OUStringBuffer(arrOUS[3]), -2, 5},
967 {"invalid character of OUStringBuffer()",
969 new OUStringBuffer(arrOUS[3]), 3, 5}
970 #endif
975 sal_Bool res = sal_True;
976 sal_uInt32 i;
978 for (i = 0; i < (sizeof (arrTestCase))/(sizeof (TestCase)); i++)
980 sal_Bool lastRes =
981 ( (arrTestCase[i].input1->setCharAt(arrTestCase[i].input2,
982 arrTestCase[i].input3)).getStr() == *(arrTestCase[i].expVal) );
983 if(i<=4)
985 c_rtl_tres_state
987 hRtlTestResult,
988 lastRes,
989 arrTestCase[i].comments,
990 createName( pMeth, "setCharAt", i )
994 else
996 c_rtl_tres_state
998 hRtlTestResult,
999 sal_True,
1000 arrTestCase[i].comments,
1001 createName( pMeth, "setCharAt", i )
1005 res &= lastRes;
1007 c_rtl_tres_state_end( hRtlTestResult, "setCharAt");
1008 // return ( res );
1010 //------------------------------------------------------------------------
1011 // testing the method append(const OUString &str)
1012 //------------------------------------------------------------------------
1014 sal_Bool SAL_CALL test_rtl_OUStringBuffer_append_001(
1015 hTestResult hRtlTestResult)
1017 sal_Char methName[MAXBUFLENGTH];
1018 sal_Char* pMeth = methName;
1020 OUString arrOUS[5]={OUString( aUStr7 ),
1021 OUString(),
1022 OUString( aUStr25 ),
1023 OUString( "\0",0,
1024 kEncodingRTLTextUSASCII,
1025 kConvertFlagsOStringToOUString),
1026 OUString( aUStr28 )};
1028 typedef struct TestCase
1030 sal_Char* comments;
1031 OUString* expVal;
1032 OUStringBuffer* input1;
1033 OUString* input2;
1035 ~TestCase() { delete input1; delete input2; delete expVal; }
1036 } TestCase;
1038 TestCase arrTestCase[]={
1040 {"Appends the string(length less than 16) to the string buffer arrOUS[0]",
1041 new OUString(aUStr1),
1042 new OUStringBuffer(arrOUS[0]), new OUString(aUStr8) },
1043 {"Appends the string(length more than 16) to the string buffer arrOUS[0]",
1044 new OUString(aUStr2),
1045 new OUStringBuffer(arrOUS[0]), new OUString(aUStr36) },
1046 {"Appends the string(length equal to 16) to the string buffer arrOUS[0]",
1047 new OUString(aUStr37),
1048 new OUStringBuffer(arrOUS[0]), new OUString(aUStr23) },
1049 {"Appends the string(length equal to 0) to the string buffer arrOUS[0]",
1050 new OUString(aUStr7),
1051 new OUStringBuffer(arrOUS[0]), new OUString()},
1052 {"Appends the string(length less than 16) to the string buffer arrOUS[1]",
1053 new OUString(aUStr7),
1054 new OUStringBuffer(arrOUS[1]), new OUString(aUStr7)},
1055 {"Appends the string(length more than 16) to the string buffer arrOUS[1]",
1056 new OUString(aUStr2),
1057 new OUStringBuffer(arrOUS[1]), new OUString(aUStr2)},
1058 {"Appends the string(length equal to 16) to the string buffer arrOUS[1]",
1059 new OUString(aUStr1),
1060 new OUStringBuffer(arrOUS[1]), new OUString(aUStr1) },
1061 {"Appends the string(length equal to 0) to the string buffer arrOUS[1]",
1062 new OUString(),
1063 new OUStringBuffer(arrOUS[1]), new OUString()},
1064 {"Appends the string(length less than 16) to the string buffer arrOUS[2]",
1065 new OUString(aUStr7),
1066 new OUStringBuffer(arrOUS[2]), new OUString(aUStr7)},
1067 {"Appends the string(length more than 16) to the string buffer arrOUS[2]",
1068 new OUString(aUStr2),
1069 new OUStringBuffer(arrOUS[2]), new OUString(aUStr2)},
1070 {"Appends the string(length equal to 16) to the string buffer arrOUS[2]",
1071 new OUString(aUStr1),
1072 new OUStringBuffer(arrOUS[2]), new OUString(aUStr1) },
1073 {"Appends the string(length equal to 0) to the string buffer arrOUS[2]",
1074 new OUString(),
1075 new OUStringBuffer(arrOUS[2]), new OUString()},
1076 {"Appends the string(length less than 16) to the string buffer arrOUS[3]",
1077 new OUString(aUStr7),
1078 new OUStringBuffer(arrOUS[3]), new OUString(aUStr7)},
1079 {"Appends the string(length more than 16) to the string buffer arrOUS[3]",
1080 new OUString(aUStr2),
1081 new OUStringBuffer(arrOUS[3]), new OUString(aUStr2)},
1082 {"Appends the string(length equal to 16) to the string buffer arrOUS[3]",
1083 new OUString(aUStr1),
1084 new OUStringBuffer(arrOUS[3]), new OUString(aUStr1) },
1085 {"Appends the string(length equal to 0) to the string buffer arrOUS[3]",
1086 new OUString(),
1087 new OUStringBuffer(arrOUS[3]), new OUString()},
1088 {"Appends the string(length less than 16) to the string buffer arrOUS[4]",
1089 new OUString(aUStr29),
1090 new OUStringBuffer(arrOUS[4]), new OUString(aUStr38)},
1091 {"Appends the string(length more than 16) to the string buffer arrOUS[4]",
1092 new OUString(aUStr39),
1093 new OUStringBuffer(arrOUS[4]), new OUString(aUStr17)},
1094 {"Appends the string(length equal to 16) to the string buffer arrOUS[4]",
1095 new OUString(aUStr40),
1096 new OUStringBuffer(arrOUS[4]), new OUString(aUStr31) },
1097 {"Appends the string(length equal to 0) to the string buffer arrOUS[4]",
1098 new OUString(aUStr28),
1099 new OUStringBuffer(arrOUS[4]), new OUString()}
1100 #ifdef WITH_CORE
1101 ,{"Appends the string(length equal to 0) to the string buffer(with INT_MAX) ",
1102 new OUString(),
1103 new OUStringBuffer(kSInt32Max), new OUString()}
1104 #endif
1108 sal_Bool res = sal_True;
1109 sal_uInt32 i;
1111 for (i = 0; i < (sizeof (arrTestCase))/(sizeof (TestCase)); i++)
1113 arrTestCase[i].input1->append( *(arrTestCase[i].input2) );
1114 sal_Bool lastRes =
1115 ( arrTestCase[i].input1->getStr()== *(arrTestCase[i].expVal) &&
1116 arrTestCase[i].input1->getLength() == arrTestCase[i].expVal->getLength() );
1118 c_rtl_tres_state
1120 hRtlTestResult,
1121 lastRes,
1122 arrTestCase[i].comments,
1123 createName( pMeth, "append(const OUString &str)_001", i )
1127 res &= lastRes;
1130 return ( res );
1132 //------------------------------------------------------------------------
1133 // testing the method append( const sal_Unicode * str )
1134 //------------------------------------------------------------------------
1136 sal_Bool SAL_CALL test_rtl_OUStringBuffer_append_002(
1137 hTestResult hRtlTestResult)
1139 sal_Char methName[MAXBUFLENGTH];
1140 sal_Char* pMeth = methName;
1142 OUString arrOUS[5]={OUString( aUStr7 ),
1143 OUString(),
1144 OUString( aUStr25 ),
1145 OUString( "\0",0,
1146 kEncodingRTLTextUSASCII,
1147 kConvertFlagsOStringToOUString),
1148 OUString( aUStr28 )};
1150 typedef struct TestCase
1152 sal_Char* comments;
1153 OUString* expVal;
1154 OUStringBuffer* input1;
1155 sal_Unicode* input2;
1157 ~TestCase() { delete input1; delete expVal; }
1158 } TestCase;
1160 TestCase arrTestCase[]={
1162 {"Appends the string(length less than 16) to the string buffer arrOUS[0]",
1163 new OUString(aUStr1),
1164 new OUStringBuffer(arrOUS[0]), aUStr8 },
1165 {"Appends the string(length more than 16) to the string buffer arrOUS[0]",
1166 new OUString(aUStr2),
1167 new OUStringBuffer(arrOUS[0]), aUStr36 },
1168 {"Appends the string(length equal to 16) to the string buffer arrOUS[0]",
1169 new OUString(aUStr37),
1170 new OUStringBuffer(arrOUS[0]), aUStr23 },
1171 {"Appends the string(length equal to 0) to the string buffer arrOUS[0]",
1172 new OUString(aUStr7),
1173 new OUStringBuffer(arrOUS[0]), aUStr25 },
1174 {"Appends the string(length less than 16) to the string buffer arrOUS[1]",
1175 new OUString(aUStr7),
1176 new OUStringBuffer(arrOUS[1]), aUStr7 },
1177 {"Appends the string(length more than 16) to the string buffer arrOUS[1]",
1178 new OUString(aUStr2),
1179 new OUStringBuffer(arrOUS[1]), aUStr2 },
1180 {"Appends the string(length equal to 16) to the string buffer arrOUS[1]",
1181 new OUString(aUStr1),
1182 new OUStringBuffer(arrOUS[1]), aUStr1 },
1183 {"Appends the string(length equal to 0) to the string buffer arrOUS[1]",
1184 new OUString(),
1185 new OUStringBuffer(arrOUS[1]), aUStr25 },
1186 {"Appends the string(length less than 16) to the string buffer arrOUS[2]",
1187 new OUString(aUStr7),
1188 new OUStringBuffer(arrOUS[2]), aUStr7 },
1189 {"Appends the string(length more than 16) to the string buffer arrOUS[2]",
1190 new OUString(aUStr2),
1191 new OUStringBuffer(arrOUS[2]), aUStr2 },
1192 {"Appends the string(length equal to 16) to the string buffer arrOUS[2]",
1193 new OUString(aUStr1),
1194 new OUStringBuffer(arrOUS[2]), aUStr1 },
1195 {"Appends the string(length equal to 0) to the string buffer arrOUS[2]",
1196 new OUString(),
1197 new OUStringBuffer(arrOUS[2]), aUStr25 },
1198 {"Appends the string(length less than 16) to the string buffer arrOUS[3]",
1199 new OUString(aUStr7),
1200 new OUStringBuffer(arrOUS[3]), aUStr7 },
1201 {"Appends the string(length more than 16) to the string buffer arrOUS[3]",
1202 new OUString(aUStr2),
1203 new OUStringBuffer(arrOUS[3]), aUStr2 },
1204 {"Appends the string(length equal to 16) to the string buffer arrOUS[3]",
1205 new OUString(aUStr1),
1206 new OUStringBuffer(arrOUS[3]), aUStr1 },
1207 {"Appends the string(length equal to 0) to the string buffer arrOUS[3]",
1208 new OUString(),
1209 new OUStringBuffer(arrOUS[3]), aUStr25 },
1210 {"Appends the string(length less than 16) to the string buffer arrOUS[4]",
1211 new OUString(aUStr29),
1212 new OUStringBuffer(arrOUS[4]), aUStr38 },
1213 {"Appends the string(length more than 16) to the string buffer arrOUS[4]",
1214 new OUString(aUStr39),
1215 new OUStringBuffer(arrOUS[4]), aUStr17 },
1216 {"Appends the string(length equal to 16) to the string buffer arrOUS[4]",
1217 new OUString(aUStr40),
1218 new OUStringBuffer(arrOUS[4]), aUStr31 },
1219 {"Appends the string(length equal to 0) to the string buffer arrOUS[4]",
1220 new OUString(aUStr28),
1221 new OUStringBuffer(arrOUS[4]), aUStr25 }
1222 #ifdef WITH_CORE
1223 ,{"Appends the string(length equal to 0) to the string buffer(with INT_MAX) ",
1224 new OUString(),
1225 new OUStringBuffer(kSInt32Max), aUStr25 }
1226 #endif
1230 sal_Bool res = sal_True;
1231 sal_uInt32 i;
1233 for (i = 0; i < (sizeof (arrTestCase))/(sizeof (TestCase)); i++)
1235 arrTestCase[i].input1->append( arrTestCase[i].input2 );
1236 sal_Bool lastRes =
1237 ( arrTestCase[i].input1->getStr()== *(arrTestCase[i].expVal) &&
1238 arrTestCase[i].input1->getLength() == arrTestCase[i].expVal->getLength() );
1240 c_rtl_tres_state
1242 hRtlTestResult,
1243 lastRes,
1244 arrTestCase[i].comments,
1245 createName( pMeth, "append( const sal_Unicode * str )_002", i )
1249 res &= lastRes;
1252 return ( res );
1254 //------------------------------------------------------------------------
1255 // testing the method append( const sal_Unicode * str, sal_Int32 len)
1256 //------------------------------------------------------------------------
1258 sal_Bool SAL_CALL test_rtl_OUStringBuffer_append_003(
1259 hTestResult hRtlTestResult)
1261 sal_Char methName[MAXBUFLENGTH];
1262 sal_Char* pMeth = methName;
1264 OUString arrOUS[5]={OUString( aUStr7 ),
1265 OUString(),
1266 OUString( aUStr25 ),
1267 OUString( "\0",0,
1268 kEncodingRTLTextUSASCII,
1269 kConvertFlagsOStringToOUString),
1270 OUString( aUStr28 )};
1272 typedef struct TestCase
1274 sal_Char* comments;
1275 OUString* expVal;
1276 OUStringBuffer* input1;
1277 sal_Unicode* input2;
1278 sal_Int32 input3;
1280 ~TestCase() { delete input1; delete expVal; }
1281 } TestCase;
1283 TestCase arrTestCase[]={
1285 {"Appends the string(length less than 16) to the string buffer arrOUS[0]",
1286 new OUString(aUStr1),
1287 new OUStringBuffer(arrOUS[0]), aUStr36, 12 },
1288 {"Appends the string(length more than 16) to the string buffer arrOUS[0]",
1289 new OUString(aUStr2),
1290 new OUStringBuffer(arrOUS[0]), aUStr36, 28 },
1291 {"Appends the string(length equal to 16) to the string buffer arrOUS[0]",
1292 new OUString(aUStr37),
1293 new OUStringBuffer(arrOUS[0]), aUStr23, 16 },
1294 {"Appends the string(length equal to 0) to the string buffer arrOUS[0]",
1295 new OUString(aUStr7),
1296 new OUStringBuffer(arrOUS[0]), aUStr2, 0 },
1297 /* LLA: input3 must null < 0
1298 {"Appends the string(length less than 0) to the string buffer arrOUS[0]",
1299 new OUString(aUStr41),
1300 new OUStringBuffer(arrOUS[0]), aUStr2, -1 },
1302 {"Appends the string(length less than 16) to the string buffer arrOUS[1]",
1303 new OUString(aUStr7),
1304 new OUStringBuffer(arrOUS[1]), aUStr2, 4 },
1305 {"Appends the string(length more than 16) to the string buffer arrOUS[1]",
1306 new OUString(aUStr2),
1307 new OUStringBuffer(arrOUS[1]), aUStr2, 32 },
1308 {"Appends the string(length equal to 16) to the string buffer arrOUS[1]",
1309 new OUString(aUStr1),
1310 new OUStringBuffer(arrOUS[1]), aUStr2, 16 },
1311 {"Appends the string(length equal to 0) to the string buffer arrOUS[1]",
1312 new OUString(),
1313 new OUStringBuffer(arrOUS[1]), aUStr2, 0 },
1314 /* LLA: input3 must null < 0
1315 {"Appends the string(length less than 0) to the string buffer arrOUS[1]",
1316 new OUString(),
1317 new OUStringBuffer(arrOUS[1]), aUStr2, -1 },
1319 {"Appends the string(length less than 16) to the string buffer arrOUS[2]",
1320 new OUString(aUStr7),
1321 new OUStringBuffer(arrOUS[2]), aUStr2, 4 },
1322 {"Appends the string(length more than 16) to the string buffer arrOUS[2]",
1323 new OUString(aUStr2),
1324 new OUStringBuffer(arrOUS[2]), aUStr2, 32 },
1325 {"Appends the string(length equal to 16) to the string buffer arrOUS[2]",
1326 new OUString(aUStr1),
1327 new OUStringBuffer(arrOUS[2]), aUStr2, 16 },
1328 {"Appends the string(length equal to 0) to the string buffer arrOUS[2]",
1329 new OUString(),
1330 new OUStringBuffer(arrOUS[2]), aUStr2, 0 },
1331 /* LLA: input3 must null < 0
1332 {"Appends the string(length less than 0) to the string buffer arrOUS[2]",
1333 new OUString(),
1334 new OUStringBuffer(arrOUS[2]), aUStr2, -1 },
1336 {"Appends the string(length less than 16) to the string buffer arrOUS[3]",
1337 new OUString(aUStr7),
1338 new OUStringBuffer(arrOUS[3]), aUStr2, 4 },
1339 {"Appends the string(length more than 16) to the string buffer arrOUS[3]",
1340 new OUString(aUStr2),
1341 new OUStringBuffer(arrOUS[3]), aUStr2, 32 },
1342 {"Appends the string(length equal to 16) to the string buffer arrOUS[3]",
1343 new OUString(aUStr1),
1344 new OUStringBuffer(arrOUS[3]), aUStr2, 16 },
1345 {"Appends the string(length equal to 0) to the string buffer arrOUS[3]",
1346 new OUString(),
1347 new OUStringBuffer(arrOUS[3]), aUStr2, 0 },
1348 /* LLA: input3 must null < 0
1349 {"Appends the string(length less than 0) to the string buffer arrOUS[3]",
1350 new OUString(),
1351 new OUStringBuffer(arrOUS[3]), aUStr2, -1 },
1353 {"Appends the string(length less than 16) to the string buffer arrOUS[4]",
1354 new OUString(aUStr29),
1355 new OUStringBuffer(arrOUS[4]), aUStr38, 7 },
1356 {"Appends the string(length more than 16) to the string buffer arrOUS[4]",
1357 new OUString(aUStr39),
1358 new OUStringBuffer(arrOUS[4]), aUStr17, 22 },
1359 {"Appends the string(length equal to 16) to the string buffer arrOUS[4]",
1360 new OUString(aUStr40),
1361 new OUStringBuffer(arrOUS[4]), aUStr31, 16 },
1362 {"Appends the string(length equal to 0) to the string buffer arrOUS[4]",
1363 new OUString(aUStr28),
1364 new OUStringBuffer(arrOUS[4]), aUStr2, 0 },
1365 /* LLA: input3 must null < 0
1366 {"Appends the string(length less than 0) to the string buffer arrOUS[4]",
1367 new OUString(aUStr42),
1368 new OUStringBuffer(arrOUS[4]), aUStr2, -1 }
1370 #ifdef WITH_CORE
1371 ,{"Appends the string(length equal to 0) to the string buffer(with INT_MAX) ",
1372 new OUString(),
1373 new OUStringBuffer(kSInt32Max), aUStr25 }
1374 #endif
1378 sal_Bool res = sal_True;
1379 sal_uInt32 i;
1381 for (i = 0; i < (sizeof (arrTestCase))/(sizeof (TestCase)); i++)
1383 arrTestCase[i].input1->append(
1384 arrTestCase[i].input2, arrTestCase[i].input3);
1385 sal_Bool lastRes =
1386 ( arrTestCase[i].input1->getStr()== *(arrTestCase[i].expVal) &&
1387 arrTestCase[i].input1->getLength() == arrTestCase[i].expVal->getLength() );
1389 c_rtl_tres_state
1391 hRtlTestResult,
1392 lastRes,
1393 arrTestCase[i].comments,
1394 createName( pMeth, "append( const sal_Unicode * str, sal_Int32 len)_003", i )
1398 res &= lastRes;
1401 return ( res );
1403 //------------------------------------------------------------------------
1404 // testing the method append(sal_Bool b)
1405 //------------------------------------------------------------------------
1407 sal_Bool SAL_CALL test_rtl_OUStringBuffer_append_004(
1408 hTestResult hRtlTestResult)
1410 sal_Char methName[MAXBUFLENGTH];
1411 sal_Char* pMeth = methName;
1413 OUString arrOUS[5]={OUString( aUStr7 ),
1414 OUString(),
1415 OUString( aUStr25 ),
1416 OUString( "\0",0,
1417 kEncodingRTLTextUSASCII,
1418 kConvertFlagsOStringToOUString),
1419 OUString( aUStr28 )};
1421 typedef struct TestCase
1423 sal_Char* comments;
1424 OUString* expVal;
1425 OUStringBuffer* input1;
1426 sal_Bool input2;
1428 ~TestCase() { delete input1; delete expVal; }
1429 } TestCase;
1431 TestCase arrTestCase[]={
1433 {"Appends the sal_Bool(sal_True) to the string buffer arrOUS[0]",
1434 new OUString(aUStr45),
1435 new OUStringBuffer(arrOUS[0]), sal_True },
1436 {"Appends the sal_Bool(sal_False) to the string buffer arrOUS[0]",
1437 new OUString(aUStr46),
1438 new OUStringBuffer(arrOUS[0]), sal_False },
1439 {"Appends the sal_Bool(sal_True) to the string buffer arrOUS[1]",
1440 new OUString(aUStr47),
1441 new OUStringBuffer(arrOUS[1]), sal_True },
1442 {"Appends the sal_Bool(sal_False) to the string buffer arrOUS[1]",
1443 new OUString(aUStr48),
1444 new OUStringBuffer(arrOUS[1]), sal_False },
1445 {"Appends the sal_Bool(sal_True) to the string buffer arrOUS[2]",
1446 new OUString(aUStr47),
1447 new OUStringBuffer(arrOUS[2]), sal_True },
1448 {"Appends the sal_Bool(sal_False) to the string buffer arrOUS[2]",
1449 new OUString(aUStr48),
1450 new OUStringBuffer(arrOUS[2]), sal_False },
1451 {"Appends the sal_Bool(sal_True) to the string buffer arrOUS[3]",
1452 new OUString(aUStr47),
1453 new OUStringBuffer(arrOUS[3]), sal_True },
1454 {"Appends the sal_Bool(sal_False) to the string buffer arrOUS[3]",
1455 new OUString(aUStr48),
1456 new OUStringBuffer(arrOUS[3]), sal_False },
1457 {"Appends the sal_Bool(sal_True) to the string buffer arrOUS[4]",
1458 new OUString(aUStr49),
1459 new OUStringBuffer(arrOUS[4]), sal_True },
1460 {"Appends the sal_Bool(sal_False) to the string buffer arrOUS[4]",
1461 new OUString(aUStr50),
1462 new OUStringBuffer(arrOUS[4]), sal_False }
1463 #ifdef WITH_CORE
1464 ,{"Appends the sal_Bool(sal_True) to the string buffer(with INT_MAX) ",
1465 new OUString(aUStr47),
1466 new OUStringBuffer(kSInt32Max), sal_True },
1467 {"Appends the sal_Bool(sal_False) to the string buffer(with INT_MAX) ",
1468 new OUString(aUStr48),
1469 new OUStringBuffer(kSInt32Max), sal_False }
1470 #endif
1474 sal_Bool res = sal_True;
1475 sal_uInt32 i;
1477 for (i = 0; i < (sizeof (arrTestCase))/(sizeof (TestCase)); i++)
1479 arrTestCase[i].input1->append(
1480 arrTestCase[i].input2 );
1481 sal_Bool lastRes =
1482 ( arrTestCase[i].input1->getStr()== *(arrTestCase[i].expVal) &&
1483 arrTestCase[i].input1->getLength() == arrTestCase[i].expVal->getLength() );
1485 c_rtl_tres_state
1487 hRtlTestResult,
1488 lastRes,
1489 arrTestCase[i].comments,
1490 createName( pMeth, "append( sal_Bool b)_004", i )
1494 res &= lastRes;
1497 return ( res );
1500 extern "C" void /* sal_Bool */ SAL_CALL test_rtl_OUStringBuffer_appends(
1501 hTestResult hRtlTestResult )
1503 c_rtl_tres_state_start( hRtlTestResult, "appends");
1504 sal_Bool bTSState = test_rtl_OUStringBuffer_append_001( hRtlTestResult );
1505 bTSState &= test_rtl_OUStringBuffer_append_002( hRtlTestResult);
1506 bTSState &= test_rtl_OUStringBuffer_append_003( hRtlTestResult);
1507 bTSState &= test_rtl_OUStringBuffer_append_004( hRtlTestResult);
1509 c_rtl_tres_state_end( hRtlTestResult, "appends");
1510 // return( bTSState );
1512 //------------------------------------------------------------------------
1513 // testing the method appendAscii( const sal_Char * str )
1514 //------------------------------------------------------------------------
1516 sal_Bool SAL_CALL test_rtl_OUStringBuffer_appendAscii_001(
1517 hTestResult hRtlTestResult)
1519 sal_Char methName[MAXBUFLENGTH];
1520 sal_Char* pMeth = methName;
1522 OUString arrOUS[5]={OUString( aUStr7 ),
1523 OUString(),
1524 OUString( aUStr25 ),
1525 OUString( "\0",0,
1526 kEncodingRTLTextUSASCII,
1527 kConvertFlagsOStringToOUString),
1528 OUString( aUStr28 )};
1530 typedef struct TestCase
1532 sal_Char* comments;
1533 OUString* expVal;
1534 OUStringBuffer* input1;
1535 const sal_Char* input2;
1537 ~TestCase() { delete input1; delete expVal; }
1538 } TestCase;
1540 TestCase arrTestCase[]={
1542 {"Appends the string(length less than 16) to the string buffer arrOUS[0]",
1543 new OUString(aUStr1),
1544 new OUStringBuffer(arrOUS[0]), kTestStr8 },
1545 {"Appends the string(length more than 16) to the string buffer arrOUS[0]",
1546 new OUString(aUStr2),
1547 new OUStringBuffer(arrOUS[0]), kTestStr36 },
1548 {"Appends the string(length equal to 16) to the string buffer arrOUS[0]",
1549 new OUString(aUStr37),
1550 new OUStringBuffer(arrOUS[0]), kTestStr23 },
1551 {"Appends the string(length equal to 0) to the string buffer arrOUS[0]",
1552 new OUString(aUStr7),
1553 new OUStringBuffer(arrOUS[0]), kTestStr25 },
1554 {"Appends the string(length less than 16) to the string buffer arrOUS[1]",
1555 new OUString(aUStr7),
1556 new OUStringBuffer(arrOUS[1]), kTestStr7 },
1557 {"Appends the string(length more than 16) to the string buffer arrOUS[1]",
1558 new OUString(aUStr2),
1559 new OUStringBuffer(arrOUS[1]), kTestStr2 },
1560 {"Appends the string(length equal to 16) to the string buffer arrOUS[1]",
1561 new OUString(aUStr1),
1562 new OUStringBuffer(arrOUS[1]), kTestStr1 },
1563 {"Appends the string(length equal to 0) to the string buffer arrOUS[1]",
1564 new OUString(),
1565 new OUStringBuffer(arrOUS[1]), kTestStr25 },
1566 {"Appends the string(length less than 16) to the string buffer arrOUS[2]",
1567 new OUString(aUStr7),
1568 new OUStringBuffer(arrOUS[2]), kTestStr7 },
1569 {"Appends the string(length more than 16) to the string buffer arrOUS[2]",
1570 new OUString(aUStr2),
1571 new OUStringBuffer(arrOUS[2]), kTestStr2 },
1572 {"Appends the string(length equal to 16) to the string buffer arrOUS[2]",
1573 new OUString(aUStr1),
1574 new OUStringBuffer(arrOUS[2]), kTestStr1 },
1575 {"Appends the string(length equal to 0) to the string buffer arrOUS[2]",
1576 new OUString(),
1577 new OUStringBuffer(arrOUS[2]), kTestStr25 },
1578 {"Appends the string(length less than 16) to the string buffer arrOUS[3]",
1579 new OUString(aUStr7),
1580 new OUStringBuffer(arrOUS[3]), kTestStr7 },
1581 {"Appends the string(length more than 16) to the string buffer arrOUS[3]",
1582 new OUString(aUStr2),
1583 new OUStringBuffer(arrOUS[3]), kTestStr2 },
1584 {"Appends the string(length equal to 16) to the string buffer arrOUS[3]",
1585 new OUString(aUStr1),
1586 new OUStringBuffer(arrOUS[3]), kTestStr1 },
1587 {"Appends the string(length equal to 0) to the string buffer arrOUS[3]",
1588 new OUString(),
1589 new OUStringBuffer(arrOUS[3]), kTestStr25 },
1590 {"Appends the string(length less than 16) to the string buffer arrOUS[4]",
1591 new OUString(aUStr29),
1592 new OUStringBuffer(arrOUS[4]), kTestStr38 },
1593 {"Appends the string(length more than 16) to the string buffer arrOUS[4]",
1594 new OUString(aUStr39),
1595 new OUStringBuffer(arrOUS[4]), kTestStr17 },
1596 {"Appends the string(length equal to 16) to the string buffer arrOUS[4]",
1597 new OUString(aUStr40),
1598 new OUStringBuffer(arrOUS[4]), kTestStr31 },
1599 {"Appends the string(length equal to 0) to the string buffer arrOUS[4]",
1600 new OUString(aUStr28),
1601 new OUStringBuffer(arrOUS[4]), kTestStr25 }
1602 /*{"Appends the string(with special characters) to the string buffer arrOUS[4]",
1603 new OUString(aUStr43),
1604 new OUStringBuffer(arrOUS[4]), kTestStr44 }*/
1605 #ifdef WITH_CORE
1606 ,{"Appends the string(length equal to 0) to the string buffer(with INT_MAX) ",
1607 new OUString(),
1608 new OUStringBuffer(kSInt32Max), kTestStr25 }
1609 #endif
1614 sal_Bool res = sal_True;
1615 sal_uInt32 i;
1617 for (i = 0; i < (sizeof (arrTestCase))/(sizeof (TestCase)); i++)
1619 arrTestCase[i].input1->appendAscii( arrTestCase[i].input2 );
1620 sal_Bool lastRes =
1621 ( arrTestCase[i].input1->getStr()== *(arrTestCase[i].expVal) &&
1622 arrTestCase[i].input1->getLength() == arrTestCase[i].expVal->getLength() );
1624 c_rtl_tres_state
1626 hRtlTestResult,
1627 lastRes,
1628 arrTestCase[i].comments,
1629 createName( pMeth, "appendAscii_001", i )
1632 res &= lastRes;
1634 return ( res );
1636 //------------------------------------------------------------------------
1637 // testing the method appendAscii( const sal_Char * str, sal_Int32 len)
1638 //------------------------------------------------------------------------
1640 sal_Bool SAL_CALL test_rtl_OUStringBuffer_appendAscii_002(
1641 hTestResult hRtlTestResult)
1643 sal_Char methName[MAXBUFLENGTH];
1644 sal_Char* pMeth = methName;
1646 OUString arrOUS[5]={OUString( aUStr7 ),
1647 OUString(),
1648 OUString( aUStr25 ),
1649 OUString( "\0",0,
1650 kEncodingRTLTextUSASCII,
1651 kConvertFlagsOStringToOUString),
1652 OUString( aUStr28 )};
1654 typedef struct TestCase
1656 sal_Char* comments;
1657 OUString* expVal;
1658 OUStringBuffer* input1;
1659 const sal_Char* input2;
1660 sal_Int32 input3;
1662 ~TestCase() { delete input1; delete expVal; }
1663 } TestCase;
1665 TestCase arrTestCase[]={
1667 {"Appends the string(length less than 16) to the string buffer arrOUS[0]",
1668 new OUString(aUStr1),
1669 new OUStringBuffer(arrOUS[0]), kTestStr36, 12 },
1670 {"Appends the string(length more than 16) to the string buffer arrOUS[0]",
1671 new OUString(aUStr2),
1672 new OUStringBuffer(arrOUS[0]), kTestStr36, 28 },
1673 {"Appends the string(length equal to 16) to the string buffer arrOUS[0]",
1674 new OUString(aUStr37),
1675 new OUStringBuffer(arrOUS[0]), kTestStr23, 16 },
1676 {"Appends the string(length equal to 0) to the string buffer arrOUS[0]",
1677 new OUString(aUStr7),
1678 new OUStringBuffer(arrOUS[0]), kTestStr2, 0 },
1679 /* LLA: input3 must null < 0
1680 {"Appends the string(length less than 0) to the string buffer arrOUS[0]",
1681 new OUString(aUStr41),
1682 new OUStringBuffer(arrOUS[0]), kTestStr2, -1 },
1684 {"Appends the string(length less than 16) to the string buffer arrOUS[1]",
1685 new OUString(aUStr7),
1686 new OUStringBuffer(arrOUS[1]), kTestStr2, 4 },
1687 {"Appends the string(length more than 16) to the string buffer arrOUS[1]",
1688 new OUString(aUStr2),
1689 new OUStringBuffer(arrOUS[1]), kTestStr2, 32 },
1690 {"Appends the string(length equal to 16) to the string buffer arrOUS[1]",
1691 new OUString(aUStr1),
1692 new OUStringBuffer(arrOUS[1]), kTestStr2, 16 },
1693 {"Appends the string(length equal to 0) to the string buffer arrOUS[1]",
1694 new OUString(),
1695 new OUStringBuffer(arrOUS[1]), kTestStr2, 0 },
1696 /* LLA: input3 must null < 0
1697 {"Appends the string(length less than 0) to the string buffer arrOUS[1]",
1698 new OUString(),
1699 new OUStringBuffer(arrOUS[1]), kTestStr2, -1 },
1701 {"Appends the string(length less than 16) to the string buffer arrOUS[2]",
1702 new OUString(aUStr7),
1703 new OUStringBuffer(arrOUS[2]), kTestStr2, 4 },
1704 {"Appends the string(length more than 16) to the string buffer arrOUS[2]",
1705 new OUString(aUStr2),
1706 new OUStringBuffer(arrOUS[2]), kTestStr2, 32 },
1707 {"Appends the string(length equal to 16) to the string buffer arrOUS[2]",
1708 new OUString(aUStr1),
1709 new OUStringBuffer(arrOUS[2]), kTestStr2, 16 },
1710 {"Appends the string(length equal to 0) to the string buffer arrOUS[2]",
1711 new OUString(),
1712 new OUStringBuffer(arrOUS[2]), kTestStr2, 0 },
1713 /* LLA: input3 must null < 0
1714 {"Appends the string(length less than 0) to the string buffer arrOUS[2]",
1715 new OUString(),
1716 new OUStringBuffer(arrOUS[2]), kTestStr2, -1 },
1718 {"Appends the string(length less than 16) to the string buffer arrOUS[3]",
1719 new OUString(aUStr7),
1720 new OUStringBuffer(arrOUS[3]), kTestStr2, 4 },
1721 {"Appends the string(length more than 16) to the string buffer arrOUS[3]",
1722 new OUString(aUStr2),
1723 new OUStringBuffer(arrOUS[3]), kTestStr2, 32 },
1724 {"Appends the string(length equal to 16) to the string buffer arrOUS[3]",
1725 new OUString(aUStr1),
1726 new OUStringBuffer(arrOUS[3]), kTestStr2, 16 },
1727 {"Appends the string(length equal to 0) to the string buffer arrOUS[3]",
1728 new OUString(),
1729 new OUStringBuffer(arrOUS[3]), kTestStr2, 0 },
1730 /* LLA: input3 must null < 0
1731 {"Appends the string(length less than 0) to the string buffer arrOUS[3]",
1732 new OUString(),
1733 new OUStringBuffer(arrOUS[3]), kTestStr2, -1 },
1735 {"Appends the string(length less than 16) to the string buffer arrOUS[4]",
1736 new OUString(aUStr29),
1737 new OUStringBuffer(arrOUS[4]), kTestStr38, 7 },
1738 {"Appends the string(length more than 16) to the string buffer arrOUS[4]",
1739 new OUString(aUStr39),
1740 new OUStringBuffer(arrOUS[4]), kTestStr17, 22 },
1741 {"Appends the string(length equal to 16) to the string buffer arrOUS[4]",
1742 new OUString(aUStr40),
1743 new OUStringBuffer(arrOUS[4]), kTestStr31, 16 },
1744 {"Appends the string(length equal to 0) to the string buffer arrOUS[4]",
1745 new OUString(aUStr28),
1746 new OUStringBuffer(arrOUS[4]), kTestStr2, 0 },
1747 /* LLA: input3 must null < 0
1748 {"Appends the string(length less than 0) to the string buffer arrOUS[4]",
1749 new OUString(aUStr42),
1750 new OUStringBuffer(arrOUS[4]), kTestStr2, -1 }
1752 #ifdef WITH_CORE
1753 ,{"Appends the string(length equal to 0) to the string buffer(with INT_MAX) ",
1754 new OUString(),
1755 new OUStringBuffer(kSInt32Max), kTestStr25 }
1756 #endif
1760 sal_Bool res = sal_True;
1761 sal_uInt32 i;
1763 for (i = 0; i < (sizeof (arrTestCase))/(sizeof (TestCase)); i++)
1765 arrTestCase[i].input1->appendAscii(
1766 arrTestCase[i].input2, arrTestCase[i].input3);
1767 sal_Bool lastRes =
1768 ( arrTestCase[i].input1->getStr()== *(arrTestCase[i].expVal) &&
1769 arrTestCase[i].input1->getLength() == arrTestCase[i].expVal->getLength() );
1771 c_rtl_tres_state
1773 hRtlTestResult,
1774 lastRes,
1775 arrTestCase[i].comments,
1776 createName( pMeth, "appendAscii_002", i )
1780 res &= lastRes;
1782 return ( res );
1784 extern "C" void /* sal_Bool */ SAL_CALL test_rtl_OUStringBuffer_appendAsciis(
1785 hTestResult hRtlTestResult )
1787 c_rtl_tres_state_start( hRtlTestResult, "appendAsciis");
1788 sal_Bool bTSState = test_rtl_OUStringBuffer_appendAscii_001( hRtlTestResult );
1789 bTSState &= test_rtl_OUStringBuffer_appendAscii_002( hRtlTestResult);
1791 c_rtl_tres_state_end( hRtlTestResult, "appendAsciis");
1792 // return( bTSState );
1794 // -----------------------------------------------------------------------------
1795 extern "C" void /* sal_Bool */ SAL_CALL test_rtl_OUStringBuffer( hTestResult hRtlTestResult )
1798 c_rtl_tres_state_start(hRtlTestResult, "rtl_OUStringBuffer" );
1800 test_rtl_OUStringBuffer_ctors( hRtlTestResult );
1801 test_rtl_OUStringBuffer_makeStringAndClear( hRtlTestResult );
1802 test_rtl_OUStringBuffer_getLength( hRtlTestResult );
1803 test_rtl_OUStringBuffer_getCapacity( hRtlTestResult );
1804 test_rtl_OUStringBuffer_ensureCapacity( hRtlTestResult );
1805 test_rtl_OUStringBuffer_setLength( hRtlTestResult );
1806 test_rtl_OUStringBuffer_charAt( hRtlTestResult );
1807 test_rtl_OUStringBuffer_csuc( hRtlTestResult );
1808 test_rtl_OUStringBuffer_getStr( hRtlTestResult );
1809 test_rtl_OUStringBuffer_setCharAt( hRtlTestResult );
1810 test_rtl_OUStringBuffer_appends( hRtlTestResult );
1811 test_rtl_OUStringBuffer_appendAsciis( hRtlTestResult );
1813 c_rtl_tres_state_end(hRtlTestResult, "rtl_OUStringBuffer");
1816 // -----------------------------------------------------------------------------
1817 void RegisterAdditionalFunctions(FktRegFuncPtr _pFunc)
1819 if (_pFunc)
1821 (_pFunc)(&test_rtl_OUStringBuffer, "");