xref: /trunk/main/sal/qa/rtl_strings/rtl_OUString.cxx (revision 87d2adbc)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 // MARKER(update_precomp.py): autogen include statement, do not remove
25 #include "precompiled_sal.hxx"
26 #include <sal/types.h>
27 
28 //# #ifndef _RTL_TRES_H_
29 //#     #include <rtl/tres.h>
30 //# #endif
31 #include <testshl/tresstatewrapper.hxx>
32 #include "stringhelper.hxx"
33 #include <rtl/string.hxx>
34 #include <rtl/ustring.h>
35 #include <rtl/ustring.hxx>
36 
37 //------------------------------------------------------------------------
38 //------------------------------------------------------------------------
39 #include <osl/thread.h>
40 #include <rtl_String_Const.h>
41 #include <rtl_String_Utils.hxx>
42 
43 
44 
45     using namespace rtl;
46 
47 //------------------------------------------------------------------------
48 // test classes
49 //------------------------------------------------------------------------
50 const int MAXBUFLENGTH = 255;
51 //------------------------------------------------------------------------
52 // helper functions
53 //------------------------------------------------------------------------
54 static void unused()
55 {
56     // NEVER CALL SUCH FUNCTION!!!
57     (void)input1StrLastDefault;
58     (void)input1StrLastNormal;
59     unused();
60 }
61 
62 //------------------------------------------------------------------------
63 // testing constructors
64 //------------------------------------------------------------------------
65 static sal_Bool test_rtl_OUString_ctor_001( hTestResult hRtlTestResult )
66 {
67 
68 	::rtl::OUString aUStr;
69     rtl_uString * pData = aUStr.pData;
70 
71     return
72         (
73             c_rtl_tres_state
74             (
75                 hRtlTestResult,
76                 pData->length == 0 &&
77                 ! *pData->buffer,
78                 "New OUString containing no characters",
79                 "ctor_001"
80                 )
81             );
82 }
83 
84 //------------------------------------------------------------------------
85 
86 static sal_Bool SAL_CALL test_rtl_OUString_ctor_002(
87     hTestResult hRtlTestResult )
88 {
89     ::rtl::OUString aUStr( kTestStr1,
90                            kTestStr1Len,
91                            kEncodingRTLTextUSASCII,
92                            kConvertFlagsOStringToOUString
93                            );
94 
95     return
96         (
97             c_rtl_tres_state
98             (
99                 hRtlTestResult,
100                 aUStr == aUStr1,
101                 "OUString from an ascii string",
102                 "ctor_002"
103                 )
104             );
105 }
106 //------------------------------------------------------------------------
107 
108 static sal_Bool SAL_CALL test_rtl_OUString_ctor_003(
109     hTestResult hRtlTestResult )
110 {
111 	rtl_uString  *rtlUStr =NULL ;
112     rtl_uString_newFromAscii( &rtlUStr, kTestStr1 );
113 	::rtl::OUString aUStr( rtlUStr );
114 
115 	return
116         (
117             c_rtl_tres_state
118             (
119                 hRtlTestResult,
120                 aUStr == aUStr1,
121                 "New OUString from a rtl_uString",
122                 "ctor_003"
123                 )
124             );
125 }
126 
127 //------------------------------------------------------------------------
128 
129 static sal_Bool SAL_CALL test_rtl_OUString_ctor_004(
130     hTestResult hRtlTestResult)
131 {
132     ::rtl::OUString aUStr( aUStr1 );
133 
134     return
135         (
136             c_rtl_tres_state
137             (
138                 hRtlTestResult,
139                 aUStr == aUStr1,
140                 "New OUString from unicode string",
141                 "ctor_004"
142                 )
143             );
144 }
145 //------------------------------------------------------------------------
146 
147 static sal_Bool test_rtl_OUString_ctor_005( hTestResult hRtlTestResult )
148 {
149     ::rtl::OUString aUStr( aUStr2, kTestStr1Len );
150 
151     return
152         (
153             c_rtl_tres_state
154             (
155                 hRtlTestResult,
156                 aUStr == aUStr1,
157                 "New OUString from the first n characters of unicode string",
158                 "ctor_004"
159                 )
160             );
161 
162 }
163 
164 
165 //------------------------------------------------------------------------
166 
167 static sal_Bool test_rtl_OUString_ctor_006( hTestResult hRtlTestResult )
168 {
169 	::rtl::OUString aUStrtmp( aUStr1 );
170     ::rtl::OUString aUStr( aUStrtmp );
171 
172     return
173         (
174             c_rtl_tres_state
175             (
176                 hRtlTestResult,
177                 aUStr==aUStrtmp,
178                 "New OUString from another OUString",
179                 "ctor_006"
180                 )
181             );
182 }
183 
184 extern "C" void /* sal_Bool */ SAL_CALL test_rtl_OUString_ctors(
185     hTestResult hRtlTestResult )
186 {
187     c_rtl_tres_state_start( hRtlTestResult, "ctors");
188     sal_Bool DCState = test_ini_uString();
189     (void)DCState;
190     sal_Bool bTSState = test_rtl_OUString_ctor_001( hRtlTestResult );
191     bTSState &= test_rtl_OUString_ctor_002( hRtlTestResult);
192     bTSState &= test_rtl_OUString_ctor_003( hRtlTestResult);
193     bTSState &= test_rtl_OUString_ctor_004( hRtlTestResult);
194     bTSState &= test_rtl_OUString_ctor_005( hRtlTestResult);
195     bTSState &= test_rtl_OUString_ctor_006( hRtlTestResult);
196     c_rtl_tres_state_end( hRtlTestResult, "ctors");
197 //    return( bTSState );
198 }
199 
200 
201 
202 //------------------------------------------------------------------------
203 // testing the method getLength
204 //------------------------------------------------------------------------
205 
206 extern "C" void /* sal_Bool */ SAL_CALL test_rtl_OUString_getLength(
207     hTestResult hRtlTestResult)
208 {
209     c_rtl_tres_state_start( hRtlTestResult, "getLength");
210 	sal_Char methName[MAXBUFLENGTH];
211     sal_Char* pMeth = methName;
212 
213 	typedef struct TestCase
214 	{
215 		sal_Char*		comments;
216 		sal_Int32 		expVal;
217     	OUString*        input;
218     	~TestCase() 	{ delete input;}
219 	} TestCase;
220 
221 	TestCase arrTestCase[]={
222 
223 		{"length of ascii string", kTestStr1Len,
224          new OUString( kTestStr1,
225                        kTestStr1Len,
226                        kEncodingRTLTextUSASCII,
227                        kConvertFlagsOStringToOUString)},
228     	{"length of ascci string of size 1", 1,
229          new OUString( "1",
230                        1,
231                        kEncodingRTLTextUSASCII,
232                        kConvertFlagsOStringToOUString)},
233     	{"length of empty string (default constructor)", 0, new OUString()},
234 		{"length of empty string (empty ascii string arg)",0,
235          new OUString( "",
236                        0,
237                        kEncodingRTLTextUSASCII,
238                        kConvertFlagsOStringToOUString)},
239 		{"length of empty string (string arg = '\\0')", 0,
240          new OUString( "\0",
241                        0,
242                        kEncodingRTLTextUSASCII,
243                        kConvertFlagsOStringToOUString)}
244 	};
245 
246 
247 	sal_Bool res = sal_True;
248 	sal_uInt32 i;
249 
250     for (i = 0; i < (sizeof (arrTestCase))/(sizeof (TestCase)); i++)
251     {
252 		sal_Int32 length = arrTestCase[i].input->getLength();
253         sal_Bool lastRes = (length == arrTestCase[i].expVal);
254         c_rtl_tres_state
255             (
256                 hRtlTestResult,
257                 lastRes,
258                 arrTestCase[i].comments,
259                 createName( pMeth, "getLength", i )
260 
261                 );
262 		res &= lastRes;
263     }
264     c_rtl_tres_state_end( hRtlTestResult, "getLength");
265 //    return ( res );
266 }
267 
268 //------------------------------------------------------------------------
269 // testing the method equals( const OString & aStr )
270 //------------------------------------------------------------------------
271 extern "C" void /* sal_Bool */ SAL_CALL test_rtl_OUString_equals(
272     hTestResult hRtlTestResult )
273 {
274     c_rtl_tres_state_start( hRtlTestResult, "equals");
275     sal_Char methName[MAXBUFLENGTH];
276     sal_Char* pMeth = methName;
277 
278 	typedef struct TestCase
279 	{
280 		sal_Char*		comments;
281 		sal_Bool         expVal;
282     	OUString*        input1;
283 		OUString*        input2;
284 		~TestCase()		{ delete input1;delete input2;}
285 	} TestCase;
286 
287 	TestCase arrTestCase[]={
288 
289 		{"same size", sal_True, new OUString(aUStr1), new OUString(aUStr1)},
290 		{"different size", sal_False, new OUString(aUStr1),
291          new OUString(aUStr2)
292 		},
293 		{"same size, no case match", sal_False, new OUString(aUStr1),
294          new OUString(aUStr3)
295 	    },
296 		{"two empty strings(def. constructor)", sal_True, new OUString(),
297          new OUString()
298 	    },
299 		{"empty(def.constructor) and non empty", sal_False, new OUString(),
300          new OUString(aUStr2)
301 	    },
302 		{"non empty and empty(def. constructor)", sal_False,
303          new OUString(aUStr1),
304          new OUString()
305 	    },
306 		{"two empty strings(string arg = '\\0')", sal_True,
307          new OUString( "",
308                        0,
309                        kEncodingRTLTextUSASCII,
310                        kConvertFlagsOStringToOUString),
311          new OUString( "",
312                        0,
313                        kEncodingRTLTextUSASCII,
314                        kConvertFlagsOStringToOUString)
315 	    },
316 		{"empty(string arg = '\\0') and non empty", sal_False,
317          new OUString( "",
318                        0,
319                        kEncodingRTLTextUSASCII,
320                        kConvertFlagsOStringToOUString),
321          new OUString(aUStr2)
322 	    },
323 		{"non empty and empty(string arg = '\\0')", sal_False,
324          new OUString(aUStr1),
325          new OUString( "",
326                        0,
327                        kEncodingRTLTextUSASCII,
328                        kConvertFlagsOStringToOUString)
329 	    }
330 	};
331 
332     sal_Bool res = sal_True;
333     sal_uInt32 i;
334 
335     for(i = 0; i < (sizeof (arrTestCase))/(sizeof (TestCase)); i++)
336     {
337         sal_Bool lastRes =
338             ( arrTestCase[i].input1->equals(*(arrTestCase[i].input2)) ==
339               arrTestCase[i].expVal );
340 
341         c_rtl_tres_state
342             (
343                 hRtlTestResult,
344                 lastRes,
345                 arrTestCase[i].comments,
346                 createName( pMeth, "equals", i )
347                 );
348 
349         res &= lastRes;
350     }
351     c_rtl_tres_state_end( hRtlTestResult, "equals");
352 //    return (res);
353 }
354 
355 //------------------------------------------------------------------------
356 // testing the method equalsIgnoreAsciiCase( const OString & aStr )
357 //------------------------------------------------------------------------
358 
359 extern "C" void /* sal_Bool */ SAL_CALL test_rtl_OUString_equalsIgnoreAsciiCase(
360     hTestResult hRtlTestResult )
361 {
362     c_rtl_tres_state_start( hRtlTestResult, "equalsIgnoreAsciiCase");
363     sal_Char methName[MAXBUFLENGTH];
364     sal_Char* pMeth = methName;
365 
366 	typedef struct TestCase
367 	{
368 		sal_Char*		comments;
369 		sal_Bool         expVal;
370     	OUString*        input1;
371 		OUString*        input2;
372 		~TestCase()		{ delete input1;delete input2;}
373 	} TestCase;
374 
375 	TestCase arrTestCase[]={
376         {"same strings but different cases",sal_True,new OUString(aUStr4),
377          new OUString(aUStr5)
378         },
379         {"same strings",sal_True,new OUString(aUStr4),
380          new OUString(aUStr4)},
381         {"with equal beginning",sal_False,new OUString(aUStr2),
382          new OUString(aUStr4)
383         },
384         {"empty(def.constructor) and non empty",sal_False,new OUString(),
385          new OUString(aUStr5)
386         },
387         {"non empty and empty(def.constructor)",sal_False,
388          new OUString(aUStr4),
389          new OUString()
390         },
391         {"two empty strings(def.constructor)",sal_True,new OUString(),
392          new OUString()
393         },
394         {"different strings with equal length",sal_False,
395          new OUString(aUStr10),
396          new OUString(aUStr11)
397         }
398     };
399 
400     sal_Bool res = sal_True;
401 	sal_uInt32 i;
402 
403     for(i = 0; i < (sizeof (arrTestCase))/(sizeof (TestCase)); i++)
404     {
405         sal_Bool lastRes =
406             (arrTestCase[i].input1->equalsIgnoreAsciiCase(*arrTestCase[i].input2) ==
407              arrTestCase[i].expVal);
408 
409         c_rtl_tres_state
410             (
411                 hRtlTestResult,
412                 lastRes,
413                 arrTestCase[i].comments,
414                 createName( pMeth, "equalsIgnoreAsciiCase", i )
415                 );
416 
417         res &= lastRes;
418     }
419     c_rtl_tres_state_end( hRtlTestResult, "equalsIgnoreAsciiCase");
420 //    return (res);
421 }
422 
423 
424 static sal_Bool SAL_CALL test_rtl_OUString_compareTo_001(
425     hTestResult hRtlTestResult )
426 {
427     sal_Char methName[MAXBUFLENGTH];
428     sal_Char* pMeth = methName;
429 
430 	typedef struct TestCase
431 	{
432 		sal_Char*		comments;
433 		sal_Int32         expVal;
434     	OUString*        input1;
435 		OUString*        input2;
436 		~TestCase()		{ delete input1;delete input2;}
437 	} TestCase;
438 
439 	TestCase arrTestCase[]={
440 
441         {"simple compare, str1 to str5",-1,new OUString(aUStr1),
442          new OUString(aUStr5)
443         },
444         {"simple compare, str2 to str5",-1,new OUString(aUStr2),
445          new OUString(aUStr5)
446         },
447         {"simple compare, str1 to str9",-1,new OUString(aUStr1),
448          new OUString(aUStr9)
449         },
450         {"simple compare, str1 to str2",-1,new OUString(aUStr1),
451          new OUString(aUStr2)
452         },
453         {"simple compare, str4 to str5",-1,new OUString(aUStr4),
454          new OUString(aUStr5)
455         },
456         {"simple compare, str1 to str3",-1,new OUString(aUStr1),
457          new OUString(aUStr3)
458         },
459         {"simple compare, str5 to str1",+1,new OUString(aUStr5),
460          new OUString(aUStr1)
461         },
462         {"simple compare, str2 to str1",+1,new OUString(aUStr2),
463          new OUString(aUStr1)
464         },
465         {"simple compare, str9 to str5",+1,new OUString(aUStr9),
466          new OUString(aUStr5)
467         },
468         {"simple compare, str5 to str4",+1,new OUString(aUStr5),
469          new OUString(aUStr4)
470         },
471         {"simple compare, str1 to str1",0,new OUString(aUStr1),
472          new OUString(aUStr1)
473         },
474         {"simple compare, nullString to nullString",0,new OUString(),
475          new OUString()
476         },
477         {"simple compare, nullString to str2",-1,new OUString(),
478          new OUString(aUStr2)
479         },
480         {"simple compare, str1 to nullString",+1,new OUString(aUStr1),
481          new OUString()
482         }
483     };
484 
485     sal_Bool res = sal_True;
486 	sal_uInt32 i;
487 
488     for(i = 0; i < (sizeof (arrTestCase))/(sizeof (TestCase)); i++)
489     {
490         sal_Int32 cmpRes = arrTestCase[i].input1->compareTo
491             (*arrTestCase[i].input2);
492         cmpRes = ( cmpRes == 0 ) ? 0 : ( cmpRes > 0 ) ? +1 : -1 ;
493         sal_Bool lastRes = ( cmpRes == arrTestCase[i].expVal);
494 
495 
496         c_rtl_tres_state
497             (
498                 hRtlTestResult,
499                 lastRes,
500                 arrTestCase[i].comments,
501                 createName( pMeth, "compareTo_001(const OString&)", i )
502                 );
503 
504         res &= lastRes;
505     }
506 
507     return (res);
508 }
509 
510 
511 //------------------------------------------------------------------------
512 //  testing the method compareTo( const OString & rObj, sal_Int32 length )
513 //------------------------------------------------------------------------
514 static sal_Bool SAL_CALL test_rtl_OUString_compareTo_002(
515     hTestResult hRtlTestResult )
516 {
517     sal_Char methName[MAXBUFLENGTH];
518     sal_Char* pMeth = methName;
519 
520 	typedef struct TestCase
521 	{
522 		sal_Char*		comments;
523 		sal_Int32		expVal;
524 		sal_Int32		maxLength;
525    		OUString*		input1;
526 		OUString*		input2;
527 		~TestCase()		{ delete input1;delete input2;}
528 	} TestCase;
529 
530 	TestCase arrTestCase[] =
531     {
532         {"compare with maxlength, str1 to str9, 16",-1,16,
533          new OUString(aUStr1), new OUString(aUStr9)},
534         {"compare with maxlength, str2 to str9, 32",-1,32,
535          new OUString(aUStr2), new OUString(aUStr9)},
536         {"compare with maxlength, str9 to str4, 16",+1,16,
537          new OUString(aUStr9), new OUString(aUStr4)},
538         {"compare with maxlength, str9 to str22, 32",+1,32,
539          new OUString(aUStr9), new OUString(aUStr22)},
540         {"compare with maxlength, str9 to str5, 16",0,16,
541          new OUString(aUStr9), new OUString(aUStr5)},
542         {"compare with maxlength, str9 to str9, 32",0,32,
543          new OUString(aUStr9), new OUString(aUStr9)},
544         {"compare with maxlength, str1 to str2, 32",-1,32,
545          new OUString(aUStr1), new OUString(aUStr2)},
546         {"compare with maxlength, str1 to str2, 32",-1,32,
547          new OUString(aUStr1), new OUString(aUStr2)},
548         {"compare with maxlength, str1 to str2", 0,-1,
549          new OUString(aUStr1), new OUString(aUStr2)}
550     };
551 
552     sal_Bool res = sal_True;
553 	sal_uInt32 i;
554 
555     for(i = 0; i < (sizeof (arrTestCase))/(sizeof (TestCase)); i++)
556     {
557         sal_Int32 cmpRes = arrTestCase[i].input1->compareTo
558             (*arrTestCase[i].input2, arrTestCase[i].maxLength);
559         cmpRes = (cmpRes == 0) ? 0 : (cmpRes > 0) ? +1 : -1 ;
560         sal_Bool lastRes = (cmpRes == arrTestCase[i].expVal);
561 
562         c_rtl_tres_state
563             (
564                 hRtlTestResult,
565                 lastRes,
566                 arrTestCase[i].comments,
567                 createName( pMeth, "compareTo_002(const OString&, sal_Int32)", i )
568                 );
569 
570         res &= lastRes;
571     }
572 
573     return (res);
574 }
575 
576 extern "C" void /* sal_Bool */ SAL_CALL test_rtl_OUString_compareTo(
577     hTestResult hRtlTestResult )
578 {
579     c_rtl_tres_state_start( hRtlTestResult, "compareTo");
580     sal_Bool res = test_rtl_OUString_compareTo_001(hRtlTestResult);
581     res &= test_rtl_OUString_compareTo_002(hRtlTestResult);
582     c_rtl_tres_state_end( hRtlTestResult, "compareTo");
583 //    return (res);
584 }
585 
586 //------------------------------------------------------------------------
587 // testing the method match( const OUString & str, sal_Int32 fromIndex = 0 )
588 //------------------------------------------------------------------------
589 static sal_Bool SAL_CALL test_rtl_OUString_match_001(
590     hTestResult hRtlTestResult)
591 
592 {
593     sal_Char methName[MAXBUFLENGTH];
594     sal_Char* pMeth = methName;
595 
596 	typedef struct TestCase
597 	{
598 		sal_Char*		comments;
599 		sal_Bool         expVal;
600 		OUString*        input1;
601 		OUString*        input2;
602 		~TestCase() 	{ delete input1;delete input2;}
603 	} TestCase;
604 
605 	TestCase arrTestCase[]={
606 
607 		{"aUStr2 and aUStr1", sal_True, new OUString(aUStr2),
608          new OUString(aUStr1)},
609 		{"aUStr1 and aUStr2", sal_False, new OUString(aUStr1),
610          new OUString(aUStr2)},
611 		{"aUStr5 and aUStr6", sal_False, new OUString(aUStr5),
612          new OUString(aUStr6)},
613 		{"null and aUStr1", sal_False, new OUString( "",
614                                                      0,
615                                                      kEncodingRTLTextUSASCII,
616                                                      kConvertFlagsOStringToOUString),
617          new OUString(aUStr1)}
618 
619 	};
620 
621     sal_Bool res = sal_True;
622     sal_uInt32 i;
623 
624     for(i = 0; i < (sizeof (arrTestCase))/(sizeof (TestCase)); i++)
625     {
626         sal_Bool lastRes = ( arrTestCase[i].input1->match(
627         	*(arrTestCase[i].input2)) == arrTestCase[i].expVal );
628 
629         c_rtl_tres_state
630             (
631                 hRtlTestResult,
632                 lastRes,
633                 arrTestCase[i].comments,
634                 createName( pMeth, "match(const OUString & str)", i  )
635                 );
636 
637         res &= lastRes;
638     }
639     return (res);
640 }
641 
642 static sal_Bool SAL_CALL test_rtl_OUString_match_002(
643     hTestResult hRtlTestResult )
644 
645 {
646     sal_Char methName[MAXBUFLENGTH];
647     sal_Char* pMeth = methName;
648 
649 	typedef struct TestCase
650 	{
651 		sal_Char*		comments;
652 		sal_Bool         expVal;
653 		sal_Int32		fromIndex;
654     	OUString*		input1;
655 		OUString*		input2;
656 		~TestCase()		{ delete input1;delete input2;}
657 	} TestCase;
658 
659 	TestCase arrTestCase[]={
660 
661 		{"aUStr2 from 17 and aUStr6", sal_True, 17,
662          new OUString(aUStr2),new OUString(aUStr6)},
663 		{"aUStr2 from 5 and aUStr6", sal_False, 5,
664          new OUString(aUStr2),new OUString(aUStr6)},
665 		{"aUStr2 from 0 and aUStr1", sal_True, 0,
666          new OUString(aUStr2),new OUString(aUStr1)},
667 		{"aUStr1 from 16 and null", sal_True, 16,
668          new OUString(aUStr1),
669          new OUString( "",
670                        0,
671                        kEncodingRTLTextUSASCII,
672                        kConvertFlagsOStringToOUString
673                        )
674 	    },
675 		{"aUStr1 from 5 and null", sal_True, 5,
676          new OUString(aUStr1),
677          new OUString( "",
678                        0,
679                        kEncodingRTLTextUSASCII,
680                        kConvertFlagsOStringToOUString
681                        )
682 	    },
683 		{"aUStr2 from -1 and aUStr1", sal_False, -1,
684          new OUString(aUStr2),new OUString(aUStr1)},
685 		{"aUStr5 from 2 and aUStr4", sal_False, 2,
686          new OUString(aUStr5),new OUString(aUStr4)},
687 		{"aUStr2 from 18 and aUStr1", sal_False, 18,
688          new OUString(aUStr2),new OUString(aUStr1)}
689 	};
690 
691     sal_Bool res = sal_True;
692     sal_uInt32 i;
693 
694     for(i = 0; i < (sizeof (arrTestCase))/(sizeof (TestCase)); i++)
695     {
696         sal_Bool lastRes = ( arrTestCase[i].input1->match
697                              (*(arrTestCase[i].input2),arrTestCase[i].fromIndex) ==
698                              arrTestCase[i].expVal );
699 
700         c_rtl_tres_state
701             (
702                 hRtlTestResult,
703                 lastRes,
704                 arrTestCase[i].comments,
705                 createName( pMeth,
706                             "match(const OUString & str,sal_Int32 fromIndex = 0)", i  )
707 
708                 );
709 
710         res &= lastRes;
711     }
712     return (res);
713 }
714 
715 extern "C" void /* sal_Bool */ SAL_CALL test_rtl_OUString_match(
716     hTestResult hRtlTestResult )
717 {
718     c_rtl_tres_state_start( hRtlTestResult, "match");
719     sal_Bool res = test_rtl_OUString_match_001(hRtlTestResult);
720     res &= test_rtl_OUString_match_002(hRtlTestResult);
721     c_rtl_tres_state_end( hRtlTestResult, "match");
722 //    return (res);
723 }
724 
725 //------------------------------------------------------------------------
726 // testing the operator +=
727 //------------------------------------------------------------------------
728 extern "C" void /* sal_Bool */ SAL_CALL test_rtl_OUString_op_eq(
729     hTestResult hRtlTestResult)
730 {
731     c_rtl_tres_state_start( hRtlTestResult, "eq");
732 	sal_Char methName[MAXBUFLENGTH];
733     sal_Char* pMeth = methName;
734 
735 	typedef struct TestCase
736 	{
737 		sal_Char*		comments;
738 	   	OUString*        input1;
739     	OUString*        input2;
740     	~TestCase() 	{ delete input1; delete input2;}
741 	} TestCase;
742 
743 	TestCase arrTestCase[]={
744 		{"null and Ustr1", new OUString, new OUString(aUStr1)},
745 		{"Ustr2 and Ustr1", new OUString(aUStr2),
746          new OUString(aUStr1)},
747 		{""" and Ustr1 from bit charactor buffer",
748          new OUString(aUStr1),
749          new OUString( "",
750                        0,
751                        kEncodingRTLTextUSASCII,
752                        kConvertFlagsOStringToOUString
753                        )},
754 		{"Ustr1 and Ustr2 from value and length",
755          new OUString( aUStr2, kTestStr2Len ),
756          new OUString(aUStr1)}
757 	};
758 
759 
760 	sal_Bool res = sal_True;
761 	sal_uInt32 i;
762 
763     for (i = 0; i < (sizeof (arrTestCase))/(sizeof (TestCase)); i++)
764     {
765 		*(arrTestCase[i].input1) = *(arrTestCase[i].input2);
766         sal_Bool lastRes = (*(arrTestCase[i].input1) ==
767                             *(arrTestCase[i].input2));
768         c_rtl_tres_state
769             (
770                 hRtlTestResult,
771                 lastRes,
772                 arrTestCase[i].comments,
773                 createName( pMeth, "op_eq", i )
774 
775                 );
776 		res &= lastRes;
777     }
778     c_rtl_tres_state_end( hRtlTestResult, "eq");
779 //    return ( res );
780 }
781 
782 //------------------------------------------------------------------------
783 // testing the operator +=
784 //------------------------------------------------------------------------
785 extern "C" void /* sal_Bool */ SAL_CALL test_rtl_OUString_op_peq(
786     hTestResult hRtlTestResult)
787 {
788     c_rtl_tres_state_start( hRtlTestResult, "peq");
789 	sal_Char methName[MAXBUFLENGTH];
790     sal_Char* pMeth = methName;
791 
792 	typedef struct TestCase
793 	{
794 		sal_Char*		comments;
795 		OUString*		expVal;
796 	   	OUString*        input1;
797     	OUString*        input2;
798     	~TestCase() 	{ delete input1; delete input2;}
799 	} TestCase;
800 
801 	TestCase arrTestCase[]={
802 		{" ' '= ''+='' ", new OUString( "",
803                                         0,
804                                         kEncodingRTLTextUSASCII,
805                                         kConvertFlagsOStringToOUString
806                                         ),
807          new OUString( "",
808                        0,
809                        kEncodingRTLTextUSASCII,
810                        kConvertFlagsOStringToOUString
811                        ),
812          new OUString( "",
813                        0,
814                        kEncodingRTLTextUSASCII,
815                        kConvertFlagsOStringToOUString
816                        )},
817 		{"Ustr1= null += Ustr1", new OUString(aUStr1),
818          new OUString(), new OUString(aUStr1)},
819 		{"Ustr1= '' += Ustr1", new OUString(aUStr1),
820 		 /*new OUString( "",
821            0,
822            kEncodingRTLTextUSASCII,
823            kConvertFlagsOStringToOUString
824            )*/
825 		 new OUString(),
826          new OUString(aUStr1)},
827 		{"Ustr1PlusUStr6 = Ustr1 += Ustr6",
828          new OUString(aUStr1PlusUStr6), new OUString(aUStr1),
829          new OUString(aUStr6)},
830 	};
831 
832 
833 	sal_Bool res = sal_True;
834 	sal_uInt32 i;
835 
836     for (i = 0; i < (sizeof (arrTestCase))/(sizeof (TestCase)); i++)
837     {
838 		*(arrTestCase[i].input1) += *(arrTestCase[i].input2);
839         sal_Bool lastRes = (*(arrTestCase[i].expVal) ==
840                             *(arrTestCase[i].input1));
841         c_rtl_tres_state
842             (
843                 hRtlTestResult,
844                 lastRes,
845                 arrTestCase[i].comments,
846                 createName( pMeth, "op_peq", i )
847 
848                 );
849 		res &= lastRes;
850     }
851     c_rtl_tres_state_end( hRtlTestResult, "peq");
852 //    return ( res );
853 }
854 
855 //------------------------------------------------------------------------
856 // testing the operator const sal_Unicode * (csuc for short)
857 //------------------------------------------------------------------------
858 extern "C" void /* sal_Bool */ SAL_CALL test_rtl_OUString_csuc(
859     hTestResult hRtlTestResult)
860 {
861     c_rtl_tres_state_start( hRtlTestResult, "csuc");
862 	sal_Char methName[MAXBUFLENGTH];
863 	sal_Char* pMeth = methName;
864 
865 	const sal_Unicode tmpUC=0x0;
866 	rtl_uString* tmpUstring = NULL;
867 	const sal_Char *tmpStr=kTestStr1;
868 	sal_Int32 tmpLen=(sal_Int32) kTestStr1Len;
869 	// sal_Int32 cmpLen = 0;
870 
871 	rtl_string2UString( &tmpUstring, tmpStr,  tmpLen,
872                         osl_getThreadTextEncoding(), OSTRING_TO_OUSTRING_CVTFLAGS );
873     OSL_ASSERT(tmpUstring != NULL);
874 
875 
876 	typedef struct TestCase
877     {
878         sal_Char*				comments;
879         const sal_Unicode*		expVal;
880         sal_Int32				cmpLen;
881         OUString*                input1;
882         ~TestCase() {  delete input1;}
883  	} TestCase;
884 
885     TestCase arrTestCase[] =
886     {
887       	{"test normal ustring",(*tmpUstring).buffer,kTestStr1Len,
888          new OUString(aUStr1)},
889         {"test empty ustring",&tmpUC, 1, new OUString()}
890     };
891 
892     sal_Bool res = sal_True;
893     sal_uInt32 i;
894     for(i = 0; i < (sizeof (arrTestCase))/(sizeof (TestCase)); i++)
895     {
896         const sal_Unicode* pstr = *arrTestCase[i].input1;
897 
898         res &= c_rtl_tres_state
899             (
900                 hRtlTestResult,
901                 cmpstr((sal_Char*)pstr,
902                        (sal_Char*)arrTestCase[i].expVal,
903                        arrTestCase[i].cmpLen),
904                 arrTestCase[i].comments,
905                 createName( pMeth, "const sal_Unicode*", i )
906                 );
907     }
908     c_rtl_tres_state_end( hRtlTestResult, "csuc");
909 //    return ( res );
910 }
911 
912 //------------------------------------------------------------------------
913 // testing the method const sal_Unicode * getStr()
914 //------------------------------------------------------------------------
915 extern "C" void /* sal_Bool */ SAL_CALL test_rtl_OUString_getStr(
916     hTestResult hRtlTestResult)
917 {
918     c_rtl_tres_state_start( hRtlTestResult, "getStr");
919 	sal_Char methName[MAXBUFLENGTH];
920 	sal_Char* pMeth = methName;
921 
922 	const sal_Unicode tmpUC=0x0;
923 	rtl_uString* tmpUstring = NULL;
924 	const sal_Char *tmpStr=kTestStr1;
925 	sal_Int32 tmpLen=(sal_Int32) kTestStr1Len;
926 	// sal_Int32 cmpLen = 0;
927 
928 	rtl_string2UString( &tmpUstring, tmpStr,  tmpLen,
929                         osl_getThreadTextEncoding(), OSTRING_TO_OUSTRING_CVTFLAGS );
930     OSL_ASSERT(tmpUstring != NULL);
931 
932 
933 	typedef struct TestCase
934     {
935         sal_Char*				comments;
936         const sal_Unicode*		expVal;
937         sal_Int32				cmpLen;
938         OUString*                input1;
939         ~TestCase() {  delete input1;}
940  	} TestCase;
941 
942     TestCase arrTestCase[] =
943     {
944       	{"test normal ustring",(*tmpUstring).buffer,kTestStr1Len,
945          new OUString(aUStr1)},
946         {"test empty ustring",&tmpUC, 1, new OUString()}
947     };
948 
949     sal_Bool res = sal_True;
950     sal_uInt32 i;
951     for(i = 0; i < (sizeof (arrTestCase))/(sizeof (TestCase)); i++)
952     {
953         const sal_Unicode* pstr = arrTestCase[i].input1->getStr();
954 
955         res &= c_rtl_tres_state
956             (
957                 hRtlTestResult,
958                 cmpstr((sal_Char*)pstr,
959                        (sal_Char*)arrTestCase[i].expVal,
960                        arrTestCase[i].cmpLen),
961                 arrTestCase[i].comments,
962                 createName( pMeth, "getStr", i )
963                 );
964     }
965     c_rtl_tres_state_end( hRtlTestResult, "getStr");
966 //    return ( res );
967 }
968 
969 
970 //------------------------------------------------------------------------
971 // testing the method sal_Int32 reverseCompareTo( const OUString & str )
972 //-------------------------------------------------------------------------
973 extern "C" void /* sal_Bool */ SAL_CALL test_rtl_OUString_reverseCompareTo(
974     hTestResult hRtlTestResult )
975 {
976     c_rtl_tres_state_start( hRtlTestResult, "reverseCompareTo");
977     sal_Char methName[MAXBUFLENGTH];
978     sal_Char* pMeth = methName;
979 
980 	typedef struct TestCase
981 	{
982 		sal_Char*		comments;
983 		sal_Int32         expVal;
984     	OUString*        input1;
985 		OUString*        input2;
986 		~TestCase()		{ delete input1;delete input2;}
987 	} TestCase;
988 
989 	TestCase arrTestCase[]={
990 
991         {"simple compare, str1 to str5",-1,new OUString(aUStr1),
992          new OUString(aUStr5)
993         },
994         {"simple compare, str2 to str5",1,new OUString(aUStr2),
995          new OUString(aUStr5)
996         },
997         {"simple compare, str1 to str9",-1,new OUString(aUStr1),
998          new OUString(aUStr9)
999         },
1000         {"simple compare, str4 to str5",-1,new OUString(aUStr4),
1001          new OUString(aUStr5)
1002         },
1003         {"simple compare, str5 to str1",+1,new OUString(aUStr5),
1004          new OUString(aUStr1)
1005         },
1006         {"simple compare, str2 to str1",+1,new OUString(aUStr2),
1007          new OUString(aUStr1)
1008         },
1009         {"simple compare, str1 to str1",0,new OUString(aUStr1),
1010          new OUString(aUStr1)
1011         },
1012         {"simple compare, nullString to nullString",0,new OUString(),
1013          new OUString()
1014         },
1015         {"simple compare, nullString to str2",-1,new OUString(),
1016          new OUString(aUStr2)
1017         },
1018         {"simple compare, str1 to nullString",+1,new OUString(aUStr1),
1019          new OUString()
1020         }
1021     };
1022 
1023     sal_Bool res = sal_True;
1024 	sal_uInt32 i;
1025 
1026     for(i = 0; i < (sizeof (arrTestCase))/(sizeof (TestCase)); i++)
1027     {
1028         sal_Int32 cmpRes = arrTestCase[i].input1->reverseCompareTo
1029             (*arrTestCase[i].input2);
1030         cmpRes = ( cmpRes == 0 ) ? 0 : ( cmpRes > 0 ) ? +1 : -1 ;
1031         sal_Bool lastRes = ( cmpRes == arrTestCase[i].expVal);
1032 
1033 
1034         c_rtl_tres_state
1035             (
1036                 hRtlTestResult,
1037                 lastRes,
1038                 arrTestCase[i].comments,
1039                 createName( pMeth, "compareTo(const OString&)", i )
1040                 );
1041 
1042         res &= lastRes;
1043     }
1044     c_rtl_tres_state_end( hRtlTestResult, "reverseCompareTo");
1045 //    return (res);
1046 }
1047 
1048 //------------------------------------------------------------------------
1049 //       testing the method sal_Bool equalsAscii( const sal_Char* asciiStr )
1050 //------------------------------------------------------------------------
1051 extern "C" void /* sal_Bool */ SAL_CALL test_rtl_OUString_equalsAscii(
1052     hTestResult hRtlTestResult)
1053 {
1054     c_rtl_tres_state_start( hRtlTestResult, "equalsAscii");
1055 	sal_Char methName[MAXBUFLENGTH];
1056     sal_Char* pMeth = methName;
1057 
1058     const sal_Char *tmpAstr1="Sun Microsystems\0";
1059     const sal_Char *tmpAstr2="\0";
1060 
1061 
1062 
1063 	typedef struct TestCase
1064 	{
1065 		sal_Char*		 comments;
1066 		sal_Bool		 expVal;
1067 	   	OUString*         input1;
1068         const sal_Char*    input2;
1069     	~TestCase() 	{ delete input1;}
1070 	} TestCase;
1071 
1072 	TestCase arrTestCase[]={
1073 		{"str1 with str1 ", sal_True, new OUString( kTestStr1,
1074                                                     kTestStr1Len,
1075                                                     kEncodingRTLTextUSASCII,
1076                                                     kConvertFlagsOStringToOUString
1077                                                     ), tmpAstr1},
1078 		{"str2 with str1 ", sal_False,new OUString( kTestStr2,
1079                                                     kTestStr2Len,
1080                                                     kEncodingRTLTextUSASCII,
1081                                                     kConvertFlagsOStringToOUString
1082                                                     ), tmpAstr1},
1083 	    {"null with str1  ", sal_False, new OUString(), tmpAstr1},
1084 	    {"null with '' ", sal_True, new OUString(), tmpAstr2},
1085 	    {"'' with ''", sal_True, new OUString( "",
1086                                                0,
1087                                                kEncodingRTLTextUSASCII,
1088                                                kConvertFlagsOStringToOUString
1089                                                ),
1090          tmpAstr2}
1091 
1092 	};
1093 
1094 
1095 	sal_Bool res = sal_True;
1096 	sal_uInt32 i;
1097 
1098     for (i = 0; i < (sizeof (arrTestCase))/(sizeof (TestCase)); i++)
1099     {
1100 
1101 		sal_Bool lastRes = (arrTestCase[i].expVal ==
1102                             arrTestCase[i].input1->equalsAscii(arrTestCase[i].input2));
1103         c_rtl_tres_state
1104             (
1105                 hRtlTestResult,
1106                 lastRes,
1107                 arrTestCase[i].comments,
1108                 createName( pMeth, "equalsAscii", i )
1109 
1110                 );
1111 		res &= lastRes;
1112     }
1113     c_rtl_tres_state_end( hRtlTestResult, "equalsAscii");
1114 //    return ( res );
1115 }
1116 
1117 
1118 
1119 //------------------------------------------------------------------------
1120 //       testing the method sal_Bool equalsAsciiL(
1121 //							const sal_Char* asciiStr, sal_Int32 asciiStrLength )
1122 //------------------------------------------------------------------------
1123 extern "C" void /* sal_Bool */ SAL_CALL test_rtl_OUString_equalsAsciiL(
1124     hTestResult hRtlTestResult)
1125 {
1126     c_rtl_tres_state_start( hRtlTestResult, "equalsAsciiL");
1127 	sal_Char methName[MAXBUFLENGTH];
1128     sal_Char* pMeth = methName;
1129 
1130     const sal_Char *tmpAstr1="Sun Microsystems\0";
1131     const sal_Char *tmpAstr2="\0";
1132     const sal_Char *tmpAstr3="Sun Microsystems Java Technology\0";
1133 
1134 
1135 
1136 	typedef struct TestCase
1137 	{
1138 		sal_Char*		 comments;
1139 		sal_Bool		 expVal;
1140 	   	OUString*         input1;
1141         const sal_Char*    input2;
1142         sal_Int32          cmpLen;
1143     	~TestCase() 	{ delete input1;}
1144 	} TestCase;
1145 
1146 	TestCase arrTestCase[]={
1147 		{"str1 with str1,str1Len ", sal_True, new OUString( kTestStr1,
1148                                                             kTestStr1Len,
1149                                                             kEncodingRTLTextUSASCII,
1150                                                             kConvertFlagsOStringToOUString
1151                                                             ), tmpAstr1, kTestStr1Len},
1152 		{"str2 with str1,str1Len", sal_False,new OUString( kTestStr2,
1153                                                            kTestStr2Len,
1154                                                            kEncodingRTLTextUSASCII,
1155                                                            kConvertFlagsOStringToOUString
1156                                                            ), tmpAstr1, kTestStr1Len},
1157 	    {"str1 with str2,str1Len", sal_True,new OUString( kTestStr1,
1158                                                           kTestStr1Len,
1159                                                           kEncodingRTLTextUSASCII,
1160                                                           kConvertFlagsOStringToOUString
1161                                                           ), tmpAstr3, kTestStr1Len},
1162 	    {"null with str1,1  ", sal_False, new OUString(), tmpAstr1, 1},
1163 	    {"null with '',1 ", sal_False, new OUString(), tmpAstr2, 1},
1164 	    {"'' with '', 1", sal_False, new OUString( "",
1165                                                    0,
1166                                                    kEncodingRTLTextUSASCII,
1167                                                    kConvertFlagsOStringToOUString
1168                                                    ),
1169          tmpAstr2, 1}
1170 
1171 	};
1172 
1173 
1174 	sal_Bool res = sal_True;
1175 	sal_uInt32 i;
1176 
1177     for (i = 0; i < (sizeof (arrTestCase))/(sizeof (TestCase)); i++)
1178     {
1179 
1180 		sal_Bool lastRes = (arrTestCase[i].expVal ==
1181                             arrTestCase[i].input1->equalsAsciiL(arrTestCase[i].input2,
1182                                                                 arrTestCase[i].cmpLen)
1183                             );
1184         c_rtl_tres_state
1185             (
1186                 hRtlTestResult,
1187                 lastRes,
1188                 arrTestCase[i].comments,
1189                 createName( pMeth, "equalsAsciiL", i )
1190 
1191                 );
1192 		res &= lastRes;
1193     }
1194     c_rtl_tres_state_end( hRtlTestResult, "equalsAsciiL");
1195 //    return ( res );
1196 }
1197 
1198 //------------------------------------------------------------------------
1199 //       testing the method sal_Int32 compareToAscii( const sal_Char* asciiStr )
1200 //------------------------------------------------------------------------
1201 extern "C" void /* sal_Bool */ SAL_CALL test_rtl_OUString_compareToAscii(
1202     hTestResult hRtlTestResult)
1203 {
1204     c_rtl_tres_state_start( hRtlTestResult, "compareToAscii");
1205 	sal_Char methName[MAXBUFLENGTH];
1206     sal_Char* pMeth = methName;
1207 
1208     const sal_Char *tmpAstr1="Sun Microsystems\0";
1209     const sal_Char *tmpAstr2="\0";
1210     const sal_Char *tmpAstr3="sun microsystems java technology\0";
1211     const sal_Char *tmpAstr4="Sun Microsystems Java Technology\0";
1212 
1213 
1214 	typedef struct TestCase
1215 	{
1216 		sal_Char*		 comments;
1217 		sal_Int32		 expVal;
1218 	   	OUString*         input1;
1219         const sal_Char*    input2;
1220     	~TestCase() 	{ delete input1;}
1221 	} TestCase;
1222 
1223 	TestCase arrTestCase[]={
1224 		{"str1 with str1 ", 0, new OUString( kTestStr1,
1225                                              kTestStr1Len,
1226                                              kEncodingRTLTextUSASCII,
1227                                              kConvertFlagsOStringToOUString
1228                                              ), tmpAstr1},
1229 		{"str1 with '' ", 83, new OUString( kTestStr1,
1230                                             kTestStr1Len,
1231                                             kEncodingRTLTextUSASCII,
1232                                             kConvertFlagsOStringToOUString
1233                                             ), tmpAstr2},
1234 	    {"null with str1  ", -83 , new OUString(), tmpAstr1},
1235 	    {"null with '' ", 0, new OUString(), tmpAstr2},
1236 	    {"str1 with str9", -32, new OUString( kTestStr1,
1237                                               kTestStr1Len,
1238                                               kEncodingRTLTextUSASCII,
1239                                               kConvertFlagsOStringToOUString
1240                                               ),
1241          tmpAstr3},
1242 	    {"str1 with str2", -32, new OUString( kTestStr1,
1243                                               kTestStr1Len,
1244                                               kEncodingRTLTextUSASCII,
1245                                               kConvertFlagsOStringToOUString
1246                                               ),
1247          tmpAstr4}
1248 
1249 	};
1250 
1251 
1252 	sal_Bool res = sal_True;
1253 	sal_uInt32 i;
1254 
1255     for (i = 0; i < (sizeof (arrTestCase))/(sizeof (TestCase)); i++)
1256     {
1257 		sal_Bool lastRes = (arrTestCase[i].expVal ==
1258                             arrTestCase[i].input1->compareToAscii(arrTestCase[i].input2));
1259 
1260         c_rtl_tres_state
1261             (
1262                 hRtlTestResult,
1263                 lastRes,
1264                 arrTestCase[i].comments,
1265                 createName( pMeth, "equalsAscii", i )
1266 
1267                 );
1268 		res &= lastRes;
1269     }
1270     c_rtl_tres_state_end( hRtlTestResult, "compareToAscii");
1271 //    return ( res );
1272 }
1273 
1274 
1275 //------------------------------------------------------------------------
1276 //       testing the method valueOf( sal_Bool b )
1277 //------------------------------------------------------------------------
1278 extern "C" void /* sal_Bool */ SAL_CALL test_rtl_OUString_valueOf_sal_Bool(
1279     hTestResult hRtlTestResult )
1280 {
1281     c_rtl_tres_state_start( hRtlTestResult, "Bool");
1282     sal_Char methName[MAXBUFLENGTH];
1283     sal_Char* pMeth = methName;
1284 
1285     typedef struct TestCase
1286     {
1287         sal_Char*       comments;
1288         OUString*       expVal;
1289         sal_Bool        input1;
1290 
1291         ~TestCase()     {delete expVal;}
1292     }TestCase;
1293 
1294     TestCase arrTestCase[]=
1295     {
1296         {"input Bool 'true' and return OUString 'true'",
1297          new OUString("true",4,kEncodingRTLTextUSASCII,
1298                       kConvertFlagsOStringToOUString),
1299          sal_True
1300         },
1301         {"input Bool 'false' and return OUString 'false'",
1302          new OUString("false",5,kEncodingRTLTextUSASCII,
1303                       kConvertFlagsOStringToOUString),
1304          sal_False
1305         }
1306     };
1307 
1308     sal_Bool    res;
1309     sal_uInt32   i;
1310 
1311     for(i=0;i<(sizeof(arrTestCase))/(sizeof(TestCase));i++)
1312     {
1313         sal_Bool lastRes=(*arrTestCase[i].expVal==
1314                           OUString::valueOf(arrTestCase[i].input1)
1315 
1316                           );
1317 
1318         c_rtl_tres_state(hRtlTestResult,
1319                          lastRes,
1320                          arrTestCase[i].comments,
1321                          createName( pMeth, "valueOf( sal_Bool b )", i )
1322                          );
1323 
1324         res &= lastRes;
1325     }
1326     c_rtl_tres_state_end( hRtlTestResult, "Bool");
1327 //    return(res);
1328 }
1329 
1330 //------------------------------------------------------------------------
1331 extern "C" void /* sal_Bool */ SAL_CALL test_rtl_OUString_valueOf_sal_Unicode(
1332     hTestResult hRtlTestResult )
1333 {
1334     c_rtl_tres_state_start( hRtlTestResult, "Unicode");
1335     sal_Char    methName[MAXBUFLENGTH];
1336     sal_Char*   pMeth = methName;
1337 
1338     sal_Unicode tmpchar1=97;
1339     sal_Unicode tmpchar2=53;
1340     sal_Unicode tmpchar3=0;
1341     sal_Unicode tmpchar4=32;
1342     sal_Unicode tmpchar5=47;
1343 
1344     typedef struct TestCase
1345     {
1346         sal_Char*       comments;
1347         OUString*       expVal;
1348         sal_Unicode     input1;
1349 
1350         ~TestCase()     {delete expVal;}
1351     }TestCase;
1352 
1353     TestCase arrTestCase[]=
1354     {
1355         {"input Unicode 'a' and return OUString 'a'",
1356          new OUString(&tmpchar1,1),tmpchar1
1357         },
1358         {"input Unicode '5' and return OUString '5'",
1359          new OUString(&tmpchar2,1), tmpchar2
1360         },
1361         {"input Unicode 0 and return OUString 0",
1362          new OUString(&tmpchar3,1),tmpchar3
1363         },
1364         {"input Unicode ' ' and return OUString ' '",
1365          new OUString(&tmpchar4,1),tmpchar4
1366         },
1367         {"input Unicode '/' and return OUString ' '",
1368          new OUString(&tmpchar5,1),tmpchar5
1369         }
1370     };
1371 
1372     sal_Bool    res=sal_True;
1373     sal_uInt32   i;
1374 
1375     for(i=0;i<(sizeof(arrTestCase))/(sizeof(TestCase));i++)
1376     {
1377         sal_Bool lastRes=(*(arrTestCase[i].expVal)==
1378                           OUString::valueOf(arrTestCase[i].input1));
1379 
1380         c_rtl_tres_state(hRtlTestResult,
1381                          lastRes,
1382                          arrTestCase[i].comments,
1383                          createName( pMeth, "valueOf( sal_Unicode c )", i )
1384                          );
1385 
1386         res &= lastRes;
1387     }
1388     c_rtl_tres_state_end( hRtlTestResult, "Unicode");
1389 //    return(res);
1390 }
1391 
1392 
1393 /**
1394  * Calls the method valueOf(T, radix) and compares
1395  * returned ustrings with ustrings that passed in the array resArray.
1396  *
1397  * @param T, type of argument, passed to valueOf
1398  * @param resArray, array of result ustrings to compare to
1399  * @param n the number of elements in the array resArray (testcases)
1400  * @param pTestResult the instance of the class TestResult
1401  * @param inArray [optional], array of value that is passed as first argument
1402  *                            to valueOf
1403  *
1404  * @return true, if all returned ustrings are equal to corresponding ustring in
1405  *               resArray else, false.
1406  */
1407 template <class T>
1408 sal_Bool test_valueOf( const char** resArray, int n, sal_Int16 radix,
1409                        hTestResult hRtlTestResult, const T *inArray )
1410 {
1411     sal_Bool    bRes = sal_True;
1412 
1413     sal_Char    methName[MAXBUFLENGTH];
1414     sal_Char*   pMeth = methName;
1415     sal_Int32   i;
1416 //    static sal_Unicode aUchar[50]={0x12};
1417 
1418     for (i = 0; i < n; i++)
1419     {
1420         ::rtl::OUString aStr1;
1421 
1422 		OSL_ENSURE( i < 50, "ERROR: leave aUchar bound");
1423 
1424 //        AStringToUStringCopy(aUchar,resArray[i]);
1425 //        ::rtl::OUString aStr2(aUchar);
1426         rtl::OUString aStr2;
1427         aStr2 = OUString::createFromAscii(resArray[i]);
1428 
1429         ::rtl::OUString aStr3( "-",1,kEncodingRTLTextUSASCII,
1430                                kConvertFlagsOStringToOUString);
1431 
1432         if (inArray == 0)
1433 		{
1434 			aStr1 = ::rtl::OUString::valueOf((T)i, radix);
1435 		}
1436         else
1437         {
1438             if ( inArray[i] < 0 )
1439             {
1440                 sal_Unicode   aStr4[100];
1441                 OSL_ASSERT(strlen(resArray[i]) < 100);
1442 
1443                 if(AStringToUStringCopy(aStr4,resArray[i]))
1444                 {
1445                     aStr2 = aStr3;
1446                     aStr2 += aStr4;
1447                 }
1448 
1449             }
1450             aStr1 = ::rtl::OUString::valueOf((T)inArray[i], radix);
1451         }
1452 
1453         bRes &= c_rtl_tres_state
1454             (
1455                 hRtlTestResult,
1456                 aStr2.compareTo(aStr1) == 0,
1457                 (sal_Char*)resArray[i],
1458                 createName( pMeth, "valueOf", i )
1459                 );
1460     }
1461 
1462     return (bRes);
1463 }
1464 
1465 
1466 #define test_valueOf_Int32      test_valueOf<sal_Int32>
1467 #define test_valueOf_Int64      test_valueOf<sal_Int64>
1468 // LLA: #define test_valueOf_float      test_valueOf<float>
1469 // LLA: #define test_valueOf_double     test_valueOf<double>
1470 
1471 //------------------------------------------------------------------------
1472 // testing the method valueOf( sal_Int32 i, sal_Int16 radix=2 )
1473 // testing the method valueOf( sal_Int32 i, sal_Int16 radix=8 )
1474 // testing the method valueOf( sal_Int32 i, sal_Int16 radix=10 )
1475 // testing the method valueOf( sal_Int32 i, sal_Int16 radix=16 )
1476 // testing the method valueOf( sal_Int32 i, sal_Int16 radix=36 )
1477 //------------------------------------------------------------------------
1478 sal_Bool SAL_CALL test_rtl_OUString_valueOf_Int32(
1479     hTestResult hRtlTestResult )
1480 {
1481     sal_Bool bRes = sal_False;
1482 
1483     bRes = c_rtl_tres_state
1484         (
1485             hRtlTestResult,
1486             test_valueOf_Int32((const char**)kBinaryNumsStr,
1487                                kBinaryNumsCount, kRadixBinary, hRtlTestResult, 0 ),
1488             "kRadixBinary",
1489             "valueOf(sal_Int32, radix 2)"
1490             );
1491 
1492 
1493     bRes &= c_rtl_tres_state
1494         (
1495             hRtlTestResult,
1496             test_valueOf_Int32((const char**)kOctolNumsStr,
1497                                kOctolNumsCount, kRadixOctol, hRtlTestResult, 0),
1498             "kRadixOctol",
1499             "valueOf(sal_Int32, radix 8)"
1500             );
1501 
1502     bRes &= c_rtl_tres_state
1503         (
1504             hRtlTestResult,
1505             test_valueOf_Int32((const char**)kDecimalNumsStr,
1506                                kDecimalNumsCount, kRadixDecimal, hRtlTestResult, 0),
1507             "kRadixDecimal",
1508             "valueOf(sal_Int32, radix 10)"
1509             );
1510 
1511     bRes &= c_rtl_tres_state
1512         (
1513             hRtlTestResult,
1514             test_valueOf_Int32((const char**)kHexDecimalNumsStr,
1515                                kHexDecimalNumsCount, kRadixHexdecimal, hRtlTestResult, 0),
1516             "kRadixHexdecimal",
1517             "valueOf(sal_Int32, radix 16)"
1518             );
1519 
1520     bRes &= c_rtl_tres_state
1521         (
1522             hRtlTestResult,
1523             test_valueOf_Int32((const char**)kBase36NumsStr,
1524                                kBase36NumsCount, kRadixBase36, hRtlTestResult, 0),
1525             "kRadixBase36",
1526             "valueOf(sal_Int32, radix 36)"
1527             );
1528 
1529 
1530     return ( bRes );
1531 }
1532 
1533 //------------------------------------------------------------------------
1534 // testing the method valueOf( sal_Int32 l, sal_Int32 radix=2 )
1535 // where l = large constants
1536 // testing the method valueOf( sal_Int32 l, sal_Int32 radix=8 )
1537 // where l = large constants
1538 // testing the method valueOf( sal_Int32 l, sal_Int32 radix=10 )
1539 // where l = large constants
1540 // testing the method valueOf( sal_Int32 l, sal_Int32 radix=16 )
1541 // where l = large constants
1542 // testing the method valueOf( sal_Int32 l, sal_Int32 radix=36 )
1543 // where l = large constants
1544 //------------------------------------------------------------------------
1545 sal_Bool SAL_CALL test_rtl_OUString_valueOf_Int32_Bounderies(
1546     hTestResult hRtlTestResult )
1547 {
1548     sal_Bool bRes = sal_False;
1549 
1550     bRes =  c_rtl_tres_state
1551         (
1552             hRtlTestResult,
1553             test_valueOf_Int32((const char**)kBinaryMaxNumsStr,
1554                                kInt32MaxNumsCount, kRadixBinary,
1555                                hRtlTestResult, kInt32MaxNums),
1556             "kRadixBinary",
1557             "valueOf(salInt32, radix 2) Bounderies"
1558             );
1559 
1560     bRes &= c_rtl_tres_state
1561         (
1562             hRtlTestResult,
1563             test_valueOf_Int32((const char**)kOctolMaxNumsStr,
1564                                kInt32MaxNumsCount, kRadixOctol,
1565                                hRtlTestResult, kInt32MaxNums),
1566             "kRadixOctol",
1567             "valueOf(salInt32, radix 8) Bounderies"
1568             );
1569 
1570     bRes &= c_rtl_tres_state
1571         (
1572             hRtlTestResult,
1573             test_valueOf_Int32((const char**)kDecimalMaxNumsStr,
1574                                kInt32MaxNumsCount, kRadixDecimal,
1575                                hRtlTestResult, kInt32MaxNums),
1576             "kRadixDecimal",
1577             "valueOf(salInt32, radix 10) Bounderies"
1578             );
1579 
1580     bRes &= c_rtl_tres_state
1581         (
1582             hRtlTestResult,
1583             test_valueOf_Int32((const char**)kHexDecimalMaxNumsStr,
1584                                kInt32MaxNumsCount, kRadixHexdecimal,
1585                                hRtlTestResult, kInt32MaxNums),
1586             "kRadixHexdecimal",
1587             "valueOf(salInt32, radix 16) Bounderies"
1588             );
1589 
1590     bRes &= c_rtl_tres_state
1591         (
1592             hRtlTestResult,
1593             test_valueOf_Int32((const char**)kBase36MaxNumsStr,
1594                                kInt32MaxNumsCount, kRadixBase36,
1595                                hRtlTestResult, kInt32MaxNums),
1596             "kRadixBase36",
1597             "valueOf(salInt32, radix 36) Bounderies"
1598             );
1599 
1600     return ( bRes );
1601 }
1602 
1603 //------------------------------------------------------------------------
1604 // testing the method valueOf( sal_Int32 i, sal_Int16 radix=2 )
1605 // for negative value
1606 // testing the method valueOf( sal_Int32 i, sal_Int16 radix=8 )
1607 // for negative value
1608 // testing the method valueOf( sal_Int32 i, sal_Int16 radix=10 )
1609 // for negative value
1610 // testing the method valueOf( sal_Int32 i, sal_Int16 radix=16 )
1611 // for negative value
1612 // testing the method valueOf( sal_Int32 i, sal_Int16 radix=36 )
1613 // for negative value
1614 //------------------------------------------------------------------------
1615 sal_Bool SAL_CALL test_rtl_OUString_valueOf_Int32_Negative(
1616     hTestResult hRtlTestResult )
1617 {
1618     sal_Bool bRes = sal_False;
1619     sal_Int32 inArr[kBase36NumsCount];
1620     sal_Int32 i;
1621 
1622     for (i = 0; i < kBase36NumsCount; i++ )
1623         inArr[i] = -i;
1624 
1625     bRes =  c_rtl_tres_state
1626         (
1627             hRtlTestResult,
1628             test_valueOf_Int32( kBinaryNumsStr, kBinaryNumsCount,
1629                                 kRadixBinary, hRtlTestResult, inArr ),
1630             "negative Int32, kRadixBinary",
1631             "valueOf( negative Int32, radix 2 )"
1632             );
1633 
1634     bRes &= c_rtl_tres_state
1635         (
1636             hRtlTestResult,
1637             test_valueOf_Int32( kOctolNumsStr, kOctolNumsCount,
1638                                 kRadixOctol, hRtlTestResult, inArr ),
1639             "negative Int32, kRadixOctol",
1640             "valueOf( negative Int32, radix 8 )"
1641             );
1642 
1643 
1644     bRes &= c_rtl_tres_state
1645         (
1646             hRtlTestResult,
1647             test_valueOf_Int32( kDecimalNumsStr, kDecimalNumsCount,
1648                                 kRadixDecimal, hRtlTestResult, inArr ),
1649             "negative Int32, kRadixDecimal",
1650             "valueOf( negative Int32, radix 10 )"
1651             );
1652 
1653     bRes &= c_rtl_tres_state
1654         (
1655             hRtlTestResult,
1656             test_valueOf_Int32( kHexDecimalNumsStr, kHexDecimalNumsCount,
1657                                 kRadixHexdecimal, hRtlTestResult, inArr ),
1658             "negative Int32, kRadixHexdecimal",
1659             "valueOf( negative Int32, radix 16 )"
1660             );
1661 
1662 
1663     bRes &= c_rtl_tres_state
1664         (
1665             hRtlTestResult,
1666             test_valueOf_Int32( kBase36NumsStr, kBase36NumsCount,
1667                                 kRadixBase36, hRtlTestResult, inArr ),
1668             "negative Int32, kRadixBase36",
1669             "valueOf( negative Int32, radix 36 )"
1670             );
1671 
1672     return ( bRes );
1673 }
1674 //------------------------------------------------------------------------
1675 // testing the method valueOf( sal_Int32 l, sal_Int32 radix ) where radix = -5
1676 //------------------------------------------------------------------------
1677 sal_Bool SAL_CALL test_rtl_OUString_valueOf_Int32_WrongRadix(
1678     hTestResult hRtlTestResult )
1679 {
1680     sal_Bool bRes = sal_False;
1681 
1682     sal_Int32 intVal = 11;
1683 
1684     ::rtl::OUString aStr1;
1685     ::rtl::OUString aStr2("11",2,kEncodingRTLTextUSASCII,
1686                           kConvertFlagsOStringToOUString);
1687 
1688     aStr1 = aStr1.valueOf( intVal, -5 );
1689 
1690     bRes = c_rtl_tres_state
1691         (
1692             hRtlTestResult,
1693             aStr2.compareTo( aStr1 ) == 0,
1694             "if radix not valid then radix must be 10",
1695             "valueOf(sal_Int32, sal_Int32 radix): radix = -5"
1696             );
1697 
1698     return (bRes);
1699 }
1700 
1701 
1702 //------------------------------------------------------------------------
1703 static sal_Bool SAL_CALL test_rtl_OUString_valueOf_Int32_defaultParam(
1704     hTestResult hRtlTestResult )
1705 {
1706     sal_Char     methName[MAXBUFLENGTH];
1707     sal_Char*    pMeth = methName;
1708 
1709     sal_Char*    newUChar1="15";
1710     sal_Char*    newUChar2="0";
1711     sal_Char*    newUChar3="-15";
1712     sal_Char*    newUChar4="2147483647";
1713     sal_Char*    newUChar5="-2147483648";
1714 
1715     typedef struct TestCase
1716     {
1717         sal_Char*       comments;
1718         sal_Int32       input1;
1719         OUString*       expVal;
1720         ~TestCase()     {delete expVal;}
1721     }TestCase;
1722 
1723     TestCase arrTestCase[]=
1724     {
1725         {"input Int32 15 and return OUString 15",15,
1726          new OUString(newUChar1,2,kEncodingRTLTextUSASCII,
1727                       kConvertFlagsOStringToOUString)
1728         },
1729         {"input Int32 0 and return OUString 0",0,
1730          new OUString(newUChar2,1,kEncodingRTLTextUSASCII,
1731                       kConvertFlagsOStringToOUString)
1732         },
1733         {"input Int32 -15 and return OUString -15",-15,
1734          new OUString(newUChar3,3,kEncodingRTLTextUSASCII,
1735                       kConvertFlagsOStringToOUString)
1736         },
1737         {"input Int32 2147483647 and return OUString 2147483647", SAL_MAX_INT32 /* 2147483647 */,
1738          new OUString(newUChar4,10,kEncodingRTLTextUSASCII,
1739                       kConvertFlagsOStringToOUString)
1740         },
1741         {"input Int32 -2147483648 and return OUString -2147483648",
1742          SAL_MIN_INT32 /* 2-2147483648 */,
1743          new OUString(newUChar5,11,kEncodingRTLTextUSASCII,
1744                       kConvertFlagsOStringToOUString)
1745         }
1746     };
1747 
1748     sal_Bool    res=sal_True;
1749     sal_uInt32   i;
1750 
1751     for(i=0;i<(sizeof(arrTestCase))/(sizeof(TestCase));i++)
1752     {
1753         sal_Bool lastRes=(*(arrTestCase[i].expVal)==
1754                           OUString::valueOf(arrTestCase[i].input1));
1755 
1756         c_rtl_tres_state(hRtlTestResult,
1757                          lastRes,
1758                          arrTestCase[i].comments,
1759                          createName( pMeth,
1760                                      "valueOf( sal_Int32 i, sal_Int16 radix = 10 )", i )
1761                          );
1762 
1763         res &= lastRes;
1764     }
1765 
1766     return(res);
1767 
1768 }
1769 //------------------------------------------------------------------------
1770 // testing the method valueOf( sal_Int64 l, sal_Int16 radix=2 )
1771 // testing the method valueOf( sal_Int64 l, sal_Int16 radix=8 )
1772 // testing the method valueOf( sal_Int64 l, sal_Int16 radix=10 )
1773 // testing the method valueOf( sal_Int64 l, sal_Int16 radix=16 )
1774 // testing the method valueOf( sal_Int64 l, sal_Int16 radix=36 )
1775 //------------------------------------------------------------------------
1776 sal_Bool SAL_CALL test_rtl_OUString_valueOf_Int64(
1777     hTestResult hRtlTestResult )
1778 {
1779     sal_Bool bRes = sal_False;
1780 
1781     bRes =  c_rtl_tres_state
1782         (
1783             hRtlTestResult,
1784             test_valueOf_Int64((const char**)kBinaryNumsStr,
1785                                kBinaryNumsCount, kRadixBinary, hRtlTestResult, 0),
1786             "kRadixBinary",
1787             "valueOf(sal_Int64, radix 2)_"
1788             );
1789 
1790     bRes &=  c_rtl_tres_state
1791         (
1792             hRtlTestResult,
1793             test_valueOf_Int64((const char**)kOctolNumsStr,
1794                                kOctolNumsCount, kRadixOctol, hRtlTestResult, 0),
1795             "kRadixOctol",
1796             "valueOf(sal_Int64, radix 8)_"
1797             );
1798 
1799     bRes &=  c_rtl_tres_state
1800         (
1801             hRtlTestResult,
1802             test_valueOf_Int64((const char**)kDecimalNumsStr,
1803                                kDecimalNumsCount, kRadixDecimal, hRtlTestResult, 0),
1804             "kRadixDecimal",
1805             "valueOf(sal_Int64, radix 10)_"
1806             );
1807     bRes &=  c_rtl_tres_state
1808         (
1809             hRtlTestResult,
1810             test_valueOf_Int64((const char**)kHexDecimalNumsStr,
1811                                kHexDecimalNumsCount, kRadixHexdecimal, hRtlTestResult, 0),
1812             "kRadixHexdecimal",
1813             "valueOf(sal_Int64, radix 16)_"
1814             );
1815 
1816     bRes &=  c_rtl_tres_state
1817         (
1818             hRtlTestResult,
1819             test_valueOf_Int64((const char**)kBase36NumsStr,
1820                                kBase36NumsCount, kRadixBase36, hRtlTestResult, 0),
1821             "kRadixBase36",
1822             "valueOf(sal_Int64, radix 36)_"
1823             );
1824 
1825     return (bRes);
1826 }
1827 
1828 //------------------------------------------------------------------------
1829 // testing the method valueOf( sal_Int64 l, sal_Int32 radix=2 )
1830 // where l = large constants
1831 // testing the method valueOf( sal_Int64 l, sal_Int32 radix=8 )
1832 // where l = large constants
1833 // testing the method valueOf( sal_Int64 l, sal_Int32 radix=10 )
1834 // where l = large constants
1835 // testing the method valueOf( sal_Int64 l, sal_Int32 radix=16 )
1836 // where l = large constants
1837 // testing the method valueOf( sal_Int64 l, sal_Int32 radix=36 )
1838 // where l = large constants
1839 //------------------------------------------------------------------------
1840 sal_Bool SAL_CALL test_rtl_OUString_valueOf_Int64_Bounderies(
1841     hTestResult hRtlTestResult )
1842 {
1843     sal_Bool bRes = sal_False;
1844 
1845     bRes =  c_rtl_tres_state
1846         (
1847             hRtlTestResult,
1848             test_valueOf_Int64((const char**)kBinaryMaxNumsStr,
1849                                kInt64MaxNumsCount, kRadixBinary,
1850                                hRtlTestResult, kInt64MaxNums),
1851             "kRadixBinary",
1852             "valueOf(salInt64, radix 2) Bounderies"
1853             );
1854 
1855     bRes &= c_rtl_tres_state
1856         (
1857             hRtlTestResult,
1858             test_valueOf_Int64((const char**)kOctolMaxNumsStr,
1859                                kInt64MaxNumsCount, kRadixOctol,
1860                                hRtlTestResult, kInt64MaxNums),
1861             "kRadixOctol",
1862             "valueOf(salInt64, radix 8) Bounderies"
1863             );
1864 
1865     bRes &= c_rtl_tres_state
1866         (
1867             hRtlTestResult,
1868             test_valueOf_Int64((const char**)kDecimalMaxNumsStr,
1869                                kInt64MaxNumsCount, kRadixDecimal,
1870                                hRtlTestResult, kInt64MaxNums),
1871             "kRadixDecimal",
1872             "valueOf(salInt64, radix 10) Bounderies"
1873             );
1874 
1875     bRes &= c_rtl_tres_state
1876         (
1877             hRtlTestResult,
1878             test_valueOf_Int64((const char**)kHexDecimalMaxNumsStr,
1879                                kInt64MaxNumsCount, kRadixHexdecimal,
1880                                hRtlTestResult, kInt64MaxNums),
1881             "kRadixHexdecimal",
1882             "valueOf(salInt64, radix 16) Bounderies"
1883             );
1884 
1885     bRes &= c_rtl_tres_state
1886         (
1887             hRtlTestResult,
1888             test_valueOf_Int64((const char**)kBase36MaxNumsStr,
1889                                kInt64MaxNumsCount, kRadixBase36,
1890                                hRtlTestResult, kInt64MaxNums),
1891             "kRadixBase36",
1892             "valueOf(salInt64, radix 36) Bounderies"
1893             );
1894 
1895     return ( bRes );
1896 }
1897 
1898 //------------------------------------------------------------------------
1899 // testing the method valueOf( sal_Int64 l, sal_Int16 radix=2 )
1900 // for negative value
1901 // testing the method valueOf( sal_Int64 l, sal_Int16 radix=8 )
1902 // for negative value
1903 // testing the method valueOf( sal_Int64 l, sal_Int16 radix=10 )
1904 // for negative value
1905 // testing the method valueOf( sal_Int64 l, sal_Int16 radix=16 )
1906 // for negative value
1907 // testing the method valueOf( sal_Int64 l, sal_Int16 radix=36 )
1908 // for negative value
1909 //------------------------------------------------------------------------
1910 sal_Bool SAL_CALL test_rtl_OUString_valueOf_Int64_Negative(
1911     hTestResult hRtlTestResult )
1912 {
1913     sal_Bool bRes = sal_False;
1914 
1915     sal_Int64 inArr[36];
1916 	sal_Int32 i;
1917 
1918     for (i = 0; i < 36; i++) {
1919         inArr[i] = -i;
1920     }
1921 
1922 
1923     bRes = c_rtl_tres_state
1924         (
1925             hRtlTestResult,
1926             test_valueOf_Int64( kBinaryNumsStr, kBinaryNumsCount,
1927                                 kRadixBinary, hRtlTestResult, inArr ),
1928             "negative Int64, kRadixBinary",
1929             "valueOf( negative Int64, radix 2 )"
1930             );
1931 
1932     bRes &= c_rtl_tres_state
1933         (
1934             hRtlTestResult,
1935             test_valueOf_Int64( kOctolNumsStr, kOctolNumsCount,
1936                                 kRadixOctol, hRtlTestResult, inArr ),
1937             "negative Int64, kRadixOctol",
1938             "valueOf( negative Int64, radix 8 )"
1939             );
1940 
1941     bRes &= c_rtl_tres_state
1942         (
1943             hRtlTestResult,
1944             test_valueOf_Int64( kDecimalNumsStr, kDecimalNumsCount,
1945                                 kRadixDecimal, hRtlTestResult, inArr ),
1946             "negative Int64, kRadixDecimal",
1947             "valueOf( negative Int64, radix 10 )"
1948             );
1949 
1950     bRes &= c_rtl_tres_state
1951         (
1952             hRtlTestResult,
1953             test_valueOf_Int64( kHexDecimalNumsStr, kHexDecimalNumsCount,
1954                                 kRadixHexdecimal, hRtlTestResult, inArr ),
1955             "negative Int64, kRadixHexDecimal",
1956             "valueOf( negative Int64, radix 16 )"
1957             );
1958 
1959     bRes &= c_rtl_tres_state
1960         (
1961             hRtlTestResult,
1962             test_valueOf_Int64( kBase36NumsStr, kBase36NumsCount,
1963                                 kRadixBase36, hRtlTestResult, inArr),
1964             "negative Int64, kRadixBase36",
1965             "valueOf( negative Int64, radix 36 )"
1966             );
1967 
1968     return (bRes);
1969 }
1970 //------------------------------------------------------------------------
1971 // testing the method valueOf( sal_Int64 l, sal_Int32 radix )
1972 // where radix = -5
1973 //------------------------------------------------------------------------
1974 sal_Bool SAL_CALL test_rtl_OUString_valueOf_Int64_WrongRadix(
1975     hTestResult hRtlTestResult )
1976 {
1977     sal_Bool bRes = sal_False;
1978 
1979     sal_Int64 intVal = 11;
1980 
1981     ::rtl::OUString aStr1;
1982     ::rtl::OUString aStr2("11",2,kEncodingRTLTextUSASCII,
1983                           kConvertFlagsOStringToOUString);
1984 
1985     aStr1 = aStr1.valueOf( intVal, -5 );
1986 
1987     bRes = c_rtl_tres_state
1988         (
1989             hRtlTestResult,
1990             aStr2.compareTo(aStr1) == 0,
1991             "if radix not valid then radix must be 10",
1992             "valueOf(sal_Int64, sal_Int32 radix): radix = -5"
1993             );
1994 
1995     return (bRes);
1996 }
1997 
1998 //------------------------------------------------------------------------
1999 static sal_Bool SAL_CALL test_rtl_OUString_valueOf_Int64_defaultParam(
2000     hTestResult hRtlTestResult )
2001 {
2002     sal_Char     methName[MAXBUFLENGTH];
2003     sal_Char*    pMeth = methName;
2004 
2005     sal_Char*    newUChar1="15";
2006     sal_Char*    newUChar2="0";
2007     sal_Char*    newUChar3="-15";
2008     sal_Char*    newUChar4= "9223372036854775807";
2009     sal_Char*    newUChar5="-9223372036854775808";
2010 
2011     typedef struct TestCase
2012     {
2013         sal_Char*       comments;
2014         sal_Int64       input1;
2015         OUString*       expVal;
2016         ~TestCase()     {delete expVal;}
2017     }TestCase;
2018 
2019     TestCase arrTestCase[]=
2020     {
2021         {"input Int64 15 and return OUString 15",15,
2022          new OUString(newUChar1,2,kEncodingRTLTextUSASCII,
2023                       kConvertFlagsOStringToOUString)
2024         },
2025         {"input Int64 0 and return OUString 0",0,
2026          new OUString(newUChar2,1,kEncodingRTLTextUSASCII,
2027                       kConvertFlagsOStringToOUString)
2028         },
2029         {"input Int64 -15 and return OUString -15",-15,
2030          new OUString(newUChar3,3,kEncodingRTLTextUSASCII,
2031                       kConvertFlagsOStringToOUString)
2032         },
2033         {"input Int64 9223372036854775807 and return 9223372036854775807",
2034          SAL_MAX_INT64 /* 9223372036854775807*/,
2035          new OUString(newUChar4,19,kEncodingRTLTextUSASCII,
2036                       kConvertFlagsOStringToOUString)
2037         },
2038         {"input Int64 -9223372036854775808 and return -9223372036854775808",
2039          SAL_MIN_INT64 /* 9223372036854775808*/,
2040          new OUString(newUChar5,20,kEncodingRTLTextUSASCII,
2041                       kConvertFlagsOStringToOUString)
2042         }
2043     };
2044 
2045     sal_Bool    res=sal_True;
2046     sal_uInt32   i;
2047 
2048     for(i=0;i<(sizeof(arrTestCase))/(sizeof(TestCase));i++)
2049     {
2050         sal_Bool lastRes=(*(arrTestCase[i].expVal)==
2051                           OUString::valueOf(arrTestCase[i].input1));
2052 
2053         c_rtl_tres_state(hRtlTestResult,
2054                          lastRes,
2055                          arrTestCase[i].comments,
2056                          createName( pMeth,
2057                                      "valueOf( sal_Int64 i, sal_Int16 radix = 10 )", i )
2058                          );
2059 
2060         res &= lastRes;
2061     }
2062 
2063     return(res);
2064 
2065 }
2066 //------------------------------------------------------------------------
2067 // testing the method valueOf( float f )
2068 //------------------------------------------------------------------------
2069 // LLA: sal_Bool SAL_CALL test_rtl_OUString_valueOf_float(
2070 // LLA:     hTestResult hRtlTestResult )
2071 // LLA: {
2072 // LLA:     sal_Char methName[MAXBUFLENGTH];
2073 // LLA:     sal_Char* pMeth =methName;
2074 // LLA:
2075 // LLA:     typedef struct TestCase
2076 // LLA: 	{
2077 // LLA:         sal_Char*                    comments;
2078 // LLA:         float                         input1;
2079 // LLA:         OUString*                     expVal;
2080 // LLA:
2081 // LLA:         ~TestCase() {delete expVal;}
2082 // LLA: 	} TestCase;
2083 // LLA:
2084 // LLA: 	TestCase arrTestCase[] =
2085 // LLA:     {
2086 // LLA:         { "3.0", 3.0, new OUString("3.0",3,kEncodingRTLTextUSASCII,
2087 // LLA:                                    kConvertFlagsOStringToOUString) },
2088 // LLA:         { "3.5", 3.5f, new OUString("3.5",3,kEncodingRTLTextUSASCII,
2089 // LLA:                                     kConvertFlagsOStringToOUString)},
2090 // LLA:         { "3.0625", 3.0625f, new OUString("3.0625",6,kEncodingRTLTextUSASCII,
2091 // LLA:                                           kConvertFlagsOStringToOUString)},
2092 // LLA:         { "3.502525", 3.502525f, new OUString("3.502525",8,
2093 // LLA:                                               kEncodingRTLTextUSASCII,kConvertFlagsOStringToOUString) },
2094 // LLA:         { "3.141592", 3.141592f, new OUString("3.141592",8,
2095 // LLA:                                               kEncodingRTLTextUSASCII,kConvertFlagsOStringToOUString) },
2096 // LLA:         { "3.5025255", 3.5025255f, new OUString("3.5025255",9,
2097 // LLA:                                                 kEncodingRTLTextUSASCII,kConvertFlagsOStringToOUString) },
2098 // LLA:         { "3.0039062", 3.00390625f, new OUString("3.0039062",9,
2099 // LLA:                                                  kEncodingRTLTextUSASCII,kConvertFlagsOStringToOUString) }
2100 // LLA:     };
2101 // LLA:
2102 // LLA:     sal_Bool res = sal_True;
2103 // LLA:     sal_Int32 i;
2104 // LLA:
2105 // LLA:     for(i = 0; i < (sizeof (arrTestCase))/(sizeof (TestCase)); i++)
2106 // LLA:     {
2107 // LLA:         ::rtl::OUString aStr1;
2108 // LLA:         aStr1 = aStr1.valueOf( arrTestCase[i].input1 );
2109 // LLA:         sal_Bool lastRes = (arrTestCase[i].expVal->compareTo(aStr1) == 0);
2110 // LLA:
2111 // LLA:         c_rtl_tres_state
2112 // LLA:             (
2113 // LLA:                 hRtlTestResult,
2114 // LLA:                 lastRes,
2115 // LLA:                 arrTestCase[i].comments,
2116 // LLA:                 createName( pMeth, "valueof_float", i)
2117 // LLA:                 );
2118 // LLA:
2119 // LLA:         res &= lastRes;
2120 // LLA:
2121 // LLA:     }
2122 // LLA:
2123 // LLA:     return ( res );
2124 // LLA: }
2125 
2126 //------------------------------------------------------------------------
2127 // testing the method valueOf( float f ) for negative value
2128 //------------------------------------------------------------------------
2129 // LLA: sal_Bool SAL_CALL test_rtl_OUString_valueOf_Float_Negative(
2130 // LLA:     hTestResult hRtlTestResult )
2131 // LLA: {
2132 // LLA:     sal_Char methName[MAXBUFLENGTH];
2133 // LLA:     sal_Char* pMeth =methName;
2134 // LLA:
2135 // LLA:     typedef struct TestCase
2136 // LLA: 	{
2137 // LLA:         sal_Char*                    comments;
2138 // LLA:         float                         input1;
2139 // LLA:         OUString*                     expVal;
2140 // LLA:
2141 // LLA:         ~TestCase() {delete expVal;}
2142 // LLA: 	} TestCase;
2143 // LLA:
2144 // LLA: 	TestCase arrTestCase[] =
2145 // LLA:     {
2146 // LLA:         { "-3.0", -3.0, new OUString("-3.0",4,kEncodingRTLTextUSASCII,
2147 // LLA:                                      kConvertFlagsOStringToOUString) },
2148 // LLA:         { "-3.5", -3.5f, new OUString("-3.5",4,kEncodingRTLTextUSASCII,
2149 // LLA:                                       kConvertFlagsOStringToOUString)},
2150 // LLA:         { "-3.0625", -3.0625f, new OUString("-3.0625",7,
2151 // LLA:                                             kEncodingRTLTextUSASCII,kConvertFlagsOStringToOUString)},
2152 // LLA:         { "-3.502525", -3.502525f, new OUString("-3.502525",9,
2153 // LLA:                                                 kEncodingRTLTextUSASCII,kConvertFlagsOStringToOUString) },
2154 // LLA:         { "-3.141592", -3.141592f, new OUString("-3.141592",9,
2155 // LLA:                                                 kEncodingRTLTextUSASCII,kConvertFlagsOStringToOUString) },
2156 // LLA:         { "-3.5025255", -3.5025255f, new OUString("-3.5025255",10,
2157 // LLA:                                                   kEncodingRTLTextUSASCII,kConvertFlagsOStringToOUString) },
2158 // LLA:         { "-3.0039062", -3.00390625f, new OUString("-3.0039062",10,
2159 // LLA:                                                    kEncodingRTLTextUSASCII,kConvertFlagsOStringToOUString) }
2160 // LLA:     };
2161 // LLA:
2162 // LLA:     sal_Bool res = sal_True;
2163 // LLA:     sal_Int32 i;
2164 // LLA:
2165 // LLA:     for(i = 0; i < (sizeof (arrTestCase))/(sizeof (TestCase)); i++)
2166 // LLA:     {
2167 // LLA:         ::rtl::OUString aStr1;
2168 // LLA:         aStr1 = aStr1.valueOf( arrTestCase[i].input1 );
2169 // LLA:         sal_Bool lastRes = (arrTestCase[i].expVal->compareTo(aStr1) == 0);
2170 // LLA:
2171 // LLA:         c_rtl_tres_state
2172 // LLA:             (
2173 // LLA:                 hRtlTestResult,
2174 // LLA:                 lastRes,
2175 // LLA:                 arrTestCase[i].comments,
2176 // LLA:                 createName( pMeth, "valueof_negative float", i)
2177 // LLA:                 );
2178 // LLA:
2179 // LLA:         res &= lastRes;
2180 // LLA:
2181 // LLA:     }
2182 // LLA:
2183 // LLA:     return ( res );
2184 // LLA: }
2185 
2186 //------------------------------------------------------------------------
2187 // testing the method valueOf( double f )
2188 //------------------------------------------------------------------------
2189 // LLA: sal_Bool SAL_CALL test_rtl_OUString_valueOf_double(
2190 // LLA:     hTestResult hRtlTestResult )
2191 // LLA: {
2192 // LLA:     sal_Char methName[MAXBUFLENGTH];
2193 // LLA:     sal_Char* pMeth =methName;
2194 // LLA:
2195 // LLA:     typedef struct TestCase
2196 // LLA:     {
2197 // LLA:         sal_Char*       comments;
2198 // LLA:         double          input1;
2199 // LLA:         OUString*       expVal;
2200 // LLA:
2201 // LLA:         ~TestCase() {delete expVal;}
2202 // LLA:     } TestCase;
2203 // LLA:
2204 // LLA: 	TestCase arrTestCase[] =
2205 // LLA:     {
2206 // LLA:         {"3.0", 3.0, new OUString("3.0",3,kEncodingRTLTextUSASCII,
2207 // LLA:                                   kConvertFlagsOStringToOUString)},
2208 // LLA:         {"3.5", 3.5, new OUString("3.5",3,kEncodingRTLTextUSASCII,
2209 // LLA:                                   kConvertFlagsOStringToOUString)},
2210 // LLA:         {"3.0625", 3.0625, new OUString("3.0625",6,kEncodingRTLTextUSASCII,
2211 // LLA:                                         kConvertFlagsOStringToOUString)},
2212 // LLA:         {"3.1415926535", 3.1415926535, new OUString("3.1415926535",12,
2213 // LLA:                                                     kEncodingRTLTextUSASCII,kConvertFlagsOStringToOUString)},
2214 // LLA:         {"3.1415926535897931", 3.141592653589793,
2215 // LLA:          new OUString("3.1415926535897931",18,kEncodingRTLTextUSASCII,
2216 // LLA:                       kConvertFlagsOStringToOUString)},
2217 // LLA:         {"3.1415926535897931", 3.1415926535897932,
2218 // LLA:          new OUString("3.1415926535897931",18,kEncodingRTLTextUSASCII,
2219 // LLA:                       kConvertFlagsOStringToOUString)},
2220 // LLA:         {"3.1415926535897931", 3.14159265358979323,
2221 // LLA:          new OUString("3.1415926535897931",18,kEncodingRTLTextUSASCII,
2222 // LLA:                       kConvertFlagsOStringToOUString)},
2223 // LLA:         {"3.1415926535897931", 3.141592653589793238462643,
2224 // LLA:          new OUString("3.1415926535897931",18,kEncodingRTLTextUSASCII,
2225 // LLA:                       kConvertFlagsOStringToOUString)}
2226 // LLA:     };
2227 // LLA:
2228 // LLA:     sal_Bool res = sal_True;
2229 // LLA:     sal_Int32 i;
2230 // LLA:
2231 // LLA:     for(i = 0; i < (sizeof (arrTestCase))/(sizeof (TestCase)); i++)
2232 // LLA:     {
2233 // LLA:         ::rtl::OUString aStr1;
2234 // LLA:         aStr1 = aStr1.valueOf( arrTestCase[i].input1 );
2235 // LLA:         sal_Bool lastRes = (arrTestCase[i].expVal->compareTo(aStr1) == 0);
2236 // LLA:
2237 // LLA:         c_rtl_tres_state
2238 // LLA:             (
2239 // LLA:                 hRtlTestResult,
2240 // LLA:                 lastRes,
2241 // LLA:                 arrTestCase[i].comments,
2242 // LLA:                 createName( pMeth, "valueof_double", i)
2243 // LLA:                 );
2244 // LLA:
2245 // LLA:         res &= lastRes;
2246 // LLA:
2247 // LLA:     }
2248 // LLA:
2249 // LLA:     return ( res );
2250 // LLA: }
2251 
2252 
2253 //------------------------------------------------------------------------
2254 // testing the method valueOf( double f ) for negative value
2255 //------------------------------------------------------------------------
2256 // LLA: sal_Bool SAL_CALL test_rtl_OUString_valueOf_Double_Negative(
2257 // LLA:     hTestResult hRtlTestResult )
2258 // LLA: {
2259 // LLA:     sal_Char methName[MAXBUFLENGTH];
2260 // LLA:     sal_Char* pMeth =methName;
2261 // LLA:
2262 // LLA:     typedef struct TestCase
2263 // LLA: 	{
2264 // LLA:         sal_Char*        comments;
2265 // LLA:         double           input1;
2266 // LLA:         OUString*        expVal;
2267 // LLA:
2268 // LLA:         ~TestCase() {delete expVal;}
2269 // LLA: 	} TestCase;
2270 // LLA:
2271 // LLA: 	TestCase arrTestCase[] =
2272 // LLA:     {
2273 // LLA:         {"-3.0", -3.0, new OUString("-3.0",4,kEncodingRTLTextUSASCII,
2274 // LLA:                                     kConvertFlagsOStringToOUString)},
2275 // LLA:         {"-3.5", -3.5, new OUString("-3.5",4,kEncodingRTLTextUSASCII,
2276 // LLA:                                     kConvertFlagsOStringToOUString)},
2277 // LLA:         {"-3.0625", -3.0625, new OUString("-3.0625",7,kEncodingRTLTextUSASCII,
2278 // LLA:                                           kConvertFlagsOStringToOUString)},
2279 // LLA:         {"-3.1415926535", -3.1415926535,
2280 // LLA:          new OUString("-3.1415926535",13,kEncodingRTLTextUSASCII,
2281 // LLA:                       kConvertFlagsOStringToOUString)},
2282 // LLA:         {"-3.1415926535897931", -3.141592653589793,
2283 // LLA:          new OUString("-3.1415926535897931",19,kEncodingRTLTextUSASCII,
2284 // LLA:                       kConvertFlagsOStringToOUString)},
2285 // LLA:         {"-3.1415926535897931", -3.1415926535897932,
2286 // LLA:          new OUString("-3.1415926535897931",19,kEncodingRTLTextUSASCII,
2287 // LLA:                       kConvertFlagsOStringToOUString)},
2288 // LLA:         {"-3.1415926535897931", -3.14159265358979323,
2289 // LLA:          new OUString("-3.1415926535897931",19,kEncodingRTLTextUSASCII,
2290 // LLA:                       kConvertFlagsOStringToOUString)},
2291 // LLA:         {"-3.1415926535897931", -3.141592653589793238462643,
2292 // LLA:          new OUString("-3.1415926535897931",19,kEncodingRTLTextUSASCII,
2293 // LLA:                       kConvertFlagsOStringToOUString)}
2294 // LLA:     };
2295 // LLA:
2296 // LLA:     sal_Bool res = sal_True;
2297 // LLA:     sal_Int32 i;
2298 // LLA:
2299 // LLA:     for(i = 0; i < (sizeof (arrTestCase))/(sizeof (TestCase)); i++)
2300 // LLA:     {
2301 // LLA:         ::rtl::OUString aStr1;
2302 // LLA:         aStr1 = aStr1.valueOf( arrTestCase[i].input1 );
2303 // LLA:         sal_Bool lastRes = (arrTestCase[i].expVal->compareTo(aStr1) == 0);
2304 // LLA:
2305 // LLA:         c_rtl_tres_state
2306 // LLA:             (
2307 // LLA:                 hRtlTestResult,
2308 // LLA:                 lastRes,
2309 // LLA:                 arrTestCase[i].comments,
2310 // LLA:                 createName( pMeth, "valueof_nagative double", i)
2311 // LLA:                 );
2312 // LLA:
2313 // LLA:         res &= lastRes;
2314 // LLA:
2315 // LLA:     }
2316 // LLA:
2317 // LLA:     return ( res );
2318 // LLA: }
2319 
2320 //------------------------------------------------------------------------
2321 // testing the method valueOf()
2322 //------------------------------------------------------------------------
2323 extern "C" void /* sal_Bool */ SAL_CALL test_rtl_OUString_valueOf(
2324     hTestResult hRtlTestResult )
2325 {
2326     c_rtl_tres_state_start( hRtlTestResult, "valueOf");
2327     sal_Bool bTState = test_rtl_OUString_valueOf_Int32( hRtlTestResult );
2328     bTState &= test_rtl_OUString_valueOf_Int32_Bounderies( hRtlTestResult );
2329     bTState &= test_rtl_OUString_valueOf_Int32_Negative( hRtlTestResult );
2330     bTState &= test_rtl_OUString_valueOf_Int32_WrongRadix( hRtlTestResult );
2331     bTState &= test_rtl_OUString_valueOf_Int32_defaultParam(
2332         hRtlTestResult );
2333     bTState &= test_rtl_OUString_valueOf_Int64( hRtlTestResult );
2334     bTState &= test_rtl_OUString_valueOf_Int64_Bounderies( hRtlTestResult );
2335     bTState &= test_rtl_OUString_valueOf_Int64_Negative( hRtlTestResult );
2336     bTState &= test_rtl_OUString_valueOf_Int64_WrongRadix( hRtlTestResult );
2337     bTState &= test_rtl_OUString_valueOf_Int64_defaultParam(
2338         hRtlTestResult );
2339     // LLA: bTState &= test_rtl_OUString_valueOf_float( hRtlTestResult );
2340     // LLA: bTState &= test_rtl_OUString_valueOf_Float_Negative( hRtlTestResult );
2341 
2342     // LLA: bTState &= test_rtl_OUString_valueOf_double( hRtlTestResult );
2343     // LLA: bTState &= test_rtl_OUString_valueOf_Double_Negative( hRtlTestResult );
2344     c_rtl_tres_state_end( hRtlTestResult, "valueOf");
2345 //    return ( bTState );
2346 }
2347 //------------------------------------------------------------------------
2348 //    this is my testing code
2349 //    testing the method createFromAscii( const sal_Char * value )
2350 //------------------------------------------------------------------------
2351 
2352 extern "C" void /* sal_Bool */ SAL_CALL test_rtl_OUString_createFromAscii(
2353     hTestResult hRtlTestResult )
2354 {
2355     c_rtl_tres_state_start( hRtlTestResult, "createFromAscii");
2356     sal_Char     methName[MAXBUFLENGTH];
2357     sal_Char*    pMeth = methName;
2358 
2359 
2360     typedef struct TestCase
2361     {
2362         sal_Char*       comments;
2363         const sal_Char*  input1;
2364         OUString*       expVal;
2365         ~TestCase()     {delete expVal;}
2366 
2367     }TestCase;
2368 
2369     TestCase arrTestCase[]=
2370     {
2371 
2372         {   "create OUString from sal_Char" ,kTestStr1,
2373             new OUString(kTestStr1,kTestStr1Len,kEncodingRTLTextUSASCII,
2374                          kConvertFlagsOStringToOUString)
2375         },
2376         {
2377             "create OUString from empty", "",
2378             new OUString()
2379         },
2380         {
2381             "create OUString from empty(string arg = '\\0')","",
2382             new OUString("",0,kEncodingRTLTextUSASCII,
2383                          kConvertFlagsOStringToOUString)
2384         }
2385 
2386     };
2387 
2388     sal_Bool    res;
2389     sal_uInt32   i;
2390 
2391     for(i=0;i<(sizeof(arrTestCase))/(sizeof(TestCase));i++)
2392     {
2393         sal_Bool lastRes=(*(arrTestCase[i].expVal)==
2394                           OUString::createFromAscii(arrTestCase[i].input1));
2395 
2396 
2397     {
2398         c_rtl_tres_state(hRtlTestResult,
2399                          lastRes,
2400                          arrTestCase[i].comments,
2401                          createName( pMeth, "createFromAscii", i )
2402                          );
2403     }
2404 
2405     res&=lastRes;
2406 
2407     }
2408 
2409     c_rtl_tres_state_end( hRtlTestResult, "createFromAscii");
2410 //    return(res);
2411 }
2412 //------------------------------------------------------------------------
2413 // testing the method index(  )
2414 //------------------------------------------------------------------------
2415 template <class T>
2416 sal_Bool test_index( const T* input1, int num,const sal_Int32* input2,
2417                      const sal_Int32* expVal,int base,rtlTestResult hRtlTestResult)
2418 {
2419 	sal_Bool    res=sal_True;
2420 	sal_Char    methName[MAXBUFLENGTH];
2421 	sal_Char    *meth = '\0';
2422 	sal_Char*   pMeth=methName;
2423 	sal_Int32   i;
2424     sal_Bool    lastRes=sal_False;
2425 
2426 	for(i=0;i<num;i++)
2427 	{
2428 		OUString str(aUStr2);
2429 
2430         if(base==0)
2431 		{
2432             lastRes=(str.indexOf(input1[i])==expVal[i]);
2433             meth="indexOf_001";
2434         }
2435 		if(base==1)
2436 		{
2437             lastRes=(str.indexOf(input1[i],input2[i])==expVal[i]);
2438             meth="indexOf_002";
2439         }
2440 // LLA: 		if(base==2)
2441 // LLA: 		{
2442 // LLA:             lastRes=(str.lastIndexOf(input1[i])==expVal[i]);
2443 // LLA:             meth="lastIndexOf_001(sal_Unicode)";
2444 // LLA:         }
2445 // LLA: 		if(base==3)
2446 // LLA: 		{
2447 // LLA: /*
2448 // LLA:             OUString s4(&input1[i]);
2449 // LLA:             rtl::OString sStr;
2450 // LLA:             sStr <<= str;
2451 // LLA:             t_print("str = %s\n", sStr.getStr());
2452 // LLA:             rtl::OString sInput1;
2453 // LLA:             sInput1 <<= s4; // rtl::OUString((sal_Unicode*)input1[i]);
2454 // LLA:             t_print("%d = lastIndexOf(\"%s\", %d) =? %d\n", str.lastIndexOf(input1[i], input2[i]), sInput1.getStr(), input2[i], expVal[i]);
2455 // LLA: */
2456 // LLA:             lastRes=(str.lastIndexOf(input1[i],input2[i])==expVal[i]);
2457 // LLA:             meth="lastIndexOf_002(sal_Unicode , sal_Int32 )";
2458 // LLA:         }
2459 
2460         c_rtl_tres_state
2461         	(
2462                 hRtlTestResult,
2463                 lastRes,
2464            		"index",
2465                 createName( pMeth,meth, i )
2466                 );
2467 
2468         res &= lastRes;
2469     }
2470 
2471     return( res );
2472 }
2473 template <class T>
2474 sal_Bool test_indexStr( const T** input1, int num,const sal_Int32* input2,
2475                         const sal_Int32* expVal,int base,rtlTestResult hRtlTestResult)
2476 {
2477 	sal_Bool    res=sal_True;
2478 	sal_Char    methName[MAXBUFLENGTH];
2479 	sal_Char    *meth = '\0';
2480 	sal_Char*   pMeth=methName;
2481 	sal_Int32   i;
2482     sal_Bool    lastRes=sal_False;
2483 
2484 	for(i=0;i<num;i++)
2485 	{
2486 		OUString str(aUStr2);
2487 
2488 
2489 		if(base==0)
2490 		{
2491             OUString s1(input1[i]);
2492             lastRes=(str.indexOf(s1)==expVal[i]);
2493             meth="indexOf_003";
2494         }
2495 		if(base==1)
2496 		{
2497             OUString s2(input1[i]);
2498             lastRes=(str.indexOf(s2,input2[i])==expVal[i]);
2499             meth="indexOf_004";
2500         }
2501 // LLA: 		if(base==2)
2502 // LLA: 		{
2503 // LLA:             OUString s3(input1[i]);
2504 // LLA:             lastRes=(str.lastIndexOf(s3)==expVal[i]);
2505 // LLA:             meth="lastIndexOf_003(const OUString)";
2506 // LLA:         }
2507 // LLA: 		if(base==3)
2508 // LLA: 		{
2509 // LLA:             OUString s4(input1[i]);
2510 // LLA:
2511 // LLA:             rtl::OString sStr;
2512 // LLA:             sStr <<= str;
2513 // LLA:             t_print("str = \"%s\"\n", sStr.getStr());
2514 // LLA:             rtl::OString sInput1;
2515 // LLA:             sInput1 <<= s4; // rtl::OUString((sal_Unicode*)input1[i]);
2516 // LLA:             t_print("%d = lastIndexOf(\"%s\", %d) =? %d\n", str.lastIndexOf(input1[i], input2[i]), sInput1.getStr(), input2[i], expVal[i]);
2517 // LLA:
2518 // LLA:             lastRes=(str.lastIndexOf(s4,input2[i])==expVal[i]);
2519 // LLA:             meth="lastIndexOf_004(const OUString,sal_Int32)";
2520 // LLA:         }
2521 
2522         c_rtl_tres_state
2523         	(
2524                 hRtlTestResult,
2525                 lastRes,
2526            		"index",
2527                 createName( pMeth,meth, i )
2528                 );
2529 
2530         res &= lastRes;
2531     }
2532 
2533     return( res );
2534 }
2535 //------------------------------------------------------------------------
2536 // testing the method indexOf(  )
2537 //------------------------------------------------------------------------
2538 sal_Bool SAL_CALL test_rtl_OUString_indexOf_001(
2539     hTestResult hRtlTestResult )
2540 {
2541 	sal_Bool bRes=sal_False;
2542 
2543 	bRes=c_rtl_tres_state
2544         (
2545 	      	hRtlTestResult,
2546 	      	test_index<sal_Unicode>((const sal_Unicode*)input1Default,
2547                                     nDefaultCount,input2Default,
2548                                     expValDefault,0,hRtlTestResult),
2549 	      	"index",
2550 	      	"indexDefault(sal_Unicode ch, sal_Int32 fromIndex = 0)"
2551 	      	);
2552 
2553     return ( bRes );
2554 }
2555 //------------------------------------------------------------------------
2556 // testing the method indexOf(  )
2557 //------------------------------------------------------------------------
2558 sal_Bool SAL_CALL test_rtl_OUString_indexOf_002(
2559     hTestResult hRtlTestResult )
2560 {
2561 	sal_Bool bRes=sal_False;
2562 
2563 	bRes=c_rtl_tres_state
2564         (
2565 	      	hRtlTestResult,
2566 	      	test_index<sal_Unicode>((const sal_Unicode*)input1Normal,
2567                                     nNormalCount,input2Normal,
2568                                     expValNormal,1,hRtlTestResult),
2569 	      	"index",
2570 	      	"indexNormal(sal_Unicode ch, sal_Int32 fromIndex)"
2571 	      	);
2572 
2573     return ( bRes );
2574 }
2575 //------------------------------------------------------------------------
2576 // testing the method indexOf(  OUString ch, sal_Int32 fromIndex = 0 )
2577 //------------------------------------------------------------------------
2578 sal_Bool SAL_CALL test_rtl_OUString_indexOf_003(
2579     hTestResult hRtlTestResult )
2580 {
2581 	sal_Bool bRes=sal_False;
2582 
2583 	bRes=c_rtl_tres_state
2584         (
2585 	      	hRtlTestResult,
2586 	      	test_indexStr<sal_Unicode>((const sal_Unicode**)input1StrDefault,
2587                                        nStrDefaultCount,input2StrDefault,
2588                                        expValStrDefault,0,hRtlTestResult),
2589 	      	"index",
2590 	      	"indexDefault(OUString ch, sal_Int32 fromIndex = 0)"
2591 	      	);
2592 
2593     return ( bRes );
2594 }
2595 //------------------------------------------------------------------------
2596 // testing the method indexOf(  OUString ch, sal_Int32 fromIndex )
2597 //------------------------------------------------------------------------
2598 sal_Bool SAL_CALL test_rtl_OUString_indexOf_004(
2599     hTestResult hRtlTestResult )
2600 {
2601 	sal_Bool bRes=sal_False;
2602 
2603 	bRes=c_rtl_tres_state
2604         (
2605 	      	hRtlTestResult,
2606 	      	test_indexStr<sal_Unicode>((const sal_Unicode**)input1StrNormal,
2607                                        nStrNormalCount,input2StrNormal,
2608                                        expValStrNormal,1,hRtlTestResult),
2609 	      	"indexOf",
2610 	      	"indexOf(OUString ch, sal_Int32 fromIndex)"
2611 	      	);
2612 
2613     return ( bRes );
2614 }
2615 // LLA: //------------------------------------------------------------------------
2616 // LLA: // testing the method lastIndexOf( sal_Unicode ch )
2617 // LLA: //------------------------------------------------------------------------
2618 // LLA: sal_Bool SAL_CALL test_rtl_OUString_lastIndexOf_001(
2619 // LLA:     hTestResult hRtlTestResult )
2620 // LLA: {
2621 // LLA: 	sal_Bool bRes=sal_False;
2622 // LLA:
2623 // LLA: 	bRes=c_rtl_tres_state
2624 // LLA:         (
2625 // LLA: 	      	hRtlTestResult,
2626 // LLA: 	      	test_index<sal_Unicode>((const sal_Unicode*)input1lastDefault,
2627 // LLA:                                     nlastDefaultCount,input2lastDefault,
2628 // LLA:                                     expVallastDefault,2,hRtlTestResult),
2629 // LLA: 	      	"lastIndex",
2630 // LLA: 	      	"lastIndexDefault(sal_Unicode ch)"
2631 // LLA: 	      	);
2632 // LLA:
2633 // LLA:     return ( bRes );
2634 // LLA: }
2635 // LLA: //------------------------------------------------------------------------
2636 // LLA: // testing the method lastIndexOf(  sal_Unicode ch, sal_Int32 fromIndex )
2637 // LLA: //------------------------------------------------------------------------
2638 // LLA: sal_Bool SAL_CALL test_rtl_OUString_lastIndexOf_002(
2639 // LLA:     hTestResult hRtlTestResult )
2640 // LLA: {
2641 // LLA: 	sal_Bool bRes=sal_False;
2642 // LLA:
2643 // LLA: 	bRes=c_rtl_tres_state
2644 // LLA:         (
2645 // LLA: 	      	hRtlTestResult,
2646 // LLA: 	      	test_index<sal_Unicode>((const sal_Unicode*)input1lastNormal,
2647 // LLA:                                     nlastNormalCount,input2lastNormal,
2648 // LLA:                                     expVallastNormal,3,hRtlTestResult),
2649 // LLA: 	      	"lastIndex",
2650 // LLA: 	      	"lastIndexNormal(sal_Unicode ch, sal_Int32 fromIndex)"
2651 // LLA: 	      	);
2652 // LLA:
2653 // LLA:     return ( bRes );
2654 // LLA: }
2655 // LLA: //------------------------------------------------------------------------
2656 // LLA: // testing the method lastIndexOf(  OUString ch )
2657 // LLA: //------------------------------------------------------------------------
2658 // LLA: sal_Bool SAL_CALL test_rtl_OUString_lastIndexOf_003(
2659 // LLA:     hTestResult hRtlTestResult )
2660 // LLA: {
2661 // LLA: 	sal_Bool bRes=sal_False;
2662 // LLA:
2663 // LLA: 	bRes=c_rtl_tres_state
2664 // LLA:         (
2665 // LLA: 	      	hRtlTestResult,
2666 // LLA: 	      	test_indexStr<sal_Unicode>((const sal_Unicode**)input1StrLastDefault,
2667 // LLA:                                        nStrLastDefaultCount,input2StrLastDefault,
2668 // LLA:                                        expValStrLastDefault,2,hRtlTestResult),
2669 // LLA: 	      	"lastIndexOf",
2670 // LLA: 	      	"lastIndexOf(OUString ch)"
2671 // LLA: 	      	);
2672 // LLA:
2673 // LLA:     return ( bRes );
2674 // LLA: }
2675 // LLA: //------------------------------------------------------------------------
2676 // LLA: // testing the method lastIndexOf(  OUString ch, sal_Int32 fromIndex )
2677 // LLA: //------------------------------------------------------------------------
2678 // LLA: sal_Bool SAL_CALL test_rtl_OUString_lastIndexOf_004(
2679 // LLA:     hTestResult hRtlTestResult )
2680 // LLA: {
2681 // LLA: 	sal_Bool bRes=sal_False;
2682 // LLA:
2683 // LLA:     for (int i=0;i<nStrLastNormalCount;i++)
2684 // LLA:     {
2685 // LLA:         rtl::OUString aStr = rtl::OUString(input1StrLastNormal[i]);
2686 // LLA:         volatile int dummy = 0;
2687 // LLA:     }
2688 // LLA:
2689 // LLA: 	bRes=c_rtl_tres_state
2690 // LLA:         (
2691 // LLA: 	      	hRtlTestResult,
2692 // LLA: 	      	test_indexStr<sal_Unicode>((const sal_Unicode**)input1StrLastNormal,
2693 // LLA:                                        nStrLastNormalCount,input2StrLastNormal,
2694 // LLA:                                        expValStrLastNormal,3,hRtlTestResult),
2695 // LLA: 	      	"lastIndexOf",
2696 // LLA: 	      	"lastIndexOf(OUString ch, sal_Int32 fromIndex)"
2697 // LLA: 	      	);
2698 // LLA:
2699 // LLA:     return ( bRes );
2700 // LLA: }
2701 //------------------------------------------------------------------------
2702 extern "C" void /* sal_Bool */ SAL_CALL test_rtl_OUString_indexOf(
2703     hTestResult hRtlTestResult )
2704 {
2705     c_rtl_tres_state_start( hRtlTestResult, "indexOf");
2706     sal_Bool res = test_rtl_OUString_indexOf_001(hRtlTestResult);
2707     res &= test_rtl_OUString_indexOf_002(hRtlTestResult);
2708     res &= test_rtl_OUString_indexOf_003(hRtlTestResult);
2709     res &= test_rtl_OUString_indexOf_004(hRtlTestResult);
2710     c_rtl_tres_state_end( hRtlTestResult, "indexOf");
2711 //    return ( res );
2712 }
2713 //------------------------------------------------------------------------
2714 // LLA: extern "C" void /* sal_Bool */ SAL_CALL test_rtl_OUString_lastIndexOf(
2715 // LLA:     hTestResult hRtlTestResult )
2716 // LLA: {
2717 // LLA:     c_rtl_tres_state_start( hRtlTestResult, "lastIndexOf");
2718 // LLA:     sal_Bool res = test_rtl_OUString_lastIndexOf_001(hRtlTestResult);
2719 // LLA:     res &= test_rtl_OUString_lastIndexOf_002(hRtlTestResult);
2720 // LLA:     res &= test_rtl_OUString_lastIndexOf_003(hRtlTestResult);
2721 // LLA:     res &= test_rtl_OUString_lastIndexOf_004(hRtlTestResult);
2722 // LLA:     c_rtl_tres_state_end( hRtlTestResult, "lastIndexOf");
2723 // LLA: //    return ( res );
2724 // LLA: }
2725 //------------------------------------------------------------------------
2726 // testing the method concat( const OString & aStr )
2727 //------------------------------------------------------------------------
2728 extern "C" void /* sal_Bool */ SAL_CALL test_rtl_OUString_concat(
2729     hTestResult hRtlTestResult )
2730 {
2731     c_rtl_tres_state_start( hRtlTestResult, "concat");
2732     sal_Char methName[MAXBUFLENGTH];
2733     sal_Char* pMeth =methName;
2734 
2735     typedef struct TestCase
2736     {
2737         sal_Char*                    comments;
2738         OUString*                     expVal;
2739         OUString*                     input1;
2740         OUString*                     input2;
2741         ~TestCase() { delete input1;delete input2; delete expVal;}
2742     } TestCase;
2743 
2744     TestCase arrTestCase[] =
2745     {
2746         {"concatenates two ustrings",new OUString(aUStr1),
2747          new OUString(aUStr7), new OUString(aUStr8)},
2748         {"concatenates empty ustring",new OUString(aUStr1),
2749          new OUString(aUStr1), new OUString("",0,
2750                                             kEncodingRTLTextUSASCII,kConvertFlagsOStringToOUString)},
2751         {"concatenates to empty ustring",new OUString(aUStr1),new OUString("",
2752                                                                            0,kEncodingRTLTextUSASCII,kConvertFlagsOStringToOUString),
2753          new OUString(aUStr1)},
2754         {"concatenates two empty ustrings",new OUString("",0,
2755                                                         kEncodingRTLTextUSASCII,kConvertFlagsOStringToOUString),
2756          new OUString("",0,
2757                       kEncodingRTLTextUSASCII,kConvertFlagsOStringToOUString),
2758          new OUString("",0,
2759                       kEncodingRTLTextUSASCII,kConvertFlagsOStringToOUString)},
2760         {"concatenates ustring constructed by default constructor",
2761          new OUString(aUStr1),new OUString(aUStr1), new OUString()},
2762         {"concatenates to ustring constructed by default constructor",
2763          new OUString(aUStr1),new OUString(), new OUString(aUStr1)},
2764         {"concatenates two ustrings constructed by default constructor",
2765          new OUString(),new OUString(), new OUString()}
2766     };
2767 
2768     sal_Bool res = sal_True;
2769     sal_uInt32 i;
2770     for(i = 0; i < (sizeof (arrTestCase))/(sizeof (TestCase)); i++)
2771     {
2772         OUString str = arrTestCase[i].input1->concat(*arrTestCase[i].input2);
2773         sal_Bool lastRes = (str == *arrTestCase[i].expVal);
2774 
2775         c_rtl_tres_state
2776             (
2777                 hRtlTestResult,
2778                 lastRes,
2779                 arrTestCase[i].comments,
2780                 createName( pMeth, "concat", i)
2781                 );
2782 
2783         res &= lastRes;
2784 
2785     }
2786     c_rtl_tres_state_end( hRtlTestResult, "concat");
2787 //    return ( res );
2788 }
2789 //------------------------------------------------------------------------
2790 // testing the method replaceAt( sal_Int32 index, sal_Int32 count,
2791 // const OUString& newStr )
2792 //------------------------------------------------------------------------
2793 extern "C" void /* sal_Bool */ SAL_CALL test_rtl_OUString_replaceAt(
2794     rtlTestResult hRtlTestResult)
2795 {
2796     c_rtl_tres_state_start( hRtlTestResult, "replaceAt");
2797     sal_Char methName[MAXBUFLENGTH];
2798     sal_Char* pMeth = methName;
2799 
2800     typedef struct TestCase
2801     {
2802         sal_Char*                    comments;
2803         OUString*                    expVal;
2804         OUString*                    input;
2805         OUString*                    newStr;
2806         sal_Int32                    index;
2807         sal_Int32                    count;
2808 
2809         ~TestCase() { delete input; delete expVal; delete newStr;}
2810     } TestCase;
2811 
2812     TestCase arrTestCase[]=
2813     {
2814 
2815         { "string differs", new OUString(aUStr2), new OUString(aUStr22),
2816           new OUString(aUStr2), 0, kTestStr22Len },
2817 
2818         { "larger index", new OUString(aUStr1), new OUString(aUStr7),
2819           new OUString(aUStr8), 64, kTestStr8Len },
2820 
2821         { "larger count", new OUString(aUStr2), new OUString(aUStr22),
2822           new OUString(aUStr2),0, 64 },
2823 
2824         { "navigate index", new OUString(aUStr2), new OUString(aUStr22),
2825           new OUString(aUStr2), -64, 64 },
2826 
2827         { "null ustring",
2828           new OUString("",0,
2829                        kEncodingRTLTextUSASCII,kConvertFlagsOStringToOUString),
2830           new OUString(aUStr14),
2831           new OUString("",0,
2832                        kEncodingRTLTextUSASCII,kConvertFlagsOStringToOUString),
2833           0, kTestStr14Len }
2834     };
2835 
2836 	sal_Bool res = sal_True;
2837 	sal_uInt32 i;
2838 
2839     for (i = 0; i < (sizeof (arrTestCase))/(sizeof (TestCase)); i++)
2840     {
2841         ::rtl::OUString aStr1;
2842         aStr1 = arrTestCase[i].input->replaceAt( arrTestCase[i].index,
2843                                                  arrTestCase[i].count, *arrTestCase[i].newStr );
2844 
2845         sal_Bool lastRes = ( arrTestCase[i].expVal->compareTo(aStr1) == 0 );
2846 
2847         c_rtl_tres_state
2848             (
2849                 hRtlTestResult,
2850                 lastRes,
2851                 arrTestCase[i].comments,
2852                 createName( pMeth, "replaceAt", i )
2853 
2854                 );
2855         res &= lastRes;
2856     }
2857 
2858     c_rtl_tres_state_end( hRtlTestResult, "replaceAt");
2859 //     return ( res );
2860 }
2861 //------------------------------------------------------------------------
2862 // this is my testing code
2863 // testing the method replace( sal_Unicode oldChar, sal_Unicode newChar )
2864 //------------------------------------------------------------------------
2865 extern "C" void /* sal_Bool */ SAL_CALL test_rtl_OUString_replace(
2866     hTestResult hRtlTestResult)
2867 {
2868     c_rtl_tres_state_start( hRtlTestResult, "replace");
2869     sal_Char methName[MAXBUFLENGTH];
2870     sal_Char* pMeth = methName;
2871 
2872     typedef struct TestCase
2873     {
2874         sal_Char*                    comments;
2875         OUString*                    expVal;
2876         OUString*                    input;
2877         sal_Unicode                  oldChar;
2878         sal_Unicode                  newChar;
2879 
2880         ~TestCase() { delete input; delete expVal;}
2881     } TestCase;
2882 
2883     TestCase arrTestCase[]=
2884     {
2885         {"ustring differs", new OUString(aUStr18), new OUString(aUStr4),83,115},
2886         {"ustring differs", new OUString(aUStr19), new OUString(aUStr17),32,45},
2887         {"ustring must be empty", new OUString("",0,
2888                                                kEncodingRTLTextUSASCII,kConvertFlagsOStringToOUString),
2889          new OUString("",0,
2890                       kEncodingRTLTextUSASCII,kConvertFlagsOStringToOUString),83,23},
2891         {"ustring must be empty", new OUString(),
2892          new OUString("",0,
2893                       kEncodingRTLTextUSASCII,kConvertFlagsOStringToOUString),83,23},
2894         {"same ustring, no replace ", new OUString(aUStr22),
2895          new OUString(aUStr22),42,56}
2896     };
2897 
2898 
2899     sal_Bool res = sal_True;
2900     sal_uInt32 i;
2901 
2902     for (i = 0; i < (sizeof (arrTestCase))/(sizeof (TestCase)); i++)
2903     {
2904         ::rtl::OUString aStr1;
2905         aStr1= arrTestCase[i].input->replace(arrTestCase[i].oldChar,arrTestCase[i].newChar);
2906         res &= c_rtl_tres_state
2907             (
2908                 hRtlTestResult,
2909                 (arrTestCase[i].expVal->compareTo(aStr1) == 0),
2910                 arrTestCase[i].comments,
2911                 createName( pMeth, "replace", i )
2912 
2913                 );
2914     }
2915     c_rtl_tres_state_end( hRtlTestResult, "replace");
2916 //     return ( res );
2917 }
2918 //------------------------------------------------------------------------
2919 // testing the method toAsciiLowerCase()
2920 //-----------------------------------------------------------------------
2921 extern "C" void /* sal_Bool */ SAL_CALL test_rtl_OUString_toAsciiLowerCase(
2922     hTestResult hRtlTestResult )
2923 {
2924     c_rtl_tres_state_start( hRtlTestResult, "toAsciiLowerCase");
2925     sal_Char methName[MAXBUFLENGTH];
2926     sal_Char* pMeth =methName;
2927 
2928     typedef struct TestCase
2929     {
2930         sal_Char*                    comments;
2931         OUString*                     expVal;
2932         OUString*                     input1;
2933         ~TestCase() { delete input1; delete expVal;}
2934     } TestCase;
2935 
2936     TestCase arrTestCase[] =
2937     {
2938 
2939         {"only uppercase",new OUString(aUStr5),new OUString(aUStr4)},
2940         {"different cases",new OUString(aUStr5),new OUString(aUStr1)},
2941         {"different cases",new OUString(aUStr5),new OUString(aUStr3)},
2942         {"only lowercase",new OUString(aUStr5),new OUString(aUStr5)},
2943         {"empty ustring",new OUString("",0,
2944                                       kEncodingRTLTextUSASCII,kConvertFlagsOStringToOUString),
2945          new OUString("",0,
2946                       kEncodingRTLTextUSASCII,kConvertFlagsOStringToOUString)},
2947         {"ustring constructed by default constructor",new OUString(),
2948          new OUString()},
2949         {"have special Unicode",new OUString("\23\12\34sun\13\45",6,
2950                                              kEncodingRTLTextUSASCII,kConvertFlagsOStringToOUString),
2951          new OUString("\23\12\34sun\13\45",6,
2952                       kEncodingRTLTextUSASCII,kConvertFlagsOStringToOUString)}
2953     };
2954 
2955     sal_Bool res = sal_True;
2956     sal_uInt32 i;
2957     sal_Bool lastRes=sal_False;
2958 
2959     for(i = 0; i < (sizeof (arrTestCase))/(sizeof (TestCase)); i++)
2960     {
2961         OUString str = arrTestCase[i].input1->toAsciiLowerCase();
2962         if(i<=5)
2963         {
2964             lastRes = (str ==* arrTestCase[i].expVal);
2965 
2966             c_rtl_tres_state
2967                 (
2968                     hRtlTestResult,
2969                     lastRes,
2970                     arrTestCase[i].comments,
2971                     createName( pMeth, "toAsciiLowerCase", i)
2972                     );
2973         }
2974         else
2975         {
2976             c_rtl_tres_state
2977                 (
2978                     hRtlTestResult,
2979                     sal_True,
2980                     arrTestCase[i].comments,
2981                     createName( pMeth, "toAsciiLowerCase", i)
2982                     );
2983         }
2984         res &= lastRes;
2985     }
2986     c_rtl_tres_state_end( hRtlTestResult, "toAsciiLowerCase");
2987 //    return ( res );
2988 }
2989 //------------------------------------------------------------------------
2990 // testing the method toAsciiUpperCase()
2991 //------------------------------------------------------------------------
2992 extern "C" void /* sal_Bool */ SAL_CALL test_rtl_OUString_toAsciiUpperCase(
2993     hTestResult hRtlTestResult )
2994 {
2995     c_rtl_tres_state_start( hRtlTestResult, "toAsciiUpperCase");
2996     sal_Char methName[MAXBUFLENGTH];
2997     sal_Char* pMeth =methName;
2998 
2999     typedef struct TestCase
3000     {
3001         sal_Char*                    comments;
3002         OUString*                    expVal;
3003         OUString*                    input1;
3004         ~TestCase() { delete input1; delete expVal;}
3005     } TestCase;
3006 
3007 	TestCase arrTestCase[] =
3008     {
3009         {"only lowercase",new OUString(aUStr4),new OUString(aUStr5)},
3010         {"mixed cases",new OUString(aUStr4),new OUString(aUStr3)},
3011         {"mixed cases",new OUString(aUStr4),new OUString(aUStr1)},
3012         {"only uppercase",new OUString(aUStr4),new OUString(aUStr4)},
3013         {"empty ustring",new OUString("",0,
3014                                       kEncodingRTLTextUSASCII,kConvertFlagsOStringToOUString),
3015          new OUString("",0,
3016                       kEncodingRTLTextUSASCII,kConvertFlagsOStringToOUString)},
3017         {"ustring constructed by default constructor",new OUString(),
3018          new OUString()},
3019         {"have special Unicode",new OUString("\23\12\34SUN\13\45",6,
3020                                              kEncodingRTLTextUSASCII,kConvertFlagsOStringToOUString),
3021          new OUString("\23\12\34sun\13\45",6,
3022                       kEncodingRTLTextUSASCII,kConvertFlagsOStringToOUString)}
3023     };
3024 
3025     sal_Bool res = sal_True;
3026     sal_uInt32 i;
3027     sal_Bool lastRes=sal_False;
3028 
3029     for(i = 0; i < (sizeof (arrTestCase))/(sizeof (TestCase)); i++)
3030     {
3031         OUString str = arrTestCase[i].input1->toAsciiUpperCase();
3032         if(i<=5)
3033         {
3034             lastRes = (str == *arrTestCase[i].expVal);
3035 
3036             c_rtl_tres_state
3037                 (
3038                     hRtlTestResult,
3039                     lastRes,
3040                     arrTestCase[i].comments,
3041                     createName( pMeth, "toAsciiUpperCase", i)
3042                     );
3043         }
3044         else
3045         {
3046             c_rtl_tres_state
3047                 (
3048                     hRtlTestResult,
3049                     sal_True,
3050                     arrTestCase[i].comments,
3051                     createName( pMeth, "toAsciiUpperCase", i)
3052                     );
3053         }
3054 
3055         res &= lastRes;
3056     }
3057     c_rtl_tres_state_end( hRtlTestResult, "toAsciiUpperCase");
3058 //    return ( res );
3059 }
3060 
3061 //------------------------------------------------------------------------
3062 // testing the method trim()
3063 //------------------------------------------------------------------------
3064 extern "C" void /* sal_Bool */ SAL_CALL test_rtl_OUString_trim(
3065     hTestResult hRtlTestResult )
3066 {
3067     c_rtl_tres_state_start( hRtlTestResult, "trim");
3068     sal_Char methName[MAXBUFLENGTH];
3069     sal_Char* pMeth =methName;
3070 
3071     typedef struct TestCase
3072     {
3073         sal_Char*                    comments;
3074         OUString*                    expVal;
3075         OUString*                    input1;
3076         ~TestCase() { delete input1; delete expVal;}
3077     } TestCase;
3078 
3079     TestCase arrTestCase[] =
3080     {
3081         {"removes space from the front",new OUString(aUStr1),
3082          new OUString(aUStr10)},
3083         {"removes space from the end",new OUString(aUStr1),
3084          new OUString(aUStr11)},
3085         {"removes space from the front and end",new OUString(aUStr1),
3086          new OUString(aUStr12)},
3087         {"removes several spaces from the end",new OUString(aUStr1),
3088          new OUString(aUStr13)},
3089         {"removes several spaces from the front",new OUString(aUStr1),
3090          new OUString(aUStr14)},
3091         {"removes several spaces from the front and one from the end",
3092          new OUString(aUStr1),
3093          new OUString(aUStr15)},
3094         {"removes one space from the front and several from the end",
3095          new OUString(aUStr1),
3096          new OUString(aUStr16)},
3097         {"removes several spaces from the front and end",
3098          new OUString(aUStr1),
3099          new OUString(aUStr17)},
3100         {"removes characters that have codes <= 32",new OUString(aUStr30),
3101          new OUString("\1\3\5\7\11\13\15\17sun\21\23\25\27\31\33\50",
3102                       18,kEncodingRTLTextUSASCII,
3103                       kConvertFlagsOStringToOUString)},
3104         {"removes characters that have codes <= 32",new OUString(aUStr28),
3105          new OUString("\50\3\5\7\11\13\15\17sun\21\23\25\27\31\33\1",
3106                       18,kEncodingRTLTextUSASCII,
3107                       kConvertFlagsOStringToOUString)},
3108         {"removes characters that have codes <= 32",new OUString(aUStr29),
3109          new OUString("\50\3\5\7\11\13\15\17sun\21\23\25\27\31\33\50",
3110                       18,kEncodingRTLTextUSASCII,
3111                       kConvertFlagsOStringToOUString)},
3112         {"removes characters that have codes <= 32",new OUString(aUStr20),
3113          new OUString("\1\3\5\7\11\13\15\17sun\21\23\25\27\31\23\20",
3114                       18,kEncodingRTLTextUSASCII,
3115                       kConvertFlagsOStringToOUString)},
3116         {"no spaces",new OUString(aUStr8),
3117          new OUString(aUStr8)}
3118     };
3119 
3120     sal_Bool res = sal_True;
3121     sal_uInt32 i;
3122 
3123     for(i = 0; i < (sizeof (arrTestCase))/(sizeof (TestCase)); i++)
3124     {
3125         OUString strRes = arrTestCase[i].input1->trim();
3126         sal_Bool lastRes = (strRes == *arrTestCase[i].expVal);
3127 
3128         c_rtl_tres_state
3129             (
3130                 hRtlTestResult,
3131                 lastRes,
3132                 arrTestCase[i].comments,
3133                 createName( pMeth, "trim", i)
3134                 );
3135 
3136         res &= lastRes;
3137 
3138     }
3139     c_rtl_tres_state_end( hRtlTestResult, "trim");
3140 //    return ( res );
3141 }
3142 //------------------------------------------------------------------------
3143 //    testing the method toData()
3144 //------------------------------------------------------------------------
3145 
3146 template <class T>
3147 sal_Bool test_toData( const char** input, int num, sal_Int16 radix,
3148                       const T* expVal,int base,
3149                       const T* _fPrecision,
3150                       rtlTestResult hRtlTestResult)
3151 {
3152     (void)_fPrecision;
3153 	sal_Bool    res=sal_True;
3154 	sal_Char    methName[MAXBUFLENGTH];
3155 	sal_Char    *meth = '\0';
3156 	sal_Char*   pMeth=methName;
3157 	sal_Int32   i;
3158 // 	static      sal_Unicode aUchar[60]={0x00};
3159 	T           intRes;
3160     sal_Bool    lastRes=sal_False;
3161 
3162 	for(i=0;i<num;i++)
3163 	{
3164         OSL_ENSURE( i < 60, "ERROR: leave aUchar bound");
3165 
3166 // LLA: stored for the posterity
3167 //      AStringToUStringCopy(aUchar,input[i]);
3168 // 		OUString str(aUchar);
3169 
3170         OUString str;
3171         str = OUString::createFromAscii(input[i]);
3172 
3173 
3174         if(base==0)
3175 		{
3176             intRes=static_cast<T>(str.toInt32());
3177             lastRes=(intRes==expVal[i]);
3178             meth="toInt32default";
3179         }
3180 		if(base==1)
3181 		{
3182             intRes=static_cast<T>(str.toInt32(radix));
3183             lastRes=(intRes==expVal[i]);
3184             meth="toInt32normal";
3185         }
3186 		if(base==2)
3187 		{
3188             intRes=static_cast<T>(str.toInt64());
3189             lastRes=(intRes==expVal[i]);
3190             meth="toInt64default";
3191         }
3192 		if(base==3)
3193 		{
3194             intRes=static_cast<T>(str.toInt64(radix));
3195             lastRes=(intRes==expVal[i]);
3196             meth="toInt64normal";
3197         }
3198 // LLA: does no longer exist, moved to rtl/oustring
3199 // LLA: 		if(base==4)
3200 // LLA: 		{
3201 // LLA:             intRes=str.toDouble();
3202 // LLA:             lastRes=(fabs(intRes-expVal[i])<=1e-35);
3203 // LLA:             meth="toDouble";
3204 // LLA:         }
3205 
3206 // LLA: dt:20040802 create compile problems within wntmsci10
3207 //		if(base==5)
3208 //		{
3209 //            intRes=str.toFloat();
3210 //            T nPrec = _fPrecision[i];
3211 //            lastRes=(fabs((T)(intRes-expVal[i])) <= nPrec /* 1e-35 */ );
3212 //            meth="toFloat";
3213 //        }
3214 		if(base==6)
3215 		{
3216             intRes=str.toChar();
3217             lastRes=(intRes==expVal[i]);
3218             meth="toChar";
3219         }
3220 
3221 		char buf[MAXBUFLENGTH];
3222         buf[0] = '\'';
3223         cpynstr( buf + 1, input[i], MAXBUFLENGTH );
3224         int length = AStringLen( input[i] );
3225         buf[length + 1] = '\'';
3226         buf[length + 2] = 0;
3227 
3228         c_rtl_tres_state
3229         	(
3230                 hRtlTestResult,
3231                 lastRes,
3232                 buf,
3233                 createName( pMeth,meth, i )
3234                 );
3235 
3236         res &= lastRes;
3237     }
3238 
3239     return( res );
3240 }
3241 //------------------------------------------------------------------------
3242 //    testing the method toDouble()
3243 //------------------------------------------------------------------------
3244 
3245 // LLA: extern "C" void /* sal_Bool */ SAL_CALL test_rtl_OUString_toDouble(
3246 // LLA:     hTestResult hRtlTestResult )
3247 // LLA: {
3248 // LLA:     c_rtl_tres_state_start( hRtlTestResult, "toDouble");
3249 // LLA: 	sal_Bool bRes=sal_False;
3250 // LLA:
3251 // LLA: 	bRes=c_rtl_tres_state
3252 // LLA:         (
3253 // LLA: 	      	hRtlTestResult,
3254 // LLA: 	      	test_toData<double>((const char**)inputDouble,nDoubleCount,10,
3255 // LLA:                                 expValDouble,4,hRtlTestResult),
3256 // LLA: 	      	"toDouble",
3257 // LLA: 	      	"toDouble()"
3258 // LLA: 	      	);
3259 // LLA: 	c_rtl_tres_state_end( hRtlTestResult, "toDouble");
3260 // LLA: //	 return ( bRes );
3261 // LLA: }
3262 
3263 //------------------------------------------------------------------------
3264 //    testing the method toFloat()
3265 //------------------------------------------------------------------------
3266 // LLA: dt:20040802 the test_toData() has compile problems.
3267 // LLA: extern "C" void /* sal_Bool */ SAL_CALL test_rtl_OUString_toFloat(
3268 // LLA:     hTestResult hRtlTestResult )
3269 // LLA: {
3270 // LLA:     c_rtl_tres_state_start( hRtlTestResult, "toFloat");
3271 // LLA: 	sal_Bool bRes=sal_False;
3272 // LLA:
3273 // LLA: 	bRes=c_rtl_tres_state
3274 // LLA:         (
3275 // LLA: 	      	hRtlTestResult,
3276 // LLA: 	      	test_toData<float>((const char**)inputFloat,
3277 // LLA:                                nFloatCount,
3278 // LLA:                                10, /* radix */
3279 // LLA:                                expValFloat,
3280 // LLA:                                5,  /* float */
3281 // LLA:                                fPrecision,
3282 // LLA:                                hRtlTestResult),
3283 // LLA: 	      	"toFloat",
3284 // LLA: 	      	"toFloat()"
3285 // LLA: 	      	);
3286 // LLA:
3287 // LLA:     c_rtl_tres_state_end( hRtlTestResult, "toFloat");
3288 // LLA: //	 return ( bRes );
3289 // LLA:
3290 // LLA: }
3291 //------------------------------------------------------------------------
3292 //    testing the method toChar()
3293 //------------------------------------------------------------------------
3294 extern "C" void /* sal_Bool */ SAL_CALL test_rtl_OUString_toChar(
3295     hTestResult hRtlTestResult )
3296 {
3297     c_rtl_tres_state_start( hRtlTestResult, "toChar");
3298 	sal_Bool bRes=sal_False;
3299 
3300 	bRes=c_rtl_tres_state
3301         (
3302 	      	hRtlTestResult,
3303 	      	test_toData<sal_Unicode>((const char**)inputChar,nCharCount,
3304                                      10,expValChar,6,NULL,hRtlTestResult),
3305 	      	"toChar",
3306 	      	"toChar()"
3307 	      	);
3308 
3309     c_rtl_tres_state_end( hRtlTestResult, "toChar");
3310 //	 return ( bRes );
3311 
3312 }
3313 //------------------------------------------------------------------------
3314 //    testing the method toBoolean()
3315 //------------------------------------------------------------------------
3316 extern "C" void /* sal_Bool */ SAL_CALL test_rtl_OUString_toBoolean(
3317     hTestResult hRtlTestResult)
3318 {
3319     c_rtl_tres_state_start( hRtlTestResult, "toBoolean");
3320     sal_Char methName[MAXBUFLENGTH];
3321     sal_Char* pMeth = methName;
3322 
3323     typedef struct TestCase
3324     {
3325         sal_Char*          comments;
3326         sal_Bool           expVal;
3327         OUString*          input;
3328 
3329         ~TestCase()      {delete input;}
3330     }TestCase;
3331 
3332     TestCase arrTestCase[]={
3333 
3334         {"expected true", sal_True, new OUString("True",4,kEncodingRTLTextUSASCII,
3335                                                  kConvertFlagsOStringToOUString)},
3336         {"expected false", sal_False, new OUString("False",5,
3337                                                    kEncodingRTLTextUSASCII,
3338                                                    kConvertFlagsOStringToOUString)},
3339         {"expected true", sal_True, new OUString("1",1,kEncodingRTLTextUSASCII,
3340                                                  kConvertFlagsOStringToOUString)}
3341     };
3342 
3343     sal_Bool res = sal_True;
3344     sal_uInt32 i;
3345 
3346     for (i = 0; i < (sizeof (arrTestCase))/(sizeof (TestCase)); i++)
3347     {
3348         sal_Bool bRes = arrTestCase[i].input->toBoolean();
3349         sal_Bool lastRes = (bRes == arrTestCase[i].expVal);
3350         c_rtl_tres_state
3351             (
3352                 hRtlTestResult,
3353                 lastRes,
3354                 arrTestCase[i].comments,
3355                 createName( pMeth, "toBoolean", i )
3356 
3357                 );
3358         res &= lastRes;
3359     }
3360     c_rtl_tres_state_end( hRtlTestResult, "toBoolean");
3361 //     return ( res );
3362 }
3363 //------------------------------------------------------------------------
3364 //    testing the method toInt32()
3365 //------------------------------------------------------------------------
3366 
3367 sal_Bool SAL_CALL test_rtl_OUString_toInt32_normal(
3368     hTestResult hRtlTestResult )
3369 {
3370     sal_Int32 expValues[kBase36NumsCount];
3371     sal_Int32 i;
3372 
3373     for ( i = 0; i < kBase36NumsCount; i++ )
3374         expValues[i] = i;
3375 
3376     sal_Bool res = c_rtl_tres_state
3377         (
3378             hRtlTestResult,
3379             test_toData<sal_Int32>( kBinaryNumsStr,kBinaryNumsCount,
3380                                     kRadixBinary,expValues,1,NULL,hRtlTestResult ),
3381             "kBinaryNumsStr",
3382             "toInt32( radix 2 )"
3383             );
3384     res &= c_rtl_tres_state
3385         (
3386             hRtlTestResult,
3387             test_toData<sal_Int32>( kBinaryMaxNumsStr,kInt32MaxNumsCount,
3388                                     kRadixBinary,kInt32MaxNums,1,NULL,hRtlTestResult ),
3389             "kBinaryMaxNumsStr",
3390             "toInt32_Boundaries( radix 2 )"
3391             );
3392 
3393     res &= c_rtl_tres_state
3394         (
3395             hRtlTestResult,
3396             test_toData<sal_Int32>( kOctolNumsStr,kOctolNumsCount,
3397                                     kRadixOctol,expValues,1,NULL,hRtlTestResult ),
3398             "kOctolNumsStr",
3399             "toInt32( radix 8 )"
3400             );
3401 
3402     res &= c_rtl_tres_state
3403         (
3404             hRtlTestResult,
3405             test_toData<sal_Int32>( kOctolMaxNumsStr,kInt32MaxNumsCount,
3406                                     kRadixOctol,(sal_Int32*)kInt32MaxNums,1,NULL,hRtlTestResult ),
3407             "kOctolMaxNumsStr",
3408             "toInt32_Boundaries( radix 8 )"
3409             );
3410 
3411     res &= c_rtl_tres_state
3412         (
3413             hRtlTestResult,
3414             test_toData<sal_Int32>( kDecimalNumsStr,kDecimalNumsCount,
3415                                     kRadixDecimal,expValues,1,NULL,hRtlTestResult ),
3416             "kDecimalNumsStr",
3417             "toInt32( radix 10 )"
3418             );
3419 
3420     res &= c_rtl_tres_state
3421         (
3422             hRtlTestResult,
3423             test_toData<sal_Int32>( kDecimalMaxNumsStr,kInt32MaxNumsCount,
3424                                     kRadixDecimal,(sal_Int32*)kInt32MaxNums,1,NULL,hRtlTestResult ),
3425             "kDecimalMaxNumsStr",
3426             "toInt32_Boundaries( radix 10 )"
3427             );
3428 
3429     res &= c_rtl_tres_state
3430         (
3431             hRtlTestResult,
3432             test_toData<sal_Int32>( kHexDecimalNumsStr,kHexDecimalNumsCount,
3433                                     kRadixHexdecimal,expValues,1,NULL,hRtlTestResult ),
3434             "kHexDecimalNumsStr",
3435             "toInt32( radix 16 )"
3436             );
3437 
3438     res &= c_rtl_tres_state
3439         (
3440             hRtlTestResult,
3441             test_toData<sal_Int32>(  kHexDecimalMaxNumsStr,kInt32MaxNumsCount,
3442                                      kRadixHexdecimal,(sal_Int32*)kInt32MaxNums,1,NULL,hRtlTestResult ),
3443             "kHexDecimalMaxNumsStr",
3444             "toInt32_Boundaries( radix 16 )"
3445             );
3446 
3447     res &= c_rtl_tres_state
3448         (
3449             hRtlTestResult,
3450             test_toData<sal_Int32>(  kBase36NumsStr,kBase36NumsCount,
3451                                      kRadixBase36, expValues,1,NULL,hRtlTestResult ),
3452             "kBase36NumsStr",
3453             "toInt32( radix 36 )"
3454             );
3455 
3456     res &= c_rtl_tres_state
3457         (
3458             hRtlTestResult,
3459             test_toData<sal_Int32>( kBase36MaxNumsStr,kInt32MaxNumsCount,
3460                                     kRadixBase36,(sal_Int32*)kInt32MaxNums,1,NULL,hRtlTestResult ),
3461             "kBase36MaxNumsStr",
3462             "toInt32_Boundaries( radix 36 )"
3463             );
3464 
3465     const sal_Int16 nSpecCases = 5;
3466     static const sal_Char *spString[nSpecCases] =
3467     {
3468         "-1",
3469         "+1",
3470         " 1",
3471         " -1",
3472         "001"
3473     };
3474 
3475     sal_Int32 expSpecVal[nSpecCases] =
3476     {
3477         -1,
3478         1,
3479         1,
3480         -1,
3481         1
3482     };
3483 
3484     res &= c_rtl_tres_state
3485         (
3486             hRtlTestResult,
3487             test_toData<sal_Int32>( spString,nSpecCases,
3488                                     kRadixDecimal,expSpecVal,1,NULL,hRtlTestResult ),
3489             "special cases",
3490             "toInt32( specialcases )"
3491             );
3492 
3493     return ( res );
3494 }
3495 sal_Bool SAL_CALL test_rtl_OUString_toInt32_wrongRadix(
3496     hTestResult hRtlTestResult )
3497 {
3498     ::rtl::OUString str("0",1,kEncodingRTLTextUSASCII,
3499                         kConvertFlagsOStringToOUString);
3500 
3501     sal_Int32 iRes =str.toInt32(-1);
3502 
3503     return
3504         (
3505             c_rtl_tres_state
3506             (
3507                 hRtlTestResult,
3508                 iRes == 0,
3509                 "wrong radix -1",
3510                 "toInt32( 0, wrong radix -1 )"
3511                 )
3512             );
3513 }
3514 sal_Bool SAL_CALL test_rtl_OUString_toInt32_defaultParam(
3515     hTestResult hRtlTestResult )
3516 {
3517     sal_Int32 expValues[kBase36NumsCount];
3518     sal_Int32 i;
3519 
3520     for ( i = 0; i < kBase36NumsCount; i++ )
3521         expValues[i] = i;
3522 
3523     sal_Bool res = c_rtl_tres_state
3524         (
3525             hRtlTestResult,
3526             test_toData<sal_Int32>( kDecimalNumsStr,kDecimalNumsCount,
3527                                     kRadixDecimal,expValues,0,NULL,hRtlTestResult ),
3528             "kBinaryNumsStr",
3529             "toInt32( radix 2 )"
3530             );
3531     res &= c_rtl_tres_state
3532         (
3533             hRtlTestResult,
3534             test_toData<sal_Int32>( kDecimalMaxNumsStr,kInt32MaxNumsCount,
3535                                     kRadixDecimal,(sal_Int32*)kInt32MaxNums,0,NULL,hRtlTestResult ),
3536             "kDecimalMaxNumsStr",
3537             "toInt32_Boundaries( radix 10 )"
3538             );
3539     const sal_Int16 nSpecCases = 5;
3540     static const sal_Char *spString[nSpecCases] =
3541     {
3542         "-1",
3543         "+1",
3544         " 1",
3545         " -1",
3546         "001"
3547     };
3548 
3549     sal_Int32 expSpecVal[nSpecCases] =
3550     {
3551         -1,
3552         1,
3553         1,
3554         -1,
3555         1
3556     };
3557 
3558     res &= c_rtl_tres_state
3559         (
3560             hRtlTestResult,
3561             test_toData<sal_Int32>( spString,nSpecCases,
3562                                     kRadixDecimal,expSpecVal,0,NULL,hRtlTestResult ),
3563             "special cases",
3564             "toInt32( specialcases )"
3565             );
3566 
3567     return ( res );
3568 }
3569 
3570 //------------------------------------------------------------------------
3571 // testing the method toInt32()
3572 //------------------------------------------------------------------------
3573 extern "C" void /* sal_Bool */ SAL_CALL test_rtl_OUString_toInt32(
3574     hTestResult hRtlTestResult )
3575 {
3576     c_rtl_tres_state_start( hRtlTestResult, "toInt32");
3577     sal_Bool bTState = test_rtl_OUString_toInt32_normal( hRtlTestResult );
3578     bTState &= test_rtl_OUString_toInt32_defaultParam( hRtlTestResult );
3579     bTState &= test_rtl_OUString_toInt32_wrongRadix( hRtlTestResult );
3580     c_rtl_tres_state_end( hRtlTestResult, "toInt32");
3581 //    return ( bTState );
3582 }
3583 //------------------------------------------------------------------------
3584 // testing the method toInt64( sal_Int16 radix = 2,8,10,16,36 )
3585 //------------------------------------------------------------------------
3586 
3587 sal_Bool SAL_CALL test_rtl_OUString_toInt64_normal(
3588     hTestResult hRtlTestResult )
3589 {
3590     sal_Int64 expValues[kBase36NumsCount];
3591     sal_Int32 i;
3592 
3593     for (i = 0; i < kBase36NumsCount; expValues[i] = i, i++);
3594 
3595     sal_Bool res = c_rtl_tres_state
3596         (
3597             hRtlTestResult,
3598             test_toData<sal_Int64>( kBinaryNumsStr,kBinaryNumsCount,
3599                                     kRadixBinary,expValues,3,NULL,hRtlTestResult ),
3600             "kBinaryNumsStr",
3601             "toInt64( radix 2 )"
3602             );
3603 
3604 /* LLA: does not work within wntmsci8.pro
3605    res &= c_rtl_tres_state
3606    (
3607    hRtlTestResult,
3608    test_toData<sal_Int64>( kBinaryMaxNumsStr,kInt64MaxNumsCount,
3609    kRadixBinary,kInt64MaxNums,3,hRtlTestResult ),
3610    "kBinaryMaxNumsStr",
3611    "toInt64_Boundaries( radix 2 )"
3612    );
3613 */
3614 
3615     res &= c_rtl_tres_state
3616         (
3617             hRtlTestResult,
3618             test_toData<sal_Int64>( kOctolNumsStr,kOctolNumsCount,
3619                                     kRadixOctol,expValues,3,NULL,hRtlTestResult ),
3620             "kOctolNumsStr",
3621             "toInt64( radix 8 )"
3622             );
3623 
3624     res &= c_rtl_tres_state
3625         (
3626             hRtlTestResult,
3627             test_toData<sal_Int64>( kOctolMaxNumsStr,kInt64MaxNumsCount,
3628                                     kRadixOctol,(sal_Int64*)kInt64MaxNums,3,NULL,hRtlTestResult ),
3629             "kOctolMaxNumsStr",
3630             "toInt64_Boundaries( radix 8 )"
3631             );
3632 
3633     res &= c_rtl_tres_state
3634         (
3635             hRtlTestResult,
3636             test_toData<sal_Int64>( kDecimalNumsStr,kDecimalNumsCount,
3637                                     kRadixDecimal,expValues,3,NULL,hRtlTestResult ),
3638             "kDecimalNumsStr",
3639             "toInt64( radix 10 )"
3640             );
3641 
3642     res &= c_rtl_tres_state
3643         (
3644             hRtlTestResult,
3645             test_toData<sal_Int64>( kDecimalMaxNumsStr,kInt64MaxNumsCount,
3646                                     kRadixDecimal,(sal_Int64*)kInt64MaxNums,3,NULL,hRtlTestResult ),
3647             "kDecimalMaxNumsStr",
3648             "toInt64_Boundaries( radix 10 )"
3649             );
3650 
3651     res &= c_rtl_tres_state
3652         (
3653             hRtlTestResult,
3654             test_toData<sal_Int64>( kHexDecimalNumsStr,kHexDecimalNumsCount,
3655                                     kRadixHexdecimal,expValues,3,NULL,hRtlTestResult ),
3656             "kHexDecimalNumsStr",
3657             "toInt64( radix 16 )"
3658             );
3659 
3660     res &= c_rtl_tres_state
3661         (
3662             hRtlTestResult,
3663             test_toData<sal_Int64>(  kHexDecimalMaxNumsStr,kInt64MaxNumsCount,
3664                                      kRadixHexdecimal,(sal_Int64*)kInt64MaxNums,3,NULL,hRtlTestResult ),
3665             "kHexDecimalMaxNumsStr",
3666             "toInt64_Boundaries( radix 16 )"
3667             );
3668 
3669     res &= c_rtl_tres_state
3670         (
3671             hRtlTestResult,
3672             test_toData<sal_Int64>(  kBase36NumsStr,kBase36NumsCount,
3673                                      kRadixBase36, expValues,3,NULL,hRtlTestResult ),
3674             "kBase36NumsStr",
3675             "toInt64( radix 36 )"
3676             );
3677 
3678     res &= c_rtl_tres_state
3679         (
3680             hRtlTestResult,
3681             test_toData<sal_Int64>( kBase36MaxNumsStr,kInt64MaxNumsCount,
3682                                     kRadixBase36,(sal_Int64*)kInt64MaxNums,3,NULL,hRtlTestResult ),
3683             "kBase36MaxNumsStr",
3684             "toInt64_Boundaries( radix 36 )"
3685             );
3686 
3687 
3688 
3689     const sal_Int16 nSpecCases = 5;
3690     static const sal_Char *spString[nSpecCases] =
3691     {
3692         "-1",
3693         "+1",
3694         " 1",
3695         " -1",
3696         "001"
3697     };
3698 
3699     sal_Int64 expSpecVal[nSpecCases] =
3700     {
3701         -1,
3702         1,
3703         1,
3704         -1,
3705         1
3706     };
3707 
3708     res &= c_rtl_tres_state
3709         (
3710             hRtlTestResult,
3711             test_toData<sal_Int64>( spString,nSpecCases,
3712                                     kRadixDecimal,expSpecVal,3,NULL,hRtlTestResult ),
3713             "special cases",
3714             "toInt64( specialcases )"
3715             );
3716 
3717     return (res);
3718 }
3719 
3720 sal_Bool SAL_CALL test_rtl_OUString_toInt64_wrongRadix(
3721     hTestResult hRtlTestResult )
3722 {
3723     ::rtl::OUString str("0",1,kEncodingRTLTextUSASCII,
3724                         kConvertFlagsOStringToOUString);
3725 
3726     sal_Int64 iRes = str.toInt64(-1);
3727 
3728     return (
3729         c_rtl_tres_state
3730 		(
3731             hRtlTestResult,
3732             iRes == 0,
3733             "wrong radix -1",
3734             "toInt64( wrong radix -1)"
3735             )
3736         );
3737 }
3738 sal_Bool SAL_CALL test_rtl_OUString_toInt64_defaultParam(
3739     hTestResult hRtlTestResult )
3740 {
3741     sal_Int64 expValues[kBase36NumsCount];
3742     sal_Int32 i;
3743 
3744     for ( i = 0; i < kBase36NumsCount; i++ )
3745         expValues[i] = i;
3746 
3747     sal_Bool res = c_rtl_tres_state
3748         (
3749             hRtlTestResult,
3750             test_toData<sal_Int64>( kDecimalNumsStr,kDecimalNumsCount,
3751                                     kRadixDecimal,expValues,2,NULL,hRtlTestResult ),
3752             "kBinaryNumsStr",
3753             "toInt64( radix 10 )"
3754             );
3755     res &= c_rtl_tres_state
3756         (
3757             hRtlTestResult,
3758             test_toData<sal_Int64>( kDecimalMaxNumsStr,kInt64MaxNumsCount,
3759                                     kRadixDecimal,(sal_Int64*)kInt64MaxNums,2,NULL,hRtlTestResult ),
3760             "kDecimalMaxNumsStr",
3761             "toInt64_Boundaries( radix 10 )"
3762             );
3763     const sal_Int16 nSpecCases = 5;
3764     static const sal_Char *spString[nSpecCases] =
3765     {
3766         "-1",
3767         "+1",
3768         " 1",
3769         " -1",
3770         "001"
3771     };
3772 
3773     sal_Int64 expSpecVal[nSpecCases] =
3774     {
3775         -1,
3776         1,
3777         1,
3778         -1,
3779         1
3780     };
3781 
3782     res &= c_rtl_tres_state
3783         (
3784             hRtlTestResult,
3785             test_toData<sal_Int64>( spString,nSpecCases,
3786                                     kRadixDecimal,expSpecVal,2,NULL,hRtlTestResult ),
3787             "special cases",
3788             "toInt64( specialcases )"
3789             );
3790 
3791     return ( res );
3792 }
3793 
3794 //------------------------------------------------------------------------
3795 // testing the method toInt64()
3796 //------------------------------------------------------------------------
3797 extern "C" void /* sal_Bool */ SAL_CALL test_rtl_OUString_toInt64(
3798     hTestResult hRtlTestResult )
3799 {
3800     c_rtl_tres_state_start( hRtlTestResult, "toInt64");
3801     sal_Bool bTState = test_rtl_OUString_toInt64_normal( hRtlTestResult );
3802     bTState &= test_rtl_OUString_toInt64_defaultParam (hRtlTestResult );
3803     bTState &= test_rtl_OUString_toInt64_wrongRadix( hRtlTestResult );
3804     c_rtl_tres_state_end( hRtlTestResult, "toInt64");
3805 //    return ( bTState );
3806 }
3807 extern "C" void /* sal_Bool */ SAL_CALL test_rtl_OUString( hTestResult hRtlTestResult )
3808 {
3809 
3810     c_rtl_tres_state_start(hRtlTestResult, "rtl_OUString" );
3811 
3812     test_rtl_OUString_ctors( hRtlTestResult );
3813     test_rtl_OUString_getLength( hRtlTestResult );
3814     test_rtl_OUString_equals( hRtlTestResult );
3815     test_rtl_OUString_equalsIgnoreAsciiCase( hRtlTestResult );
3816     test_rtl_OUString_compareTo( hRtlTestResult );
3817     test_rtl_OUString_match( hRtlTestResult );
3818     test_rtl_OUString_op_eq( hRtlTestResult );
3819     test_rtl_OUString_op_peq( hRtlTestResult );
3820     test_rtl_OUString_csuc( hRtlTestResult );
3821     test_rtl_OUString_getStr( hRtlTestResult );
3822     test_rtl_OUString_reverseCompareTo( hRtlTestResult );
3823     test_rtl_OUString_equalsAscii( hRtlTestResult );
3824     test_rtl_OUString_equalsAsciiL( hRtlTestResult );
3825     test_rtl_OUString_compareToAscii( hRtlTestResult );
3826     test_rtl_OUString_valueOf_sal_Bool( hRtlTestResult );
3827     test_rtl_OUString_valueOf_sal_Unicode( hRtlTestResult );
3828     test_rtl_OUString_valueOf( hRtlTestResult );
3829     test_rtl_OUString_createFromAscii( hRtlTestResult );
3830     test_rtl_OUString_indexOf( hRtlTestResult );
3831 // LLA: removed, it is in a new test in rtl/oustring. test_rtl_OUString_lastIndexOf( hRtlTestResult );
3832     test_rtl_OUString_concat( hRtlTestResult );
3833     test_rtl_OUString_replaceAt( hRtlTestResult );
3834     test_rtl_OUString_replace( hRtlTestResult );
3835     test_rtl_OUString_toAsciiLowerCase( hRtlTestResult );
3836     test_rtl_OUString_toAsciiUpperCase( hRtlTestResult );
3837     test_rtl_OUString_trim( hRtlTestResult );
3838 // LLA: removed, it is in a new test in rtl/oustring. test_rtl_OUString_toDouble( hRtlTestResult );
3839 // LLA: removed, has compile problems.    test_rtl_OUString_toFloat( hRtlTestResult );
3840     test_rtl_OUString_toChar( hRtlTestResult );
3841     test_rtl_OUString_toBoolean( hRtlTestResult );
3842     test_rtl_OUString_toInt32( hRtlTestResult );
3843     test_rtl_OUString_toInt64( hRtlTestResult );
3844 
3845     c_rtl_tres_state_end(hRtlTestResult, "rtl_OUString");
3846 }
3847 // -----------------------------------------------------------------------------
3848 void RegisterAdditionalFunctions(FktRegFuncPtr _pFunc)
3849 {
3850     if (_pFunc)
3851     {
3852         (_pFunc)(&test_rtl_OUString, "");
3853     }
3854 }
3855