1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: rtl_OUString.cxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_sal.hxx"
33 #include <sal/types.h>
35 //# #ifndef _RTL_TRES_H_
36 //# #include <rtl/tres.h>
38 #include <testshl/tresstatewrapper.hxx>
39 #include "stringhelper.hxx"
40 #include <rtl/string.hxx>
41 #include <rtl/ustring.h>
42 #include <rtl/ustring.hxx>
44 //------------------------------------------------------------------------
45 //------------------------------------------------------------------------
46 #include <osl/thread.h>
47 #include <rtl_String_Const.h>
48 #include <rtl_String_Utils.hxx>
54 //------------------------------------------------------------------------
56 //------------------------------------------------------------------------
57 const int MAXBUFLENGTH
= 255;
58 //------------------------------------------------------------------------
60 //------------------------------------------------------------------------
63 // NEVER CALL SUCH FUNCTION!!!
64 (void)input1StrLastDefault
;
65 (void)input1StrLastNormal
;
69 //------------------------------------------------------------------------
70 // testing constructors
71 //------------------------------------------------------------------------
72 static sal_Bool
test_rtl_OUString_ctor_001( hTestResult hRtlTestResult
)
75 ::rtl::OUString aUStr
;
76 rtl_uString
* pData
= aUStr
.pData
;
85 "New OUString containing no characters",
91 //------------------------------------------------------------------------
93 static sal_Bool SAL_CALL
test_rtl_OUString_ctor_002(
94 hTestResult hRtlTestResult
)
96 ::rtl::OUString
aUStr( kTestStr1
,
98 kEncodingRTLTextUSASCII
,
99 kConvertFlagsOStringToOUString
108 "OUString from an ascii string",
113 //------------------------------------------------------------------------
115 static sal_Bool SAL_CALL
test_rtl_OUString_ctor_003(
116 hTestResult hRtlTestResult
)
118 rtl_uString
*rtlUStr
=NULL
;
119 rtl_uString_newFromAscii( &rtlUStr
, kTestStr1
);
120 ::rtl::OUString
aUStr( rtlUStr
);
128 "New OUString from a rtl_uString",
134 //------------------------------------------------------------------------
136 static sal_Bool SAL_CALL
test_rtl_OUString_ctor_004(
137 hTestResult hRtlTestResult
)
139 ::rtl::OUString
aUStr( aUStr1
);
147 "New OUString from unicode string",
152 //------------------------------------------------------------------------
154 static sal_Bool
test_rtl_OUString_ctor_005( hTestResult hRtlTestResult
)
156 ::rtl::OUString
aUStr( aUStr2
, kTestStr1Len
);
164 "New OUString from the first n characters of unicode string",
172 //------------------------------------------------------------------------
174 static sal_Bool
test_rtl_OUString_ctor_006( hTestResult hRtlTestResult
)
176 ::rtl::OUString
aUStrtmp( aUStr1
);
177 ::rtl::OUString
aUStr( aUStrtmp
);
185 "New OUString from another OUString",
191 extern "C" void /* sal_Bool */ SAL_CALL
test_rtl_OUString_ctors(
192 hTestResult hRtlTestResult
)
194 c_rtl_tres_state_start( hRtlTestResult
, "ctors");
195 sal_Bool DCState
= test_ini_uString();
197 sal_Bool bTSState
= test_rtl_OUString_ctor_001( hRtlTestResult
);
198 bTSState
&= test_rtl_OUString_ctor_002( hRtlTestResult
);
199 bTSState
&= test_rtl_OUString_ctor_003( hRtlTestResult
);
200 bTSState
&= test_rtl_OUString_ctor_004( hRtlTestResult
);
201 bTSState
&= test_rtl_OUString_ctor_005( hRtlTestResult
);
202 bTSState
&= test_rtl_OUString_ctor_006( hRtlTestResult
);
203 c_rtl_tres_state_end( hRtlTestResult
, "ctors");
204 // return( bTSState );
209 //------------------------------------------------------------------------
210 // testing the method getLength
211 //------------------------------------------------------------------------
213 extern "C" void /* sal_Bool */ SAL_CALL
test_rtl_OUString_getLength(
214 hTestResult hRtlTestResult
)
216 c_rtl_tres_state_start( hRtlTestResult
, "getLength");
217 sal_Char methName
[MAXBUFLENGTH
];
218 sal_Char
* pMeth
= methName
;
220 typedef struct TestCase
225 ~TestCase() { delete input
;}
228 TestCase arrTestCase
[]={
230 {"length of ascii string", kTestStr1Len
,
231 new OUString( kTestStr1
,
233 kEncodingRTLTextUSASCII
,
234 kConvertFlagsOStringToOUString
)},
235 {"length of ascci string of size 1", 1,
238 kEncodingRTLTextUSASCII
,
239 kConvertFlagsOStringToOUString
)},
240 {"length of empty string (default constructor)", 0, new OUString()},
241 {"length of empty string (empty ascii string arg)",0,
244 kEncodingRTLTextUSASCII
,
245 kConvertFlagsOStringToOUString
)},
246 {"length of empty string (string arg = '\\0')", 0,
249 kEncodingRTLTextUSASCII
,
250 kConvertFlagsOStringToOUString
)}
254 sal_Bool res
= sal_True
;
257 for (i
= 0; i
< (sizeof (arrTestCase
))/(sizeof (TestCase
)); i
++)
259 sal_Int32 length
= arrTestCase
[i
].input
->getLength();
260 sal_Bool lastRes
= (length
== arrTestCase
[i
].expVal
);
265 arrTestCase
[i
].comments
,
266 createName( pMeth
, "getLength", i
)
271 c_rtl_tres_state_end( hRtlTestResult
, "getLength");
275 //------------------------------------------------------------------------
276 // testing the method equals( const OString & aStr )
277 //------------------------------------------------------------------------
278 extern "C" void /* sal_Bool */ SAL_CALL
test_rtl_OUString_equals(
279 hTestResult hRtlTestResult
)
281 c_rtl_tres_state_start( hRtlTestResult
, "equals");
282 sal_Char methName
[MAXBUFLENGTH
];
283 sal_Char
* pMeth
= methName
;
285 typedef struct TestCase
291 ~TestCase() { delete input1
;delete input2
;}
294 TestCase arrTestCase
[]={
296 {"same size", sal_True
, new OUString(aUStr1
), new OUString(aUStr1
)},
297 {"different size", sal_False
, new OUString(aUStr1
),
300 {"same size, no case match", sal_False
, new OUString(aUStr1
),
303 {"two empty strings(def. constructor)", sal_True
, new OUString(),
306 {"empty(def.constructor) and non empty", sal_False
, new OUString(),
309 {"non empty and empty(def. constructor)", sal_False
,
310 new OUString(aUStr1
),
313 {"two empty strings(string arg = '\\0')", sal_True
,
316 kEncodingRTLTextUSASCII
,
317 kConvertFlagsOStringToOUString
),
320 kEncodingRTLTextUSASCII
,
321 kConvertFlagsOStringToOUString
)
323 {"empty(string arg = '\\0') and non empty", sal_False
,
326 kEncodingRTLTextUSASCII
,
327 kConvertFlagsOStringToOUString
),
330 {"non empty and empty(string arg = '\\0')", sal_False
,
331 new OUString(aUStr1
),
334 kEncodingRTLTextUSASCII
,
335 kConvertFlagsOStringToOUString
)
339 sal_Bool res
= sal_True
;
342 for(i
= 0; i
< (sizeof (arrTestCase
))/(sizeof (TestCase
)); i
++)
345 ( arrTestCase
[i
].input1
->equals(*(arrTestCase
[i
].input2
)) ==
346 arrTestCase
[i
].expVal
);
352 arrTestCase
[i
].comments
,
353 createName( pMeth
, "equals", i
)
358 c_rtl_tres_state_end( hRtlTestResult
, "equals");
362 //------------------------------------------------------------------------
363 // testing the method equalsIgnoreAsciiCase( const OString & aStr )
364 //------------------------------------------------------------------------
366 extern "C" void /* sal_Bool */ SAL_CALL
test_rtl_OUString_equalsIgnoreAsciiCase(
367 hTestResult hRtlTestResult
)
369 c_rtl_tres_state_start( hRtlTestResult
, "equalsIgnoreAsciiCase");
370 sal_Char methName
[MAXBUFLENGTH
];
371 sal_Char
* pMeth
= methName
;
373 typedef struct TestCase
379 ~TestCase() { delete input1
;delete input2
;}
382 TestCase arrTestCase
[]={
383 {"same strings but different cases",sal_True
,new OUString(aUStr4
),
386 {"same strings",sal_True
,new OUString(aUStr4
),
387 new OUString(aUStr4
)},
388 {"with equal beginning",sal_False
,new OUString(aUStr2
),
391 {"empty(def.constructor) and non empty",sal_False
,new OUString(),
394 {"non empty and empty(def.constructor)",sal_False
,
395 new OUString(aUStr4
),
398 {"two empty strings(def.constructor)",sal_True
,new OUString(),
401 {"different strings with equal length",sal_False
,
402 new OUString(aUStr10
),
403 new OUString(aUStr11
)
407 sal_Bool res
= sal_True
;
410 for(i
= 0; i
< (sizeof (arrTestCase
))/(sizeof (TestCase
)); i
++)
413 (arrTestCase
[i
].input1
->equalsIgnoreAsciiCase(*arrTestCase
[i
].input2
) ==
414 arrTestCase
[i
].expVal
);
420 arrTestCase
[i
].comments
,
421 createName( pMeth
, "equalsIgnoreAsciiCase", i
)
426 c_rtl_tres_state_end( hRtlTestResult
, "equalsIgnoreAsciiCase");
431 static sal_Bool SAL_CALL
test_rtl_OUString_compareTo_001(
432 hTestResult hRtlTestResult
)
434 sal_Char methName
[MAXBUFLENGTH
];
435 sal_Char
* pMeth
= methName
;
437 typedef struct TestCase
443 ~TestCase() { delete input1
;delete input2
;}
446 TestCase arrTestCase
[]={
448 {"simple compare, str1 to str5",-1,new OUString(aUStr1
),
451 {"simple compare, str2 to str5",-1,new OUString(aUStr2
),
454 {"simple compare, str1 to str9",-1,new OUString(aUStr1
),
457 {"simple compare, str1 to str2",-1,new OUString(aUStr1
),
460 {"simple compare, str4 to str5",-1,new OUString(aUStr4
),
463 {"simple compare, str1 to str3",-1,new OUString(aUStr1
),
466 {"simple compare, str5 to str1",+1,new OUString(aUStr5
),
469 {"simple compare, str2 to str1",+1,new OUString(aUStr2
),
472 {"simple compare, str9 to str5",+1,new OUString(aUStr9
),
475 {"simple compare, str5 to str4",+1,new OUString(aUStr5
),
478 {"simple compare, str1 to str1",0,new OUString(aUStr1
),
481 {"simple compare, nullString to nullString",0,new OUString(),
484 {"simple compare, nullString to str2",-1,new OUString(),
487 {"simple compare, str1 to nullString",+1,new OUString(aUStr1
),
492 sal_Bool res
= sal_True
;
495 for(i
= 0; i
< (sizeof (arrTestCase
))/(sizeof (TestCase
)); i
++)
497 sal_Int32 cmpRes
= arrTestCase
[i
].input1
->compareTo
498 (*arrTestCase
[i
].input2
);
499 cmpRes
= ( cmpRes
== 0 ) ? 0 : ( cmpRes
> 0 ) ? +1 : -1 ;
500 sal_Bool lastRes
= ( cmpRes
== arrTestCase
[i
].expVal
);
507 arrTestCase
[i
].comments
,
508 createName( pMeth
, "compareTo_001(const OString&)", i
)
518 //------------------------------------------------------------------------
519 // testing the method compareTo( const OString & rObj, sal_Int32 length )
520 //------------------------------------------------------------------------
521 static sal_Bool SAL_CALL
test_rtl_OUString_compareTo_002(
522 hTestResult hRtlTestResult
)
524 sal_Char methName
[MAXBUFLENGTH
];
525 sal_Char
* pMeth
= methName
;
527 typedef struct TestCase
534 ~TestCase() { delete input1
;delete input2
;}
537 TestCase arrTestCase
[] =
539 {"compare with maxlength, str1 to str9, 16",-1,16,
540 new OUString(aUStr1
), new OUString(aUStr9
)},
541 {"compare with maxlength, str2 to str9, 32",-1,32,
542 new OUString(aUStr2
), new OUString(aUStr9
)},
543 {"compare with maxlength, str9 to str4, 16",+1,16,
544 new OUString(aUStr9
), new OUString(aUStr4
)},
545 {"compare with maxlength, str9 to str22, 32",+1,32,
546 new OUString(aUStr9
), new OUString(aUStr22
)},
547 {"compare with maxlength, str9 to str5, 16",0,16,
548 new OUString(aUStr9
), new OUString(aUStr5
)},
549 {"compare with maxlength, str9 to str9, 32",0,32,
550 new OUString(aUStr9
), new OUString(aUStr9
)},
551 {"compare with maxlength, str1 to str2, 32",-1,32,
552 new OUString(aUStr1
), new OUString(aUStr2
)},
553 {"compare with maxlength, str1 to str2, 32",-1,32,
554 new OUString(aUStr1
), new OUString(aUStr2
)},
555 {"compare with maxlength, str1 to str2", 0,-1,
556 new OUString(aUStr1
), new OUString(aUStr2
)}
559 sal_Bool res
= sal_True
;
562 for(i
= 0; i
< (sizeof (arrTestCase
))/(sizeof (TestCase
)); i
++)
564 sal_Int32 cmpRes
= arrTestCase
[i
].input1
->compareTo
565 (*arrTestCase
[i
].input2
, arrTestCase
[i
].maxLength
);
566 cmpRes
= (cmpRes
== 0) ? 0 : (cmpRes
> 0) ? +1 : -1 ;
567 sal_Bool lastRes
= (cmpRes
== arrTestCase
[i
].expVal
);
573 arrTestCase
[i
].comments
,
574 createName( pMeth
, "compareTo_002(const OString&, sal_Int32)", i
)
583 extern "C" void /* sal_Bool */ SAL_CALL
test_rtl_OUString_compareTo(
584 hTestResult hRtlTestResult
)
586 c_rtl_tres_state_start( hRtlTestResult
, "compareTo");
587 sal_Bool res
= test_rtl_OUString_compareTo_001(hRtlTestResult
);
588 res
&= test_rtl_OUString_compareTo_002(hRtlTestResult
);
589 c_rtl_tres_state_end( hRtlTestResult
, "compareTo");
593 //------------------------------------------------------------------------
594 // testing the method match( const OUString & str, sal_Int32 fromIndex = 0 )
595 //------------------------------------------------------------------------
596 static sal_Bool SAL_CALL
test_rtl_OUString_match_001(
597 hTestResult hRtlTestResult
)
600 sal_Char methName
[MAXBUFLENGTH
];
601 sal_Char
* pMeth
= methName
;
603 typedef struct TestCase
609 ~TestCase() { delete input1
;delete input2
;}
612 TestCase arrTestCase
[]={
614 {"aUStr2 and aUStr1", sal_True
, new OUString(aUStr2
),
615 new OUString(aUStr1
)},
616 {"aUStr1 and aUStr2", sal_False
, new OUString(aUStr1
),
617 new OUString(aUStr2
)},
618 {"aUStr5 and aUStr6", sal_False
, new OUString(aUStr5
),
619 new OUString(aUStr6
)},
620 {"null and aUStr1", sal_False
, new OUString( "",
622 kEncodingRTLTextUSASCII
,
623 kConvertFlagsOStringToOUString
),
624 new OUString(aUStr1
)}
628 sal_Bool res
= sal_True
;
631 for(i
= 0; i
< (sizeof (arrTestCase
))/(sizeof (TestCase
)); i
++)
633 sal_Bool lastRes
= ( arrTestCase
[i
].input1
->match(
634 *(arrTestCase
[i
].input2
)) == arrTestCase
[i
].expVal
);
640 arrTestCase
[i
].comments
,
641 createName( pMeth
, "match(const OUString & str)", i
)
649 static sal_Bool SAL_CALL
test_rtl_OUString_match_002(
650 hTestResult hRtlTestResult
)
653 sal_Char methName
[MAXBUFLENGTH
];
654 sal_Char
* pMeth
= methName
;
656 typedef struct TestCase
663 ~TestCase() { delete input1
;delete input2
;}
666 TestCase arrTestCase
[]={
668 {"aUStr2 from 17 and aUStr6", sal_True
, 17,
669 new OUString(aUStr2
),new OUString(aUStr6
)},
670 {"aUStr2 from 5 and aUStr6", sal_False
, 5,
671 new OUString(aUStr2
),new OUString(aUStr6
)},
672 {"aUStr2 from 0 and aUStr1", sal_True
, 0,
673 new OUString(aUStr2
),new OUString(aUStr1
)},
674 {"aUStr1 from 16 and null", sal_True
, 16,
675 new OUString(aUStr1
),
678 kEncodingRTLTextUSASCII
,
679 kConvertFlagsOStringToOUString
682 {"aUStr1 from 5 and null", sal_True
, 5,
683 new OUString(aUStr1
),
686 kEncodingRTLTextUSASCII
,
687 kConvertFlagsOStringToOUString
690 {"aUStr2 from -1 and aUStr1", sal_False
, -1,
691 new OUString(aUStr2
),new OUString(aUStr1
)},
692 {"aUStr5 from 2 and aUStr4", sal_False
, 2,
693 new OUString(aUStr5
),new OUString(aUStr4
)},
694 {"aUStr2 from 18 and aUStr1", sal_False
, 18,
695 new OUString(aUStr2
),new OUString(aUStr1
)}
698 sal_Bool res
= sal_True
;
701 for(i
= 0; i
< (sizeof (arrTestCase
))/(sizeof (TestCase
)); i
++)
703 sal_Bool lastRes
= ( arrTestCase
[i
].input1
->match
704 (*(arrTestCase
[i
].input2
),arrTestCase
[i
].fromIndex
) ==
705 arrTestCase
[i
].expVal
);
711 arrTestCase
[i
].comments
,
713 "match(const OUString & str,sal_Int32 fromIndex = 0)", i
)
722 extern "C" void /* sal_Bool */ SAL_CALL
test_rtl_OUString_match(
723 hTestResult hRtlTestResult
)
725 c_rtl_tres_state_start( hRtlTestResult
, "match");
726 sal_Bool res
= test_rtl_OUString_match_001(hRtlTestResult
);
727 res
&= test_rtl_OUString_match_002(hRtlTestResult
);
728 c_rtl_tres_state_end( hRtlTestResult
, "match");
732 //------------------------------------------------------------------------
733 // testing the operator +=
734 //------------------------------------------------------------------------
735 extern "C" void /* sal_Bool */ SAL_CALL
test_rtl_OUString_op_eq(
736 hTestResult hRtlTestResult
)
738 c_rtl_tres_state_start( hRtlTestResult
, "eq");
739 sal_Char methName
[MAXBUFLENGTH
];
740 sal_Char
* pMeth
= methName
;
742 typedef struct TestCase
747 ~TestCase() { delete input1
; delete input2
;}
750 TestCase arrTestCase
[]={
751 {"null and Ustr1", new OUString
, new OUString(aUStr1
)},
752 {"Ustr2 and Ustr1", new OUString(aUStr2
),
753 new OUString(aUStr1
)},
754 {""" and Ustr1 from bit charactor buffer",
755 new OUString(aUStr1
),
758 kEncodingRTLTextUSASCII
,
759 kConvertFlagsOStringToOUString
761 {"Ustr1 and Ustr2 from value and length",
762 new OUString( aUStr2
, kTestStr2Len
),
763 new OUString(aUStr1
)}
767 sal_Bool res
= sal_True
;
770 for (i
= 0; i
< (sizeof (arrTestCase
))/(sizeof (TestCase
)); i
++)
772 *(arrTestCase
[i
].input1
) = *(arrTestCase
[i
].input2
);
773 sal_Bool lastRes
= (*(arrTestCase
[i
].input1
) ==
774 *(arrTestCase
[i
].input2
));
779 arrTestCase
[i
].comments
,
780 createName( pMeth
, "op_eq", i
)
785 c_rtl_tres_state_end( hRtlTestResult
, "eq");
789 //------------------------------------------------------------------------
790 // testing the operator +=
791 //------------------------------------------------------------------------
792 extern "C" void /* sal_Bool */ SAL_CALL
test_rtl_OUString_op_peq(
793 hTestResult hRtlTestResult
)
795 c_rtl_tres_state_start( hRtlTestResult
, "peq");
796 sal_Char methName
[MAXBUFLENGTH
];
797 sal_Char
* pMeth
= methName
;
799 typedef struct TestCase
805 ~TestCase() { delete input1
; delete input2
;}
808 TestCase arrTestCase
[]={
809 {" ' '= ''+='' ", new OUString( "",
811 kEncodingRTLTextUSASCII
,
812 kConvertFlagsOStringToOUString
816 kEncodingRTLTextUSASCII
,
817 kConvertFlagsOStringToOUString
821 kEncodingRTLTextUSASCII
,
822 kConvertFlagsOStringToOUString
824 {"Ustr1= null += Ustr1", new OUString(aUStr1
),
825 new OUString(), new OUString(aUStr1
)},
826 {"Ustr1= '' += Ustr1", new OUString(aUStr1
),
829 kEncodingRTLTextUSASCII,
830 kConvertFlagsOStringToOUString
833 new OUString(aUStr1
)},
834 {"Ustr1PlusUStr6 = Ustr1 += Ustr6",
835 new OUString(aUStr1PlusUStr6
), new OUString(aUStr1
),
836 new OUString(aUStr6
)},
840 sal_Bool res
= sal_True
;
843 for (i
= 0; i
< (sizeof (arrTestCase
))/(sizeof (TestCase
)); i
++)
845 *(arrTestCase
[i
].input1
) += *(arrTestCase
[i
].input2
);
846 sal_Bool lastRes
= (*(arrTestCase
[i
].expVal
) ==
847 *(arrTestCase
[i
].input1
));
852 arrTestCase
[i
].comments
,
853 createName( pMeth
, "op_peq", i
)
858 c_rtl_tres_state_end( hRtlTestResult
, "peq");
862 //------------------------------------------------------------------------
863 // testing the operator const sal_Unicode * (csuc for short)
864 //------------------------------------------------------------------------
865 extern "C" void /* sal_Bool */ SAL_CALL
test_rtl_OUString_csuc(
866 hTestResult hRtlTestResult
)
868 c_rtl_tres_state_start( hRtlTestResult
, "csuc");
869 sal_Char methName
[MAXBUFLENGTH
];
870 sal_Char
* pMeth
= methName
;
872 const sal_Unicode tmpUC
=0x0;
873 rtl_uString
* tmpUstring
= NULL
;
874 const sal_Char
*tmpStr
=kTestStr1
;
875 sal_Int32 tmpLen
=(sal_Int32
) kTestStr1Len
;
876 // sal_Int32 cmpLen = 0;
878 rtl_string2UString( &tmpUstring
, tmpStr
, tmpLen
,
879 osl_getThreadTextEncoding(), OSTRING_TO_OUSTRING_CVTFLAGS
);
880 OSL_ASSERT(tmpUstring
!= NULL
);
883 typedef struct TestCase
886 const sal_Unicode
* expVal
;
889 ~TestCase() { delete input1
;}
892 TestCase arrTestCase
[] =
894 {"test normal ustring",(*tmpUstring
).buffer
,kTestStr1Len
,
895 new OUString(aUStr1
)},
896 {"test empty ustring",&tmpUC
, 1, new OUString()}
899 sal_Bool res
= sal_True
;
901 for(i
= 0; i
< (sizeof (arrTestCase
))/(sizeof (TestCase
)); i
++)
903 const sal_Unicode
* pstr
= *arrTestCase
[i
].input1
;
905 res
&= c_rtl_tres_state
908 cmpstr((sal_Char
*)pstr
,
909 (sal_Char
*)arrTestCase
[i
].expVal
,
910 arrTestCase
[i
].cmpLen
),
911 arrTestCase
[i
].comments
,
912 createName( pMeth
, "const sal_Unicode*", i
)
915 c_rtl_tres_state_end( hRtlTestResult
, "csuc");
919 //------------------------------------------------------------------------
920 // testing the method const sal_Unicode * getStr()
921 //------------------------------------------------------------------------
922 extern "C" void /* sal_Bool */ SAL_CALL
test_rtl_OUString_getStr(
923 hTestResult hRtlTestResult
)
925 c_rtl_tres_state_start( hRtlTestResult
, "getStr");
926 sal_Char methName
[MAXBUFLENGTH
];
927 sal_Char
* pMeth
= methName
;
929 const sal_Unicode tmpUC
=0x0;
930 rtl_uString
* tmpUstring
= NULL
;
931 const sal_Char
*tmpStr
=kTestStr1
;
932 sal_Int32 tmpLen
=(sal_Int32
) kTestStr1Len
;
933 // sal_Int32 cmpLen = 0;
935 rtl_string2UString( &tmpUstring
, tmpStr
, tmpLen
,
936 osl_getThreadTextEncoding(), OSTRING_TO_OUSTRING_CVTFLAGS
);
937 OSL_ASSERT(tmpUstring
!= NULL
);
940 typedef struct TestCase
943 const sal_Unicode
* expVal
;
946 ~TestCase() { delete input1
;}
949 TestCase arrTestCase
[] =
951 {"test normal ustring",(*tmpUstring
).buffer
,kTestStr1Len
,
952 new OUString(aUStr1
)},
953 {"test empty ustring",&tmpUC
, 1, new OUString()}
956 sal_Bool res
= sal_True
;
958 for(i
= 0; i
< (sizeof (arrTestCase
))/(sizeof (TestCase
)); i
++)
960 const sal_Unicode
* pstr
= arrTestCase
[i
].input1
->getStr();
962 res
&= c_rtl_tres_state
965 cmpstr((sal_Char
*)pstr
,
966 (sal_Char
*)arrTestCase
[i
].expVal
,
967 arrTestCase
[i
].cmpLen
),
968 arrTestCase
[i
].comments
,
969 createName( pMeth
, "getStr", i
)
972 c_rtl_tres_state_end( hRtlTestResult
, "getStr");
977 //------------------------------------------------------------------------
978 // testing the method sal_Int32 reverseCompareTo( const OUString & str )
979 //-------------------------------------------------------------------------
980 extern "C" void /* sal_Bool */ SAL_CALL
test_rtl_OUString_reverseCompareTo(
981 hTestResult hRtlTestResult
)
983 c_rtl_tres_state_start( hRtlTestResult
, "reverseCompareTo");
984 sal_Char methName
[MAXBUFLENGTH
];
985 sal_Char
* pMeth
= methName
;
987 typedef struct TestCase
993 ~TestCase() { delete input1
;delete input2
;}
996 TestCase arrTestCase
[]={
998 {"simple compare, str1 to str5",-1,new OUString(aUStr1
),
1001 {"simple compare, str2 to str5",1,new OUString(aUStr2
),
1002 new OUString(aUStr5
)
1004 {"simple compare, str1 to str9",-1,new OUString(aUStr1
),
1005 new OUString(aUStr9
)
1007 {"simple compare, str4 to str5",-1,new OUString(aUStr4
),
1008 new OUString(aUStr5
)
1010 {"simple compare, str5 to str1",+1,new OUString(aUStr5
),
1011 new OUString(aUStr1
)
1013 {"simple compare, str2 to str1",+1,new OUString(aUStr2
),
1014 new OUString(aUStr1
)
1016 {"simple compare, str1 to str1",0,new OUString(aUStr1
),
1017 new OUString(aUStr1
)
1019 {"simple compare, nullString to nullString",0,new OUString(),
1022 {"simple compare, nullString to str2",-1,new OUString(),
1023 new OUString(aUStr2
)
1025 {"simple compare, str1 to nullString",+1,new OUString(aUStr1
),
1030 sal_Bool res
= sal_True
;
1033 for(i
= 0; i
< (sizeof (arrTestCase
))/(sizeof (TestCase
)); i
++)
1035 sal_Int32 cmpRes
= arrTestCase
[i
].input1
->reverseCompareTo
1036 (*arrTestCase
[i
].input2
);
1037 cmpRes
= ( cmpRes
== 0 ) ? 0 : ( cmpRes
> 0 ) ? +1 : -1 ;
1038 sal_Bool lastRes
= ( cmpRes
== arrTestCase
[i
].expVal
);
1045 arrTestCase
[i
].comments
,
1046 createName( pMeth
, "compareTo(const OString&)", i
)
1051 c_rtl_tres_state_end( hRtlTestResult
, "reverseCompareTo");
1055 //------------------------------------------------------------------------
1056 // testing the method sal_Bool equalsAscii( const sal_Char* asciiStr )
1057 //------------------------------------------------------------------------
1058 extern "C" void /* sal_Bool */ SAL_CALL
test_rtl_OUString_equalsAscii(
1059 hTestResult hRtlTestResult
)
1061 c_rtl_tres_state_start( hRtlTestResult
, "equalsAscii");
1062 sal_Char methName
[MAXBUFLENGTH
];
1063 sal_Char
* pMeth
= methName
;
1065 const sal_Char
*tmpAstr1
="Sun Microsystems\0";
1066 const sal_Char
*tmpAstr2
="\0";
1070 typedef struct TestCase
1075 const sal_Char
* input2
;
1076 ~TestCase() { delete input1
;}
1079 TestCase arrTestCase
[]={
1080 {"str1 with str1 ", sal_True
, new OUString( kTestStr1
,
1082 kEncodingRTLTextUSASCII
,
1083 kConvertFlagsOStringToOUString
1085 {"str2 with str1 ", sal_False
,new OUString( kTestStr2
,
1087 kEncodingRTLTextUSASCII
,
1088 kConvertFlagsOStringToOUString
1090 {"null with str1 ", sal_False
, new OUString(), tmpAstr1
},
1091 {"null with '' ", sal_True
, new OUString(), tmpAstr2
},
1092 {"'' with ''", sal_True
, new OUString( "",
1094 kEncodingRTLTextUSASCII
,
1095 kConvertFlagsOStringToOUString
1102 sal_Bool res
= sal_True
;
1105 for (i
= 0; i
< (sizeof (arrTestCase
))/(sizeof (TestCase
)); i
++)
1108 sal_Bool lastRes
= (arrTestCase
[i
].expVal
==
1109 arrTestCase
[i
].input1
->equalsAscii(arrTestCase
[i
].input2
));
1114 arrTestCase
[i
].comments
,
1115 createName( pMeth
, "equalsAscii", i
)
1120 c_rtl_tres_state_end( hRtlTestResult
, "equalsAscii");
1126 //------------------------------------------------------------------------
1127 // testing the method sal_Bool equalsAsciiL(
1128 // const sal_Char* asciiStr, sal_Int32 asciiStrLength )
1129 //------------------------------------------------------------------------
1130 extern "C" void /* sal_Bool */ SAL_CALL
test_rtl_OUString_equalsAsciiL(
1131 hTestResult hRtlTestResult
)
1133 c_rtl_tres_state_start( hRtlTestResult
, "equalsAsciiL");
1134 sal_Char methName
[MAXBUFLENGTH
];
1135 sal_Char
* pMeth
= methName
;
1137 const sal_Char
*tmpAstr1
="Sun Microsystems\0";
1138 const sal_Char
*tmpAstr2
="\0";
1139 const sal_Char
*tmpAstr3
="Sun Microsystems Java Technology\0";
1143 typedef struct TestCase
1148 const sal_Char
* input2
;
1150 ~TestCase() { delete input1
;}
1153 TestCase arrTestCase
[]={
1154 {"str1 with str1,str1Len ", sal_True
, new OUString( kTestStr1
,
1156 kEncodingRTLTextUSASCII
,
1157 kConvertFlagsOStringToOUString
1158 ), tmpAstr1
, kTestStr1Len
},
1159 {"str2 with str1,str1Len", sal_False
,new OUString( kTestStr2
,
1161 kEncodingRTLTextUSASCII
,
1162 kConvertFlagsOStringToOUString
1163 ), tmpAstr1
, kTestStr1Len
},
1164 {"str1 with str2,str1Len", sal_True
,new OUString( kTestStr1
,
1166 kEncodingRTLTextUSASCII
,
1167 kConvertFlagsOStringToOUString
1168 ), tmpAstr3
, kTestStr1Len
},
1169 {"null with str1,1 ", sal_False
, new OUString(), tmpAstr1
, 1},
1170 {"null with '',1 ", sal_False
, new OUString(), tmpAstr2
, 1},
1171 {"'' with '', 1", sal_False
, new OUString( "",
1173 kEncodingRTLTextUSASCII
,
1174 kConvertFlagsOStringToOUString
1181 sal_Bool res
= sal_True
;
1184 for (i
= 0; i
< (sizeof (arrTestCase
))/(sizeof (TestCase
)); i
++)
1187 sal_Bool lastRes
= (arrTestCase
[i
].expVal
==
1188 arrTestCase
[i
].input1
->equalsAsciiL(arrTestCase
[i
].input2
,
1189 arrTestCase
[i
].cmpLen
)
1195 arrTestCase
[i
].comments
,
1196 createName( pMeth
, "equalsAsciiL", i
)
1201 c_rtl_tres_state_end( hRtlTestResult
, "equalsAsciiL");
1205 //------------------------------------------------------------------------
1206 // testing the method sal_Int32 compareToAscii( const sal_Char* asciiStr )
1207 //------------------------------------------------------------------------
1208 extern "C" void /* sal_Bool */ SAL_CALL
test_rtl_OUString_compareToAscii(
1209 hTestResult hRtlTestResult
)
1211 c_rtl_tres_state_start( hRtlTestResult
, "compareToAscii");
1212 sal_Char methName
[MAXBUFLENGTH
];
1213 sal_Char
* pMeth
= methName
;
1215 const sal_Char
*tmpAstr1
="Sun Microsystems\0";
1216 const sal_Char
*tmpAstr2
="\0";
1217 const sal_Char
*tmpAstr3
="sun microsystems java technology\0";
1218 const sal_Char
*tmpAstr4
="Sun Microsystems Java Technology\0";
1221 typedef struct TestCase
1226 const sal_Char
* input2
;
1227 ~TestCase() { delete input1
;}
1230 TestCase arrTestCase
[]={
1231 {"str1 with str1 ", 0, new OUString( kTestStr1
,
1233 kEncodingRTLTextUSASCII
,
1234 kConvertFlagsOStringToOUString
1236 {"str1 with '' ", 83, new OUString( kTestStr1
,
1238 kEncodingRTLTextUSASCII
,
1239 kConvertFlagsOStringToOUString
1241 {"null with str1 ", -83 , new OUString(), tmpAstr1
},
1242 {"null with '' ", 0, new OUString(), tmpAstr2
},
1243 {"str1 with str9", -32, new OUString( kTestStr1
,
1245 kEncodingRTLTextUSASCII
,
1246 kConvertFlagsOStringToOUString
1249 {"str1 with str2", -32, new OUString( kTestStr1
,
1251 kEncodingRTLTextUSASCII
,
1252 kConvertFlagsOStringToOUString
1259 sal_Bool res
= sal_True
;
1262 for (i
= 0; i
< (sizeof (arrTestCase
))/(sizeof (TestCase
)); i
++)
1264 sal_Bool lastRes
= (arrTestCase
[i
].expVal
==
1265 arrTestCase
[i
].input1
->compareToAscii(arrTestCase
[i
].input2
));
1271 arrTestCase
[i
].comments
,
1272 createName( pMeth
, "equalsAscii", i
)
1277 c_rtl_tres_state_end( hRtlTestResult
, "compareToAscii");
1282 //------------------------------------------------------------------------
1283 // testing the method valueOf( sal_Bool b )
1284 //------------------------------------------------------------------------
1285 extern "C" void /* sal_Bool */ SAL_CALL
test_rtl_OUString_valueOf_sal_Bool(
1286 hTestResult hRtlTestResult
)
1288 c_rtl_tres_state_start( hRtlTestResult
, "Bool");
1289 sal_Char methName
[MAXBUFLENGTH
];
1290 sal_Char
* pMeth
= methName
;
1292 typedef struct TestCase
1298 ~TestCase() {delete expVal
;}
1301 TestCase arrTestCase
[]=
1303 {"input Bool 'true' and return OUString 'true'",
1304 new OUString("true",4,kEncodingRTLTextUSASCII
,
1305 kConvertFlagsOStringToOUString
),
1308 {"input Bool 'false' and return OUString 'false'",
1309 new OUString("false",5,kEncodingRTLTextUSASCII
,
1310 kConvertFlagsOStringToOUString
),
1318 for(i
=0;i
<(sizeof(arrTestCase
))/(sizeof(TestCase
));i
++)
1320 sal_Bool lastRes
=(*arrTestCase
[i
].expVal
==
1321 OUString::valueOf(arrTestCase
[i
].input1
)
1325 c_rtl_tres_state(hRtlTestResult
,
1327 arrTestCase
[i
].comments
,
1328 createName( pMeth
, "valueOf( sal_Bool b )", i
)
1333 c_rtl_tres_state_end( hRtlTestResult
, "Bool");
1337 //------------------------------------------------------------------------
1338 extern "C" void /* sal_Bool */ SAL_CALL
test_rtl_OUString_valueOf_sal_Unicode(
1339 hTestResult hRtlTestResult
)
1341 c_rtl_tres_state_start( hRtlTestResult
, "Unicode");
1342 sal_Char methName
[MAXBUFLENGTH
];
1343 sal_Char
* pMeth
= methName
;
1345 sal_Unicode tmpchar1
=97;
1346 sal_Unicode tmpchar2
=53;
1347 sal_Unicode tmpchar3
=0;
1348 sal_Unicode tmpchar4
=32;
1349 sal_Unicode tmpchar5
=47;
1351 typedef struct TestCase
1357 ~TestCase() {delete expVal
;}
1360 TestCase arrTestCase
[]=
1362 {"input Unicode 'a' and return OUString 'a'",
1363 new OUString(&tmpchar1
,1),tmpchar1
1365 {"input Unicode '5' and return OUString '5'",
1366 new OUString(&tmpchar2
,1), tmpchar2
1368 {"input Unicode 0 and return OUString 0",
1369 new OUString(&tmpchar3
,1),tmpchar3
1371 {"input Unicode ' ' and return OUString ' '",
1372 new OUString(&tmpchar4
,1),tmpchar4
1374 {"input Unicode '/' and return OUString ' '",
1375 new OUString(&tmpchar5
,1),tmpchar5
1379 sal_Bool res
=sal_True
;
1382 for(i
=0;i
<(sizeof(arrTestCase
))/(sizeof(TestCase
));i
++)
1384 sal_Bool lastRes
=(*(arrTestCase
[i
].expVal
)==
1385 OUString::valueOf(arrTestCase
[i
].input1
));
1387 c_rtl_tres_state(hRtlTestResult
,
1389 arrTestCase
[i
].comments
,
1390 createName( pMeth
, "valueOf( sal_Unicode c )", i
)
1395 c_rtl_tres_state_end( hRtlTestResult
, "Unicode");
1401 * Calls the method valueOf(T, radix) and compares
1402 * returned ustrings with ustrings that passed in the array resArray.
1404 * @param T, type of argument, passed to valueOf
1405 * @param resArray, array of result ustrings to compare to
1406 * @param n the number of elements in the array resArray (testcases)
1407 * @param pTestResult the instance of the class TestResult
1408 * @param inArray [optional], array of value that is passed as first argument
1411 * @return true, if all returned ustrings are equal to corresponding ustring in
1412 * resArray else, false.
1415 sal_Bool
test_valueOf( const char** resArray
, int n
, sal_Int16 radix
,
1416 hTestResult hRtlTestResult
, const T
*inArray
)
1418 sal_Bool bRes
= sal_True
;
1420 sal_Char methName
[MAXBUFLENGTH
];
1421 sal_Char
* pMeth
= methName
;
1423 // static sal_Unicode aUchar[50]={0x12};
1425 for (i
= 0; i
< n
; i
++)
1427 ::rtl::OUString aStr1
;
1429 OSL_ENSURE( i
< 50, "ERROR: leave aUchar bound");
1431 // AStringToUStringCopy(aUchar,resArray[i]);
1432 // ::rtl::OUString aStr2(aUchar);
1433 rtl::OUString aStr2
;
1434 aStr2
= OUString::createFromAscii(resArray
[i
]);
1436 ::rtl::OUString
aStr3( "-",1,kEncodingRTLTextUSASCII
,
1437 kConvertFlagsOStringToOUString
);
1441 aStr1
= ::rtl::OUString::valueOf((T
)i
, radix
);
1445 if ( inArray
[i
] < 0 )
1447 sal_Unicode aStr4
[100];
1448 OSL_ASSERT(strlen(resArray
[i
]) < 100);
1450 if(AStringToUStringCopy(aStr4
,resArray
[i
]))
1457 aStr1
= ::rtl::OUString::valueOf((T
)inArray
[i
], radix
);
1460 bRes
&= c_rtl_tres_state
1463 aStr2
.compareTo(aStr1
) == 0,
1464 (sal_Char
*)resArray
[i
],
1465 createName( pMeth
, "valueOf", i
)
1473 #define test_valueOf_Int32 test_valueOf<sal_Int32>
1474 #define test_valueOf_Int64 test_valueOf<sal_Int64>
1475 // LLA: #define test_valueOf_float test_valueOf<float>
1476 // LLA: #define test_valueOf_double test_valueOf<double>
1478 //------------------------------------------------------------------------
1479 // testing the method valueOf( sal_Int32 i, sal_Int16 radix=2 )
1480 // testing the method valueOf( sal_Int32 i, sal_Int16 radix=8 )
1481 // testing the method valueOf( sal_Int32 i, sal_Int16 radix=10 )
1482 // testing the method valueOf( sal_Int32 i, sal_Int16 radix=16 )
1483 // testing the method valueOf( sal_Int32 i, sal_Int16 radix=36 )
1484 //------------------------------------------------------------------------
1485 sal_Bool SAL_CALL
test_rtl_OUString_valueOf_Int32(
1486 hTestResult hRtlTestResult
)
1488 sal_Bool bRes
= sal_False
;
1490 bRes
= c_rtl_tres_state
1493 test_valueOf_Int32((const char**)kBinaryNumsStr
,
1494 kBinaryNumsCount
, kRadixBinary
, hRtlTestResult
, 0 ),
1496 "valueOf(sal_Int32, radix 2)"
1500 bRes
&= c_rtl_tres_state
1503 test_valueOf_Int32((const char**)kOctolNumsStr
,
1504 kOctolNumsCount
, kRadixOctol
, hRtlTestResult
, 0),
1506 "valueOf(sal_Int32, radix 8)"
1509 bRes
&= c_rtl_tres_state
1512 test_valueOf_Int32((const char**)kDecimalNumsStr
,
1513 kDecimalNumsCount
, kRadixDecimal
, hRtlTestResult
, 0),
1515 "valueOf(sal_Int32, radix 10)"
1518 bRes
&= c_rtl_tres_state
1521 test_valueOf_Int32((const char**)kHexDecimalNumsStr
,
1522 kHexDecimalNumsCount
, kRadixHexdecimal
, hRtlTestResult
, 0),
1524 "valueOf(sal_Int32, radix 16)"
1527 bRes
&= c_rtl_tres_state
1530 test_valueOf_Int32((const char**)kBase36NumsStr
,
1531 kBase36NumsCount
, kRadixBase36
, hRtlTestResult
, 0),
1533 "valueOf(sal_Int32, radix 36)"
1540 //------------------------------------------------------------------------
1541 // testing the method valueOf( sal_Int32 l, sal_Int32 radix=2 )
1542 // where l = large constants
1543 // testing the method valueOf( sal_Int32 l, sal_Int32 radix=8 )
1544 // where l = large constants
1545 // testing the method valueOf( sal_Int32 l, sal_Int32 radix=10 )
1546 // where l = large constants
1547 // testing the method valueOf( sal_Int32 l, sal_Int32 radix=16 )
1548 // where l = large constants
1549 // testing the method valueOf( sal_Int32 l, sal_Int32 radix=36 )
1550 // where l = large constants
1551 //------------------------------------------------------------------------
1552 sal_Bool SAL_CALL
test_rtl_OUString_valueOf_Int32_Bounderies(
1553 hTestResult hRtlTestResult
)
1555 sal_Bool bRes
= sal_False
;
1557 bRes
= c_rtl_tres_state
1560 test_valueOf_Int32((const char**)kBinaryMaxNumsStr
,
1561 kInt32MaxNumsCount
, kRadixBinary
,
1562 hRtlTestResult
, kInt32MaxNums
),
1564 "valueOf(salInt32, radix 2) Bounderies"
1567 bRes
&= c_rtl_tres_state
1570 test_valueOf_Int32((const char**)kOctolMaxNumsStr
,
1571 kInt32MaxNumsCount
, kRadixOctol
,
1572 hRtlTestResult
, kInt32MaxNums
),
1574 "valueOf(salInt32, radix 8) Bounderies"
1577 bRes
&= c_rtl_tres_state
1580 test_valueOf_Int32((const char**)kDecimalMaxNumsStr
,
1581 kInt32MaxNumsCount
, kRadixDecimal
,
1582 hRtlTestResult
, kInt32MaxNums
),
1584 "valueOf(salInt32, radix 10) Bounderies"
1587 bRes
&= c_rtl_tres_state
1590 test_valueOf_Int32((const char**)kHexDecimalMaxNumsStr
,
1591 kInt32MaxNumsCount
, kRadixHexdecimal
,
1592 hRtlTestResult
, kInt32MaxNums
),
1594 "valueOf(salInt32, radix 16) Bounderies"
1597 bRes
&= c_rtl_tres_state
1600 test_valueOf_Int32((const char**)kBase36MaxNumsStr
,
1601 kInt32MaxNumsCount
, kRadixBase36
,
1602 hRtlTestResult
, kInt32MaxNums
),
1604 "valueOf(salInt32, radix 36) Bounderies"
1610 //------------------------------------------------------------------------
1611 // testing the method valueOf( sal_Int32 i, sal_Int16 radix=2 )
1612 // for negative value
1613 // testing the method valueOf( sal_Int32 i, sal_Int16 radix=8 )
1614 // for negative value
1615 // testing the method valueOf( sal_Int32 i, sal_Int16 radix=10 )
1616 // for negative value
1617 // testing the method valueOf( sal_Int32 i, sal_Int16 radix=16 )
1618 // for negative value
1619 // testing the method valueOf( sal_Int32 i, sal_Int16 radix=36 )
1620 // for negative value
1621 //------------------------------------------------------------------------
1622 sal_Bool SAL_CALL
test_rtl_OUString_valueOf_Int32_Negative(
1623 hTestResult hRtlTestResult
)
1625 sal_Bool bRes
= sal_False
;
1626 sal_Int32 inArr
[kBase36NumsCount
];
1629 for (i
= 0; i
< kBase36NumsCount
; i
++ )
1632 bRes
= c_rtl_tres_state
1635 test_valueOf_Int32( kBinaryNumsStr
, kBinaryNumsCount
,
1636 kRadixBinary
, hRtlTestResult
, inArr
),
1637 "negative Int32, kRadixBinary",
1638 "valueOf( negative Int32, radix 2 )"
1641 bRes
&= c_rtl_tres_state
1644 test_valueOf_Int32( kOctolNumsStr
, kOctolNumsCount
,
1645 kRadixOctol
, hRtlTestResult
, inArr
),
1646 "negative Int32, kRadixOctol",
1647 "valueOf( negative Int32, radix 8 )"
1651 bRes
&= c_rtl_tres_state
1654 test_valueOf_Int32( kDecimalNumsStr
, kDecimalNumsCount
,
1655 kRadixDecimal
, hRtlTestResult
, inArr
),
1656 "negative Int32, kRadixDecimal",
1657 "valueOf( negative Int32, radix 10 )"
1660 bRes
&= c_rtl_tres_state
1663 test_valueOf_Int32( kHexDecimalNumsStr
, kHexDecimalNumsCount
,
1664 kRadixHexdecimal
, hRtlTestResult
, inArr
),
1665 "negative Int32, kRadixHexdecimal",
1666 "valueOf( negative Int32, radix 16 )"
1670 bRes
&= c_rtl_tres_state
1673 test_valueOf_Int32( kBase36NumsStr
, kBase36NumsCount
,
1674 kRadixBase36
, hRtlTestResult
, inArr
),
1675 "negative Int32, kRadixBase36",
1676 "valueOf( negative Int32, radix 36 )"
1681 //------------------------------------------------------------------------
1682 // testing the method valueOf( sal_Int32 l, sal_Int32 radix ) where radix = -5
1683 //------------------------------------------------------------------------
1684 sal_Bool SAL_CALL
test_rtl_OUString_valueOf_Int32_WrongRadix(
1685 hTestResult hRtlTestResult
)
1687 sal_Bool bRes
= sal_False
;
1689 sal_Int32 intVal
= 11;
1691 ::rtl::OUString aStr1
;
1692 ::rtl::OUString
aStr2("11",2,kEncodingRTLTextUSASCII
,
1693 kConvertFlagsOStringToOUString
);
1695 aStr1
= aStr1
.valueOf( intVal
, -5 );
1697 bRes
= c_rtl_tres_state
1700 aStr2
.compareTo( aStr1
) == 0,
1701 "if radix not valid then radix must be 10",
1702 "valueOf(sal_Int32, sal_Int32 radix): radix = -5"
1709 //------------------------------------------------------------------------
1710 static sal_Bool SAL_CALL
test_rtl_OUString_valueOf_Int32_defaultParam(
1711 hTestResult hRtlTestResult
)
1713 sal_Char methName
[MAXBUFLENGTH
];
1714 sal_Char
* pMeth
= methName
;
1716 sal_Char
* newUChar1
="15";
1717 sal_Char
* newUChar2
="0";
1718 sal_Char
* newUChar3
="-15";
1719 sal_Char
* newUChar4
="2147483647";
1720 sal_Char
* newUChar5
="-2147483648";
1722 typedef struct TestCase
1727 ~TestCase() {delete expVal
;}
1730 TestCase arrTestCase
[]=
1732 {"input Int32 15 and return OUString 15",15,
1733 new OUString(newUChar1
,2,kEncodingRTLTextUSASCII
,
1734 kConvertFlagsOStringToOUString
)
1736 {"input Int32 0 and return OUString 0",0,
1737 new OUString(newUChar2
,1,kEncodingRTLTextUSASCII
,
1738 kConvertFlagsOStringToOUString
)
1740 {"input Int32 -15 and return OUString -15",-15,
1741 new OUString(newUChar3
,3,kEncodingRTLTextUSASCII
,
1742 kConvertFlagsOStringToOUString
)
1744 {"input Int32 2147483647 and return OUString 2147483647", SAL_MAX_INT32
/* 2147483647 */,
1745 new OUString(newUChar4
,10,kEncodingRTLTextUSASCII
,
1746 kConvertFlagsOStringToOUString
)
1748 {"input Int32 -2147483648 and return OUString -2147483648",
1749 SAL_MIN_INT32
/* 2-2147483648 */,
1750 new OUString(newUChar5
,11,kEncodingRTLTextUSASCII
,
1751 kConvertFlagsOStringToOUString
)
1755 sal_Bool res
=sal_True
;
1758 for(i
=0;i
<(sizeof(arrTestCase
))/(sizeof(TestCase
));i
++)
1760 sal_Bool lastRes
=(*(arrTestCase
[i
].expVal
)==
1761 OUString::valueOf(arrTestCase
[i
].input1
));
1763 c_rtl_tres_state(hRtlTestResult
,
1765 arrTestCase
[i
].comments
,
1767 "valueOf( sal_Int32 i, sal_Int16 radix = 10 )", i
)
1776 //------------------------------------------------------------------------
1777 // testing the method valueOf( sal_Int64 l, sal_Int16 radix=2 )
1778 // testing the method valueOf( sal_Int64 l, sal_Int16 radix=8 )
1779 // testing the method valueOf( sal_Int64 l, sal_Int16 radix=10 )
1780 // testing the method valueOf( sal_Int64 l, sal_Int16 radix=16 )
1781 // testing the method valueOf( sal_Int64 l, sal_Int16 radix=36 )
1782 //------------------------------------------------------------------------
1783 sal_Bool SAL_CALL
test_rtl_OUString_valueOf_Int64(
1784 hTestResult hRtlTestResult
)
1786 sal_Bool bRes
= sal_False
;
1788 bRes
= c_rtl_tres_state
1791 test_valueOf_Int64((const char**)kBinaryNumsStr
,
1792 kBinaryNumsCount
, kRadixBinary
, hRtlTestResult
, 0),
1794 "valueOf(sal_Int64, radix 2)_"
1797 bRes
&= c_rtl_tres_state
1800 test_valueOf_Int64((const char**)kOctolNumsStr
,
1801 kOctolNumsCount
, kRadixOctol
, hRtlTestResult
, 0),
1803 "valueOf(sal_Int64, radix 8)_"
1806 bRes
&= c_rtl_tres_state
1809 test_valueOf_Int64((const char**)kDecimalNumsStr
,
1810 kDecimalNumsCount
, kRadixDecimal
, hRtlTestResult
, 0),
1812 "valueOf(sal_Int64, radix 10)_"
1814 bRes
&= c_rtl_tres_state
1817 test_valueOf_Int64((const char**)kHexDecimalNumsStr
,
1818 kHexDecimalNumsCount
, kRadixHexdecimal
, hRtlTestResult
, 0),
1820 "valueOf(sal_Int64, radix 16)_"
1823 bRes
&= c_rtl_tres_state
1826 test_valueOf_Int64((const char**)kBase36NumsStr
,
1827 kBase36NumsCount
, kRadixBase36
, hRtlTestResult
, 0),
1829 "valueOf(sal_Int64, radix 36)_"
1835 //------------------------------------------------------------------------
1836 // testing the method valueOf( sal_Int64 l, sal_Int32 radix=2 )
1837 // where l = large constants
1838 // testing the method valueOf( sal_Int64 l, sal_Int32 radix=8 )
1839 // where l = large constants
1840 // testing the method valueOf( sal_Int64 l, sal_Int32 radix=10 )
1841 // where l = large constants
1842 // testing the method valueOf( sal_Int64 l, sal_Int32 radix=16 )
1843 // where l = large constants
1844 // testing the method valueOf( sal_Int64 l, sal_Int32 radix=36 )
1845 // where l = large constants
1846 //------------------------------------------------------------------------
1847 sal_Bool SAL_CALL
test_rtl_OUString_valueOf_Int64_Bounderies(
1848 hTestResult hRtlTestResult
)
1850 sal_Bool bRes
= sal_False
;
1852 bRes
= c_rtl_tres_state
1855 test_valueOf_Int64((const char**)kBinaryMaxNumsStr
,
1856 kInt64MaxNumsCount
, kRadixBinary
,
1857 hRtlTestResult
, kInt64MaxNums
),
1859 "valueOf(salInt64, radix 2) Bounderies"
1862 bRes
&= c_rtl_tres_state
1865 test_valueOf_Int64((const char**)kOctolMaxNumsStr
,
1866 kInt64MaxNumsCount
, kRadixOctol
,
1867 hRtlTestResult
, kInt64MaxNums
),
1869 "valueOf(salInt64, radix 8) Bounderies"
1872 bRes
&= c_rtl_tres_state
1875 test_valueOf_Int64((const char**)kDecimalMaxNumsStr
,
1876 kInt64MaxNumsCount
, kRadixDecimal
,
1877 hRtlTestResult
, kInt64MaxNums
),
1879 "valueOf(salInt64, radix 10) Bounderies"
1882 bRes
&= c_rtl_tres_state
1885 test_valueOf_Int64((const char**)kHexDecimalMaxNumsStr
,
1886 kInt64MaxNumsCount
, kRadixHexdecimal
,
1887 hRtlTestResult
, kInt64MaxNums
),
1889 "valueOf(salInt64, radix 16) Bounderies"
1892 bRes
&= c_rtl_tres_state
1895 test_valueOf_Int64((const char**)kBase36MaxNumsStr
,
1896 kInt64MaxNumsCount
, kRadixBase36
,
1897 hRtlTestResult
, kInt64MaxNums
),
1899 "valueOf(salInt64, radix 36) Bounderies"
1905 //------------------------------------------------------------------------
1906 // testing the method valueOf( sal_Int64 l, sal_Int16 radix=2 )
1907 // for negative value
1908 // testing the method valueOf( sal_Int64 l, sal_Int16 radix=8 )
1909 // for negative value
1910 // testing the method valueOf( sal_Int64 l, sal_Int16 radix=10 )
1911 // for negative value
1912 // testing the method valueOf( sal_Int64 l, sal_Int16 radix=16 )
1913 // for negative value
1914 // testing the method valueOf( sal_Int64 l, sal_Int16 radix=36 )
1915 // for negative value
1916 //------------------------------------------------------------------------
1917 sal_Bool SAL_CALL
test_rtl_OUString_valueOf_Int64_Negative(
1918 hTestResult hRtlTestResult
)
1920 sal_Bool bRes
= sal_False
;
1922 sal_Int64 inArr
[36];
1925 for (i
= 0; i
< 36; i
++) {
1930 bRes
= c_rtl_tres_state
1933 test_valueOf_Int64( kBinaryNumsStr
, kBinaryNumsCount
,
1934 kRadixBinary
, hRtlTestResult
, inArr
),
1935 "negative Int64, kRadixBinary",
1936 "valueOf( negative Int64, radix 2 )"
1939 bRes
&= c_rtl_tres_state
1942 test_valueOf_Int64( kOctolNumsStr
, kOctolNumsCount
,
1943 kRadixOctol
, hRtlTestResult
, inArr
),
1944 "negative Int64, kRadixOctol",
1945 "valueOf( negative Int64, radix 8 )"
1948 bRes
&= c_rtl_tres_state
1951 test_valueOf_Int64( kDecimalNumsStr
, kDecimalNumsCount
,
1952 kRadixDecimal
, hRtlTestResult
, inArr
),
1953 "negative Int64, kRadixDecimal",
1954 "valueOf( negative Int64, radix 10 )"
1957 bRes
&= c_rtl_tres_state
1960 test_valueOf_Int64( kHexDecimalNumsStr
, kHexDecimalNumsCount
,
1961 kRadixHexdecimal
, hRtlTestResult
, inArr
),
1962 "negative Int64, kRadixHexDecimal",
1963 "valueOf( negative Int64, radix 16 )"
1966 bRes
&= c_rtl_tres_state
1969 test_valueOf_Int64( kBase36NumsStr
, kBase36NumsCount
,
1970 kRadixBase36
, hRtlTestResult
, inArr
),
1971 "negative Int64, kRadixBase36",
1972 "valueOf( negative Int64, radix 36 )"
1977 //------------------------------------------------------------------------
1978 // testing the method valueOf( sal_Int64 l, sal_Int32 radix )
1980 //------------------------------------------------------------------------
1981 sal_Bool SAL_CALL
test_rtl_OUString_valueOf_Int64_WrongRadix(
1982 hTestResult hRtlTestResult
)
1984 sal_Bool bRes
= sal_False
;
1986 sal_Int64 intVal
= 11;
1988 ::rtl::OUString aStr1
;
1989 ::rtl::OUString
aStr2("11",2,kEncodingRTLTextUSASCII
,
1990 kConvertFlagsOStringToOUString
);
1992 aStr1
= aStr1
.valueOf( intVal
, -5 );
1994 bRes
= c_rtl_tres_state
1997 aStr2
.compareTo(aStr1
) == 0,
1998 "if radix not valid then radix must be 10",
1999 "valueOf(sal_Int64, sal_Int32 radix): radix = -5"
2005 //------------------------------------------------------------------------
2006 static sal_Bool SAL_CALL
test_rtl_OUString_valueOf_Int64_defaultParam(
2007 hTestResult hRtlTestResult
)
2009 sal_Char methName
[MAXBUFLENGTH
];
2010 sal_Char
* pMeth
= methName
;
2012 sal_Char
* newUChar1
="15";
2013 sal_Char
* newUChar2
="0";
2014 sal_Char
* newUChar3
="-15";
2015 sal_Char
* newUChar4
= "9223372036854775807";
2016 sal_Char
* newUChar5
="-9223372036854775808";
2018 typedef struct TestCase
2023 ~TestCase() {delete expVal
;}
2026 TestCase arrTestCase
[]=
2028 {"input Int64 15 and return OUString 15",15,
2029 new OUString(newUChar1
,2,kEncodingRTLTextUSASCII
,
2030 kConvertFlagsOStringToOUString
)
2032 {"input Int64 0 and return OUString 0",0,
2033 new OUString(newUChar2
,1,kEncodingRTLTextUSASCII
,
2034 kConvertFlagsOStringToOUString
)
2036 {"input Int64 -15 and return OUString -15",-15,
2037 new OUString(newUChar3
,3,kEncodingRTLTextUSASCII
,
2038 kConvertFlagsOStringToOUString
)
2040 {"input Int64 9223372036854775807 and return 9223372036854775807",
2041 SAL_MAX_INT64
/* 9223372036854775807*/,
2042 new OUString(newUChar4
,19,kEncodingRTLTextUSASCII
,
2043 kConvertFlagsOStringToOUString
)
2045 {"input Int64 -9223372036854775808 and return -9223372036854775808",
2046 SAL_MIN_INT64
/* 9223372036854775808*/,
2047 new OUString(newUChar5
,20,kEncodingRTLTextUSASCII
,
2048 kConvertFlagsOStringToOUString
)
2052 sal_Bool res
=sal_True
;
2055 for(i
=0;i
<(sizeof(arrTestCase
))/(sizeof(TestCase
));i
++)
2057 sal_Bool lastRes
=(*(arrTestCase
[i
].expVal
)==
2058 OUString::valueOf(arrTestCase
[i
].input1
));
2060 c_rtl_tres_state(hRtlTestResult
,
2062 arrTestCase
[i
].comments
,
2064 "valueOf( sal_Int64 i, sal_Int16 radix = 10 )", i
)
2073 //------------------------------------------------------------------------
2074 // testing the method valueOf( float f )
2075 //------------------------------------------------------------------------
2076 // LLA: sal_Bool SAL_CALL test_rtl_OUString_valueOf_float(
2077 // LLA: hTestResult hRtlTestResult )
2079 // LLA: sal_Char methName[MAXBUFLENGTH];
2080 // LLA: sal_Char* pMeth =methName;
2082 // LLA: typedef struct TestCase
2084 // LLA: sal_Char* comments;
2085 // LLA: float input1;
2086 // LLA: OUString* expVal;
2088 // LLA: ~TestCase() {delete expVal;}
2091 // LLA: TestCase arrTestCase[] =
2093 // LLA: { "3.0", 3.0, new OUString("3.0",3,kEncodingRTLTextUSASCII,
2094 // LLA: kConvertFlagsOStringToOUString) },
2095 // LLA: { "3.5", 3.5f, new OUString("3.5",3,kEncodingRTLTextUSASCII,
2096 // LLA: kConvertFlagsOStringToOUString)},
2097 // LLA: { "3.0625", 3.0625f, new OUString("3.0625",6,kEncodingRTLTextUSASCII,
2098 // LLA: kConvertFlagsOStringToOUString)},
2099 // LLA: { "3.502525", 3.502525f, new OUString("3.502525",8,
2100 // LLA: kEncodingRTLTextUSASCII,kConvertFlagsOStringToOUString) },
2101 // LLA: { "3.141592", 3.141592f, new OUString("3.141592",8,
2102 // LLA: kEncodingRTLTextUSASCII,kConvertFlagsOStringToOUString) },
2103 // LLA: { "3.5025255", 3.5025255f, new OUString("3.5025255",9,
2104 // LLA: kEncodingRTLTextUSASCII,kConvertFlagsOStringToOUString) },
2105 // LLA: { "3.0039062", 3.00390625f, new OUString("3.0039062",9,
2106 // LLA: kEncodingRTLTextUSASCII,kConvertFlagsOStringToOUString) }
2109 // LLA: sal_Bool res = sal_True;
2110 // LLA: sal_Int32 i;
2112 // LLA: for(i = 0; i < (sizeof (arrTestCase))/(sizeof (TestCase)); i++)
2114 // LLA: ::rtl::OUString aStr1;
2115 // LLA: aStr1 = aStr1.valueOf( arrTestCase[i].input1 );
2116 // LLA: sal_Bool lastRes = (arrTestCase[i].expVal->compareTo(aStr1) == 0);
2118 // LLA: c_rtl_tres_state
2120 // LLA: hRtlTestResult,
2122 // LLA: arrTestCase[i].comments,
2123 // LLA: createName( pMeth, "valueof_float", i)
2126 // LLA: res &= lastRes;
2130 // LLA: return ( res );
2133 //------------------------------------------------------------------------
2134 // testing the method valueOf( float f ) for negative value
2135 //------------------------------------------------------------------------
2136 // LLA: sal_Bool SAL_CALL test_rtl_OUString_valueOf_Float_Negative(
2137 // LLA: hTestResult hRtlTestResult )
2139 // LLA: sal_Char methName[MAXBUFLENGTH];
2140 // LLA: sal_Char* pMeth =methName;
2142 // LLA: typedef struct TestCase
2144 // LLA: sal_Char* comments;
2145 // LLA: float input1;
2146 // LLA: OUString* expVal;
2148 // LLA: ~TestCase() {delete expVal;}
2151 // LLA: TestCase arrTestCase[] =
2153 // LLA: { "-3.0", -3.0, new OUString("-3.0",4,kEncodingRTLTextUSASCII,
2154 // LLA: kConvertFlagsOStringToOUString) },
2155 // LLA: { "-3.5", -3.5f, new OUString("-3.5",4,kEncodingRTLTextUSASCII,
2156 // LLA: kConvertFlagsOStringToOUString)},
2157 // LLA: { "-3.0625", -3.0625f, new OUString("-3.0625",7,
2158 // LLA: kEncodingRTLTextUSASCII,kConvertFlagsOStringToOUString)},
2159 // LLA: { "-3.502525", -3.502525f, new OUString("-3.502525",9,
2160 // LLA: kEncodingRTLTextUSASCII,kConvertFlagsOStringToOUString) },
2161 // LLA: { "-3.141592", -3.141592f, new OUString("-3.141592",9,
2162 // LLA: kEncodingRTLTextUSASCII,kConvertFlagsOStringToOUString) },
2163 // LLA: { "-3.5025255", -3.5025255f, new OUString("-3.5025255",10,
2164 // LLA: kEncodingRTLTextUSASCII,kConvertFlagsOStringToOUString) },
2165 // LLA: { "-3.0039062", -3.00390625f, new OUString("-3.0039062",10,
2166 // LLA: kEncodingRTLTextUSASCII,kConvertFlagsOStringToOUString) }
2169 // LLA: sal_Bool res = sal_True;
2170 // LLA: sal_Int32 i;
2172 // LLA: for(i = 0; i < (sizeof (arrTestCase))/(sizeof (TestCase)); i++)
2174 // LLA: ::rtl::OUString aStr1;
2175 // LLA: aStr1 = aStr1.valueOf( arrTestCase[i].input1 );
2176 // LLA: sal_Bool lastRes = (arrTestCase[i].expVal->compareTo(aStr1) == 0);
2178 // LLA: c_rtl_tres_state
2180 // LLA: hRtlTestResult,
2182 // LLA: arrTestCase[i].comments,
2183 // LLA: createName( pMeth, "valueof_negative float", i)
2186 // LLA: res &= lastRes;
2190 // LLA: return ( res );
2193 //------------------------------------------------------------------------
2194 // testing the method valueOf( double f )
2195 //------------------------------------------------------------------------
2196 // LLA: sal_Bool SAL_CALL test_rtl_OUString_valueOf_double(
2197 // LLA: hTestResult hRtlTestResult )
2199 // LLA: sal_Char methName[MAXBUFLENGTH];
2200 // LLA: sal_Char* pMeth =methName;
2202 // LLA: typedef struct TestCase
2204 // LLA: sal_Char* comments;
2205 // LLA: double input1;
2206 // LLA: OUString* expVal;
2208 // LLA: ~TestCase() {delete expVal;}
2211 // LLA: TestCase arrTestCase[] =
2213 // LLA: {"3.0", 3.0, new OUString("3.0",3,kEncodingRTLTextUSASCII,
2214 // LLA: kConvertFlagsOStringToOUString)},
2215 // LLA: {"3.5", 3.5, new OUString("3.5",3,kEncodingRTLTextUSASCII,
2216 // LLA: kConvertFlagsOStringToOUString)},
2217 // LLA: {"3.0625", 3.0625, new OUString("3.0625",6,kEncodingRTLTextUSASCII,
2218 // LLA: kConvertFlagsOStringToOUString)},
2219 // LLA: {"3.1415926535", 3.1415926535, new OUString("3.1415926535",12,
2220 // LLA: kEncodingRTLTextUSASCII,kConvertFlagsOStringToOUString)},
2221 // LLA: {"3.1415926535897931", 3.141592653589793,
2222 // LLA: new OUString("3.1415926535897931",18,kEncodingRTLTextUSASCII,
2223 // LLA: kConvertFlagsOStringToOUString)},
2224 // LLA: {"3.1415926535897931", 3.1415926535897932,
2225 // LLA: new OUString("3.1415926535897931",18,kEncodingRTLTextUSASCII,
2226 // LLA: kConvertFlagsOStringToOUString)},
2227 // LLA: {"3.1415926535897931", 3.14159265358979323,
2228 // LLA: new OUString("3.1415926535897931",18,kEncodingRTLTextUSASCII,
2229 // LLA: kConvertFlagsOStringToOUString)},
2230 // LLA: {"3.1415926535897931", 3.141592653589793238462643,
2231 // LLA: new OUString("3.1415926535897931",18,kEncodingRTLTextUSASCII,
2232 // LLA: kConvertFlagsOStringToOUString)}
2235 // LLA: sal_Bool res = sal_True;
2236 // LLA: sal_Int32 i;
2238 // LLA: for(i = 0; i < (sizeof (arrTestCase))/(sizeof (TestCase)); i++)
2240 // LLA: ::rtl::OUString aStr1;
2241 // LLA: aStr1 = aStr1.valueOf( arrTestCase[i].input1 );
2242 // LLA: sal_Bool lastRes = (arrTestCase[i].expVal->compareTo(aStr1) == 0);
2244 // LLA: c_rtl_tres_state
2246 // LLA: hRtlTestResult,
2248 // LLA: arrTestCase[i].comments,
2249 // LLA: createName( pMeth, "valueof_double", i)
2252 // LLA: res &= lastRes;
2256 // LLA: return ( res );
2260 //------------------------------------------------------------------------
2261 // testing the method valueOf( double f ) for negative value
2262 //------------------------------------------------------------------------
2263 // LLA: sal_Bool SAL_CALL test_rtl_OUString_valueOf_Double_Negative(
2264 // LLA: hTestResult hRtlTestResult )
2266 // LLA: sal_Char methName[MAXBUFLENGTH];
2267 // LLA: sal_Char* pMeth =methName;
2269 // LLA: typedef struct TestCase
2271 // LLA: sal_Char* comments;
2272 // LLA: double input1;
2273 // LLA: OUString* expVal;
2275 // LLA: ~TestCase() {delete expVal;}
2278 // LLA: TestCase arrTestCase[] =
2280 // LLA: {"-3.0", -3.0, new OUString("-3.0",4,kEncodingRTLTextUSASCII,
2281 // LLA: kConvertFlagsOStringToOUString)},
2282 // LLA: {"-3.5", -3.5, new OUString("-3.5",4,kEncodingRTLTextUSASCII,
2283 // LLA: kConvertFlagsOStringToOUString)},
2284 // LLA: {"-3.0625", -3.0625, new OUString("-3.0625",7,kEncodingRTLTextUSASCII,
2285 // LLA: kConvertFlagsOStringToOUString)},
2286 // LLA: {"-3.1415926535", -3.1415926535,
2287 // LLA: new OUString("-3.1415926535",13,kEncodingRTLTextUSASCII,
2288 // LLA: kConvertFlagsOStringToOUString)},
2289 // LLA: {"-3.1415926535897931", -3.141592653589793,
2290 // LLA: new OUString("-3.1415926535897931",19,kEncodingRTLTextUSASCII,
2291 // LLA: kConvertFlagsOStringToOUString)},
2292 // LLA: {"-3.1415926535897931", -3.1415926535897932,
2293 // LLA: new OUString("-3.1415926535897931",19,kEncodingRTLTextUSASCII,
2294 // LLA: kConvertFlagsOStringToOUString)},
2295 // LLA: {"-3.1415926535897931", -3.14159265358979323,
2296 // LLA: new OUString("-3.1415926535897931",19,kEncodingRTLTextUSASCII,
2297 // LLA: kConvertFlagsOStringToOUString)},
2298 // LLA: {"-3.1415926535897931", -3.141592653589793238462643,
2299 // LLA: new OUString("-3.1415926535897931",19,kEncodingRTLTextUSASCII,
2300 // LLA: kConvertFlagsOStringToOUString)}
2303 // LLA: sal_Bool res = sal_True;
2304 // LLA: sal_Int32 i;
2306 // LLA: for(i = 0; i < (sizeof (arrTestCase))/(sizeof (TestCase)); i++)
2308 // LLA: ::rtl::OUString aStr1;
2309 // LLA: aStr1 = aStr1.valueOf( arrTestCase[i].input1 );
2310 // LLA: sal_Bool lastRes = (arrTestCase[i].expVal->compareTo(aStr1) == 0);
2312 // LLA: c_rtl_tres_state
2314 // LLA: hRtlTestResult,
2316 // LLA: arrTestCase[i].comments,
2317 // LLA: createName( pMeth, "valueof_nagative double", i)
2320 // LLA: res &= lastRes;
2324 // LLA: return ( res );
2327 //------------------------------------------------------------------------
2328 // testing the method valueOf()
2329 //------------------------------------------------------------------------
2330 extern "C" void /* sal_Bool */ SAL_CALL
test_rtl_OUString_valueOf(
2331 hTestResult hRtlTestResult
)
2333 c_rtl_tres_state_start( hRtlTestResult
, "valueOf");
2334 sal_Bool bTState
= test_rtl_OUString_valueOf_Int32( hRtlTestResult
);
2335 bTState
&= test_rtl_OUString_valueOf_Int32_Bounderies( hRtlTestResult
);
2336 bTState
&= test_rtl_OUString_valueOf_Int32_Negative( hRtlTestResult
);
2337 bTState
&= test_rtl_OUString_valueOf_Int32_WrongRadix( hRtlTestResult
);
2338 bTState
&= test_rtl_OUString_valueOf_Int32_defaultParam(
2340 bTState
&= test_rtl_OUString_valueOf_Int64( hRtlTestResult
);
2341 bTState
&= test_rtl_OUString_valueOf_Int64_Bounderies( hRtlTestResult
);
2342 bTState
&= test_rtl_OUString_valueOf_Int64_Negative( hRtlTestResult
);
2343 bTState
&= test_rtl_OUString_valueOf_Int64_WrongRadix( hRtlTestResult
);
2344 bTState
&= test_rtl_OUString_valueOf_Int64_defaultParam(
2346 // LLA: bTState &= test_rtl_OUString_valueOf_float( hRtlTestResult );
2347 // LLA: bTState &= test_rtl_OUString_valueOf_Float_Negative( hRtlTestResult );
2349 // LLA: bTState &= test_rtl_OUString_valueOf_double( hRtlTestResult );
2350 // LLA: bTState &= test_rtl_OUString_valueOf_Double_Negative( hRtlTestResult );
2351 c_rtl_tres_state_end( hRtlTestResult
, "valueOf");
2352 // return ( bTState );
2354 //------------------------------------------------------------------------
2355 // this is my testing code
2356 // testing the method createFromAscii( const sal_Char * value )
2357 //------------------------------------------------------------------------
2359 extern "C" void /* sal_Bool */ SAL_CALL
test_rtl_OUString_createFromAscii(
2360 hTestResult hRtlTestResult
)
2362 c_rtl_tres_state_start( hRtlTestResult
, "createFromAscii");
2363 sal_Char methName
[MAXBUFLENGTH
];
2364 sal_Char
* pMeth
= methName
;
2367 typedef struct TestCase
2370 const sal_Char
* input1
;
2372 ~TestCase() {delete expVal
;}
2376 TestCase arrTestCase
[]=
2379 { "create OUString from sal_Char" ,kTestStr1
,
2380 new OUString(kTestStr1
,kTestStr1Len
,kEncodingRTLTextUSASCII
,
2381 kConvertFlagsOStringToOUString
)
2384 "create OUString from empty", "",
2388 "create OUString from empty(string arg = '\\0')","",
2389 new OUString("",0,kEncodingRTLTextUSASCII
,
2390 kConvertFlagsOStringToOUString
)
2398 for(i
=0;i
<(sizeof(arrTestCase
))/(sizeof(TestCase
));i
++)
2400 sal_Bool lastRes
=(*(arrTestCase
[i
].expVal
)==
2401 OUString::createFromAscii(arrTestCase
[i
].input1
));
2405 c_rtl_tres_state(hRtlTestResult
,
2407 arrTestCase
[i
].comments
,
2408 createName( pMeth
, "createFromAscii", i
)
2416 c_rtl_tres_state_end( hRtlTestResult
, "createFromAscii");
2419 //------------------------------------------------------------------------
2420 // testing the method index( )
2421 //------------------------------------------------------------------------
2423 sal_Bool
test_index( const T
* input1
, int num
,const sal_Int32
* input2
,
2424 const sal_Int32
* expVal
,int base
,rtlTestResult hRtlTestResult
)
2426 sal_Bool res
=sal_True
;
2427 sal_Char methName
[MAXBUFLENGTH
];
2428 sal_Char
*meth
= '\0';
2429 sal_Char
* pMeth
=methName
;
2431 sal_Bool lastRes
=sal_False
;
2435 OUString
str(aUStr2
);
2439 lastRes
=(str
.indexOf(input1
[i
])==expVal
[i
]);
2444 lastRes
=(str
.indexOf(input1
[i
],input2
[i
])==expVal
[i
]);
2449 // LLA: lastRes=(str.lastIndexOf(input1[i])==expVal[i]);
2450 // LLA: meth="lastIndexOf_001(sal_Unicode)";
2455 // LLA: OUString s4(&input1[i]);
2456 // LLA: rtl::OString sStr;
2457 // LLA: sStr <<= str;
2458 // LLA: t_print("str = %s\n", sStr.getStr());
2459 // LLA: rtl::OString sInput1;
2460 // LLA: sInput1 <<= s4; // rtl::OUString((sal_Unicode*)input1[i]);
2461 // LLA: t_print("%d = lastIndexOf(\"%s\", %d) =? %d\n", str.lastIndexOf(input1[i], input2[i]), sInput1.getStr(), input2[i], expVal[i]);
2463 // LLA: lastRes=(str.lastIndexOf(input1[i],input2[i])==expVal[i]);
2464 // LLA: meth="lastIndexOf_002(sal_Unicode , sal_Int32 )";
2472 createName( pMeth
,meth
, i
)
2481 sal_Bool
test_indexStr( const T
** input1
, int num
,const sal_Int32
* input2
,
2482 const sal_Int32
* expVal
,int base
,rtlTestResult hRtlTestResult
)
2484 sal_Bool res
=sal_True
;
2485 sal_Char methName
[MAXBUFLENGTH
];
2486 sal_Char
*meth
= '\0';
2487 sal_Char
* pMeth
=methName
;
2489 sal_Bool lastRes
=sal_False
;
2493 OUString
str(aUStr2
);
2498 OUString
s1(input1
[i
]);
2499 lastRes
=(str
.indexOf(s1
)==expVal
[i
]);
2504 OUString
s2(input1
[i
]);
2505 lastRes
=(str
.indexOf(s2
,input2
[i
])==expVal
[i
]);
2510 // LLA: OUString s3(input1[i]);
2511 // LLA: lastRes=(str.lastIndexOf(s3)==expVal[i]);
2512 // LLA: meth="lastIndexOf_003(const OUString)";
2516 // LLA: OUString s4(input1[i]);
2518 // LLA: rtl::OString sStr;
2519 // LLA: sStr <<= str;
2520 // LLA: t_print("str = \"%s\"\n", sStr.getStr());
2521 // LLA: rtl::OString sInput1;
2522 // LLA: sInput1 <<= s4; // rtl::OUString((sal_Unicode*)input1[i]);
2523 // LLA: t_print("%d = lastIndexOf(\"%s\", %d) =? %d\n", str.lastIndexOf(input1[i], input2[i]), sInput1.getStr(), input2[i], expVal[i]);
2525 // LLA: lastRes=(str.lastIndexOf(s4,input2[i])==expVal[i]);
2526 // LLA: meth="lastIndexOf_004(const OUString,sal_Int32)";
2534 createName( pMeth
,meth
, i
)
2542 //------------------------------------------------------------------------
2543 // testing the method indexOf( )
2544 //------------------------------------------------------------------------
2545 sal_Bool SAL_CALL
test_rtl_OUString_indexOf_001(
2546 hTestResult hRtlTestResult
)
2548 sal_Bool bRes
=sal_False
;
2550 bRes
=c_rtl_tres_state
2553 test_index
<sal_Unicode
>((const sal_Unicode
*)input1Default
,
2554 nDefaultCount
,input2Default
,
2555 expValDefault
,0,hRtlTestResult
),
2557 "indexDefault(sal_Unicode ch, sal_Int32 fromIndex = 0)"
2562 //------------------------------------------------------------------------
2563 // testing the method indexOf( )
2564 //------------------------------------------------------------------------
2565 sal_Bool SAL_CALL
test_rtl_OUString_indexOf_002(
2566 hTestResult hRtlTestResult
)
2568 sal_Bool bRes
=sal_False
;
2570 bRes
=c_rtl_tres_state
2573 test_index
<sal_Unicode
>((const sal_Unicode
*)input1Normal
,
2574 nNormalCount
,input2Normal
,
2575 expValNormal
,1,hRtlTestResult
),
2577 "indexNormal(sal_Unicode ch, sal_Int32 fromIndex)"
2582 //------------------------------------------------------------------------
2583 // testing the method indexOf( OUString ch, sal_Int32 fromIndex = 0 )
2584 //------------------------------------------------------------------------
2585 sal_Bool SAL_CALL
test_rtl_OUString_indexOf_003(
2586 hTestResult hRtlTestResult
)
2588 sal_Bool bRes
=sal_False
;
2590 bRes
=c_rtl_tres_state
2593 test_indexStr
<sal_Unicode
>((const sal_Unicode
**)input1StrDefault
,
2594 nStrDefaultCount
,input2StrDefault
,
2595 expValStrDefault
,0,hRtlTestResult
),
2597 "indexDefault(OUString ch, sal_Int32 fromIndex = 0)"
2602 //------------------------------------------------------------------------
2603 // testing the method indexOf( OUString ch, sal_Int32 fromIndex )
2604 //------------------------------------------------------------------------
2605 sal_Bool SAL_CALL
test_rtl_OUString_indexOf_004(
2606 hTestResult hRtlTestResult
)
2608 sal_Bool bRes
=sal_False
;
2610 bRes
=c_rtl_tres_state
2613 test_indexStr
<sal_Unicode
>((const sal_Unicode
**)input1StrNormal
,
2614 nStrNormalCount
,input2StrNormal
,
2615 expValStrNormal
,1,hRtlTestResult
),
2617 "indexOf(OUString ch, sal_Int32 fromIndex)"
2622 // LLA: //------------------------------------------------------------------------
2623 // LLA: // testing the method lastIndexOf( sal_Unicode ch )
2624 // LLA: //------------------------------------------------------------------------
2625 // LLA: sal_Bool SAL_CALL test_rtl_OUString_lastIndexOf_001(
2626 // LLA: hTestResult hRtlTestResult )
2628 // LLA: sal_Bool bRes=sal_False;
2630 // LLA: bRes=c_rtl_tres_state
2632 // LLA: hRtlTestResult,
2633 // LLA: test_index<sal_Unicode>((const sal_Unicode*)input1lastDefault,
2634 // LLA: nlastDefaultCount,input2lastDefault,
2635 // LLA: expVallastDefault,2,hRtlTestResult),
2636 // LLA: "lastIndex",
2637 // LLA: "lastIndexDefault(sal_Unicode ch)"
2640 // LLA: return ( bRes );
2642 // LLA: //------------------------------------------------------------------------
2643 // LLA: // testing the method lastIndexOf( sal_Unicode ch, sal_Int32 fromIndex )
2644 // LLA: //------------------------------------------------------------------------
2645 // LLA: sal_Bool SAL_CALL test_rtl_OUString_lastIndexOf_002(
2646 // LLA: hTestResult hRtlTestResult )
2648 // LLA: sal_Bool bRes=sal_False;
2650 // LLA: bRes=c_rtl_tres_state
2652 // LLA: hRtlTestResult,
2653 // LLA: test_index<sal_Unicode>((const sal_Unicode*)input1lastNormal,
2654 // LLA: nlastNormalCount,input2lastNormal,
2655 // LLA: expVallastNormal,3,hRtlTestResult),
2656 // LLA: "lastIndex",
2657 // LLA: "lastIndexNormal(sal_Unicode ch, sal_Int32 fromIndex)"
2660 // LLA: return ( bRes );
2662 // LLA: //------------------------------------------------------------------------
2663 // LLA: // testing the method lastIndexOf( OUString ch )
2664 // LLA: //------------------------------------------------------------------------
2665 // LLA: sal_Bool SAL_CALL test_rtl_OUString_lastIndexOf_003(
2666 // LLA: hTestResult hRtlTestResult )
2668 // LLA: sal_Bool bRes=sal_False;
2670 // LLA: bRes=c_rtl_tres_state
2672 // LLA: hRtlTestResult,
2673 // LLA: test_indexStr<sal_Unicode>((const sal_Unicode**)input1StrLastDefault,
2674 // LLA: nStrLastDefaultCount,input2StrLastDefault,
2675 // LLA: expValStrLastDefault,2,hRtlTestResult),
2676 // LLA: "lastIndexOf",
2677 // LLA: "lastIndexOf(OUString ch)"
2680 // LLA: return ( bRes );
2682 // LLA: //------------------------------------------------------------------------
2683 // LLA: // testing the method lastIndexOf( OUString ch, sal_Int32 fromIndex )
2684 // LLA: //------------------------------------------------------------------------
2685 // LLA: sal_Bool SAL_CALL test_rtl_OUString_lastIndexOf_004(
2686 // LLA: hTestResult hRtlTestResult )
2688 // LLA: sal_Bool bRes=sal_False;
2690 // LLA: for (int i=0;i<nStrLastNormalCount;i++)
2692 // LLA: rtl::OUString aStr = rtl::OUString(input1StrLastNormal[i]);
2693 // LLA: volatile int dummy = 0;
2696 // LLA: bRes=c_rtl_tres_state
2698 // LLA: hRtlTestResult,
2699 // LLA: test_indexStr<sal_Unicode>((const sal_Unicode**)input1StrLastNormal,
2700 // LLA: nStrLastNormalCount,input2StrLastNormal,
2701 // LLA: expValStrLastNormal,3,hRtlTestResult),
2702 // LLA: "lastIndexOf",
2703 // LLA: "lastIndexOf(OUString ch, sal_Int32 fromIndex)"
2706 // LLA: return ( bRes );
2708 //------------------------------------------------------------------------
2709 extern "C" void /* sal_Bool */ SAL_CALL
test_rtl_OUString_indexOf(
2710 hTestResult hRtlTestResult
)
2712 c_rtl_tres_state_start( hRtlTestResult
, "indexOf");
2713 sal_Bool res
= test_rtl_OUString_indexOf_001(hRtlTestResult
);
2714 res
&= test_rtl_OUString_indexOf_002(hRtlTestResult
);
2715 res
&= test_rtl_OUString_indexOf_003(hRtlTestResult
);
2716 res
&= test_rtl_OUString_indexOf_004(hRtlTestResult
);
2717 c_rtl_tres_state_end( hRtlTestResult
, "indexOf");
2720 //------------------------------------------------------------------------
2721 // LLA: extern "C" void /* sal_Bool */ SAL_CALL test_rtl_OUString_lastIndexOf(
2722 // LLA: hTestResult hRtlTestResult )
2724 // LLA: c_rtl_tres_state_start( hRtlTestResult, "lastIndexOf");
2725 // LLA: sal_Bool res = test_rtl_OUString_lastIndexOf_001(hRtlTestResult);
2726 // LLA: res &= test_rtl_OUString_lastIndexOf_002(hRtlTestResult);
2727 // LLA: res &= test_rtl_OUString_lastIndexOf_003(hRtlTestResult);
2728 // LLA: res &= test_rtl_OUString_lastIndexOf_004(hRtlTestResult);
2729 // LLA: c_rtl_tres_state_end( hRtlTestResult, "lastIndexOf");
2730 // LLA: // return ( res );
2732 //------------------------------------------------------------------------
2733 // testing the method concat( const OString & aStr )
2734 //------------------------------------------------------------------------
2735 extern "C" void /* sal_Bool */ SAL_CALL
test_rtl_OUString_concat(
2736 hTestResult hRtlTestResult
)
2738 c_rtl_tres_state_start( hRtlTestResult
, "concat");
2739 sal_Char methName
[MAXBUFLENGTH
];
2740 sal_Char
* pMeth
=methName
;
2742 typedef struct TestCase
2748 ~TestCase() { delete input1
;delete input2
; delete expVal
;}
2751 TestCase arrTestCase
[] =
2753 {"concatenates two ustrings",new OUString(aUStr1
),
2754 new OUString(aUStr7
), new OUString(aUStr8
)},
2755 {"concatenates empty ustring",new OUString(aUStr1
),
2756 new OUString(aUStr1
), new OUString("",0,
2757 kEncodingRTLTextUSASCII
,kConvertFlagsOStringToOUString
)},
2758 {"concatenates to empty ustring",new OUString(aUStr1
),new OUString("",
2759 0,kEncodingRTLTextUSASCII
,kConvertFlagsOStringToOUString
),
2760 new OUString(aUStr1
)},
2761 {"concatenates two empty ustrings",new OUString("",0,
2762 kEncodingRTLTextUSASCII
,kConvertFlagsOStringToOUString
),
2764 kEncodingRTLTextUSASCII
,kConvertFlagsOStringToOUString
),
2766 kEncodingRTLTextUSASCII
,kConvertFlagsOStringToOUString
)},
2767 {"concatenates ustring constructed by default constructor",
2768 new OUString(aUStr1
),new OUString(aUStr1
), new OUString()},
2769 {"concatenates to ustring constructed by default constructor",
2770 new OUString(aUStr1
),new OUString(), new OUString(aUStr1
)},
2771 {"concatenates two ustrings constructed by default constructor",
2772 new OUString(),new OUString(), new OUString()}
2775 sal_Bool res
= sal_True
;
2777 for(i
= 0; i
< (sizeof (arrTestCase
))/(sizeof (TestCase
)); i
++)
2779 OUString str
= arrTestCase
[i
].input1
->concat(*arrTestCase
[i
].input2
);
2780 sal_Bool lastRes
= (str
== *arrTestCase
[i
].expVal
);
2786 arrTestCase
[i
].comments
,
2787 createName( pMeth
, "concat", i
)
2793 c_rtl_tres_state_end( hRtlTestResult
, "concat");
2796 //------------------------------------------------------------------------
2797 // testing the method replaceAt( sal_Int32 index, sal_Int32 count,
2798 // const OUString& newStr )
2799 //------------------------------------------------------------------------
2800 extern "C" void /* sal_Bool */ SAL_CALL
test_rtl_OUString_replaceAt(
2801 rtlTestResult hRtlTestResult
)
2803 c_rtl_tres_state_start( hRtlTestResult
, "replaceAt");
2804 sal_Char methName
[MAXBUFLENGTH
];
2805 sal_Char
* pMeth
= methName
;
2807 typedef struct TestCase
2816 ~TestCase() { delete input
; delete expVal
; delete newStr
;}
2819 TestCase arrTestCase
[]=
2822 { "string differs", new OUString(aUStr2
), new OUString(aUStr22
),
2823 new OUString(aUStr2
), 0, kTestStr22Len
},
2825 { "larger index", new OUString(aUStr1
), new OUString(aUStr7
),
2826 new OUString(aUStr8
), 64, kTestStr8Len
},
2828 { "larger count", new OUString(aUStr2
), new OUString(aUStr22
),
2829 new OUString(aUStr2
),0, 64 },
2831 { "navigate index", new OUString(aUStr2
), new OUString(aUStr22
),
2832 new OUString(aUStr2
), -64, 64 },
2836 kEncodingRTLTextUSASCII
,kConvertFlagsOStringToOUString
),
2837 new OUString(aUStr14
),
2839 kEncodingRTLTextUSASCII
,kConvertFlagsOStringToOUString
),
2843 sal_Bool res
= sal_True
;
2846 for (i
= 0; i
< (sizeof (arrTestCase
))/(sizeof (TestCase
)); i
++)
2848 ::rtl::OUString aStr1
;
2849 aStr1
= arrTestCase
[i
].input
->replaceAt( arrTestCase
[i
].index
,
2850 arrTestCase
[i
].count
, *arrTestCase
[i
].newStr
);
2852 sal_Bool lastRes
= ( arrTestCase
[i
].expVal
->compareTo(aStr1
) == 0 );
2858 arrTestCase
[i
].comments
,
2859 createName( pMeth
, "replaceAt", i
)
2865 c_rtl_tres_state_end( hRtlTestResult
, "replaceAt");
2868 //------------------------------------------------------------------------
2869 // this is my testing code
2870 // testing the method replace( sal_Unicode oldChar, sal_Unicode newChar )
2871 //------------------------------------------------------------------------
2872 extern "C" void /* sal_Bool */ SAL_CALL
test_rtl_OUString_replace(
2873 hTestResult hRtlTestResult
)
2875 c_rtl_tres_state_start( hRtlTestResult
, "replace");
2876 sal_Char methName
[MAXBUFLENGTH
];
2877 sal_Char
* pMeth
= methName
;
2879 typedef struct TestCase
2884 sal_Unicode oldChar
;
2885 sal_Unicode newChar
;
2887 ~TestCase() { delete input
; delete expVal
;}
2890 TestCase arrTestCase
[]=
2892 {"ustring differs", new OUString(aUStr18
), new OUString(aUStr4
),83,115},
2893 {"ustring differs", new OUString(aUStr19
), new OUString(aUStr17
),32,45},
2894 {"ustring must be empty", new OUString("",0,
2895 kEncodingRTLTextUSASCII
,kConvertFlagsOStringToOUString
),
2897 kEncodingRTLTextUSASCII
,kConvertFlagsOStringToOUString
),83,23},
2898 {"ustring must be empty", new OUString(),
2900 kEncodingRTLTextUSASCII
,kConvertFlagsOStringToOUString
),83,23},
2901 {"same ustring, no replace ", new OUString(aUStr22
),
2902 new OUString(aUStr22
),42,56}
2906 sal_Bool res
= sal_True
;
2909 for (i
= 0; i
< (sizeof (arrTestCase
))/(sizeof (TestCase
)); i
++)
2911 ::rtl::OUString aStr1
;
2912 aStr1
= arrTestCase
[i
].input
->replace(arrTestCase
[i
].oldChar
,arrTestCase
[i
].newChar
);
2913 res
&= c_rtl_tres_state
2916 (arrTestCase
[i
].expVal
->compareTo(aStr1
) == 0),
2917 arrTestCase
[i
].comments
,
2918 createName( pMeth
, "replace", i
)
2922 c_rtl_tres_state_end( hRtlTestResult
, "replace");
2925 //------------------------------------------------------------------------
2926 // testing the method toAsciiLowerCase()
2927 //-----------------------------------------------------------------------
2928 extern "C" void /* sal_Bool */ SAL_CALL
test_rtl_OUString_toAsciiLowerCase(
2929 hTestResult hRtlTestResult
)
2931 c_rtl_tres_state_start( hRtlTestResult
, "toAsciiLowerCase");
2932 sal_Char methName
[MAXBUFLENGTH
];
2933 sal_Char
* pMeth
=methName
;
2935 typedef struct TestCase
2940 ~TestCase() { delete input1
; delete expVal
;}
2943 TestCase arrTestCase
[] =
2946 {"only uppercase",new OUString(aUStr5
),new OUString(aUStr4
)},
2947 {"different cases",new OUString(aUStr5
),new OUString(aUStr1
)},
2948 {"different cases",new OUString(aUStr5
),new OUString(aUStr3
)},
2949 {"only lowercase",new OUString(aUStr5
),new OUString(aUStr5
)},
2950 {"empty ustring",new OUString("",0,
2951 kEncodingRTLTextUSASCII
,kConvertFlagsOStringToOUString
),
2953 kEncodingRTLTextUSASCII
,kConvertFlagsOStringToOUString
)},
2954 {"ustring constructed by default constructor",new OUString(),
2956 {"have special Unicode",new OUString("\23\12\34sun\13\45",6,
2957 kEncodingRTLTextUSASCII
,kConvertFlagsOStringToOUString
),
2958 new OUString("\23\12\34sun\13\45",6,
2959 kEncodingRTLTextUSASCII
,kConvertFlagsOStringToOUString
)}
2962 sal_Bool res
= sal_True
;
2964 sal_Bool lastRes
=sal_False
;
2966 for(i
= 0; i
< (sizeof (arrTestCase
))/(sizeof (TestCase
)); i
++)
2968 OUString str
= arrTestCase
[i
].input1
->toAsciiLowerCase();
2971 lastRes
= (str
==* arrTestCase
[i
].expVal
);
2977 arrTestCase
[i
].comments
,
2978 createName( pMeth
, "toAsciiLowerCase", i
)
2987 arrTestCase
[i
].comments
,
2988 createName( pMeth
, "toAsciiLowerCase", i
)
2993 c_rtl_tres_state_end( hRtlTestResult
, "toAsciiLowerCase");
2996 //------------------------------------------------------------------------
2997 // testing the method toAsciiUpperCase()
2998 //------------------------------------------------------------------------
2999 extern "C" void /* sal_Bool */ SAL_CALL
test_rtl_OUString_toAsciiUpperCase(
3000 hTestResult hRtlTestResult
)
3002 c_rtl_tres_state_start( hRtlTestResult
, "toAsciiUpperCase");
3003 sal_Char methName
[MAXBUFLENGTH
];
3004 sal_Char
* pMeth
=methName
;
3006 typedef struct TestCase
3011 ~TestCase() { delete input1
; delete expVal
;}
3014 TestCase arrTestCase
[] =
3016 {"only lowercase",new OUString(aUStr4
),new OUString(aUStr5
)},
3017 {"mixed cases",new OUString(aUStr4
),new OUString(aUStr3
)},
3018 {"mixed cases",new OUString(aUStr4
),new OUString(aUStr1
)},
3019 {"only uppercase",new OUString(aUStr4
),new OUString(aUStr4
)},
3020 {"empty ustring",new OUString("",0,
3021 kEncodingRTLTextUSASCII
,kConvertFlagsOStringToOUString
),
3023 kEncodingRTLTextUSASCII
,kConvertFlagsOStringToOUString
)},
3024 {"ustring constructed by default constructor",new OUString(),
3026 {"have special Unicode",new OUString("\23\12\34SUN\13\45",6,
3027 kEncodingRTLTextUSASCII
,kConvertFlagsOStringToOUString
),
3028 new OUString("\23\12\34sun\13\45",6,
3029 kEncodingRTLTextUSASCII
,kConvertFlagsOStringToOUString
)}
3032 sal_Bool res
= sal_True
;
3034 sal_Bool lastRes
=sal_False
;
3036 for(i
= 0; i
< (sizeof (arrTestCase
))/(sizeof (TestCase
)); i
++)
3038 OUString str
= arrTestCase
[i
].input1
->toAsciiUpperCase();
3041 lastRes
= (str
== *arrTestCase
[i
].expVal
);
3047 arrTestCase
[i
].comments
,
3048 createName( pMeth
, "toAsciiUpperCase", i
)
3057 arrTestCase
[i
].comments
,
3058 createName( pMeth
, "toAsciiUpperCase", i
)
3064 c_rtl_tres_state_end( hRtlTestResult
, "toAsciiUpperCase");
3068 //------------------------------------------------------------------------
3069 // testing the method trim()
3070 //------------------------------------------------------------------------
3071 extern "C" void /* sal_Bool */ SAL_CALL
test_rtl_OUString_trim(
3072 hTestResult hRtlTestResult
)
3074 c_rtl_tres_state_start( hRtlTestResult
, "trim");
3075 sal_Char methName
[MAXBUFLENGTH
];
3076 sal_Char
* pMeth
=methName
;
3078 typedef struct TestCase
3083 ~TestCase() { delete input1
; delete expVal
;}
3086 TestCase arrTestCase
[] =
3088 {"removes space from the front",new OUString(aUStr1
),
3089 new OUString(aUStr10
)},
3090 {"removes space from the end",new OUString(aUStr1
),
3091 new OUString(aUStr11
)},
3092 {"removes space from the front and end",new OUString(aUStr1
),
3093 new OUString(aUStr12
)},
3094 {"removes several spaces from the end",new OUString(aUStr1
),
3095 new OUString(aUStr13
)},
3096 {"removes several spaces from the front",new OUString(aUStr1
),
3097 new OUString(aUStr14
)},
3098 {"removes several spaces from the front and one from the end",
3099 new OUString(aUStr1
),
3100 new OUString(aUStr15
)},
3101 {"removes one space from the front and several from the end",
3102 new OUString(aUStr1
),
3103 new OUString(aUStr16
)},
3104 {"removes several spaces from the front and end",
3105 new OUString(aUStr1
),
3106 new OUString(aUStr17
)},
3107 {"removes characters that have codes <= 32",new OUString(aUStr30
),
3108 new OUString("\1\3\5\7\11\13\15\17sun\21\23\25\27\31\33\50",
3109 18,kEncodingRTLTextUSASCII
,
3110 kConvertFlagsOStringToOUString
)},
3111 {"removes characters that have codes <= 32",new OUString(aUStr28
),
3112 new OUString("\50\3\5\7\11\13\15\17sun\21\23\25\27\31\33\1",
3113 18,kEncodingRTLTextUSASCII
,
3114 kConvertFlagsOStringToOUString
)},
3115 {"removes characters that have codes <= 32",new OUString(aUStr29
),
3116 new OUString("\50\3\5\7\11\13\15\17sun\21\23\25\27\31\33\50",
3117 18,kEncodingRTLTextUSASCII
,
3118 kConvertFlagsOStringToOUString
)},
3119 {"removes characters that have codes <= 32",new OUString(aUStr20
),
3120 new OUString("\1\3\5\7\11\13\15\17sun\21\23\25\27\31\23\20",
3121 18,kEncodingRTLTextUSASCII
,
3122 kConvertFlagsOStringToOUString
)},
3123 {"no spaces",new OUString(aUStr8
),
3124 new OUString(aUStr8
)}
3127 sal_Bool res
= sal_True
;
3130 for(i
= 0; i
< (sizeof (arrTestCase
))/(sizeof (TestCase
)); i
++)
3132 OUString strRes
= arrTestCase
[i
].input1
->trim();
3133 sal_Bool lastRes
= (strRes
== *arrTestCase
[i
].expVal
);
3139 arrTestCase
[i
].comments
,
3140 createName( pMeth
, "trim", i
)
3146 c_rtl_tres_state_end( hRtlTestResult
, "trim");
3149 //------------------------------------------------------------------------
3150 // testing the method toData()
3151 //------------------------------------------------------------------------
3154 sal_Bool
test_toData( const char** input
, int num
, sal_Int16 radix
,
3155 const T
* expVal
,int base
,
3156 const T
* _fPrecision
,
3157 rtlTestResult hRtlTestResult
)
3160 sal_Bool res
=sal_True
;
3161 sal_Char methName
[MAXBUFLENGTH
];
3162 sal_Char
*meth
= '\0';
3163 sal_Char
* pMeth
=methName
;
3165 // static sal_Unicode aUchar[60]={0x00};
3167 sal_Bool lastRes
=sal_False
;
3171 OSL_ENSURE( i
< 60, "ERROR: leave aUchar bound");
3173 // LLA: stored for the posterity
3174 // AStringToUStringCopy(aUchar,input[i]);
3175 // OUString str(aUchar);
3178 str
= OUString::createFromAscii(input
[i
]);
3183 intRes
=static_cast<T
>(str
.toInt32());
3184 lastRes
=(intRes
==expVal
[i
]);
3185 meth
="toInt32default";
3189 intRes
=static_cast<T
>(str
.toInt32(radix
));
3190 lastRes
=(intRes
==expVal
[i
]);
3191 meth
="toInt32normal";
3195 intRes
=static_cast<T
>(str
.toInt64());
3196 lastRes
=(intRes
==expVal
[i
]);
3197 meth
="toInt64default";
3201 intRes
=static_cast<T
>(str
.toInt64(radix
));
3202 lastRes
=(intRes
==expVal
[i
]);
3203 meth
="toInt64normal";
3205 // LLA: does no longer exist, moved to rtl/oustring
3208 // LLA: intRes=str.toDouble();
3209 // LLA: lastRes=(fabs(intRes-expVal[i])<=1e-35);
3210 // LLA: meth="toDouble";
3213 // LLA: dt:20040802 create compile problems within wntmsci10
3216 // intRes=str.toFloat();
3217 // T nPrec = _fPrecision[i];
3218 // lastRes=(fabs((T)(intRes-expVal[i])) <= nPrec /* 1e-35 */ );
3223 intRes
=str
.toChar();
3224 lastRes
=(intRes
==expVal
[i
]);
3228 char buf
[MAXBUFLENGTH
];
3230 cpynstr( buf
+ 1, input
[i
], MAXBUFLENGTH
);
3231 int length
= AStringLen( input
[i
] );
3232 buf
[length
+ 1] = '\'';
3233 buf
[length
+ 2] = 0;
3240 createName( pMeth
,meth
, i
)
3248 //------------------------------------------------------------------------
3249 // testing the method toDouble()
3250 //------------------------------------------------------------------------
3252 // LLA: extern "C" void /* sal_Bool */ SAL_CALL test_rtl_OUString_toDouble(
3253 // LLA: hTestResult hRtlTestResult )
3255 // LLA: c_rtl_tres_state_start( hRtlTestResult, "toDouble");
3256 // LLA: sal_Bool bRes=sal_False;
3258 // LLA: bRes=c_rtl_tres_state
3260 // LLA: hRtlTestResult,
3261 // LLA: test_toData<double>((const char**)inputDouble,nDoubleCount,10,
3262 // LLA: expValDouble,4,hRtlTestResult),
3264 // LLA: "toDouble()"
3266 // LLA: c_rtl_tres_state_end( hRtlTestResult, "toDouble");
3267 // LLA: // return ( bRes );
3270 //------------------------------------------------------------------------
3271 // testing the method toFloat()
3272 //------------------------------------------------------------------------
3273 // LLA: dt:20040802 the test_toData() has compile problems.
3274 // LLA: extern "C" void /* sal_Bool */ SAL_CALL test_rtl_OUString_toFloat(
3275 // LLA: hTestResult hRtlTestResult )
3277 // LLA: c_rtl_tres_state_start( hRtlTestResult, "toFloat");
3278 // LLA: sal_Bool bRes=sal_False;
3280 // LLA: bRes=c_rtl_tres_state
3282 // LLA: hRtlTestResult,
3283 // LLA: test_toData<float>((const char**)inputFloat,
3284 // LLA: nFloatCount,
3285 // LLA: 10, /* radix */
3286 // LLA: expValFloat,
3287 // LLA: 5, /* float */
3289 // LLA: hRtlTestResult),
3294 // LLA: c_rtl_tres_state_end( hRtlTestResult, "toFloat");
3295 // LLA: // return ( bRes );
3298 //------------------------------------------------------------------------
3299 // testing the method toChar()
3300 //------------------------------------------------------------------------
3301 extern "C" void /* sal_Bool */ SAL_CALL
test_rtl_OUString_toChar(
3302 hTestResult hRtlTestResult
)
3304 c_rtl_tres_state_start( hRtlTestResult
, "toChar");
3305 sal_Bool bRes
=sal_False
;
3307 bRes
=c_rtl_tres_state
3310 test_toData
<sal_Unicode
>((const char**)inputChar
,nCharCount
,
3311 10,expValChar
,6,NULL
,hRtlTestResult
),
3316 c_rtl_tres_state_end( hRtlTestResult
, "toChar");
3320 //------------------------------------------------------------------------
3321 // testing the method toBoolean()
3322 //------------------------------------------------------------------------
3323 extern "C" void /* sal_Bool */ SAL_CALL
test_rtl_OUString_toBoolean(
3324 hTestResult hRtlTestResult
)
3326 c_rtl_tres_state_start( hRtlTestResult
, "toBoolean");
3327 sal_Char methName
[MAXBUFLENGTH
];
3328 sal_Char
* pMeth
= methName
;
3330 typedef struct TestCase
3336 ~TestCase() {delete input
;}
3339 TestCase arrTestCase
[]={
3341 {"expected true", sal_True
, new OUString("True",4,kEncodingRTLTextUSASCII
,
3342 kConvertFlagsOStringToOUString
)},
3343 {"expected false", sal_False
, new OUString("False",5,
3344 kEncodingRTLTextUSASCII
,
3345 kConvertFlagsOStringToOUString
)},
3346 {"expected true", sal_True
, new OUString("1",1,kEncodingRTLTextUSASCII
,
3347 kConvertFlagsOStringToOUString
)}
3350 sal_Bool res
= sal_True
;
3353 for (i
= 0; i
< (sizeof (arrTestCase
))/(sizeof (TestCase
)); i
++)
3355 sal_Bool bRes
= arrTestCase
[i
].input
->toBoolean();
3356 sal_Bool lastRes
= (bRes
== arrTestCase
[i
].expVal
);
3361 arrTestCase
[i
].comments
,
3362 createName( pMeth
, "toBoolean", i
)
3367 c_rtl_tres_state_end( hRtlTestResult
, "toBoolean");
3370 //------------------------------------------------------------------------
3371 // testing the method toInt32()
3372 //------------------------------------------------------------------------
3374 sal_Bool SAL_CALL
test_rtl_OUString_toInt32_normal(
3375 hTestResult hRtlTestResult
)
3377 sal_Int32 expValues
[kBase36NumsCount
];
3380 for ( i
= 0; i
< kBase36NumsCount
; i
++ )
3383 sal_Bool res
= c_rtl_tres_state
3386 test_toData
<sal_Int32
>( kBinaryNumsStr
,kBinaryNumsCount
,
3387 kRadixBinary
,expValues
,1,NULL
,hRtlTestResult
),
3389 "toInt32( radix 2 )"
3391 res
&= c_rtl_tres_state
3394 test_toData
<sal_Int32
>( kBinaryMaxNumsStr
,kInt32MaxNumsCount
,
3395 kRadixBinary
,kInt32MaxNums
,1,NULL
,hRtlTestResult
),
3396 "kBinaryMaxNumsStr",
3397 "toInt32_Boundaries( radix 2 )"
3400 res
&= c_rtl_tres_state
3403 test_toData
<sal_Int32
>( kOctolNumsStr
,kOctolNumsCount
,
3404 kRadixOctol
,expValues
,1,NULL
,hRtlTestResult
),
3406 "toInt32( radix 8 )"
3409 res
&= c_rtl_tres_state
3412 test_toData
<sal_Int32
>( kOctolMaxNumsStr
,kInt32MaxNumsCount
,
3413 kRadixOctol
,(sal_Int32
*)kInt32MaxNums
,1,NULL
,hRtlTestResult
),
3415 "toInt32_Boundaries( radix 8 )"
3418 res
&= c_rtl_tres_state
3421 test_toData
<sal_Int32
>( kDecimalNumsStr
,kDecimalNumsCount
,
3422 kRadixDecimal
,expValues
,1,NULL
,hRtlTestResult
),
3424 "toInt32( radix 10 )"
3427 res
&= c_rtl_tres_state
3430 test_toData
<sal_Int32
>( kDecimalMaxNumsStr
,kInt32MaxNumsCount
,
3431 kRadixDecimal
,(sal_Int32
*)kInt32MaxNums
,1,NULL
,hRtlTestResult
),
3432 "kDecimalMaxNumsStr",
3433 "toInt32_Boundaries( radix 10 )"
3436 res
&= c_rtl_tres_state
3439 test_toData
<sal_Int32
>( kHexDecimalNumsStr
,kHexDecimalNumsCount
,
3440 kRadixHexdecimal
,expValues
,1,NULL
,hRtlTestResult
),
3441 "kHexDecimalNumsStr",
3442 "toInt32( radix 16 )"
3445 res
&= c_rtl_tres_state
3448 test_toData
<sal_Int32
>( kHexDecimalMaxNumsStr
,kInt32MaxNumsCount
,
3449 kRadixHexdecimal
,(sal_Int32
*)kInt32MaxNums
,1,NULL
,hRtlTestResult
),
3450 "kHexDecimalMaxNumsStr",
3451 "toInt32_Boundaries( radix 16 )"
3454 res
&= c_rtl_tres_state
3457 test_toData
<sal_Int32
>( kBase36NumsStr
,kBase36NumsCount
,
3458 kRadixBase36
, expValues
,1,NULL
,hRtlTestResult
),
3460 "toInt32( radix 36 )"
3463 res
&= c_rtl_tres_state
3466 test_toData
<sal_Int32
>( kBase36MaxNumsStr
,kInt32MaxNumsCount
,
3467 kRadixBase36
,(sal_Int32
*)kInt32MaxNums
,1,NULL
,hRtlTestResult
),
3468 "kBase36MaxNumsStr",
3469 "toInt32_Boundaries( radix 36 )"
3472 const sal_Int16 nSpecCases
= 5;
3473 static const sal_Char
*spString
[nSpecCases
] =
3482 sal_Int32 expSpecVal
[nSpecCases
] =
3491 res
&= c_rtl_tres_state
3494 test_toData
<sal_Int32
>( spString
,nSpecCases
,
3495 kRadixDecimal
,expSpecVal
,1,NULL
,hRtlTestResult
),
3497 "toInt32( specialcases )"
3502 sal_Bool SAL_CALL
test_rtl_OUString_toInt32_wrongRadix(
3503 hTestResult hRtlTestResult
)
3505 ::rtl::OUString
str("0",1,kEncodingRTLTextUSASCII
,
3506 kConvertFlagsOStringToOUString
);
3508 sal_Int32 iRes
=str
.toInt32(-1);
3517 "toInt32( 0, wrong radix -1 )"
3521 sal_Bool SAL_CALL
test_rtl_OUString_toInt32_defaultParam(
3522 hTestResult hRtlTestResult
)
3524 sal_Int32 expValues
[kBase36NumsCount
];
3527 for ( i
= 0; i
< kBase36NumsCount
; i
++ )
3530 sal_Bool res
= c_rtl_tres_state
3533 test_toData
<sal_Int32
>( kDecimalNumsStr
,kDecimalNumsCount
,
3534 kRadixDecimal
,expValues
,0,NULL
,hRtlTestResult
),
3536 "toInt32( radix 2 )"
3538 res
&= c_rtl_tres_state
3541 test_toData
<sal_Int32
>( kDecimalMaxNumsStr
,kInt32MaxNumsCount
,
3542 kRadixDecimal
,(sal_Int32
*)kInt32MaxNums
,0,NULL
,hRtlTestResult
),
3543 "kDecimalMaxNumsStr",
3544 "toInt32_Boundaries( radix 10 )"
3546 const sal_Int16 nSpecCases
= 5;
3547 static const sal_Char
*spString
[nSpecCases
] =
3556 sal_Int32 expSpecVal
[nSpecCases
] =
3565 res
&= c_rtl_tres_state
3568 test_toData
<sal_Int32
>( spString
,nSpecCases
,
3569 kRadixDecimal
,expSpecVal
,0,NULL
,hRtlTestResult
),
3571 "toInt32( specialcases )"
3577 //------------------------------------------------------------------------
3578 // testing the method toInt32()
3579 //------------------------------------------------------------------------
3580 extern "C" void /* sal_Bool */ SAL_CALL
test_rtl_OUString_toInt32(
3581 hTestResult hRtlTestResult
)
3583 c_rtl_tres_state_start( hRtlTestResult
, "toInt32");
3584 sal_Bool bTState
= test_rtl_OUString_toInt32_normal( hRtlTestResult
);
3585 bTState
&= test_rtl_OUString_toInt32_defaultParam( hRtlTestResult
);
3586 bTState
&= test_rtl_OUString_toInt32_wrongRadix( hRtlTestResult
);
3587 c_rtl_tres_state_end( hRtlTestResult
, "toInt32");
3588 // return ( bTState );
3590 //------------------------------------------------------------------------
3591 // testing the method toInt64( sal_Int16 radix = 2,8,10,16,36 )
3592 //------------------------------------------------------------------------
3594 sal_Bool SAL_CALL
test_rtl_OUString_toInt64_normal(
3595 hTestResult hRtlTestResult
)
3597 sal_Int64 expValues
[kBase36NumsCount
];
3600 for (i
= 0; i
< kBase36NumsCount
; expValues
[i
] = i
, i
++);
3602 sal_Bool res
= c_rtl_tres_state
3605 test_toData
<sal_Int64
>( kBinaryNumsStr
,kBinaryNumsCount
,
3606 kRadixBinary
,expValues
,3,NULL
,hRtlTestResult
),
3608 "toInt64( radix 2 )"
3611 /* LLA: does not work within wntmsci8.pro
3612 res &= c_rtl_tres_state
3615 test_toData<sal_Int64>( kBinaryMaxNumsStr,kInt64MaxNumsCount,
3616 kRadixBinary,kInt64MaxNums,3,hRtlTestResult ),
3617 "kBinaryMaxNumsStr",
3618 "toInt64_Boundaries( radix 2 )"
3622 res
&= c_rtl_tres_state
3625 test_toData
<sal_Int64
>( kOctolNumsStr
,kOctolNumsCount
,
3626 kRadixOctol
,expValues
,3,NULL
,hRtlTestResult
),
3628 "toInt64( radix 8 )"
3631 res
&= c_rtl_tres_state
3634 test_toData
<sal_Int64
>( kOctolMaxNumsStr
,kInt64MaxNumsCount
,
3635 kRadixOctol
,(sal_Int64
*)kInt64MaxNums
,3,NULL
,hRtlTestResult
),
3637 "toInt64_Boundaries( radix 8 )"
3640 res
&= c_rtl_tres_state
3643 test_toData
<sal_Int64
>( kDecimalNumsStr
,kDecimalNumsCount
,
3644 kRadixDecimal
,expValues
,3,NULL
,hRtlTestResult
),
3646 "toInt64( radix 10 )"
3649 res
&= c_rtl_tres_state
3652 test_toData
<sal_Int64
>( kDecimalMaxNumsStr
,kInt64MaxNumsCount
,
3653 kRadixDecimal
,(sal_Int64
*)kInt64MaxNums
,3,NULL
,hRtlTestResult
),
3654 "kDecimalMaxNumsStr",
3655 "toInt64_Boundaries( radix 10 )"
3658 res
&= c_rtl_tres_state
3661 test_toData
<sal_Int64
>( kHexDecimalNumsStr
,kHexDecimalNumsCount
,
3662 kRadixHexdecimal
,expValues
,3,NULL
,hRtlTestResult
),
3663 "kHexDecimalNumsStr",
3664 "toInt64( radix 16 )"
3667 res
&= c_rtl_tres_state
3670 test_toData
<sal_Int64
>( kHexDecimalMaxNumsStr
,kInt64MaxNumsCount
,
3671 kRadixHexdecimal
,(sal_Int64
*)kInt64MaxNums
,3,NULL
,hRtlTestResult
),
3672 "kHexDecimalMaxNumsStr",
3673 "toInt64_Boundaries( radix 16 )"
3676 res
&= c_rtl_tres_state
3679 test_toData
<sal_Int64
>( kBase36NumsStr
,kBase36NumsCount
,
3680 kRadixBase36
, expValues
,3,NULL
,hRtlTestResult
),
3682 "toInt64( radix 36 )"
3685 res
&= c_rtl_tres_state
3688 test_toData
<sal_Int64
>( kBase36MaxNumsStr
,kInt64MaxNumsCount
,
3689 kRadixBase36
,(sal_Int64
*)kInt64MaxNums
,3,NULL
,hRtlTestResult
),
3690 "kBase36MaxNumsStr",
3691 "toInt64_Boundaries( radix 36 )"
3696 const sal_Int16 nSpecCases
= 5;
3697 static const sal_Char
*spString
[nSpecCases
] =
3706 sal_Int64 expSpecVal
[nSpecCases
] =
3715 res
&= c_rtl_tres_state
3718 test_toData
<sal_Int64
>( spString
,nSpecCases
,
3719 kRadixDecimal
,expSpecVal
,3,NULL
,hRtlTestResult
),
3721 "toInt64( specialcases )"
3727 sal_Bool SAL_CALL
test_rtl_OUString_toInt64_wrongRadix(
3728 hTestResult hRtlTestResult
)
3730 ::rtl::OUString
str("0",1,kEncodingRTLTextUSASCII
,
3731 kConvertFlagsOStringToOUString
);
3733 sal_Int64 iRes
= str
.toInt64(-1);
3741 "toInt64( wrong radix -1)"
3745 sal_Bool SAL_CALL
test_rtl_OUString_toInt64_defaultParam(
3746 hTestResult hRtlTestResult
)
3748 sal_Int64 expValues
[kBase36NumsCount
];
3751 for ( i
= 0; i
< kBase36NumsCount
; i
++ )
3754 sal_Bool res
= c_rtl_tres_state
3757 test_toData
<sal_Int64
>( kDecimalNumsStr
,kDecimalNumsCount
,
3758 kRadixDecimal
,expValues
,2,NULL
,hRtlTestResult
),
3760 "toInt64( radix 10 )"
3762 res
&= c_rtl_tres_state
3765 test_toData
<sal_Int64
>( kDecimalMaxNumsStr
,kInt64MaxNumsCount
,
3766 kRadixDecimal
,(sal_Int64
*)kInt64MaxNums
,2,NULL
,hRtlTestResult
),
3767 "kDecimalMaxNumsStr",
3768 "toInt64_Boundaries( radix 10 )"
3770 const sal_Int16 nSpecCases
= 5;
3771 static const sal_Char
*spString
[nSpecCases
] =
3780 sal_Int64 expSpecVal
[nSpecCases
] =
3789 res
&= c_rtl_tres_state
3792 test_toData
<sal_Int64
>( spString
,nSpecCases
,
3793 kRadixDecimal
,expSpecVal
,2,NULL
,hRtlTestResult
),
3795 "toInt64( specialcases )"
3801 //------------------------------------------------------------------------
3802 // testing the method toInt64()
3803 //------------------------------------------------------------------------
3804 extern "C" void /* sal_Bool */ SAL_CALL
test_rtl_OUString_toInt64(
3805 hTestResult hRtlTestResult
)
3807 c_rtl_tres_state_start( hRtlTestResult
, "toInt64");
3808 sal_Bool bTState
= test_rtl_OUString_toInt64_normal( hRtlTestResult
);
3809 bTState
&= test_rtl_OUString_toInt64_defaultParam (hRtlTestResult
);
3810 bTState
&= test_rtl_OUString_toInt64_wrongRadix( hRtlTestResult
);
3811 c_rtl_tres_state_end( hRtlTestResult
, "toInt64");
3812 // return ( bTState );
3814 extern "C" void /* sal_Bool */ SAL_CALL
test_rtl_OUString( hTestResult hRtlTestResult
)
3817 c_rtl_tres_state_start(hRtlTestResult
, "rtl_OUString" );
3819 test_rtl_OUString_ctors( hRtlTestResult
);
3820 test_rtl_OUString_getLength( hRtlTestResult
);
3821 test_rtl_OUString_equals( hRtlTestResult
);
3822 test_rtl_OUString_equalsIgnoreAsciiCase( hRtlTestResult
);
3823 test_rtl_OUString_compareTo( hRtlTestResult
);
3824 test_rtl_OUString_match( hRtlTestResult
);
3825 test_rtl_OUString_op_eq( hRtlTestResult
);
3826 test_rtl_OUString_op_peq( hRtlTestResult
);
3827 test_rtl_OUString_csuc( hRtlTestResult
);
3828 test_rtl_OUString_getStr( hRtlTestResult
);
3829 test_rtl_OUString_reverseCompareTo( hRtlTestResult
);
3830 test_rtl_OUString_equalsAscii( hRtlTestResult
);
3831 test_rtl_OUString_equalsAsciiL( hRtlTestResult
);
3832 test_rtl_OUString_compareToAscii( hRtlTestResult
);
3833 test_rtl_OUString_valueOf_sal_Bool( hRtlTestResult
);
3834 test_rtl_OUString_valueOf_sal_Unicode( hRtlTestResult
);
3835 test_rtl_OUString_valueOf( hRtlTestResult
);
3836 test_rtl_OUString_createFromAscii( hRtlTestResult
);
3837 test_rtl_OUString_indexOf( hRtlTestResult
);
3838 // LLA: removed, it is in a new test in rtl/oustring. test_rtl_OUString_lastIndexOf( hRtlTestResult );
3839 test_rtl_OUString_concat( hRtlTestResult
);
3840 test_rtl_OUString_replaceAt( hRtlTestResult
);
3841 test_rtl_OUString_replace( hRtlTestResult
);
3842 test_rtl_OUString_toAsciiLowerCase( hRtlTestResult
);
3843 test_rtl_OUString_toAsciiUpperCase( hRtlTestResult
);
3844 test_rtl_OUString_trim( hRtlTestResult
);
3845 // LLA: removed, it is in a new test in rtl/oustring. test_rtl_OUString_toDouble( hRtlTestResult );
3846 // LLA: removed, has compile problems. test_rtl_OUString_toFloat( hRtlTestResult );
3847 test_rtl_OUString_toChar( hRtlTestResult
);
3848 test_rtl_OUString_toBoolean( hRtlTestResult
);
3849 test_rtl_OUString_toInt32( hRtlTestResult
);
3850 test_rtl_OUString_toInt64( hRtlTestResult
);
3852 c_rtl_tres_state_end(hRtlTestResult
, "rtl_OUString");
3854 // -----------------------------------------------------------------------------
3855 void RegisterAdditionalFunctions(FktRegFuncPtr _pFunc
)
3859 (_pFunc
)(&test_rtl_OUString
, "");