1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2000, 2010 Oracle and/or its affiliates.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * This file is part of OpenOffice.org.
11 * OpenOffice.org is free software: you can redistribute it and/or modify
12 * it under the terms of the GNU Lesser General Public License version 3
13 * only, as published by the Free Software Foundation.
15 * OpenOffice.org is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Lesser General Public License version 3 for more details
19 * (a copy is included in the LICENSE file that accompanied this code).
21 * You should have received a copy of the GNU Lesser General Public License
22 * version 3 along with OpenOffice.org. If not, see
23 * <http://www.openoffice.org/license.html>
24 * for a copy of the LGPLv3 License.
26 ************************************************************************/
28 // MARKER(update_precomp.py): autogen include statement, do not remove
29 #include "precompiled_sal.hxx"
30 #include <sal/types.h>
32 //# #ifndef _RTL_TRES_H_
33 //# #include <rtl/tres.h>
35 #include <testshl/tresstatewrapper.hxx>
36 #include "stringhelper.hxx"
37 #include <rtl/string.hxx>
38 #include <rtl/ustring.h>
39 #include <rtl/ustring.hxx>
41 //------------------------------------------------------------------------
42 //------------------------------------------------------------------------
43 #include <osl/thread.h>
44 #include <rtl_String_Const.h>
45 #include <rtl_String_Utils.hxx>
51 //------------------------------------------------------------------------
53 //------------------------------------------------------------------------
54 const int MAXBUFLENGTH
= 255;
55 //------------------------------------------------------------------------
57 //------------------------------------------------------------------------
60 // NEVER CALL SUCH FUNCTION!!!
61 (void)input1StrLastDefault
;
62 (void)input1StrLastNormal
;
66 //------------------------------------------------------------------------
67 // testing constructors
68 //------------------------------------------------------------------------
69 static sal_Bool
test_rtl_OUString_ctor_001( hTestResult hRtlTestResult
)
72 ::rtl::OUString aUStr
;
73 rtl_uString
* pData
= aUStr
.pData
;
82 "New OUString containing no characters",
88 //------------------------------------------------------------------------
90 static sal_Bool SAL_CALL
test_rtl_OUString_ctor_002(
91 hTestResult hRtlTestResult
)
93 ::rtl::OUString
aUStr( kTestStr1
,
95 kEncodingRTLTextUSASCII
,
96 kConvertFlagsOStringToOUString
105 "OUString from an ascii string",
110 //------------------------------------------------------------------------
112 static sal_Bool SAL_CALL
test_rtl_OUString_ctor_003(
113 hTestResult hRtlTestResult
)
115 rtl_uString
*rtlUStr
=NULL
;
116 rtl_uString_newFromAscii( &rtlUStr
, kTestStr1
);
117 ::rtl::OUString
aUStr( rtlUStr
);
125 "New OUString from a rtl_uString",
131 //------------------------------------------------------------------------
133 static sal_Bool SAL_CALL
test_rtl_OUString_ctor_004(
134 hTestResult hRtlTestResult
)
136 ::rtl::OUString
aUStr( aUStr1
);
144 "New OUString from unicode string",
149 //------------------------------------------------------------------------
151 static sal_Bool
test_rtl_OUString_ctor_005( hTestResult hRtlTestResult
)
153 ::rtl::OUString
aUStr( aUStr2
, kTestStr1Len
);
161 "New OUString from the first n characters of unicode string",
169 //------------------------------------------------------------------------
171 static sal_Bool
test_rtl_OUString_ctor_006( hTestResult hRtlTestResult
)
173 ::rtl::OUString
aUStrtmp( aUStr1
);
174 ::rtl::OUString
aUStr( aUStrtmp
);
182 "New OUString from another OUString",
188 extern "C" void /* sal_Bool */ SAL_CALL
test_rtl_OUString_ctors(
189 hTestResult hRtlTestResult
)
191 c_rtl_tres_state_start( hRtlTestResult
, "ctors");
192 sal_Bool DCState
= test_ini_uString();
194 sal_Bool bTSState
= test_rtl_OUString_ctor_001( hRtlTestResult
);
195 bTSState
&= test_rtl_OUString_ctor_002( hRtlTestResult
);
196 bTSState
&= test_rtl_OUString_ctor_003( hRtlTestResult
);
197 bTSState
&= test_rtl_OUString_ctor_004( hRtlTestResult
);
198 bTSState
&= test_rtl_OUString_ctor_005( hRtlTestResult
);
199 bTSState
&= test_rtl_OUString_ctor_006( hRtlTestResult
);
200 c_rtl_tres_state_end( hRtlTestResult
, "ctors");
201 // return( bTSState );
206 //------------------------------------------------------------------------
207 // testing the method getLength
208 //------------------------------------------------------------------------
210 extern "C" void /* sal_Bool */ SAL_CALL
test_rtl_OUString_getLength(
211 hTestResult hRtlTestResult
)
213 c_rtl_tres_state_start( hRtlTestResult
, "getLength");
214 sal_Char methName
[MAXBUFLENGTH
];
215 sal_Char
* pMeth
= methName
;
217 typedef struct TestCase
222 ~TestCase() { delete input
;}
225 TestCase arrTestCase
[]={
227 {"length of ascii string", kTestStr1Len
,
228 new OUString( kTestStr1
,
230 kEncodingRTLTextUSASCII
,
231 kConvertFlagsOStringToOUString
)},
232 {"length of ascci string of size 1", 1,
235 kEncodingRTLTextUSASCII
,
236 kConvertFlagsOStringToOUString
)},
237 {"length of empty string (default constructor)", 0, new OUString()},
238 {"length of empty string (empty ascii string arg)",0,
241 kEncodingRTLTextUSASCII
,
242 kConvertFlagsOStringToOUString
)},
243 {"length of empty string (string arg = '\\0')", 0,
246 kEncodingRTLTextUSASCII
,
247 kConvertFlagsOStringToOUString
)}
251 sal_Bool res
= sal_True
;
254 for (i
= 0; i
< (sizeof (arrTestCase
))/(sizeof (TestCase
)); i
++)
256 sal_Int32 length
= arrTestCase
[i
].input
->getLength();
257 sal_Bool lastRes
= (length
== arrTestCase
[i
].expVal
);
262 arrTestCase
[i
].comments
,
263 createName( pMeth
, "getLength", i
)
268 c_rtl_tres_state_end( hRtlTestResult
, "getLength");
272 //------------------------------------------------------------------------
273 // testing the method equals( const OString & aStr )
274 //------------------------------------------------------------------------
275 extern "C" void /* sal_Bool */ SAL_CALL
test_rtl_OUString_equals(
276 hTestResult hRtlTestResult
)
278 c_rtl_tres_state_start( hRtlTestResult
, "equals");
279 sal_Char methName
[MAXBUFLENGTH
];
280 sal_Char
* pMeth
= methName
;
282 typedef struct TestCase
288 ~TestCase() { delete input1
;delete input2
;}
291 TestCase arrTestCase
[]={
293 {"same size", sal_True
, new OUString(aUStr1
), new OUString(aUStr1
)},
294 {"different size", sal_False
, new OUString(aUStr1
),
297 {"same size, no case match", sal_False
, new OUString(aUStr1
),
300 {"two empty strings(def. constructor)", sal_True
, new OUString(),
303 {"empty(def.constructor) and non empty", sal_False
, new OUString(),
306 {"non empty and empty(def. constructor)", sal_False
,
307 new OUString(aUStr1
),
310 {"two empty strings(string arg = '\\0')", sal_True
,
313 kEncodingRTLTextUSASCII
,
314 kConvertFlagsOStringToOUString
),
317 kEncodingRTLTextUSASCII
,
318 kConvertFlagsOStringToOUString
)
320 {"empty(string arg = '\\0') and non empty", sal_False
,
323 kEncodingRTLTextUSASCII
,
324 kConvertFlagsOStringToOUString
),
327 {"non empty and empty(string arg = '\\0')", sal_False
,
328 new OUString(aUStr1
),
331 kEncodingRTLTextUSASCII
,
332 kConvertFlagsOStringToOUString
)
336 sal_Bool res
= sal_True
;
339 for(i
= 0; i
< (sizeof (arrTestCase
))/(sizeof (TestCase
)); i
++)
342 ( arrTestCase
[i
].input1
->equals(*(arrTestCase
[i
].input2
)) ==
343 arrTestCase
[i
].expVal
);
349 arrTestCase
[i
].comments
,
350 createName( pMeth
, "equals", i
)
355 c_rtl_tres_state_end( hRtlTestResult
, "equals");
359 //------------------------------------------------------------------------
360 // testing the method equalsIgnoreAsciiCase( const OString & aStr )
361 //------------------------------------------------------------------------
363 extern "C" void /* sal_Bool */ SAL_CALL
test_rtl_OUString_equalsIgnoreAsciiCase(
364 hTestResult hRtlTestResult
)
366 c_rtl_tres_state_start( hRtlTestResult
, "equalsIgnoreAsciiCase");
367 sal_Char methName
[MAXBUFLENGTH
];
368 sal_Char
* pMeth
= methName
;
370 typedef struct TestCase
376 ~TestCase() { delete input1
;delete input2
;}
379 TestCase arrTestCase
[]={
380 {"same strings but different cases",sal_True
,new OUString(aUStr4
),
383 {"same strings",sal_True
,new OUString(aUStr4
),
384 new OUString(aUStr4
)},
385 {"with equal beginning",sal_False
,new OUString(aUStr2
),
388 {"empty(def.constructor) and non empty",sal_False
,new OUString(),
391 {"non empty and empty(def.constructor)",sal_False
,
392 new OUString(aUStr4
),
395 {"two empty strings(def.constructor)",sal_True
,new OUString(),
398 {"different strings with equal length",sal_False
,
399 new OUString(aUStr10
),
400 new OUString(aUStr11
)
404 sal_Bool res
= sal_True
;
407 for(i
= 0; i
< (sizeof (arrTestCase
))/(sizeof (TestCase
)); i
++)
410 (arrTestCase
[i
].input1
->equalsIgnoreAsciiCase(*arrTestCase
[i
].input2
) ==
411 arrTestCase
[i
].expVal
);
417 arrTestCase
[i
].comments
,
418 createName( pMeth
, "equalsIgnoreAsciiCase", i
)
423 c_rtl_tres_state_end( hRtlTestResult
, "equalsIgnoreAsciiCase");
428 static sal_Bool SAL_CALL
test_rtl_OUString_compareTo_001(
429 hTestResult hRtlTestResult
)
431 sal_Char methName
[MAXBUFLENGTH
];
432 sal_Char
* pMeth
= methName
;
434 typedef struct TestCase
440 ~TestCase() { delete input1
;delete input2
;}
443 TestCase arrTestCase
[]={
445 {"simple compare, str1 to str5",-1,new OUString(aUStr1
),
448 {"simple compare, str2 to str5",-1,new OUString(aUStr2
),
451 {"simple compare, str1 to str9",-1,new OUString(aUStr1
),
454 {"simple compare, str1 to str2",-1,new OUString(aUStr1
),
457 {"simple compare, str4 to str5",-1,new OUString(aUStr4
),
460 {"simple compare, str1 to str3",-1,new OUString(aUStr1
),
463 {"simple compare, str5 to str1",+1,new OUString(aUStr5
),
466 {"simple compare, str2 to str1",+1,new OUString(aUStr2
),
469 {"simple compare, str9 to str5",+1,new OUString(aUStr9
),
472 {"simple compare, str5 to str4",+1,new OUString(aUStr5
),
475 {"simple compare, str1 to str1",0,new OUString(aUStr1
),
478 {"simple compare, nullString to nullString",0,new OUString(),
481 {"simple compare, nullString to str2",-1,new OUString(),
484 {"simple compare, str1 to nullString",+1,new OUString(aUStr1
),
489 sal_Bool res
= sal_True
;
492 for(i
= 0; i
< (sizeof (arrTestCase
))/(sizeof (TestCase
)); i
++)
494 sal_Int32 cmpRes
= arrTestCase
[i
].input1
->compareTo
495 (*arrTestCase
[i
].input2
);
496 cmpRes
= ( cmpRes
== 0 ) ? 0 : ( cmpRes
> 0 ) ? +1 : -1 ;
497 sal_Bool lastRes
= ( cmpRes
== arrTestCase
[i
].expVal
);
504 arrTestCase
[i
].comments
,
505 createName( pMeth
, "compareTo_001(const OString&)", i
)
515 //------------------------------------------------------------------------
516 // testing the method compareTo( const OString & rObj, sal_Int32 length )
517 //------------------------------------------------------------------------
518 static sal_Bool SAL_CALL
test_rtl_OUString_compareTo_002(
519 hTestResult hRtlTestResult
)
521 sal_Char methName
[MAXBUFLENGTH
];
522 sal_Char
* pMeth
= methName
;
524 typedef struct TestCase
531 ~TestCase() { delete input1
;delete input2
;}
534 TestCase arrTestCase
[] =
536 {"compare with maxlength, str1 to str9, 16",-1,16,
537 new OUString(aUStr1
), new OUString(aUStr9
)},
538 {"compare with maxlength, str2 to str9, 32",-1,32,
539 new OUString(aUStr2
), new OUString(aUStr9
)},
540 {"compare with maxlength, str9 to str4, 16",+1,16,
541 new OUString(aUStr9
), new OUString(aUStr4
)},
542 {"compare with maxlength, str9 to str22, 32",+1,32,
543 new OUString(aUStr9
), new OUString(aUStr22
)},
544 {"compare with maxlength, str9 to str5, 16",0,16,
545 new OUString(aUStr9
), new OUString(aUStr5
)},
546 {"compare with maxlength, str9 to str9, 32",0,32,
547 new OUString(aUStr9
), new OUString(aUStr9
)},
548 {"compare with maxlength, str1 to str2, 32",-1,32,
549 new OUString(aUStr1
), new OUString(aUStr2
)},
550 {"compare with maxlength, str1 to str2, 32",-1,32,
551 new OUString(aUStr1
), new OUString(aUStr2
)},
552 {"compare with maxlength, str1 to str2", 0,-1,
553 new OUString(aUStr1
), new OUString(aUStr2
)}
556 sal_Bool res
= sal_True
;
559 for(i
= 0; i
< (sizeof (arrTestCase
))/(sizeof (TestCase
)); i
++)
561 sal_Int32 cmpRes
= arrTestCase
[i
].input1
->compareTo
562 (*arrTestCase
[i
].input2
, arrTestCase
[i
].maxLength
);
563 cmpRes
= (cmpRes
== 0) ? 0 : (cmpRes
> 0) ? +1 : -1 ;
564 sal_Bool lastRes
= (cmpRes
== arrTestCase
[i
].expVal
);
570 arrTestCase
[i
].comments
,
571 createName( pMeth
, "compareTo_002(const OString&, sal_Int32)", i
)
580 extern "C" void /* sal_Bool */ SAL_CALL
test_rtl_OUString_compareTo(
581 hTestResult hRtlTestResult
)
583 c_rtl_tres_state_start( hRtlTestResult
, "compareTo");
584 sal_Bool res
= test_rtl_OUString_compareTo_001(hRtlTestResult
);
585 res
&= test_rtl_OUString_compareTo_002(hRtlTestResult
);
586 c_rtl_tres_state_end( hRtlTestResult
, "compareTo");
590 //------------------------------------------------------------------------
591 // testing the method match( const OUString & str, sal_Int32 fromIndex = 0 )
592 //------------------------------------------------------------------------
593 static sal_Bool SAL_CALL
test_rtl_OUString_match_001(
594 hTestResult hRtlTestResult
)
597 sal_Char methName
[MAXBUFLENGTH
];
598 sal_Char
* pMeth
= methName
;
600 typedef struct TestCase
606 ~TestCase() { delete input1
;delete input2
;}
609 TestCase arrTestCase
[]={
611 {"aUStr2 and aUStr1", sal_True
, new OUString(aUStr2
),
612 new OUString(aUStr1
)},
613 {"aUStr1 and aUStr2", sal_False
, new OUString(aUStr1
),
614 new OUString(aUStr2
)},
615 {"aUStr5 and aUStr6", sal_False
, new OUString(aUStr5
),
616 new OUString(aUStr6
)},
617 {"null and aUStr1", sal_False
, new OUString( "",
619 kEncodingRTLTextUSASCII
,
620 kConvertFlagsOStringToOUString
),
621 new OUString(aUStr1
)}
625 sal_Bool res
= sal_True
;
628 for(i
= 0; i
< (sizeof (arrTestCase
))/(sizeof (TestCase
)); i
++)
630 sal_Bool lastRes
= ( arrTestCase
[i
].input1
->match(
631 *(arrTestCase
[i
].input2
)) == arrTestCase
[i
].expVal
);
637 arrTestCase
[i
].comments
,
638 createName( pMeth
, "match(const OUString & str)", i
)
646 static sal_Bool SAL_CALL
test_rtl_OUString_match_002(
647 hTestResult hRtlTestResult
)
650 sal_Char methName
[MAXBUFLENGTH
];
651 sal_Char
* pMeth
= methName
;
653 typedef struct TestCase
660 ~TestCase() { delete input1
;delete input2
;}
663 TestCase arrTestCase
[]={
665 {"aUStr2 from 17 and aUStr6", sal_True
, 17,
666 new OUString(aUStr2
),new OUString(aUStr6
)},
667 {"aUStr2 from 5 and aUStr6", sal_False
, 5,
668 new OUString(aUStr2
),new OUString(aUStr6
)},
669 {"aUStr2 from 0 and aUStr1", sal_True
, 0,
670 new OUString(aUStr2
),new OUString(aUStr1
)},
671 {"aUStr1 from 16 and null", sal_True
, 16,
672 new OUString(aUStr1
),
675 kEncodingRTLTextUSASCII
,
676 kConvertFlagsOStringToOUString
679 {"aUStr1 from 5 and null", sal_True
, 5,
680 new OUString(aUStr1
),
683 kEncodingRTLTextUSASCII
,
684 kConvertFlagsOStringToOUString
687 {"aUStr2 from -1 and aUStr1", sal_False
, -1,
688 new OUString(aUStr2
),new OUString(aUStr1
)},
689 {"aUStr5 from 2 and aUStr4", sal_False
, 2,
690 new OUString(aUStr5
),new OUString(aUStr4
)},
691 {"aUStr2 from 18 and aUStr1", sal_False
, 18,
692 new OUString(aUStr2
),new OUString(aUStr1
)}
695 sal_Bool res
= sal_True
;
698 for(i
= 0; i
< (sizeof (arrTestCase
))/(sizeof (TestCase
)); i
++)
700 sal_Bool lastRes
= ( arrTestCase
[i
].input1
->match
701 (*(arrTestCase
[i
].input2
),arrTestCase
[i
].fromIndex
) ==
702 arrTestCase
[i
].expVal
);
708 arrTestCase
[i
].comments
,
710 "match(const OUString & str,sal_Int32 fromIndex = 0)", i
)
719 extern "C" void /* sal_Bool */ SAL_CALL
test_rtl_OUString_match(
720 hTestResult hRtlTestResult
)
722 c_rtl_tres_state_start( hRtlTestResult
, "match");
723 sal_Bool res
= test_rtl_OUString_match_001(hRtlTestResult
);
724 res
&= test_rtl_OUString_match_002(hRtlTestResult
);
725 c_rtl_tres_state_end( hRtlTestResult
, "match");
729 //------------------------------------------------------------------------
730 // testing the operator +=
731 //------------------------------------------------------------------------
732 extern "C" void /* sal_Bool */ SAL_CALL
test_rtl_OUString_op_eq(
733 hTestResult hRtlTestResult
)
735 c_rtl_tres_state_start( hRtlTestResult
, "eq");
736 sal_Char methName
[MAXBUFLENGTH
];
737 sal_Char
* pMeth
= methName
;
739 typedef struct TestCase
744 ~TestCase() { delete input1
; delete input2
;}
747 TestCase arrTestCase
[]={
748 {"null and Ustr1", new OUString
, new OUString(aUStr1
)},
749 {"Ustr2 and Ustr1", new OUString(aUStr2
),
750 new OUString(aUStr1
)},
751 {""" and Ustr1 from bit charactor buffer",
752 new OUString(aUStr1
),
755 kEncodingRTLTextUSASCII
,
756 kConvertFlagsOStringToOUString
758 {"Ustr1 and Ustr2 from value and length",
759 new OUString( aUStr2
, kTestStr2Len
),
760 new OUString(aUStr1
)}
764 sal_Bool res
= sal_True
;
767 for (i
= 0; i
< (sizeof (arrTestCase
))/(sizeof (TestCase
)); i
++)
769 *(arrTestCase
[i
].input1
) = *(arrTestCase
[i
].input2
);
770 sal_Bool lastRes
= (*(arrTestCase
[i
].input1
) ==
771 *(arrTestCase
[i
].input2
));
776 arrTestCase
[i
].comments
,
777 createName( pMeth
, "op_eq", i
)
782 c_rtl_tres_state_end( hRtlTestResult
, "eq");
786 //------------------------------------------------------------------------
787 // testing the operator +=
788 //------------------------------------------------------------------------
789 extern "C" void /* sal_Bool */ SAL_CALL
test_rtl_OUString_op_peq(
790 hTestResult hRtlTestResult
)
792 c_rtl_tres_state_start( hRtlTestResult
, "peq");
793 sal_Char methName
[MAXBUFLENGTH
];
794 sal_Char
* pMeth
= methName
;
796 typedef struct TestCase
802 ~TestCase() { delete input1
; delete input2
;}
805 TestCase arrTestCase
[]={
806 {" ' '= ''+='' ", new OUString( "",
808 kEncodingRTLTextUSASCII
,
809 kConvertFlagsOStringToOUString
813 kEncodingRTLTextUSASCII
,
814 kConvertFlagsOStringToOUString
818 kEncodingRTLTextUSASCII
,
819 kConvertFlagsOStringToOUString
821 {"Ustr1= null += Ustr1", new OUString(aUStr1
),
822 new OUString(), new OUString(aUStr1
)},
823 {"Ustr1= '' += Ustr1", new OUString(aUStr1
),
826 kEncodingRTLTextUSASCII,
827 kConvertFlagsOStringToOUString
830 new OUString(aUStr1
)},
831 {"Ustr1PlusUStr6 = Ustr1 += Ustr6",
832 new OUString(aUStr1PlusUStr6
), new OUString(aUStr1
),
833 new OUString(aUStr6
)},
837 sal_Bool res
= sal_True
;
840 for (i
= 0; i
< (sizeof (arrTestCase
))/(sizeof (TestCase
)); i
++)
842 *(arrTestCase
[i
].input1
) += *(arrTestCase
[i
].input2
);
843 sal_Bool lastRes
= (*(arrTestCase
[i
].expVal
) ==
844 *(arrTestCase
[i
].input1
));
849 arrTestCase
[i
].comments
,
850 createName( pMeth
, "op_peq", i
)
855 c_rtl_tres_state_end( hRtlTestResult
, "peq");
859 //------------------------------------------------------------------------
860 // testing the operator const sal_Unicode * (csuc for short)
861 //------------------------------------------------------------------------
862 extern "C" void /* sal_Bool */ SAL_CALL
test_rtl_OUString_csuc(
863 hTestResult hRtlTestResult
)
865 c_rtl_tres_state_start( hRtlTestResult
, "csuc");
866 sal_Char methName
[MAXBUFLENGTH
];
867 sal_Char
* pMeth
= methName
;
869 const sal_Unicode tmpUC
=0x0;
870 rtl_uString
* tmpUstring
= NULL
;
871 const sal_Char
*tmpStr
=kTestStr1
;
872 sal_Int32 tmpLen
=(sal_Int32
) kTestStr1Len
;
873 // sal_Int32 cmpLen = 0;
875 rtl_string2UString( &tmpUstring
, tmpStr
, tmpLen
,
876 osl_getThreadTextEncoding(), OSTRING_TO_OUSTRING_CVTFLAGS
);
877 OSL_ASSERT(tmpUstring
!= NULL
);
880 typedef struct TestCase
883 const sal_Unicode
* expVal
;
886 ~TestCase() { delete input1
;}
889 TestCase arrTestCase
[] =
891 {"test normal ustring",(*tmpUstring
).buffer
,kTestStr1Len
,
892 new OUString(aUStr1
)},
893 {"test empty ustring",&tmpUC
, 1, new OUString()}
896 sal_Bool res
= sal_True
;
898 for(i
= 0; i
< (sizeof (arrTestCase
))/(sizeof (TestCase
)); i
++)
900 const sal_Unicode
* pstr
= *arrTestCase
[i
].input1
;
902 res
&= c_rtl_tres_state
905 cmpstr((sal_Char
*)pstr
,
906 (sal_Char
*)arrTestCase
[i
].expVal
,
907 arrTestCase
[i
].cmpLen
),
908 arrTestCase
[i
].comments
,
909 createName( pMeth
, "const sal_Unicode*", i
)
912 c_rtl_tres_state_end( hRtlTestResult
, "csuc");
916 //------------------------------------------------------------------------
917 // testing the method const sal_Unicode * getStr()
918 //------------------------------------------------------------------------
919 extern "C" void /* sal_Bool */ SAL_CALL
test_rtl_OUString_getStr(
920 hTestResult hRtlTestResult
)
922 c_rtl_tres_state_start( hRtlTestResult
, "getStr");
923 sal_Char methName
[MAXBUFLENGTH
];
924 sal_Char
* pMeth
= methName
;
926 const sal_Unicode tmpUC
=0x0;
927 rtl_uString
* tmpUstring
= NULL
;
928 const sal_Char
*tmpStr
=kTestStr1
;
929 sal_Int32 tmpLen
=(sal_Int32
) kTestStr1Len
;
930 // sal_Int32 cmpLen = 0;
932 rtl_string2UString( &tmpUstring
, tmpStr
, tmpLen
,
933 osl_getThreadTextEncoding(), OSTRING_TO_OUSTRING_CVTFLAGS
);
934 OSL_ASSERT(tmpUstring
!= NULL
);
937 typedef struct TestCase
940 const sal_Unicode
* expVal
;
943 ~TestCase() { delete input1
;}
946 TestCase arrTestCase
[] =
948 {"test normal ustring",(*tmpUstring
).buffer
,kTestStr1Len
,
949 new OUString(aUStr1
)},
950 {"test empty ustring",&tmpUC
, 1, new OUString()}
953 sal_Bool res
= sal_True
;
955 for(i
= 0; i
< (sizeof (arrTestCase
))/(sizeof (TestCase
)); i
++)
957 const sal_Unicode
* pstr
= arrTestCase
[i
].input1
->getStr();
959 res
&= c_rtl_tres_state
962 cmpstr((sal_Char
*)pstr
,
963 (sal_Char
*)arrTestCase
[i
].expVal
,
964 arrTestCase
[i
].cmpLen
),
965 arrTestCase
[i
].comments
,
966 createName( pMeth
, "getStr", i
)
969 c_rtl_tres_state_end( hRtlTestResult
, "getStr");
974 //------------------------------------------------------------------------
975 // testing the method sal_Int32 reverseCompareTo( const OUString & str )
976 //-------------------------------------------------------------------------
977 extern "C" void /* sal_Bool */ SAL_CALL
test_rtl_OUString_reverseCompareTo(
978 hTestResult hRtlTestResult
)
980 c_rtl_tres_state_start( hRtlTestResult
, "reverseCompareTo");
981 sal_Char methName
[MAXBUFLENGTH
];
982 sal_Char
* pMeth
= methName
;
984 typedef struct TestCase
990 ~TestCase() { delete input1
;delete input2
;}
993 TestCase arrTestCase
[]={
995 {"simple compare, str1 to str5",-1,new OUString(aUStr1
),
998 {"simple compare, str2 to str5",1,new OUString(aUStr2
),
1001 {"simple compare, str1 to str9",-1,new OUString(aUStr1
),
1002 new OUString(aUStr9
)
1004 {"simple compare, str4 to str5",-1,new OUString(aUStr4
),
1005 new OUString(aUStr5
)
1007 {"simple compare, str5 to str1",+1,new OUString(aUStr5
),
1008 new OUString(aUStr1
)
1010 {"simple compare, str2 to str1",+1,new OUString(aUStr2
),
1011 new OUString(aUStr1
)
1013 {"simple compare, str1 to str1",0,new OUString(aUStr1
),
1014 new OUString(aUStr1
)
1016 {"simple compare, nullString to nullString",0,new OUString(),
1019 {"simple compare, nullString to str2",-1,new OUString(),
1020 new OUString(aUStr2
)
1022 {"simple compare, str1 to nullString",+1,new OUString(aUStr1
),
1027 sal_Bool res
= sal_True
;
1030 for(i
= 0; i
< (sizeof (arrTestCase
))/(sizeof (TestCase
)); i
++)
1032 sal_Int32 cmpRes
= arrTestCase
[i
].input1
->reverseCompareTo
1033 (*arrTestCase
[i
].input2
);
1034 cmpRes
= ( cmpRes
== 0 ) ? 0 : ( cmpRes
> 0 ) ? +1 : -1 ;
1035 sal_Bool lastRes
= ( cmpRes
== arrTestCase
[i
].expVal
);
1042 arrTestCase
[i
].comments
,
1043 createName( pMeth
, "compareTo(const OString&)", i
)
1048 c_rtl_tres_state_end( hRtlTestResult
, "reverseCompareTo");
1052 //------------------------------------------------------------------------
1053 // testing the method sal_Bool equalsAscii( const sal_Char* asciiStr )
1054 //------------------------------------------------------------------------
1055 extern "C" void /* sal_Bool */ SAL_CALL
test_rtl_OUString_equalsAscii(
1056 hTestResult hRtlTestResult
)
1058 c_rtl_tres_state_start( hRtlTestResult
, "equalsAscii");
1059 sal_Char methName
[MAXBUFLENGTH
];
1060 sal_Char
* pMeth
= methName
;
1062 const sal_Char
*tmpAstr1
="Sun Microsystems\0";
1063 const sal_Char
*tmpAstr2
="\0";
1067 typedef struct TestCase
1072 const sal_Char
* input2
;
1073 ~TestCase() { delete input1
;}
1076 TestCase arrTestCase
[]={
1077 {"str1 with str1 ", sal_True
, new OUString( kTestStr1
,
1079 kEncodingRTLTextUSASCII
,
1080 kConvertFlagsOStringToOUString
1082 {"str2 with str1 ", sal_False
,new OUString( kTestStr2
,
1084 kEncodingRTLTextUSASCII
,
1085 kConvertFlagsOStringToOUString
1087 {"null with str1 ", sal_False
, new OUString(), tmpAstr1
},
1088 {"null with '' ", sal_True
, new OUString(), tmpAstr2
},
1089 {"'' with ''", sal_True
, new OUString( "",
1091 kEncodingRTLTextUSASCII
,
1092 kConvertFlagsOStringToOUString
1099 sal_Bool res
= sal_True
;
1102 for (i
= 0; i
< (sizeof (arrTestCase
))/(sizeof (TestCase
)); i
++)
1105 sal_Bool lastRes
= (arrTestCase
[i
].expVal
==
1106 arrTestCase
[i
].input1
->equalsAscii(arrTestCase
[i
].input2
));
1111 arrTestCase
[i
].comments
,
1112 createName( pMeth
, "equalsAscii", i
)
1117 c_rtl_tres_state_end( hRtlTestResult
, "equalsAscii");
1123 //------------------------------------------------------------------------
1124 // testing the method sal_Bool equalsAsciiL(
1125 // const sal_Char* asciiStr, sal_Int32 asciiStrLength )
1126 //------------------------------------------------------------------------
1127 extern "C" void /* sal_Bool */ SAL_CALL
test_rtl_OUString_equalsAsciiL(
1128 hTestResult hRtlTestResult
)
1130 c_rtl_tres_state_start( hRtlTestResult
, "equalsAsciiL");
1131 sal_Char methName
[MAXBUFLENGTH
];
1132 sal_Char
* pMeth
= methName
;
1134 const sal_Char
*tmpAstr1
="Sun Microsystems\0";
1135 const sal_Char
*tmpAstr2
="\0";
1136 const sal_Char
*tmpAstr3
="Sun Microsystems Java Technology\0";
1140 typedef struct TestCase
1145 const sal_Char
* input2
;
1147 ~TestCase() { delete input1
;}
1150 TestCase arrTestCase
[]={
1151 {"str1 with str1,str1Len ", sal_True
, new OUString( kTestStr1
,
1153 kEncodingRTLTextUSASCII
,
1154 kConvertFlagsOStringToOUString
1155 ), tmpAstr1
, kTestStr1Len
},
1156 {"str2 with str1,str1Len", sal_False
,new OUString( kTestStr2
,
1158 kEncodingRTLTextUSASCII
,
1159 kConvertFlagsOStringToOUString
1160 ), tmpAstr1
, kTestStr1Len
},
1161 {"str1 with str2,str1Len", sal_True
,new OUString( kTestStr1
,
1163 kEncodingRTLTextUSASCII
,
1164 kConvertFlagsOStringToOUString
1165 ), tmpAstr3
, kTestStr1Len
},
1166 {"null with str1,1 ", sal_False
, new OUString(), tmpAstr1
, 1},
1167 {"null with '',1 ", sal_False
, new OUString(), tmpAstr2
, 1},
1168 {"'' with '', 1", sal_False
, new OUString( "",
1170 kEncodingRTLTextUSASCII
,
1171 kConvertFlagsOStringToOUString
1178 sal_Bool res
= sal_True
;
1181 for (i
= 0; i
< (sizeof (arrTestCase
))/(sizeof (TestCase
)); i
++)
1184 sal_Bool lastRes
= (arrTestCase
[i
].expVal
==
1185 arrTestCase
[i
].input1
->equalsAsciiL(arrTestCase
[i
].input2
,
1186 arrTestCase
[i
].cmpLen
)
1192 arrTestCase
[i
].comments
,
1193 createName( pMeth
, "equalsAsciiL", i
)
1198 c_rtl_tres_state_end( hRtlTestResult
, "equalsAsciiL");
1202 //------------------------------------------------------------------------
1203 // testing the method sal_Int32 compareToAscii( const sal_Char* asciiStr )
1204 //------------------------------------------------------------------------
1205 extern "C" void /* sal_Bool */ SAL_CALL
test_rtl_OUString_compareToAscii(
1206 hTestResult hRtlTestResult
)
1208 c_rtl_tres_state_start( hRtlTestResult
, "compareToAscii");
1209 sal_Char methName
[MAXBUFLENGTH
];
1210 sal_Char
* pMeth
= methName
;
1212 const sal_Char
*tmpAstr1
="Sun Microsystems\0";
1213 const sal_Char
*tmpAstr2
="\0";
1214 const sal_Char
*tmpAstr3
="sun microsystems java technology\0";
1215 const sal_Char
*tmpAstr4
="Sun Microsystems Java Technology\0";
1218 typedef struct TestCase
1223 const sal_Char
* input2
;
1224 ~TestCase() { delete input1
;}
1227 TestCase arrTestCase
[]={
1228 {"str1 with str1 ", 0, new OUString( kTestStr1
,
1230 kEncodingRTLTextUSASCII
,
1231 kConvertFlagsOStringToOUString
1233 {"str1 with '' ", 83, new OUString( kTestStr1
,
1235 kEncodingRTLTextUSASCII
,
1236 kConvertFlagsOStringToOUString
1238 {"null with str1 ", -83 , new OUString(), tmpAstr1
},
1239 {"null with '' ", 0, new OUString(), tmpAstr2
},
1240 {"str1 with str9", -32, new OUString( kTestStr1
,
1242 kEncodingRTLTextUSASCII
,
1243 kConvertFlagsOStringToOUString
1246 {"str1 with str2", -32, new OUString( kTestStr1
,
1248 kEncodingRTLTextUSASCII
,
1249 kConvertFlagsOStringToOUString
1256 sal_Bool res
= sal_True
;
1259 for (i
= 0; i
< (sizeof (arrTestCase
))/(sizeof (TestCase
)); i
++)
1261 sal_Bool lastRes
= (arrTestCase
[i
].expVal
==
1262 arrTestCase
[i
].input1
->compareToAscii(arrTestCase
[i
].input2
));
1268 arrTestCase
[i
].comments
,
1269 createName( pMeth
, "equalsAscii", i
)
1274 c_rtl_tres_state_end( hRtlTestResult
, "compareToAscii");
1279 //------------------------------------------------------------------------
1280 // testing the method valueOf( sal_Bool b )
1281 //------------------------------------------------------------------------
1282 extern "C" void /* sal_Bool */ SAL_CALL
test_rtl_OUString_valueOf_sal_Bool(
1283 hTestResult hRtlTestResult
)
1285 c_rtl_tres_state_start( hRtlTestResult
, "Bool");
1286 sal_Char methName
[MAXBUFLENGTH
];
1287 sal_Char
* pMeth
= methName
;
1289 typedef struct TestCase
1295 ~TestCase() {delete expVal
;}
1298 TestCase arrTestCase
[]=
1300 {"input Bool 'true' and return OUString 'true'",
1301 new OUString("true",4,kEncodingRTLTextUSASCII
,
1302 kConvertFlagsOStringToOUString
),
1305 {"input Bool 'false' and return OUString 'false'",
1306 new OUString("false",5,kEncodingRTLTextUSASCII
,
1307 kConvertFlagsOStringToOUString
),
1315 for(i
=0;i
<(sizeof(arrTestCase
))/(sizeof(TestCase
));i
++)
1317 sal_Bool lastRes
=(*arrTestCase
[i
].expVal
==
1318 OUString::valueOf(arrTestCase
[i
].input1
)
1322 c_rtl_tres_state(hRtlTestResult
,
1324 arrTestCase
[i
].comments
,
1325 createName( pMeth
, "valueOf( sal_Bool b )", i
)
1330 c_rtl_tres_state_end( hRtlTestResult
, "Bool");
1334 //------------------------------------------------------------------------
1335 extern "C" void /* sal_Bool */ SAL_CALL
test_rtl_OUString_valueOf_sal_Unicode(
1336 hTestResult hRtlTestResult
)
1338 c_rtl_tres_state_start( hRtlTestResult
, "Unicode");
1339 sal_Char methName
[MAXBUFLENGTH
];
1340 sal_Char
* pMeth
= methName
;
1342 sal_Unicode tmpchar1
=97;
1343 sal_Unicode tmpchar2
=53;
1344 sal_Unicode tmpchar3
=0;
1345 sal_Unicode tmpchar4
=32;
1346 sal_Unicode tmpchar5
=47;
1348 typedef struct TestCase
1354 ~TestCase() {delete expVal
;}
1357 TestCase arrTestCase
[]=
1359 {"input Unicode 'a' and return OUString 'a'",
1360 new OUString(&tmpchar1
,1),tmpchar1
1362 {"input Unicode '5' and return OUString '5'",
1363 new OUString(&tmpchar2
,1), tmpchar2
1365 {"input Unicode 0 and return OUString 0",
1366 new OUString(&tmpchar3
,1),tmpchar3
1368 {"input Unicode ' ' and return OUString ' '",
1369 new OUString(&tmpchar4
,1),tmpchar4
1371 {"input Unicode '/' and return OUString ' '",
1372 new OUString(&tmpchar5
,1),tmpchar5
1376 sal_Bool res
=sal_True
;
1379 for(i
=0;i
<(sizeof(arrTestCase
))/(sizeof(TestCase
));i
++)
1381 sal_Bool lastRes
=(*(arrTestCase
[i
].expVal
)==
1382 OUString::valueOf(arrTestCase
[i
].input1
));
1384 c_rtl_tres_state(hRtlTestResult
,
1386 arrTestCase
[i
].comments
,
1387 createName( pMeth
, "valueOf( sal_Unicode c )", i
)
1392 c_rtl_tres_state_end( hRtlTestResult
, "Unicode");
1398 * Calls the method valueOf(T, radix) and compares
1399 * returned ustrings with ustrings that passed in the array resArray.
1401 * @param T, type of argument, passed to valueOf
1402 * @param resArray, array of result ustrings to compare to
1403 * @param n the number of elements in the array resArray (testcases)
1404 * @param pTestResult the instance of the class TestResult
1405 * @param inArray [optional], array of value that is passed as first argument
1408 * @return true, if all returned ustrings are equal to corresponding ustring in
1409 * resArray else, false.
1412 sal_Bool
test_valueOf( const char** resArray
, int n
, sal_Int16 radix
,
1413 hTestResult hRtlTestResult
, const T
*inArray
)
1415 sal_Bool bRes
= sal_True
;
1417 sal_Char methName
[MAXBUFLENGTH
];
1418 sal_Char
* pMeth
= methName
;
1420 // static sal_Unicode aUchar[50]={0x12};
1422 for (i
= 0; i
< n
; i
++)
1424 ::rtl::OUString aStr1
;
1426 OSL_ENSURE( i
< 50, "ERROR: leave aUchar bound");
1428 // AStringToUStringCopy(aUchar,resArray[i]);
1429 // ::rtl::OUString aStr2(aUchar);
1430 rtl::OUString aStr2
;
1431 aStr2
= OUString::createFromAscii(resArray
[i
]);
1433 ::rtl::OUString
aStr3( "-",1,kEncodingRTLTextUSASCII
,
1434 kConvertFlagsOStringToOUString
);
1438 aStr1
= ::rtl::OUString::valueOf((T
)i
, radix
);
1442 if ( inArray
[i
] < 0 )
1444 sal_Unicode aStr4
[100];
1445 OSL_ASSERT(strlen(resArray
[i
]) < 100);
1447 if(AStringToUStringCopy(aStr4
,resArray
[i
]))
1454 aStr1
= ::rtl::OUString::valueOf((T
)inArray
[i
], radix
);
1457 bRes
&= c_rtl_tres_state
1460 aStr2
.compareTo(aStr1
) == 0,
1461 (sal_Char
*)resArray
[i
],
1462 createName( pMeth
, "valueOf", i
)
1470 #define test_valueOf_Int32 test_valueOf<sal_Int32>
1471 #define test_valueOf_Int64 test_valueOf<sal_Int64>
1472 // LLA: #define test_valueOf_float test_valueOf<float>
1473 // LLA: #define test_valueOf_double test_valueOf<double>
1475 //------------------------------------------------------------------------
1476 // testing the method valueOf( sal_Int32 i, sal_Int16 radix=2 )
1477 // testing the method valueOf( sal_Int32 i, sal_Int16 radix=8 )
1478 // testing the method valueOf( sal_Int32 i, sal_Int16 radix=10 )
1479 // testing the method valueOf( sal_Int32 i, sal_Int16 radix=16 )
1480 // testing the method valueOf( sal_Int32 i, sal_Int16 radix=36 )
1481 //------------------------------------------------------------------------
1482 sal_Bool SAL_CALL
test_rtl_OUString_valueOf_Int32(
1483 hTestResult hRtlTestResult
)
1485 sal_Bool bRes
= sal_False
;
1487 bRes
= c_rtl_tres_state
1490 test_valueOf_Int32((const char**)kBinaryNumsStr
,
1491 kBinaryNumsCount
, kRadixBinary
, hRtlTestResult
, 0 ),
1493 "valueOf(sal_Int32, radix 2)"
1497 bRes
&= c_rtl_tres_state
1500 test_valueOf_Int32((const char**)kOctolNumsStr
,
1501 kOctolNumsCount
, kRadixOctol
, hRtlTestResult
, 0),
1503 "valueOf(sal_Int32, radix 8)"
1506 bRes
&= c_rtl_tres_state
1509 test_valueOf_Int32((const char**)kDecimalNumsStr
,
1510 kDecimalNumsCount
, kRadixDecimal
, hRtlTestResult
, 0),
1512 "valueOf(sal_Int32, radix 10)"
1515 bRes
&= c_rtl_tres_state
1518 test_valueOf_Int32((const char**)kHexDecimalNumsStr
,
1519 kHexDecimalNumsCount
, kRadixHexdecimal
, hRtlTestResult
, 0),
1521 "valueOf(sal_Int32, radix 16)"
1524 bRes
&= c_rtl_tres_state
1527 test_valueOf_Int32((const char**)kBase36NumsStr
,
1528 kBase36NumsCount
, kRadixBase36
, hRtlTestResult
, 0),
1530 "valueOf(sal_Int32, radix 36)"
1537 //------------------------------------------------------------------------
1538 // testing the method valueOf( sal_Int32 l, sal_Int32 radix=2 )
1539 // where l = large constants
1540 // testing the method valueOf( sal_Int32 l, sal_Int32 radix=8 )
1541 // where l = large constants
1542 // testing the method valueOf( sal_Int32 l, sal_Int32 radix=10 )
1543 // where l = large constants
1544 // testing the method valueOf( sal_Int32 l, sal_Int32 radix=16 )
1545 // where l = large constants
1546 // testing the method valueOf( sal_Int32 l, sal_Int32 radix=36 )
1547 // where l = large constants
1548 //------------------------------------------------------------------------
1549 sal_Bool SAL_CALL
test_rtl_OUString_valueOf_Int32_Bounderies(
1550 hTestResult hRtlTestResult
)
1552 sal_Bool bRes
= sal_False
;
1554 bRes
= c_rtl_tres_state
1557 test_valueOf_Int32((const char**)kBinaryMaxNumsStr
,
1558 kInt32MaxNumsCount
, kRadixBinary
,
1559 hRtlTestResult
, kInt32MaxNums
),
1561 "valueOf(salInt32, radix 2) Bounderies"
1564 bRes
&= c_rtl_tres_state
1567 test_valueOf_Int32((const char**)kOctolMaxNumsStr
,
1568 kInt32MaxNumsCount
, kRadixOctol
,
1569 hRtlTestResult
, kInt32MaxNums
),
1571 "valueOf(salInt32, radix 8) Bounderies"
1574 bRes
&= c_rtl_tres_state
1577 test_valueOf_Int32((const char**)kDecimalMaxNumsStr
,
1578 kInt32MaxNumsCount
, kRadixDecimal
,
1579 hRtlTestResult
, kInt32MaxNums
),
1581 "valueOf(salInt32, radix 10) Bounderies"
1584 bRes
&= c_rtl_tres_state
1587 test_valueOf_Int32((const char**)kHexDecimalMaxNumsStr
,
1588 kInt32MaxNumsCount
, kRadixHexdecimal
,
1589 hRtlTestResult
, kInt32MaxNums
),
1591 "valueOf(salInt32, radix 16) Bounderies"
1594 bRes
&= c_rtl_tres_state
1597 test_valueOf_Int32((const char**)kBase36MaxNumsStr
,
1598 kInt32MaxNumsCount
, kRadixBase36
,
1599 hRtlTestResult
, kInt32MaxNums
),
1601 "valueOf(salInt32, radix 36) Bounderies"
1607 //------------------------------------------------------------------------
1608 // testing the method valueOf( sal_Int32 i, sal_Int16 radix=2 )
1609 // for negative value
1610 // testing the method valueOf( sal_Int32 i, sal_Int16 radix=8 )
1611 // for negative value
1612 // testing the method valueOf( sal_Int32 i, sal_Int16 radix=10 )
1613 // for negative value
1614 // testing the method valueOf( sal_Int32 i, sal_Int16 radix=16 )
1615 // for negative value
1616 // testing the method valueOf( sal_Int32 i, sal_Int16 radix=36 )
1617 // for negative value
1618 //------------------------------------------------------------------------
1619 sal_Bool SAL_CALL
test_rtl_OUString_valueOf_Int32_Negative(
1620 hTestResult hRtlTestResult
)
1622 sal_Bool bRes
= sal_False
;
1623 sal_Int32 inArr
[kBase36NumsCount
];
1626 for (i
= 0; i
< kBase36NumsCount
; i
++ )
1629 bRes
= c_rtl_tres_state
1632 test_valueOf_Int32( kBinaryNumsStr
, kBinaryNumsCount
,
1633 kRadixBinary
, hRtlTestResult
, inArr
),
1634 "negative Int32, kRadixBinary",
1635 "valueOf( negative Int32, radix 2 )"
1638 bRes
&= c_rtl_tres_state
1641 test_valueOf_Int32( kOctolNumsStr
, kOctolNumsCount
,
1642 kRadixOctol
, hRtlTestResult
, inArr
),
1643 "negative Int32, kRadixOctol",
1644 "valueOf( negative Int32, radix 8 )"
1648 bRes
&= c_rtl_tres_state
1651 test_valueOf_Int32( kDecimalNumsStr
, kDecimalNumsCount
,
1652 kRadixDecimal
, hRtlTestResult
, inArr
),
1653 "negative Int32, kRadixDecimal",
1654 "valueOf( negative Int32, radix 10 )"
1657 bRes
&= c_rtl_tres_state
1660 test_valueOf_Int32( kHexDecimalNumsStr
, kHexDecimalNumsCount
,
1661 kRadixHexdecimal
, hRtlTestResult
, inArr
),
1662 "negative Int32, kRadixHexdecimal",
1663 "valueOf( negative Int32, radix 16 )"
1667 bRes
&= c_rtl_tres_state
1670 test_valueOf_Int32( kBase36NumsStr
, kBase36NumsCount
,
1671 kRadixBase36
, hRtlTestResult
, inArr
),
1672 "negative Int32, kRadixBase36",
1673 "valueOf( negative Int32, radix 36 )"
1678 //------------------------------------------------------------------------
1679 // testing the method valueOf( sal_Int32 l, sal_Int32 radix ) where radix = -5
1680 //------------------------------------------------------------------------
1681 sal_Bool SAL_CALL
test_rtl_OUString_valueOf_Int32_WrongRadix(
1682 hTestResult hRtlTestResult
)
1684 sal_Bool bRes
= sal_False
;
1686 sal_Int32 intVal
= 11;
1688 ::rtl::OUString aStr1
;
1689 ::rtl::OUString
aStr2("11",2,kEncodingRTLTextUSASCII
,
1690 kConvertFlagsOStringToOUString
);
1692 aStr1
= aStr1
.valueOf( intVal
, -5 );
1694 bRes
= c_rtl_tres_state
1697 aStr2
.compareTo( aStr1
) == 0,
1698 "if radix not valid then radix must be 10",
1699 "valueOf(sal_Int32, sal_Int32 radix): radix = -5"
1706 //------------------------------------------------------------------------
1707 static sal_Bool SAL_CALL
test_rtl_OUString_valueOf_Int32_defaultParam(
1708 hTestResult hRtlTestResult
)
1710 sal_Char methName
[MAXBUFLENGTH
];
1711 sal_Char
* pMeth
= methName
;
1713 sal_Char
* newUChar1
="15";
1714 sal_Char
* newUChar2
="0";
1715 sal_Char
* newUChar3
="-15";
1716 sal_Char
* newUChar4
="2147483647";
1717 sal_Char
* newUChar5
="-2147483648";
1719 typedef struct TestCase
1724 ~TestCase() {delete expVal
;}
1727 TestCase arrTestCase
[]=
1729 {"input Int32 15 and return OUString 15",15,
1730 new OUString(newUChar1
,2,kEncodingRTLTextUSASCII
,
1731 kConvertFlagsOStringToOUString
)
1733 {"input Int32 0 and return OUString 0",0,
1734 new OUString(newUChar2
,1,kEncodingRTLTextUSASCII
,
1735 kConvertFlagsOStringToOUString
)
1737 {"input Int32 -15 and return OUString -15",-15,
1738 new OUString(newUChar3
,3,kEncodingRTLTextUSASCII
,
1739 kConvertFlagsOStringToOUString
)
1741 {"input Int32 2147483647 and return OUString 2147483647", SAL_MAX_INT32
/* 2147483647 */,
1742 new OUString(newUChar4
,10,kEncodingRTLTextUSASCII
,
1743 kConvertFlagsOStringToOUString
)
1745 {"input Int32 -2147483648 and return OUString -2147483648",
1746 SAL_MIN_INT32
/* 2-2147483648 */,
1747 new OUString(newUChar5
,11,kEncodingRTLTextUSASCII
,
1748 kConvertFlagsOStringToOUString
)
1752 sal_Bool res
=sal_True
;
1755 for(i
=0;i
<(sizeof(arrTestCase
))/(sizeof(TestCase
));i
++)
1757 sal_Bool lastRes
=(*(arrTestCase
[i
].expVal
)==
1758 OUString::valueOf(arrTestCase
[i
].input1
));
1760 c_rtl_tres_state(hRtlTestResult
,
1762 arrTestCase
[i
].comments
,
1764 "valueOf( sal_Int32 i, sal_Int16 radix = 10 )", i
)
1773 //------------------------------------------------------------------------
1774 // testing the method valueOf( sal_Int64 l, sal_Int16 radix=2 )
1775 // testing the method valueOf( sal_Int64 l, sal_Int16 radix=8 )
1776 // testing the method valueOf( sal_Int64 l, sal_Int16 radix=10 )
1777 // testing the method valueOf( sal_Int64 l, sal_Int16 radix=16 )
1778 // testing the method valueOf( sal_Int64 l, sal_Int16 radix=36 )
1779 //------------------------------------------------------------------------
1780 sal_Bool SAL_CALL
test_rtl_OUString_valueOf_Int64(
1781 hTestResult hRtlTestResult
)
1783 sal_Bool bRes
= sal_False
;
1785 bRes
= c_rtl_tres_state
1788 test_valueOf_Int64((const char**)kBinaryNumsStr
,
1789 kBinaryNumsCount
, kRadixBinary
, hRtlTestResult
, 0),
1791 "valueOf(sal_Int64, radix 2)_"
1794 bRes
&= c_rtl_tres_state
1797 test_valueOf_Int64((const char**)kOctolNumsStr
,
1798 kOctolNumsCount
, kRadixOctol
, hRtlTestResult
, 0),
1800 "valueOf(sal_Int64, radix 8)_"
1803 bRes
&= c_rtl_tres_state
1806 test_valueOf_Int64((const char**)kDecimalNumsStr
,
1807 kDecimalNumsCount
, kRadixDecimal
, hRtlTestResult
, 0),
1809 "valueOf(sal_Int64, radix 10)_"
1811 bRes
&= c_rtl_tres_state
1814 test_valueOf_Int64((const char**)kHexDecimalNumsStr
,
1815 kHexDecimalNumsCount
, kRadixHexdecimal
, hRtlTestResult
, 0),
1817 "valueOf(sal_Int64, radix 16)_"
1820 bRes
&= c_rtl_tres_state
1823 test_valueOf_Int64((const char**)kBase36NumsStr
,
1824 kBase36NumsCount
, kRadixBase36
, hRtlTestResult
, 0),
1826 "valueOf(sal_Int64, radix 36)_"
1832 //------------------------------------------------------------------------
1833 // testing the method valueOf( sal_Int64 l, sal_Int32 radix=2 )
1834 // where l = large constants
1835 // testing the method valueOf( sal_Int64 l, sal_Int32 radix=8 )
1836 // where l = large constants
1837 // testing the method valueOf( sal_Int64 l, sal_Int32 radix=10 )
1838 // where l = large constants
1839 // testing the method valueOf( sal_Int64 l, sal_Int32 radix=16 )
1840 // where l = large constants
1841 // testing the method valueOf( sal_Int64 l, sal_Int32 radix=36 )
1842 // where l = large constants
1843 //------------------------------------------------------------------------
1844 sal_Bool SAL_CALL
test_rtl_OUString_valueOf_Int64_Bounderies(
1845 hTestResult hRtlTestResult
)
1847 sal_Bool bRes
= sal_False
;
1849 bRes
= c_rtl_tres_state
1852 test_valueOf_Int64((const char**)kBinaryMaxNumsStr
,
1853 kInt64MaxNumsCount
, kRadixBinary
,
1854 hRtlTestResult
, kInt64MaxNums
),
1856 "valueOf(salInt64, radix 2) Bounderies"
1859 bRes
&= c_rtl_tres_state
1862 test_valueOf_Int64((const char**)kOctolMaxNumsStr
,
1863 kInt64MaxNumsCount
, kRadixOctol
,
1864 hRtlTestResult
, kInt64MaxNums
),
1866 "valueOf(salInt64, radix 8) Bounderies"
1869 bRes
&= c_rtl_tres_state
1872 test_valueOf_Int64((const char**)kDecimalMaxNumsStr
,
1873 kInt64MaxNumsCount
, kRadixDecimal
,
1874 hRtlTestResult
, kInt64MaxNums
),
1876 "valueOf(salInt64, radix 10) Bounderies"
1879 bRes
&= c_rtl_tres_state
1882 test_valueOf_Int64((const char**)kHexDecimalMaxNumsStr
,
1883 kInt64MaxNumsCount
, kRadixHexdecimal
,
1884 hRtlTestResult
, kInt64MaxNums
),
1886 "valueOf(salInt64, radix 16) Bounderies"
1889 bRes
&= c_rtl_tres_state
1892 test_valueOf_Int64((const char**)kBase36MaxNumsStr
,
1893 kInt64MaxNumsCount
, kRadixBase36
,
1894 hRtlTestResult
, kInt64MaxNums
),
1896 "valueOf(salInt64, radix 36) Bounderies"
1902 //------------------------------------------------------------------------
1903 // testing the method valueOf( sal_Int64 l, sal_Int16 radix=2 )
1904 // for negative value
1905 // testing the method valueOf( sal_Int64 l, sal_Int16 radix=8 )
1906 // for negative value
1907 // testing the method valueOf( sal_Int64 l, sal_Int16 radix=10 )
1908 // for negative value
1909 // testing the method valueOf( sal_Int64 l, sal_Int16 radix=16 )
1910 // for negative value
1911 // testing the method valueOf( sal_Int64 l, sal_Int16 radix=36 )
1912 // for negative value
1913 //------------------------------------------------------------------------
1914 sal_Bool SAL_CALL
test_rtl_OUString_valueOf_Int64_Negative(
1915 hTestResult hRtlTestResult
)
1917 sal_Bool bRes
= sal_False
;
1919 sal_Int64 inArr
[36];
1922 for (i
= 0; i
< 36; i
++) {
1927 bRes
= c_rtl_tres_state
1930 test_valueOf_Int64( kBinaryNumsStr
, kBinaryNumsCount
,
1931 kRadixBinary
, hRtlTestResult
, inArr
),
1932 "negative Int64, kRadixBinary",
1933 "valueOf( negative Int64, radix 2 )"
1936 bRes
&= c_rtl_tres_state
1939 test_valueOf_Int64( kOctolNumsStr
, kOctolNumsCount
,
1940 kRadixOctol
, hRtlTestResult
, inArr
),
1941 "negative Int64, kRadixOctol",
1942 "valueOf( negative Int64, radix 8 )"
1945 bRes
&= c_rtl_tres_state
1948 test_valueOf_Int64( kDecimalNumsStr
, kDecimalNumsCount
,
1949 kRadixDecimal
, hRtlTestResult
, inArr
),
1950 "negative Int64, kRadixDecimal",
1951 "valueOf( negative Int64, radix 10 )"
1954 bRes
&= c_rtl_tres_state
1957 test_valueOf_Int64( kHexDecimalNumsStr
, kHexDecimalNumsCount
,
1958 kRadixHexdecimal
, hRtlTestResult
, inArr
),
1959 "negative Int64, kRadixHexDecimal",
1960 "valueOf( negative Int64, radix 16 )"
1963 bRes
&= c_rtl_tres_state
1966 test_valueOf_Int64( kBase36NumsStr
, kBase36NumsCount
,
1967 kRadixBase36
, hRtlTestResult
, inArr
),
1968 "negative Int64, kRadixBase36",
1969 "valueOf( negative Int64, radix 36 )"
1974 //------------------------------------------------------------------------
1975 // testing the method valueOf( sal_Int64 l, sal_Int32 radix )
1977 //------------------------------------------------------------------------
1978 sal_Bool SAL_CALL
test_rtl_OUString_valueOf_Int64_WrongRadix(
1979 hTestResult hRtlTestResult
)
1981 sal_Bool bRes
= sal_False
;
1983 sal_Int64 intVal
= 11;
1985 ::rtl::OUString aStr1
;
1986 ::rtl::OUString
aStr2("11",2,kEncodingRTLTextUSASCII
,
1987 kConvertFlagsOStringToOUString
);
1989 aStr1
= aStr1
.valueOf( intVal
, -5 );
1991 bRes
= c_rtl_tres_state
1994 aStr2
.compareTo(aStr1
) == 0,
1995 "if radix not valid then radix must be 10",
1996 "valueOf(sal_Int64, sal_Int32 radix): radix = -5"
2002 //------------------------------------------------------------------------
2003 static sal_Bool SAL_CALL
test_rtl_OUString_valueOf_Int64_defaultParam(
2004 hTestResult hRtlTestResult
)
2006 sal_Char methName
[MAXBUFLENGTH
];
2007 sal_Char
* pMeth
= methName
;
2009 sal_Char
* newUChar1
="15";
2010 sal_Char
* newUChar2
="0";
2011 sal_Char
* newUChar3
="-15";
2012 sal_Char
* newUChar4
= "9223372036854775807";
2013 sal_Char
* newUChar5
="-9223372036854775808";
2015 typedef struct TestCase
2020 ~TestCase() {delete expVal
;}
2023 TestCase arrTestCase
[]=
2025 {"input Int64 15 and return OUString 15",15,
2026 new OUString(newUChar1
,2,kEncodingRTLTextUSASCII
,
2027 kConvertFlagsOStringToOUString
)
2029 {"input Int64 0 and return OUString 0",0,
2030 new OUString(newUChar2
,1,kEncodingRTLTextUSASCII
,
2031 kConvertFlagsOStringToOUString
)
2033 {"input Int64 -15 and return OUString -15",-15,
2034 new OUString(newUChar3
,3,kEncodingRTLTextUSASCII
,
2035 kConvertFlagsOStringToOUString
)
2037 {"input Int64 9223372036854775807 and return 9223372036854775807",
2038 SAL_MAX_INT64
/* 9223372036854775807*/,
2039 new OUString(newUChar4
,19,kEncodingRTLTextUSASCII
,
2040 kConvertFlagsOStringToOUString
)
2042 {"input Int64 -9223372036854775808 and return -9223372036854775808",
2043 SAL_MIN_INT64
/* 9223372036854775808*/,
2044 new OUString(newUChar5
,20,kEncodingRTLTextUSASCII
,
2045 kConvertFlagsOStringToOUString
)
2049 sal_Bool res
=sal_True
;
2052 for(i
=0;i
<(sizeof(arrTestCase
))/(sizeof(TestCase
));i
++)
2054 sal_Bool lastRes
=(*(arrTestCase
[i
].expVal
)==
2055 OUString::valueOf(arrTestCase
[i
].input1
));
2057 c_rtl_tres_state(hRtlTestResult
,
2059 arrTestCase
[i
].comments
,
2061 "valueOf( sal_Int64 i, sal_Int16 radix = 10 )", i
)
2070 //------------------------------------------------------------------------
2071 // testing the method valueOf( float f )
2072 //------------------------------------------------------------------------
2073 // LLA: sal_Bool SAL_CALL test_rtl_OUString_valueOf_float(
2074 // LLA: hTestResult hRtlTestResult )
2076 // LLA: sal_Char methName[MAXBUFLENGTH];
2077 // LLA: sal_Char* pMeth =methName;
2079 // LLA: typedef struct TestCase
2081 // LLA: sal_Char* comments;
2082 // LLA: float input1;
2083 // LLA: OUString* expVal;
2085 // LLA: ~TestCase() {delete expVal;}
2088 // LLA: TestCase arrTestCase[] =
2090 // LLA: { "3.0", 3.0, new OUString("3.0",3,kEncodingRTLTextUSASCII,
2091 // LLA: kConvertFlagsOStringToOUString) },
2092 // LLA: { "3.5", 3.5f, new OUString("3.5",3,kEncodingRTLTextUSASCII,
2093 // LLA: kConvertFlagsOStringToOUString)},
2094 // LLA: { "3.0625", 3.0625f, new OUString("3.0625",6,kEncodingRTLTextUSASCII,
2095 // LLA: kConvertFlagsOStringToOUString)},
2096 // LLA: { "3.502525", 3.502525f, new OUString("3.502525",8,
2097 // LLA: kEncodingRTLTextUSASCII,kConvertFlagsOStringToOUString) },
2098 // LLA: { "3.141592", 3.141592f, new OUString("3.141592",8,
2099 // LLA: kEncodingRTLTextUSASCII,kConvertFlagsOStringToOUString) },
2100 // LLA: { "3.5025255", 3.5025255f, new OUString("3.5025255",9,
2101 // LLA: kEncodingRTLTextUSASCII,kConvertFlagsOStringToOUString) },
2102 // LLA: { "3.0039062", 3.00390625f, new OUString("3.0039062",9,
2103 // LLA: kEncodingRTLTextUSASCII,kConvertFlagsOStringToOUString) }
2106 // LLA: sal_Bool res = sal_True;
2107 // LLA: sal_Int32 i;
2109 // LLA: for(i = 0; i < (sizeof (arrTestCase))/(sizeof (TestCase)); i++)
2111 // LLA: ::rtl::OUString aStr1;
2112 // LLA: aStr1 = aStr1.valueOf( arrTestCase[i].input1 );
2113 // LLA: sal_Bool lastRes = (arrTestCase[i].expVal->compareTo(aStr1) == 0);
2115 // LLA: c_rtl_tres_state
2117 // LLA: hRtlTestResult,
2119 // LLA: arrTestCase[i].comments,
2120 // LLA: createName( pMeth, "valueof_float", i)
2123 // LLA: res &= lastRes;
2127 // LLA: return ( res );
2130 //------------------------------------------------------------------------
2131 // testing the method valueOf( float f ) for negative value
2132 //------------------------------------------------------------------------
2133 // LLA: sal_Bool SAL_CALL test_rtl_OUString_valueOf_Float_Negative(
2134 // LLA: hTestResult hRtlTestResult )
2136 // LLA: sal_Char methName[MAXBUFLENGTH];
2137 // LLA: sal_Char* pMeth =methName;
2139 // LLA: typedef struct TestCase
2141 // LLA: sal_Char* comments;
2142 // LLA: float input1;
2143 // LLA: OUString* expVal;
2145 // LLA: ~TestCase() {delete expVal;}
2148 // LLA: TestCase arrTestCase[] =
2150 // LLA: { "-3.0", -3.0, new OUString("-3.0",4,kEncodingRTLTextUSASCII,
2151 // LLA: kConvertFlagsOStringToOUString) },
2152 // LLA: { "-3.5", -3.5f, new OUString("-3.5",4,kEncodingRTLTextUSASCII,
2153 // LLA: kConvertFlagsOStringToOUString)},
2154 // LLA: { "-3.0625", -3.0625f, new OUString("-3.0625",7,
2155 // LLA: kEncodingRTLTextUSASCII,kConvertFlagsOStringToOUString)},
2156 // LLA: { "-3.502525", -3.502525f, new OUString("-3.502525",9,
2157 // LLA: kEncodingRTLTextUSASCII,kConvertFlagsOStringToOUString) },
2158 // LLA: { "-3.141592", -3.141592f, new OUString("-3.141592",9,
2159 // LLA: kEncodingRTLTextUSASCII,kConvertFlagsOStringToOUString) },
2160 // LLA: { "-3.5025255", -3.5025255f, new OUString("-3.5025255",10,
2161 // LLA: kEncodingRTLTextUSASCII,kConvertFlagsOStringToOUString) },
2162 // LLA: { "-3.0039062", -3.00390625f, new OUString("-3.0039062",10,
2163 // LLA: kEncodingRTLTextUSASCII,kConvertFlagsOStringToOUString) }
2166 // LLA: sal_Bool res = sal_True;
2167 // LLA: sal_Int32 i;
2169 // LLA: for(i = 0; i < (sizeof (arrTestCase))/(sizeof (TestCase)); i++)
2171 // LLA: ::rtl::OUString aStr1;
2172 // LLA: aStr1 = aStr1.valueOf( arrTestCase[i].input1 );
2173 // LLA: sal_Bool lastRes = (arrTestCase[i].expVal->compareTo(aStr1) == 0);
2175 // LLA: c_rtl_tres_state
2177 // LLA: hRtlTestResult,
2179 // LLA: arrTestCase[i].comments,
2180 // LLA: createName( pMeth, "valueof_negative float", i)
2183 // LLA: res &= lastRes;
2187 // LLA: return ( res );
2190 //------------------------------------------------------------------------
2191 // testing the method valueOf( double f )
2192 //------------------------------------------------------------------------
2193 // LLA: sal_Bool SAL_CALL test_rtl_OUString_valueOf_double(
2194 // LLA: hTestResult hRtlTestResult )
2196 // LLA: sal_Char methName[MAXBUFLENGTH];
2197 // LLA: sal_Char* pMeth =methName;
2199 // LLA: typedef struct TestCase
2201 // LLA: sal_Char* comments;
2202 // LLA: double input1;
2203 // LLA: OUString* expVal;
2205 // LLA: ~TestCase() {delete expVal;}
2208 // LLA: TestCase arrTestCase[] =
2210 // LLA: {"3.0", 3.0, new OUString("3.0",3,kEncodingRTLTextUSASCII,
2211 // LLA: kConvertFlagsOStringToOUString)},
2212 // LLA: {"3.5", 3.5, new OUString("3.5",3,kEncodingRTLTextUSASCII,
2213 // LLA: kConvertFlagsOStringToOUString)},
2214 // LLA: {"3.0625", 3.0625, new OUString("3.0625",6,kEncodingRTLTextUSASCII,
2215 // LLA: kConvertFlagsOStringToOUString)},
2216 // LLA: {"3.1415926535", 3.1415926535, new OUString("3.1415926535",12,
2217 // LLA: kEncodingRTLTextUSASCII,kConvertFlagsOStringToOUString)},
2218 // LLA: {"3.1415926535897931", 3.141592653589793,
2219 // LLA: new OUString("3.1415926535897931",18,kEncodingRTLTextUSASCII,
2220 // LLA: kConvertFlagsOStringToOUString)},
2221 // LLA: {"3.1415926535897931", 3.1415926535897932,
2222 // LLA: new OUString("3.1415926535897931",18,kEncodingRTLTextUSASCII,
2223 // LLA: kConvertFlagsOStringToOUString)},
2224 // LLA: {"3.1415926535897931", 3.14159265358979323,
2225 // LLA: new OUString("3.1415926535897931",18,kEncodingRTLTextUSASCII,
2226 // LLA: kConvertFlagsOStringToOUString)},
2227 // LLA: {"3.1415926535897931", 3.141592653589793238462643,
2228 // LLA: new OUString("3.1415926535897931",18,kEncodingRTLTextUSASCII,
2229 // LLA: kConvertFlagsOStringToOUString)}
2232 // LLA: sal_Bool res = sal_True;
2233 // LLA: sal_Int32 i;
2235 // LLA: for(i = 0; i < (sizeof (arrTestCase))/(sizeof (TestCase)); i++)
2237 // LLA: ::rtl::OUString aStr1;
2238 // LLA: aStr1 = aStr1.valueOf( arrTestCase[i].input1 );
2239 // LLA: sal_Bool lastRes = (arrTestCase[i].expVal->compareTo(aStr1) == 0);
2241 // LLA: c_rtl_tres_state
2243 // LLA: hRtlTestResult,
2245 // LLA: arrTestCase[i].comments,
2246 // LLA: createName( pMeth, "valueof_double", i)
2249 // LLA: res &= lastRes;
2253 // LLA: return ( res );
2257 //------------------------------------------------------------------------
2258 // testing the method valueOf( double f ) for negative value
2259 //------------------------------------------------------------------------
2260 // LLA: sal_Bool SAL_CALL test_rtl_OUString_valueOf_Double_Negative(
2261 // LLA: hTestResult hRtlTestResult )
2263 // LLA: sal_Char methName[MAXBUFLENGTH];
2264 // LLA: sal_Char* pMeth =methName;
2266 // LLA: typedef struct TestCase
2268 // LLA: sal_Char* comments;
2269 // LLA: double input1;
2270 // LLA: OUString* expVal;
2272 // LLA: ~TestCase() {delete expVal;}
2275 // LLA: TestCase arrTestCase[] =
2277 // LLA: {"-3.0", -3.0, new OUString("-3.0",4,kEncodingRTLTextUSASCII,
2278 // LLA: kConvertFlagsOStringToOUString)},
2279 // LLA: {"-3.5", -3.5, new OUString("-3.5",4,kEncodingRTLTextUSASCII,
2280 // LLA: kConvertFlagsOStringToOUString)},
2281 // LLA: {"-3.0625", -3.0625, new OUString("-3.0625",7,kEncodingRTLTextUSASCII,
2282 // LLA: kConvertFlagsOStringToOUString)},
2283 // LLA: {"-3.1415926535", -3.1415926535,
2284 // LLA: new OUString("-3.1415926535",13,kEncodingRTLTextUSASCII,
2285 // LLA: kConvertFlagsOStringToOUString)},
2286 // LLA: {"-3.1415926535897931", -3.141592653589793,
2287 // LLA: new OUString("-3.1415926535897931",19,kEncodingRTLTextUSASCII,
2288 // LLA: kConvertFlagsOStringToOUString)},
2289 // LLA: {"-3.1415926535897931", -3.1415926535897932,
2290 // LLA: new OUString("-3.1415926535897931",19,kEncodingRTLTextUSASCII,
2291 // LLA: kConvertFlagsOStringToOUString)},
2292 // LLA: {"-3.1415926535897931", -3.14159265358979323,
2293 // LLA: new OUString("-3.1415926535897931",19,kEncodingRTLTextUSASCII,
2294 // LLA: kConvertFlagsOStringToOUString)},
2295 // LLA: {"-3.1415926535897931", -3.141592653589793238462643,
2296 // LLA: new OUString("-3.1415926535897931",19,kEncodingRTLTextUSASCII,
2297 // LLA: kConvertFlagsOStringToOUString)}
2300 // LLA: sal_Bool res = sal_True;
2301 // LLA: sal_Int32 i;
2303 // LLA: for(i = 0; i < (sizeof (arrTestCase))/(sizeof (TestCase)); i++)
2305 // LLA: ::rtl::OUString aStr1;
2306 // LLA: aStr1 = aStr1.valueOf( arrTestCase[i].input1 );
2307 // LLA: sal_Bool lastRes = (arrTestCase[i].expVal->compareTo(aStr1) == 0);
2309 // LLA: c_rtl_tres_state
2311 // LLA: hRtlTestResult,
2313 // LLA: arrTestCase[i].comments,
2314 // LLA: createName( pMeth, "valueof_nagative double", i)
2317 // LLA: res &= lastRes;
2321 // LLA: return ( res );
2324 //------------------------------------------------------------------------
2325 // testing the method valueOf()
2326 //------------------------------------------------------------------------
2327 extern "C" void /* sal_Bool */ SAL_CALL
test_rtl_OUString_valueOf(
2328 hTestResult hRtlTestResult
)
2330 c_rtl_tres_state_start( hRtlTestResult
, "valueOf");
2331 sal_Bool bTState
= test_rtl_OUString_valueOf_Int32( hRtlTestResult
);
2332 bTState
&= test_rtl_OUString_valueOf_Int32_Bounderies( hRtlTestResult
);
2333 bTState
&= test_rtl_OUString_valueOf_Int32_Negative( hRtlTestResult
);
2334 bTState
&= test_rtl_OUString_valueOf_Int32_WrongRadix( hRtlTestResult
);
2335 bTState
&= test_rtl_OUString_valueOf_Int32_defaultParam(
2337 bTState
&= test_rtl_OUString_valueOf_Int64( hRtlTestResult
);
2338 bTState
&= test_rtl_OUString_valueOf_Int64_Bounderies( hRtlTestResult
);
2339 bTState
&= test_rtl_OUString_valueOf_Int64_Negative( hRtlTestResult
);
2340 bTState
&= test_rtl_OUString_valueOf_Int64_WrongRadix( hRtlTestResult
);
2341 bTState
&= test_rtl_OUString_valueOf_Int64_defaultParam(
2343 // LLA: bTState &= test_rtl_OUString_valueOf_float( hRtlTestResult );
2344 // LLA: bTState &= test_rtl_OUString_valueOf_Float_Negative( hRtlTestResult );
2346 // LLA: bTState &= test_rtl_OUString_valueOf_double( hRtlTestResult );
2347 // LLA: bTState &= test_rtl_OUString_valueOf_Double_Negative( hRtlTestResult );
2348 c_rtl_tres_state_end( hRtlTestResult
, "valueOf");
2349 // return ( bTState );
2351 //------------------------------------------------------------------------
2352 // this is my testing code
2353 // testing the method createFromAscii( const sal_Char * value )
2354 //------------------------------------------------------------------------
2356 extern "C" void /* sal_Bool */ SAL_CALL
test_rtl_OUString_createFromAscii(
2357 hTestResult hRtlTestResult
)
2359 c_rtl_tres_state_start( hRtlTestResult
, "createFromAscii");
2360 sal_Char methName
[MAXBUFLENGTH
];
2361 sal_Char
* pMeth
= methName
;
2364 typedef struct TestCase
2367 const sal_Char
* input1
;
2369 ~TestCase() {delete expVal
;}
2373 TestCase arrTestCase
[]=
2376 { "create OUString from sal_Char" ,kTestStr1
,
2377 new OUString(kTestStr1
,kTestStr1Len
,kEncodingRTLTextUSASCII
,
2378 kConvertFlagsOStringToOUString
)
2381 "create OUString from empty", "",
2385 "create OUString from empty(string arg = '\\0')","",
2386 new OUString("",0,kEncodingRTLTextUSASCII
,
2387 kConvertFlagsOStringToOUString
)
2395 for(i
=0;i
<(sizeof(arrTestCase
))/(sizeof(TestCase
));i
++)
2397 sal_Bool lastRes
=(*(arrTestCase
[i
].expVal
)==
2398 OUString::createFromAscii(arrTestCase
[i
].input1
));
2402 c_rtl_tres_state(hRtlTestResult
,
2404 arrTestCase
[i
].comments
,
2405 createName( pMeth
, "createFromAscii", i
)
2413 c_rtl_tres_state_end( hRtlTestResult
, "createFromAscii");
2416 //------------------------------------------------------------------------
2417 // testing the method index( )
2418 //------------------------------------------------------------------------
2420 sal_Bool
test_index( const T
* input1
, int num
,const sal_Int32
* input2
,
2421 const sal_Int32
* expVal
,int base
,rtlTestResult hRtlTestResult
)
2423 sal_Bool res
=sal_True
;
2424 sal_Char methName
[MAXBUFLENGTH
];
2425 sal_Char
*meth
= '\0';
2426 sal_Char
* pMeth
=methName
;
2428 sal_Bool lastRes
=sal_False
;
2432 OUString
str(aUStr2
);
2436 lastRes
=(str
.indexOf(input1
[i
])==expVal
[i
]);
2441 lastRes
=(str
.indexOf(input1
[i
],input2
[i
])==expVal
[i
]);
2446 // LLA: lastRes=(str.lastIndexOf(input1[i])==expVal[i]);
2447 // LLA: meth="lastIndexOf_001(sal_Unicode)";
2452 // LLA: OUString s4(&input1[i]);
2453 // LLA: rtl::OString sStr;
2454 // LLA: sStr <<= str;
2455 // LLA: t_print("str = %s\n", sStr.getStr());
2456 // LLA: rtl::OString sInput1;
2457 // LLA: sInput1 <<= s4; // rtl::OUString((sal_Unicode*)input1[i]);
2458 // LLA: t_print("%d = lastIndexOf(\"%s\", %d) =? %d\n", str.lastIndexOf(input1[i], input2[i]), sInput1.getStr(), input2[i], expVal[i]);
2460 // LLA: lastRes=(str.lastIndexOf(input1[i],input2[i])==expVal[i]);
2461 // LLA: meth="lastIndexOf_002(sal_Unicode , sal_Int32 )";
2469 createName( pMeth
,meth
, i
)
2478 sal_Bool
test_indexStr( const T
** input1
, int num
,const sal_Int32
* input2
,
2479 const sal_Int32
* expVal
,int base
,rtlTestResult hRtlTestResult
)
2481 sal_Bool res
=sal_True
;
2482 sal_Char methName
[MAXBUFLENGTH
];
2483 sal_Char
*meth
= '\0';
2484 sal_Char
* pMeth
=methName
;
2486 sal_Bool lastRes
=sal_False
;
2490 OUString
str(aUStr2
);
2495 OUString
s1(input1
[i
]);
2496 lastRes
=(str
.indexOf(s1
)==expVal
[i
]);
2501 OUString
s2(input1
[i
]);
2502 lastRes
=(str
.indexOf(s2
,input2
[i
])==expVal
[i
]);
2507 // LLA: OUString s3(input1[i]);
2508 // LLA: lastRes=(str.lastIndexOf(s3)==expVal[i]);
2509 // LLA: meth="lastIndexOf_003(const OUString)";
2513 // LLA: OUString s4(input1[i]);
2515 // LLA: rtl::OString sStr;
2516 // LLA: sStr <<= str;
2517 // LLA: t_print("str = \"%s\"\n", sStr.getStr());
2518 // LLA: rtl::OString sInput1;
2519 // LLA: sInput1 <<= s4; // rtl::OUString((sal_Unicode*)input1[i]);
2520 // LLA: t_print("%d = lastIndexOf(\"%s\", %d) =? %d\n", str.lastIndexOf(input1[i], input2[i]), sInput1.getStr(), input2[i], expVal[i]);
2522 // LLA: lastRes=(str.lastIndexOf(s4,input2[i])==expVal[i]);
2523 // LLA: meth="lastIndexOf_004(const OUString,sal_Int32)";
2531 createName( pMeth
,meth
, i
)
2539 //------------------------------------------------------------------------
2540 // testing the method indexOf( )
2541 //------------------------------------------------------------------------
2542 sal_Bool SAL_CALL
test_rtl_OUString_indexOf_001(
2543 hTestResult hRtlTestResult
)
2545 sal_Bool bRes
=sal_False
;
2547 bRes
=c_rtl_tres_state
2550 test_index
<sal_Unicode
>((const sal_Unicode
*)input1Default
,
2551 nDefaultCount
,input2Default
,
2552 expValDefault
,0,hRtlTestResult
),
2554 "indexDefault(sal_Unicode ch, sal_Int32 fromIndex = 0)"
2559 //------------------------------------------------------------------------
2560 // testing the method indexOf( )
2561 //------------------------------------------------------------------------
2562 sal_Bool SAL_CALL
test_rtl_OUString_indexOf_002(
2563 hTestResult hRtlTestResult
)
2565 sal_Bool bRes
=sal_False
;
2567 bRes
=c_rtl_tres_state
2570 test_index
<sal_Unicode
>((const sal_Unicode
*)input1Normal
,
2571 nNormalCount
,input2Normal
,
2572 expValNormal
,1,hRtlTestResult
),
2574 "indexNormal(sal_Unicode ch, sal_Int32 fromIndex)"
2579 //------------------------------------------------------------------------
2580 // testing the method indexOf( OUString ch, sal_Int32 fromIndex = 0 )
2581 //------------------------------------------------------------------------
2582 sal_Bool SAL_CALL
test_rtl_OUString_indexOf_003(
2583 hTestResult hRtlTestResult
)
2585 sal_Bool bRes
=sal_False
;
2587 bRes
=c_rtl_tres_state
2590 test_indexStr
<sal_Unicode
>((const sal_Unicode
**)input1StrDefault
,
2591 nStrDefaultCount
,input2StrDefault
,
2592 expValStrDefault
,0,hRtlTestResult
),
2594 "indexDefault(OUString ch, sal_Int32 fromIndex = 0)"
2599 //------------------------------------------------------------------------
2600 // testing the method indexOf( OUString ch, sal_Int32 fromIndex )
2601 //------------------------------------------------------------------------
2602 sal_Bool SAL_CALL
test_rtl_OUString_indexOf_004(
2603 hTestResult hRtlTestResult
)
2605 sal_Bool bRes
=sal_False
;
2607 bRes
=c_rtl_tres_state
2610 test_indexStr
<sal_Unicode
>((const sal_Unicode
**)input1StrNormal
,
2611 nStrNormalCount
,input2StrNormal
,
2612 expValStrNormal
,1,hRtlTestResult
),
2614 "indexOf(OUString ch, sal_Int32 fromIndex)"
2619 // LLA: //------------------------------------------------------------------------
2620 // LLA: // testing the method lastIndexOf( sal_Unicode ch )
2621 // LLA: //------------------------------------------------------------------------
2622 // LLA: sal_Bool SAL_CALL test_rtl_OUString_lastIndexOf_001(
2623 // LLA: hTestResult hRtlTestResult )
2625 // LLA: sal_Bool bRes=sal_False;
2627 // LLA: bRes=c_rtl_tres_state
2629 // LLA: hRtlTestResult,
2630 // LLA: test_index<sal_Unicode>((const sal_Unicode*)input1lastDefault,
2631 // LLA: nlastDefaultCount,input2lastDefault,
2632 // LLA: expVallastDefault,2,hRtlTestResult),
2633 // LLA: "lastIndex",
2634 // LLA: "lastIndexDefault(sal_Unicode ch)"
2637 // LLA: return ( bRes );
2639 // LLA: //------------------------------------------------------------------------
2640 // LLA: // testing the method lastIndexOf( sal_Unicode ch, sal_Int32 fromIndex )
2641 // LLA: //------------------------------------------------------------------------
2642 // LLA: sal_Bool SAL_CALL test_rtl_OUString_lastIndexOf_002(
2643 // LLA: hTestResult hRtlTestResult )
2645 // LLA: sal_Bool bRes=sal_False;
2647 // LLA: bRes=c_rtl_tres_state
2649 // LLA: hRtlTestResult,
2650 // LLA: test_index<sal_Unicode>((const sal_Unicode*)input1lastNormal,
2651 // LLA: nlastNormalCount,input2lastNormal,
2652 // LLA: expVallastNormal,3,hRtlTestResult),
2653 // LLA: "lastIndex",
2654 // LLA: "lastIndexNormal(sal_Unicode ch, sal_Int32 fromIndex)"
2657 // LLA: return ( bRes );
2659 // LLA: //------------------------------------------------------------------------
2660 // LLA: // testing the method lastIndexOf( OUString ch )
2661 // LLA: //------------------------------------------------------------------------
2662 // LLA: sal_Bool SAL_CALL test_rtl_OUString_lastIndexOf_003(
2663 // LLA: hTestResult hRtlTestResult )
2665 // LLA: sal_Bool bRes=sal_False;
2667 // LLA: bRes=c_rtl_tres_state
2669 // LLA: hRtlTestResult,
2670 // LLA: test_indexStr<sal_Unicode>((const sal_Unicode**)input1StrLastDefault,
2671 // LLA: nStrLastDefaultCount,input2StrLastDefault,
2672 // LLA: expValStrLastDefault,2,hRtlTestResult),
2673 // LLA: "lastIndexOf",
2674 // LLA: "lastIndexOf(OUString ch)"
2677 // LLA: return ( bRes );
2679 // LLA: //------------------------------------------------------------------------
2680 // LLA: // testing the method lastIndexOf( OUString ch, sal_Int32 fromIndex )
2681 // LLA: //------------------------------------------------------------------------
2682 // LLA: sal_Bool SAL_CALL test_rtl_OUString_lastIndexOf_004(
2683 // LLA: hTestResult hRtlTestResult )
2685 // LLA: sal_Bool bRes=sal_False;
2687 // LLA: for (int i=0;i<nStrLastNormalCount;i++)
2689 // LLA: rtl::OUString aStr = rtl::OUString(input1StrLastNormal[i]);
2690 // LLA: volatile int dummy = 0;
2693 // LLA: bRes=c_rtl_tres_state
2695 // LLA: hRtlTestResult,
2696 // LLA: test_indexStr<sal_Unicode>((const sal_Unicode**)input1StrLastNormal,
2697 // LLA: nStrLastNormalCount,input2StrLastNormal,
2698 // LLA: expValStrLastNormal,3,hRtlTestResult),
2699 // LLA: "lastIndexOf",
2700 // LLA: "lastIndexOf(OUString ch, sal_Int32 fromIndex)"
2703 // LLA: return ( bRes );
2705 //------------------------------------------------------------------------
2706 extern "C" void /* sal_Bool */ SAL_CALL
test_rtl_OUString_indexOf(
2707 hTestResult hRtlTestResult
)
2709 c_rtl_tres_state_start( hRtlTestResult
, "indexOf");
2710 sal_Bool res
= test_rtl_OUString_indexOf_001(hRtlTestResult
);
2711 res
&= test_rtl_OUString_indexOf_002(hRtlTestResult
);
2712 res
&= test_rtl_OUString_indexOf_003(hRtlTestResult
);
2713 res
&= test_rtl_OUString_indexOf_004(hRtlTestResult
);
2714 c_rtl_tres_state_end( hRtlTestResult
, "indexOf");
2717 //------------------------------------------------------------------------
2718 // LLA: extern "C" void /* sal_Bool */ SAL_CALL test_rtl_OUString_lastIndexOf(
2719 // LLA: hTestResult hRtlTestResult )
2721 // LLA: c_rtl_tres_state_start( hRtlTestResult, "lastIndexOf");
2722 // LLA: sal_Bool res = test_rtl_OUString_lastIndexOf_001(hRtlTestResult);
2723 // LLA: res &= test_rtl_OUString_lastIndexOf_002(hRtlTestResult);
2724 // LLA: res &= test_rtl_OUString_lastIndexOf_003(hRtlTestResult);
2725 // LLA: res &= test_rtl_OUString_lastIndexOf_004(hRtlTestResult);
2726 // LLA: c_rtl_tres_state_end( hRtlTestResult, "lastIndexOf");
2727 // LLA: // return ( res );
2729 //------------------------------------------------------------------------
2730 // testing the method concat( const OString & aStr )
2731 //------------------------------------------------------------------------
2732 extern "C" void /* sal_Bool */ SAL_CALL
test_rtl_OUString_concat(
2733 hTestResult hRtlTestResult
)
2735 c_rtl_tres_state_start( hRtlTestResult
, "concat");
2736 sal_Char methName
[MAXBUFLENGTH
];
2737 sal_Char
* pMeth
=methName
;
2739 typedef struct TestCase
2745 ~TestCase() { delete input1
;delete input2
; delete expVal
;}
2748 TestCase arrTestCase
[] =
2750 {"concatenates two ustrings",new OUString(aUStr1
),
2751 new OUString(aUStr7
), new OUString(aUStr8
)},
2752 {"concatenates empty ustring",new OUString(aUStr1
),
2753 new OUString(aUStr1
), new OUString("",0,
2754 kEncodingRTLTextUSASCII
,kConvertFlagsOStringToOUString
)},
2755 {"concatenates to empty ustring",new OUString(aUStr1
),new OUString("",
2756 0,kEncodingRTLTextUSASCII
,kConvertFlagsOStringToOUString
),
2757 new OUString(aUStr1
)},
2758 {"concatenates two empty ustrings",new OUString("",0,
2759 kEncodingRTLTextUSASCII
,kConvertFlagsOStringToOUString
),
2761 kEncodingRTLTextUSASCII
,kConvertFlagsOStringToOUString
),
2763 kEncodingRTLTextUSASCII
,kConvertFlagsOStringToOUString
)},
2764 {"concatenates ustring constructed by default constructor",
2765 new OUString(aUStr1
),new OUString(aUStr1
), new OUString()},
2766 {"concatenates to ustring constructed by default constructor",
2767 new OUString(aUStr1
),new OUString(), new OUString(aUStr1
)},
2768 {"concatenates two ustrings constructed by default constructor",
2769 new OUString(),new OUString(), new OUString()}
2772 sal_Bool res
= sal_True
;
2774 for(i
= 0; i
< (sizeof (arrTestCase
))/(sizeof (TestCase
)); i
++)
2776 OUString str
= arrTestCase
[i
].input1
->concat(*arrTestCase
[i
].input2
);
2777 sal_Bool lastRes
= (str
== *arrTestCase
[i
].expVal
);
2783 arrTestCase
[i
].comments
,
2784 createName( pMeth
, "concat", i
)
2790 c_rtl_tres_state_end( hRtlTestResult
, "concat");
2793 //------------------------------------------------------------------------
2794 // testing the method replaceAt( sal_Int32 index, sal_Int32 count,
2795 // const OUString& newStr )
2796 //------------------------------------------------------------------------
2797 extern "C" void /* sal_Bool */ SAL_CALL
test_rtl_OUString_replaceAt(
2798 rtlTestResult hRtlTestResult
)
2800 c_rtl_tres_state_start( hRtlTestResult
, "replaceAt");
2801 sal_Char methName
[MAXBUFLENGTH
];
2802 sal_Char
* pMeth
= methName
;
2804 typedef struct TestCase
2813 ~TestCase() { delete input
; delete expVal
; delete newStr
;}
2816 TestCase arrTestCase
[]=
2819 { "string differs", new OUString(aUStr2
), new OUString(aUStr22
),
2820 new OUString(aUStr2
), 0, kTestStr22Len
},
2822 { "larger index", new OUString(aUStr1
), new OUString(aUStr7
),
2823 new OUString(aUStr8
), 64, kTestStr8Len
},
2825 { "larger count", new OUString(aUStr2
), new OUString(aUStr22
),
2826 new OUString(aUStr2
),0, 64 },
2828 { "navigate index", new OUString(aUStr2
), new OUString(aUStr22
),
2829 new OUString(aUStr2
), -64, 64 },
2833 kEncodingRTLTextUSASCII
,kConvertFlagsOStringToOUString
),
2834 new OUString(aUStr14
),
2836 kEncodingRTLTextUSASCII
,kConvertFlagsOStringToOUString
),
2840 sal_Bool res
= sal_True
;
2843 for (i
= 0; i
< (sizeof (arrTestCase
))/(sizeof (TestCase
)); i
++)
2845 ::rtl::OUString aStr1
;
2846 aStr1
= arrTestCase
[i
].input
->replaceAt( arrTestCase
[i
].index
,
2847 arrTestCase
[i
].count
, *arrTestCase
[i
].newStr
);
2849 sal_Bool lastRes
= ( arrTestCase
[i
].expVal
->compareTo(aStr1
) == 0 );
2855 arrTestCase
[i
].comments
,
2856 createName( pMeth
, "replaceAt", i
)
2862 c_rtl_tres_state_end( hRtlTestResult
, "replaceAt");
2865 //------------------------------------------------------------------------
2866 // this is my testing code
2867 // testing the method replace( sal_Unicode oldChar, sal_Unicode newChar )
2868 //------------------------------------------------------------------------
2869 extern "C" void /* sal_Bool */ SAL_CALL
test_rtl_OUString_replace(
2870 hTestResult hRtlTestResult
)
2872 c_rtl_tres_state_start( hRtlTestResult
, "replace");
2873 sal_Char methName
[MAXBUFLENGTH
];
2874 sal_Char
* pMeth
= methName
;
2876 typedef struct TestCase
2881 sal_Unicode oldChar
;
2882 sal_Unicode newChar
;
2884 ~TestCase() { delete input
; delete expVal
;}
2887 TestCase arrTestCase
[]=
2889 {"ustring differs", new OUString(aUStr18
), new OUString(aUStr4
),83,115},
2890 {"ustring differs", new OUString(aUStr19
), new OUString(aUStr17
),32,45},
2891 {"ustring must be empty", new OUString("",0,
2892 kEncodingRTLTextUSASCII
,kConvertFlagsOStringToOUString
),
2894 kEncodingRTLTextUSASCII
,kConvertFlagsOStringToOUString
),83,23},
2895 {"ustring must be empty", new OUString(),
2897 kEncodingRTLTextUSASCII
,kConvertFlagsOStringToOUString
),83,23},
2898 {"same ustring, no replace ", new OUString(aUStr22
),
2899 new OUString(aUStr22
),42,56}
2903 sal_Bool res
= sal_True
;
2906 for (i
= 0; i
< (sizeof (arrTestCase
))/(sizeof (TestCase
)); i
++)
2908 ::rtl::OUString aStr1
;
2909 aStr1
= arrTestCase
[i
].input
->replace(arrTestCase
[i
].oldChar
,arrTestCase
[i
].newChar
);
2910 res
&= c_rtl_tres_state
2913 (arrTestCase
[i
].expVal
->compareTo(aStr1
) == 0),
2914 arrTestCase
[i
].comments
,
2915 createName( pMeth
, "replace", i
)
2919 c_rtl_tres_state_end( hRtlTestResult
, "replace");
2922 //------------------------------------------------------------------------
2923 // testing the method toAsciiLowerCase()
2924 //-----------------------------------------------------------------------
2925 extern "C" void /* sal_Bool */ SAL_CALL
test_rtl_OUString_toAsciiLowerCase(
2926 hTestResult hRtlTestResult
)
2928 c_rtl_tres_state_start( hRtlTestResult
, "toAsciiLowerCase");
2929 sal_Char methName
[MAXBUFLENGTH
];
2930 sal_Char
* pMeth
=methName
;
2932 typedef struct TestCase
2937 ~TestCase() { delete input1
; delete expVal
;}
2940 TestCase arrTestCase
[] =
2943 {"only uppercase",new OUString(aUStr5
),new OUString(aUStr4
)},
2944 {"different cases",new OUString(aUStr5
),new OUString(aUStr1
)},
2945 {"different cases",new OUString(aUStr5
),new OUString(aUStr3
)},
2946 {"only lowercase",new OUString(aUStr5
),new OUString(aUStr5
)},
2947 {"empty ustring",new OUString("",0,
2948 kEncodingRTLTextUSASCII
,kConvertFlagsOStringToOUString
),
2950 kEncodingRTLTextUSASCII
,kConvertFlagsOStringToOUString
)},
2951 {"ustring constructed by default constructor",new OUString(),
2953 {"have special Unicode",new OUString("\23\12\34sun\13\45",6,
2954 kEncodingRTLTextUSASCII
,kConvertFlagsOStringToOUString
),
2955 new OUString("\23\12\34sun\13\45",6,
2956 kEncodingRTLTextUSASCII
,kConvertFlagsOStringToOUString
)}
2959 sal_Bool res
= sal_True
;
2961 sal_Bool lastRes
=sal_False
;
2963 for(i
= 0; i
< (sizeof (arrTestCase
))/(sizeof (TestCase
)); i
++)
2965 OUString str
= arrTestCase
[i
].input1
->toAsciiLowerCase();
2968 lastRes
= (str
==* arrTestCase
[i
].expVal
);
2974 arrTestCase
[i
].comments
,
2975 createName( pMeth
, "toAsciiLowerCase", i
)
2984 arrTestCase
[i
].comments
,
2985 createName( pMeth
, "toAsciiLowerCase", i
)
2990 c_rtl_tres_state_end( hRtlTestResult
, "toAsciiLowerCase");
2993 //------------------------------------------------------------------------
2994 // testing the method toAsciiUpperCase()
2995 //------------------------------------------------------------------------
2996 extern "C" void /* sal_Bool */ SAL_CALL
test_rtl_OUString_toAsciiUpperCase(
2997 hTestResult hRtlTestResult
)
2999 c_rtl_tres_state_start( hRtlTestResult
, "toAsciiUpperCase");
3000 sal_Char methName
[MAXBUFLENGTH
];
3001 sal_Char
* pMeth
=methName
;
3003 typedef struct TestCase
3008 ~TestCase() { delete input1
; delete expVal
;}
3011 TestCase arrTestCase
[] =
3013 {"only lowercase",new OUString(aUStr4
),new OUString(aUStr5
)},
3014 {"mixed cases",new OUString(aUStr4
),new OUString(aUStr3
)},
3015 {"mixed cases",new OUString(aUStr4
),new OUString(aUStr1
)},
3016 {"only uppercase",new OUString(aUStr4
),new OUString(aUStr4
)},
3017 {"empty ustring",new OUString("",0,
3018 kEncodingRTLTextUSASCII
,kConvertFlagsOStringToOUString
),
3020 kEncodingRTLTextUSASCII
,kConvertFlagsOStringToOUString
)},
3021 {"ustring constructed by default constructor",new OUString(),
3023 {"have special Unicode",new OUString("\23\12\34SUN\13\45",6,
3024 kEncodingRTLTextUSASCII
,kConvertFlagsOStringToOUString
),
3025 new OUString("\23\12\34sun\13\45",6,
3026 kEncodingRTLTextUSASCII
,kConvertFlagsOStringToOUString
)}
3029 sal_Bool res
= sal_True
;
3031 sal_Bool lastRes
=sal_False
;
3033 for(i
= 0; i
< (sizeof (arrTestCase
))/(sizeof (TestCase
)); i
++)
3035 OUString str
= arrTestCase
[i
].input1
->toAsciiUpperCase();
3038 lastRes
= (str
== *arrTestCase
[i
].expVal
);
3044 arrTestCase
[i
].comments
,
3045 createName( pMeth
, "toAsciiUpperCase", i
)
3054 arrTestCase
[i
].comments
,
3055 createName( pMeth
, "toAsciiUpperCase", i
)
3061 c_rtl_tres_state_end( hRtlTestResult
, "toAsciiUpperCase");
3065 //------------------------------------------------------------------------
3066 // testing the method trim()
3067 //------------------------------------------------------------------------
3068 extern "C" void /* sal_Bool */ SAL_CALL
test_rtl_OUString_trim(
3069 hTestResult hRtlTestResult
)
3071 c_rtl_tres_state_start( hRtlTestResult
, "trim");
3072 sal_Char methName
[MAXBUFLENGTH
];
3073 sal_Char
* pMeth
=methName
;
3075 typedef struct TestCase
3080 ~TestCase() { delete input1
; delete expVal
;}
3083 TestCase arrTestCase
[] =
3085 {"removes space from the front",new OUString(aUStr1
),
3086 new OUString(aUStr10
)},
3087 {"removes space from the end",new OUString(aUStr1
),
3088 new OUString(aUStr11
)},
3089 {"removes space from the front and end",new OUString(aUStr1
),
3090 new OUString(aUStr12
)},
3091 {"removes several spaces from the end",new OUString(aUStr1
),
3092 new OUString(aUStr13
)},
3093 {"removes several spaces from the front",new OUString(aUStr1
),
3094 new OUString(aUStr14
)},
3095 {"removes several spaces from the front and one from the end",
3096 new OUString(aUStr1
),
3097 new OUString(aUStr15
)},
3098 {"removes one space from the front and several from the end",
3099 new OUString(aUStr1
),
3100 new OUString(aUStr16
)},
3101 {"removes several spaces from the front and end",
3102 new OUString(aUStr1
),
3103 new OUString(aUStr17
)},
3104 {"removes characters that have codes <= 32",new OUString(aUStr30
),
3105 new OUString("\1\3\5\7\11\13\15\17sun\21\23\25\27\31\33\50",
3106 18,kEncodingRTLTextUSASCII
,
3107 kConvertFlagsOStringToOUString
)},
3108 {"removes characters that have codes <= 32",new OUString(aUStr28
),
3109 new OUString("\50\3\5\7\11\13\15\17sun\21\23\25\27\31\33\1",
3110 18,kEncodingRTLTextUSASCII
,
3111 kConvertFlagsOStringToOUString
)},
3112 {"removes characters that have codes <= 32",new OUString(aUStr29
),
3113 new OUString("\50\3\5\7\11\13\15\17sun\21\23\25\27\31\33\50",
3114 18,kEncodingRTLTextUSASCII
,
3115 kConvertFlagsOStringToOUString
)},
3116 {"removes characters that have codes <= 32",new OUString(aUStr20
),
3117 new OUString("\1\3\5\7\11\13\15\17sun\21\23\25\27\31\23\20",
3118 18,kEncodingRTLTextUSASCII
,
3119 kConvertFlagsOStringToOUString
)},
3120 {"no spaces",new OUString(aUStr8
),
3121 new OUString(aUStr8
)}
3124 sal_Bool res
= sal_True
;
3127 for(i
= 0; i
< (sizeof (arrTestCase
))/(sizeof (TestCase
)); i
++)
3129 OUString strRes
= arrTestCase
[i
].input1
->trim();
3130 sal_Bool lastRes
= (strRes
== *arrTestCase
[i
].expVal
);
3136 arrTestCase
[i
].comments
,
3137 createName( pMeth
, "trim", i
)
3143 c_rtl_tres_state_end( hRtlTestResult
, "trim");
3146 //------------------------------------------------------------------------
3147 // testing the method toData()
3148 //------------------------------------------------------------------------
3151 sal_Bool
test_toData( const char** input
, int num
, sal_Int16 radix
,
3152 const T
* expVal
,int base
,
3153 const T
* _fPrecision
,
3154 rtlTestResult hRtlTestResult
)
3157 sal_Bool res
=sal_True
;
3158 sal_Char methName
[MAXBUFLENGTH
];
3159 sal_Char
*meth
= '\0';
3160 sal_Char
* pMeth
=methName
;
3162 // static sal_Unicode aUchar[60]={0x00};
3164 sal_Bool lastRes
=sal_False
;
3168 OSL_ENSURE( i
< 60, "ERROR: leave aUchar bound");
3170 // LLA: stored for the posterity
3171 // AStringToUStringCopy(aUchar,input[i]);
3172 // OUString str(aUchar);
3175 str
= OUString::createFromAscii(input
[i
]);
3180 intRes
=static_cast<T
>(str
.toInt32());
3181 lastRes
=(intRes
==expVal
[i
]);
3182 meth
="toInt32default";
3186 intRes
=static_cast<T
>(str
.toInt32(radix
));
3187 lastRes
=(intRes
==expVal
[i
]);
3188 meth
="toInt32normal";
3192 intRes
=static_cast<T
>(str
.toInt64());
3193 lastRes
=(intRes
==expVal
[i
]);
3194 meth
="toInt64default";
3198 intRes
=static_cast<T
>(str
.toInt64(radix
));
3199 lastRes
=(intRes
==expVal
[i
]);
3200 meth
="toInt64normal";
3202 // LLA: does no longer exist, moved to rtl/oustring
3205 // LLA: intRes=str.toDouble();
3206 // LLA: lastRes=(fabs(intRes-expVal[i])<=1e-35);
3207 // LLA: meth="toDouble";
3210 // LLA: dt:20040802 create compile problems within wntmsci10
3213 // intRes=str.toFloat();
3214 // T nPrec = _fPrecision[i];
3215 // lastRes=(fabs((T)(intRes-expVal[i])) <= nPrec /* 1e-35 */ );
3220 intRes
=str
.toChar();
3221 lastRes
=(intRes
==expVal
[i
]);
3225 char buf
[MAXBUFLENGTH
];
3227 cpynstr( buf
+ 1, input
[i
], MAXBUFLENGTH
);
3228 int length
= AStringLen( input
[i
] );
3229 buf
[length
+ 1] = '\'';
3230 buf
[length
+ 2] = 0;
3237 createName( pMeth
,meth
, i
)
3245 //------------------------------------------------------------------------
3246 // testing the method toDouble()
3247 //------------------------------------------------------------------------
3249 // LLA: extern "C" void /* sal_Bool */ SAL_CALL test_rtl_OUString_toDouble(
3250 // LLA: hTestResult hRtlTestResult )
3252 // LLA: c_rtl_tres_state_start( hRtlTestResult, "toDouble");
3253 // LLA: sal_Bool bRes=sal_False;
3255 // LLA: bRes=c_rtl_tres_state
3257 // LLA: hRtlTestResult,
3258 // LLA: test_toData<double>((const char**)inputDouble,nDoubleCount,10,
3259 // LLA: expValDouble,4,hRtlTestResult),
3261 // LLA: "toDouble()"
3263 // LLA: c_rtl_tres_state_end( hRtlTestResult, "toDouble");
3264 // LLA: // return ( bRes );
3267 //------------------------------------------------------------------------
3268 // testing the method toFloat()
3269 //------------------------------------------------------------------------
3270 // LLA: dt:20040802 the test_toData() has compile problems.
3271 // LLA: extern "C" void /* sal_Bool */ SAL_CALL test_rtl_OUString_toFloat(
3272 // LLA: hTestResult hRtlTestResult )
3274 // LLA: c_rtl_tres_state_start( hRtlTestResult, "toFloat");
3275 // LLA: sal_Bool bRes=sal_False;
3277 // LLA: bRes=c_rtl_tres_state
3279 // LLA: hRtlTestResult,
3280 // LLA: test_toData<float>((const char**)inputFloat,
3281 // LLA: nFloatCount,
3282 // LLA: 10, /* radix */
3283 // LLA: expValFloat,
3284 // LLA: 5, /* float */
3286 // LLA: hRtlTestResult),
3291 // LLA: c_rtl_tres_state_end( hRtlTestResult, "toFloat");
3292 // LLA: // return ( bRes );
3295 //------------------------------------------------------------------------
3296 // testing the method toChar()
3297 //------------------------------------------------------------------------
3298 extern "C" void /* sal_Bool */ SAL_CALL
test_rtl_OUString_toChar(
3299 hTestResult hRtlTestResult
)
3301 c_rtl_tres_state_start( hRtlTestResult
, "toChar");
3302 sal_Bool bRes
=sal_False
;
3304 bRes
=c_rtl_tres_state
3307 test_toData
<sal_Unicode
>((const char**)inputChar
,nCharCount
,
3308 10,expValChar
,6,NULL
,hRtlTestResult
),
3313 c_rtl_tres_state_end( hRtlTestResult
, "toChar");
3317 //------------------------------------------------------------------------
3318 // testing the method toBoolean()
3319 //------------------------------------------------------------------------
3320 extern "C" void /* sal_Bool */ SAL_CALL
test_rtl_OUString_toBoolean(
3321 hTestResult hRtlTestResult
)
3323 c_rtl_tres_state_start( hRtlTestResult
, "toBoolean");
3324 sal_Char methName
[MAXBUFLENGTH
];
3325 sal_Char
* pMeth
= methName
;
3327 typedef struct TestCase
3333 ~TestCase() {delete input
;}
3336 TestCase arrTestCase
[]={
3338 {"expected true", sal_True
, new OUString("True",4,kEncodingRTLTextUSASCII
,
3339 kConvertFlagsOStringToOUString
)},
3340 {"expected false", sal_False
, new OUString("False",5,
3341 kEncodingRTLTextUSASCII
,
3342 kConvertFlagsOStringToOUString
)},
3343 {"expected true", sal_True
, new OUString("1",1,kEncodingRTLTextUSASCII
,
3344 kConvertFlagsOStringToOUString
)}
3347 sal_Bool res
= sal_True
;
3350 for (i
= 0; i
< (sizeof (arrTestCase
))/(sizeof (TestCase
)); i
++)
3352 sal_Bool bRes
= arrTestCase
[i
].input
->toBoolean();
3353 sal_Bool lastRes
= (bRes
== arrTestCase
[i
].expVal
);
3358 arrTestCase
[i
].comments
,
3359 createName( pMeth
, "toBoolean", i
)
3364 c_rtl_tres_state_end( hRtlTestResult
, "toBoolean");
3367 //------------------------------------------------------------------------
3368 // testing the method toInt32()
3369 //------------------------------------------------------------------------
3371 sal_Bool SAL_CALL
test_rtl_OUString_toInt32_normal(
3372 hTestResult hRtlTestResult
)
3374 sal_Int32 expValues
[kBase36NumsCount
];
3377 for ( i
= 0; i
< kBase36NumsCount
; i
++ )
3380 sal_Bool res
= c_rtl_tres_state
3383 test_toData
<sal_Int32
>( kBinaryNumsStr
,kBinaryNumsCount
,
3384 kRadixBinary
,expValues
,1,NULL
,hRtlTestResult
),
3386 "toInt32( radix 2 )"
3388 res
&= c_rtl_tres_state
3391 test_toData
<sal_Int32
>( kBinaryMaxNumsStr
,kInt32MaxNumsCount
,
3392 kRadixBinary
,kInt32MaxNums
,1,NULL
,hRtlTestResult
),
3393 "kBinaryMaxNumsStr",
3394 "toInt32_Boundaries( radix 2 )"
3397 res
&= c_rtl_tres_state
3400 test_toData
<sal_Int32
>( kOctolNumsStr
,kOctolNumsCount
,
3401 kRadixOctol
,expValues
,1,NULL
,hRtlTestResult
),
3403 "toInt32( radix 8 )"
3406 res
&= c_rtl_tres_state
3409 test_toData
<sal_Int32
>( kOctolMaxNumsStr
,kInt32MaxNumsCount
,
3410 kRadixOctol
,(sal_Int32
*)kInt32MaxNums
,1,NULL
,hRtlTestResult
),
3412 "toInt32_Boundaries( radix 8 )"
3415 res
&= c_rtl_tres_state
3418 test_toData
<sal_Int32
>( kDecimalNumsStr
,kDecimalNumsCount
,
3419 kRadixDecimal
,expValues
,1,NULL
,hRtlTestResult
),
3421 "toInt32( radix 10 )"
3424 res
&= c_rtl_tres_state
3427 test_toData
<sal_Int32
>( kDecimalMaxNumsStr
,kInt32MaxNumsCount
,
3428 kRadixDecimal
,(sal_Int32
*)kInt32MaxNums
,1,NULL
,hRtlTestResult
),
3429 "kDecimalMaxNumsStr",
3430 "toInt32_Boundaries( radix 10 )"
3433 res
&= c_rtl_tres_state
3436 test_toData
<sal_Int32
>( kHexDecimalNumsStr
,kHexDecimalNumsCount
,
3437 kRadixHexdecimal
,expValues
,1,NULL
,hRtlTestResult
),
3438 "kHexDecimalNumsStr",
3439 "toInt32( radix 16 )"
3442 res
&= c_rtl_tres_state
3445 test_toData
<sal_Int32
>( kHexDecimalMaxNumsStr
,kInt32MaxNumsCount
,
3446 kRadixHexdecimal
,(sal_Int32
*)kInt32MaxNums
,1,NULL
,hRtlTestResult
),
3447 "kHexDecimalMaxNumsStr",
3448 "toInt32_Boundaries( radix 16 )"
3451 res
&= c_rtl_tres_state
3454 test_toData
<sal_Int32
>( kBase36NumsStr
,kBase36NumsCount
,
3455 kRadixBase36
, expValues
,1,NULL
,hRtlTestResult
),
3457 "toInt32( radix 36 )"
3460 res
&= c_rtl_tres_state
3463 test_toData
<sal_Int32
>( kBase36MaxNumsStr
,kInt32MaxNumsCount
,
3464 kRadixBase36
,(sal_Int32
*)kInt32MaxNums
,1,NULL
,hRtlTestResult
),
3465 "kBase36MaxNumsStr",
3466 "toInt32_Boundaries( radix 36 )"
3469 const sal_Int16 nSpecCases
= 5;
3470 static const sal_Char
*spString
[nSpecCases
] =
3479 sal_Int32 expSpecVal
[nSpecCases
] =
3488 res
&= c_rtl_tres_state
3491 test_toData
<sal_Int32
>( spString
,nSpecCases
,
3492 kRadixDecimal
,expSpecVal
,1,NULL
,hRtlTestResult
),
3494 "toInt32( specialcases )"
3499 sal_Bool SAL_CALL
test_rtl_OUString_toInt32_wrongRadix(
3500 hTestResult hRtlTestResult
)
3502 ::rtl::OUString
str("0",1,kEncodingRTLTextUSASCII
,
3503 kConvertFlagsOStringToOUString
);
3505 sal_Int32 iRes
=str
.toInt32(-1);
3514 "toInt32( 0, wrong radix -1 )"
3518 sal_Bool SAL_CALL
test_rtl_OUString_toInt32_defaultParam(
3519 hTestResult hRtlTestResult
)
3521 sal_Int32 expValues
[kBase36NumsCount
];
3524 for ( i
= 0; i
< kBase36NumsCount
; i
++ )
3527 sal_Bool res
= c_rtl_tres_state
3530 test_toData
<sal_Int32
>( kDecimalNumsStr
,kDecimalNumsCount
,
3531 kRadixDecimal
,expValues
,0,NULL
,hRtlTestResult
),
3533 "toInt32( radix 2 )"
3535 res
&= c_rtl_tres_state
3538 test_toData
<sal_Int32
>( kDecimalMaxNumsStr
,kInt32MaxNumsCount
,
3539 kRadixDecimal
,(sal_Int32
*)kInt32MaxNums
,0,NULL
,hRtlTestResult
),
3540 "kDecimalMaxNumsStr",
3541 "toInt32_Boundaries( radix 10 )"
3543 const sal_Int16 nSpecCases
= 5;
3544 static const sal_Char
*spString
[nSpecCases
] =
3553 sal_Int32 expSpecVal
[nSpecCases
] =
3562 res
&= c_rtl_tres_state
3565 test_toData
<sal_Int32
>( spString
,nSpecCases
,
3566 kRadixDecimal
,expSpecVal
,0,NULL
,hRtlTestResult
),
3568 "toInt32( specialcases )"
3574 //------------------------------------------------------------------------
3575 // testing the method toInt32()
3576 //------------------------------------------------------------------------
3577 extern "C" void /* sal_Bool */ SAL_CALL
test_rtl_OUString_toInt32(
3578 hTestResult hRtlTestResult
)
3580 c_rtl_tres_state_start( hRtlTestResult
, "toInt32");
3581 sal_Bool bTState
= test_rtl_OUString_toInt32_normal( hRtlTestResult
);
3582 bTState
&= test_rtl_OUString_toInt32_defaultParam( hRtlTestResult
);
3583 bTState
&= test_rtl_OUString_toInt32_wrongRadix( hRtlTestResult
);
3584 c_rtl_tres_state_end( hRtlTestResult
, "toInt32");
3585 // return ( bTState );
3587 //------------------------------------------------------------------------
3588 // testing the method toInt64( sal_Int16 radix = 2,8,10,16,36 )
3589 //------------------------------------------------------------------------
3591 sal_Bool SAL_CALL
test_rtl_OUString_toInt64_normal(
3592 hTestResult hRtlTestResult
)
3594 sal_Int64 expValues
[kBase36NumsCount
];
3597 for (i
= 0; i
< kBase36NumsCount
; expValues
[i
] = i
, i
++);
3599 sal_Bool res
= c_rtl_tres_state
3602 test_toData
<sal_Int64
>( kBinaryNumsStr
,kBinaryNumsCount
,
3603 kRadixBinary
,expValues
,3,NULL
,hRtlTestResult
),
3605 "toInt64( radix 2 )"
3608 /* LLA: does not work within wntmsci8.pro
3609 res &= c_rtl_tres_state
3612 test_toData<sal_Int64>( kBinaryMaxNumsStr,kInt64MaxNumsCount,
3613 kRadixBinary,kInt64MaxNums,3,hRtlTestResult ),
3614 "kBinaryMaxNumsStr",
3615 "toInt64_Boundaries( radix 2 )"
3619 res
&= c_rtl_tres_state
3622 test_toData
<sal_Int64
>( kOctolNumsStr
,kOctolNumsCount
,
3623 kRadixOctol
,expValues
,3,NULL
,hRtlTestResult
),
3625 "toInt64( radix 8 )"
3628 res
&= c_rtl_tres_state
3631 test_toData
<sal_Int64
>( kOctolMaxNumsStr
,kInt64MaxNumsCount
,
3632 kRadixOctol
,(sal_Int64
*)kInt64MaxNums
,3,NULL
,hRtlTestResult
),
3634 "toInt64_Boundaries( radix 8 )"
3637 res
&= c_rtl_tres_state
3640 test_toData
<sal_Int64
>( kDecimalNumsStr
,kDecimalNumsCount
,
3641 kRadixDecimal
,expValues
,3,NULL
,hRtlTestResult
),
3643 "toInt64( radix 10 )"
3646 res
&= c_rtl_tres_state
3649 test_toData
<sal_Int64
>( kDecimalMaxNumsStr
,kInt64MaxNumsCount
,
3650 kRadixDecimal
,(sal_Int64
*)kInt64MaxNums
,3,NULL
,hRtlTestResult
),
3651 "kDecimalMaxNumsStr",
3652 "toInt64_Boundaries( radix 10 )"
3655 res
&= c_rtl_tres_state
3658 test_toData
<sal_Int64
>( kHexDecimalNumsStr
,kHexDecimalNumsCount
,
3659 kRadixHexdecimal
,expValues
,3,NULL
,hRtlTestResult
),
3660 "kHexDecimalNumsStr",
3661 "toInt64( radix 16 )"
3664 res
&= c_rtl_tres_state
3667 test_toData
<sal_Int64
>( kHexDecimalMaxNumsStr
,kInt64MaxNumsCount
,
3668 kRadixHexdecimal
,(sal_Int64
*)kInt64MaxNums
,3,NULL
,hRtlTestResult
),
3669 "kHexDecimalMaxNumsStr",
3670 "toInt64_Boundaries( radix 16 )"
3673 res
&= c_rtl_tres_state
3676 test_toData
<sal_Int64
>( kBase36NumsStr
,kBase36NumsCount
,
3677 kRadixBase36
, expValues
,3,NULL
,hRtlTestResult
),
3679 "toInt64( radix 36 )"
3682 res
&= c_rtl_tres_state
3685 test_toData
<sal_Int64
>( kBase36MaxNumsStr
,kInt64MaxNumsCount
,
3686 kRadixBase36
,(sal_Int64
*)kInt64MaxNums
,3,NULL
,hRtlTestResult
),
3687 "kBase36MaxNumsStr",
3688 "toInt64_Boundaries( radix 36 )"
3693 const sal_Int16 nSpecCases
= 5;
3694 static const sal_Char
*spString
[nSpecCases
] =
3703 sal_Int64 expSpecVal
[nSpecCases
] =
3712 res
&= c_rtl_tres_state
3715 test_toData
<sal_Int64
>( spString
,nSpecCases
,
3716 kRadixDecimal
,expSpecVal
,3,NULL
,hRtlTestResult
),
3718 "toInt64( specialcases )"
3724 sal_Bool SAL_CALL
test_rtl_OUString_toInt64_wrongRadix(
3725 hTestResult hRtlTestResult
)
3727 ::rtl::OUString
str("0",1,kEncodingRTLTextUSASCII
,
3728 kConvertFlagsOStringToOUString
);
3730 sal_Int64 iRes
= str
.toInt64(-1);
3738 "toInt64( wrong radix -1)"
3742 sal_Bool SAL_CALL
test_rtl_OUString_toInt64_defaultParam(
3743 hTestResult hRtlTestResult
)
3745 sal_Int64 expValues
[kBase36NumsCount
];
3748 for ( i
= 0; i
< kBase36NumsCount
; i
++ )
3751 sal_Bool res
= c_rtl_tres_state
3754 test_toData
<sal_Int64
>( kDecimalNumsStr
,kDecimalNumsCount
,
3755 kRadixDecimal
,expValues
,2,NULL
,hRtlTestResult
),
3757 "toInt64( radix 10 )"
3759 res
&= c_rtl_tres_state
3762 test_toData
<sal_Int64
>( kDecimalMaxNumsStr
,kInt64MaxNumsCount
,
3763 kRadixDecimal
,(sal_Int64
*)kInt64MaxNums
,2,NULL
,hRtlTestResult
),
3764 "kDecimalMaxNumsStr",
3765 "toInt64_Boundaries( radix 10 )"
3767 const sal_Int16 nSpecCases
= 5;
3768 static const sal_Char
*spString
[nSpecCases
] =
3777 sal_Int64 expSpecVal
[nSpecCases
] =
3786 res
&= c_rtl_tres_state
3789 test_toData
<sal_Int64
>( spString
,nSpecCases
,
3790 kRadixDecimal
,expSpecVal
,2,NULL
,hRtlTestResult
),
3792 "toInt64( specialcases )"
3798 //------------------------------------------------------------------------
3799 // testing the method toInt64()
3800 //------------------------------------------------------------------------
3801 extern "C" void /* sal_Bool */ SAL_CALL
test_rtl_OUString_toInt64(
3802 hTestResult hRtlTestResult
)
3804 c_rtl_tres_state_start( hRtlTestResult
, "toInt64");
3805 sal_Bool bTState
= test_rtl_OUString_toInt64_normal( hRtlTestResult
);
3806 bTState
&= test_rtl_OUString_toInt64_defaultParam (hRtlTestResult
);
3807 bTState
&= test_rtl_OUString_toInt64_wrongRadix( hRtlTestResult
);
3808 c_rtl_tres_state_end( hRtlTestResult
, "toInt64");
3809 // return ( bTState );
3811 extern "C" void /* sal_Bool */ SAL_CALL
test_rtl_OUString( hTestResult hRtlTestResult
)
3814 c_rtl_tres_state_start(hRtlTestResult
, "rtl_OUString" );
3816 test_rtl_OUString_ctors( hRtlTestResult
);
3817 test_rtl_OUString_getLength( hRtlTestResult
);
3818 test_rtl_OUString_equals( hRtlTestResult
);
3819 test_rtl_OUString_equalsIgnoreAsciiCase( hRtlTestResult
);
3820 test_rtl_OUString_compareTo( hRtlTestResult
);
3821 test_rtl_OUString_match( hRtlTestResult
);
3822 test_rtl_OUString_op_eq( hRtlTestResult
);
3823 test_rtl_OUString_op_peq( hRtlTestResult
);
3824 test_rtl_OUString_csuc( hRtlTestResult
);
3825 test_rtl_OUString_getStr( hRtlTestResult
);
3826 test_rtl_OUString_reverseCompareTo( hRtlTestResult
);
3827 test_rtl_OUString_equalsAscii( hRtlTestResult
);
3828 test_rtl_OUString_equalsAsciiL( hRtlTestResult
);
3829 test_rtl_OUString_compareToAscii( hRtlTestResult
);
3830 test_rtl_OUString_valueOf_sal_Bool( hRtlTestResult
);
3831 test_rtl_OUString_valueOf_sal_Unicode( hRtlTestResult
);
3832 test_rtl_OUString_valueOf( hRtlTestResult
);
3833 test_rtl_OUString_createFromAscii( hRtlTestResult
);
3834 test_rtl_OUString_indexOf( hRtlTestResult
);
3835 // LLA: removed, it is in a new test in rtl/oustring. test_rtl_OUString_lastIndexOf( hRtlTestResult );
3836 test_rtl_OUString_concat( hRtlTestResult
);
3837 test_rtl_OUString_replaceAt( hRtlTestResult
);
3838 test_rtl_OUString_replace( hRtlTestResult
);
3839 test_rtl_OUString_toAsciiLowerCase( hRtlTestResult
);
3840 test_rtl_OUString_toAsciiUpperCase( hRtlTestResult
);
3841 test_rtl_OUString_trim( hRtlTestResult
);
3842 // LLA: removed, it is in a new test in rtl/oustring. test_rtl_OUString_toDouble( hRtlTestResult );
3843 // LLA: removed, has compile problems. test_rtl_OUString_toFloat( hRtlTestResult );
3844 test_rtl_OUString_toChar( hRtlTestResult
);
3845 test_rtl_OUString_toBoolean( hRtlTestResult
);
3846 test_rtl_OUString_toInt32( hRtlTestResult
);
3847 test_rtl_OUString_toInt64( hRtlTestResult
);
3849 c_rtl_tres_state_end(hRtlTestResult
, "rtl_OUString");
3851 // -----------------------------------------------------------------------------
3852 void RegisterAdditionalFunctions(FktRegFuncPtr _pFunc
)
3856 (_pFunc
)(&test_rtl_OUString
, "");