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