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_old_testowstring.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"
35 // this file is converted to use with testshl2
36 // original was placed in sal/test/textenc.cxx
39 // -----------------------------------------------------------------------------
50 // #ifndef _OSL_DIAGNOSE_H_
51 // #include <osl/diagnose.h>
54 #ifndef _RTL_USTRING_HXX
55 #include <rtl/ustring.hxx>
58 #ifndef _RTL_STRING_HXX
59 #include <rtl/string.hxx>
62 #include <rtl/locale.hxx>
64 #include <cppunit/simpleheader.hxx>
66 #define TEST_ENSURE(c, m) CPPUNIT_ASSERT_MESSAGE((m), (c))
67 // #if OSL_DEBUG_LEVEL > 0
68 // #define TEST_ENSHURE(c, m) OSL_ENSURE(c, m)
70 // #define TEST_ENSHURE(c, m) OSL_VERIFY(c)
75 // -----------------------------------------------------------------------------
76 namespace rtl_OUString
78 class oldtests
: public CppUnit::TestFixture
82 void test_OString2OUStringAndViceVersa();
84 CPPUNIT_TEST_SUITE( oldtests
);
85 CPPUNIT_TEST( test_OUString
);
86 CPPUNIT_TEST( test_OString2OUStringAndViceVersa
);
87 CPPUNIT_TEST_SUITE_END( );
91 void oldtests::test_OUString()
93 // "Mein erster RTL OUString\n"
96 OUString
s1(OUString::createFromAscii("Mein erster RTL OUString\n"));
97 TEST_ENSURE( s1
== OUString::createFromAscii("Mein erster RTL OUString\n"), "test_OWString error 1");
98 TEST_ENSURE( s1
.getLength() == 25, "test_OWString error 2");
101 TEST_ENSURE( s2
[16] == (sal_Unicode
)'O', "test_OWString error 3");
102 TEST_ENSURE( s2
.equals(s1
), "test_OWString error 4");
103 TEST_ENSURE( OUString( OUString::createFromAscii("hallo")) == OUString::createFromAscii( "hallo"), "test_OWString error 4");
104 TEST_ENSURE( s2
.indexOf((sal_Unicode
)'O') == 16, "test_OWString error 5");
105 TEST_ENSURE( s2
.indexOf((sal_Unicode
)'O', 5) == 16, "test_OWString error 5a");
106 TEST_ENSURE( s2
.lastIndexOf((sal_Unicode
)'r') == 20, "test_OWString error 6");
107 TEST_ENSURE( s2
[20] == (sal_Unicode
)'r', "test_OWString error 7");
108 TEST_ENSURE( s2
[24] == (sal_Unicode
)'\n', "test_OWString error 8");
109 TEST_ENSURE( s2
.lastIndexOf((sal_Unicode
)'\n') == 24, "test_OWString error 9");
110 TEST_ENSURE( s2
.lastIndexOf((sal_Unicode
)'M') == 0, "test_OWString error 10");
111 TEST_ENSURE( s2
.lastIndexOf((sal_Unicode
)'t', s2
.getLength() - 8) == 8, "test_OWString error 9");
114 // "Mein erster RTL OUString ist ein String aus der RTL Library\n"
115 // | | | | | | | | | | | |
116 // Index 0 5 10 15 20 25 30 35 40 45 50 55
117 OUString s3
= s2
.copy(0, s2
.getLength() - 1);
118 OUString s4
= s3
.concat( OUString::createFromAscii(" ist ein String aus der RTL Library\n") );
119 TEST_ENSURE( s4
.getLength() == 60, "test_OWString error 11");
123 s5
= s1
+ OUString::createFromAscii( " aus der RTL Library\n" );
124 TEST_ENSURE( s5
.compareTo(s4
) == 0 , "test_OWString error 12");
125 TEST_ENSURE( s5
.indexOf(OUString::createFromAscii("RTL")) == 12, "test_OWString error 13");
126 TEST_ENSURE( s5
.lastIndexOf(OUString::createFromAscii("RTL")) == 48, "test_OWString error 13");
128 sal_Bool b
= sal_False
;
129 OUString s6
= s5
.valueOf(b
);
130 // TEST_ENSURE( s6.compareTo(OUString::createFromAscii("False")) == 0, "test_OWString error 14");
131 s6
= s5
.valueOf((sal_Unicode
)'H');
132 TEST_ENSURE( s6
.compareTo(OUString::createFromAscii("H")) == 0, "test_OWString error 15");
133 sal_Int32 n
= 123456789L;
135 TEST_ENSURE( s6
.compareTo(OUString::createFromAscii("123456789")) == 0, "test_OWString error 16");
139 sal_Int64 m
= -3223372036854775807LL;
140 #elif defined(SAL_OS2)
142 sal_setInt64(&m
, 3965190145L, -750499787L);
144 sal_Int64 m
= -3223372036854775807;
147 TEST_ENSURE( s6
.compareTo( OUString::createFromAscii( "-3223372036854775807" ) ) == 0, "test_OWString error 17");
150 // LLA: locale tests removed ::rtl::OLocale locale = ::rtl::OLocale::getDefault();
151 // LLA: locale tests removed
152 // LLA: locale tests removed OUString s61(OUString::createFromAscii("HaLLo"));
153 // LLA: locale tests removed s61 = s61.toLowerCase(locale);
154 // LLA: locale tests removed TEST_ENSURE( s61 == OUString::createFromAscii("hallo"), "test_OWString error 17a");
155 // LLA: locale tests removed s61 = s61.toUpperCase();
156 // LLA: locale tests removed TEST_ENSURE( s61 == OUString::createFromAscii("HALLO"), "test_OWString error 17b");
157 // LLA: locale tests removed s61 = s61.toLowerCase();
158 // LLA: locale tests removed TEST_ENSURE( s61 == OUString::createFromAscii("hallo"), "test_OWString error 17c");
159 // LLA: locale tests removed
160 // LLA: locale tests removed ::rtl::OLocale::setDefault( OUString::createFromAscii( "de" ), OUString::createFromAscii( "DE" ), OUString() );
161 // LLA: locale tests removed locale = OLocale::getDefault();
162 // LLA: locale tests removed
163 // LLA: locale tests removed // AB, 24.3.2000, removed NAMESPACE_RTL(OLocale)::getENGLISH() and error 18
164 // LLA: locale tests removed
165 // LLA: locale tests removed OUString s7(OUString::createFromAscii("HaLLo"));
166 // LLA: locale tests removed s7 = s7.toLowerCase(locale);
167 // LLA: locale tests removed TEST_ENSURE( s7 == OUString::createFromAscii("hallo"), "test_OWString error 19");
168 // LLA: locale tests removed s7 = s7.toUpperCase(locale);
169 // LLA: locale tests removed TEST_ENSURE( s7 == OUString::createFromAscii("HALLO"), "test_OWString error 20");
170 // LLA: locale tests removed
171 // LLA: locale tests removed OUString s8(OUString::createFromAscii("HaLLo ICH BIn eIn "));
172 // LLA: locale tests removed s8 += OUString::valueOf( (sal_Unicode)0xDF );
173 // LLA: locale tests removed locale = OLocale::registerLocale( OUString::createFromAscii("tr"), OUString::createFromAscii("TR"), OUString());
174 // LLA: locale tests removed s8 = s8.toLowerCase(locale);
175 // LLA: locale tests removed s8 = s8.toUpperCase(locale);
176 // LLA: locale tests removed TEST_ENSURE( s8 == OUString::createFromAscii("HALLO ICH BIN EIN SS"), "test_OWString error 21");
177 // LLA: locale tests removed
178 // LLA: locale tests removed s7 = OUString::createFromAscii("Hallo ich bIn ein I");
179 // LLA: locale tests removed s7 = s8.toUpperCase(locale);
180 // LLA: locale tests removed TEST_ENSURE( s7 != OUString::createFromAscii("HALLO ICH BIN EIN I"), "test_OWString error 21.b");
183 OUString
s8(OUString::createFromAscii("HALLO ICH BIN EIN SS"));
184 s7
= OUString::createFromAscii(" ");
185 s8
= s7
+ s8
+ OUString::createFromAscii(" " );
186 TEST_ENSURE( s8
== OUString::createFromAscii(" HALLO ICH BIN EIN SS "),
187 "test_OWString error 22");
190 TEST_ENSURE( s7
== OUString::createFromAscii("HALLO ICH BIN EIN SS"), "test_OWString error 23");
191 // TEST_ENSURE( wcscmp(s7.getStr(), L"HALLO ICH BIN EIN SS") == 0, "test_OWString error 24");
193 s7
= OUString::createFromAscii("Hallo");
194 s8
= OUString::createFromAscii("aber Hallo");
196 TEST_ENSURE( s7
< s8
, "test_OWString error 25");
197 TEST_ENSURE( s8
> s7
, "test_OWString error 26");
198 TEST_ENSURE( s7
!= s8
, "test_OWString error 27");
199 TEST_ENSURE( s7
!= OUString::createFromAscii("blabla"), "test_OWString error 28");
200 TEST_ENSURE( OUString::createFromAscii("blabla") != s7
, "test_OWString error 29");
202 s8
= OUString::createFromAscii("Hallo");
203 TEST_ENSURE( s7
<= s8
, "test_OWString error 30");
204 TEST_ENSURE( s7
>= s8
, "test_OwString error 31");
206 s8
= s8
.replace((sal_Unicode
)'l', (sal_Unicode
)'r');
207 TEST_ENSURE( s8
== OUString::createFromAscii("Harro"), "test_OWString error 32");
208 // LLA: len() unknown TEST_ENSURE( s8.len() == 5, "test_OWString error 33");
210 // "Ich bin ein String mit einem A und C und vielen m, m, m, m"
211 // | | | | | | | | | | | |
212 //index 0 5 10 15 20 25 30 35 40 45 50 55
213 s8
= OUString::createFromAscii("Ich bin ein String mit einem A und C und vielen m, m, m, m");
214 // LLA: no matching TEST_ENSURE( s8.search((sal_Unicode)'I') == 0, "test_OWString error 34");
215 // LLA: no matching TEST_ENSURE( s8.search((sal_Unicode)'A') == 29, "test_OWString error 35");
216 // LLA: no matching s7 = OUString::createFromAscii("A und C");
217 // LLA: no matching TEST_ENSURE( s8.search(s7) == 29, "test_OWString error 36");
218 // LLA: no matching TEST_ENSURE( s8.search(OUString::createFromAscii("mit einem A")) == 19, "test_OWString error 37");
220 // LLA: no matching s8 = OUString::createFromAscii("||token1|token2|token3||token4|token5||" );
221 // LLA: no matching TEST_ENSURE( s8.getTokenCount('|') == 10, "test_OWString error 38a");
222 // LLA: no matching TEST_ENSURE( s8.getToken(10,'|') == OUString(), "test_OWString error 39a");
224 // LLA: no matching s8 = OUString::createFromAscii("token1");
225 // LLA: no matching TEST_ENSURE( s8.getTokenCount('|') == 1, "test_OWString error 38b");
226 // LLA: no matching TEST_ENSURE( s8.getToken(0,'|') == OUString::createFromAscii("token1"), "test_OWString error 39b");
227 // LLA: no matching TEST_ENSURE( s8.getToken(-1,'|') == OUString(), "test_OWString error 39c");
228 // LLA: no matching TEST_ENSURE( s8.getToken(1,'|') == OUString(), "test_OWString error 39d");
230 // LLA: no matching s8 = OUString::createFromAscii("|hallo1|hallo2|hallo3|hallo4|hallo5|hallo6|hallo7|hallo8|");
231 // LLA: no matching TEST_ENSURE( s8.getTokenCount((sal_Unicode)'|') == 10, "test_OWString error 38");
232 // LLA: no matching TEST_ENSURE( s8.getToken(3, (sal_Unicode)'|') == OUString::createFromAscii("hallo3"), "test_OWString error 39");
234 // LLA: removed due to the fact, this is not a clean test!
236 // LLA: s7 = OUString();
238 // LLA: TEST_ENSURE( s7 == s8, "test_OWString error 40");
240 // LLA: s7 = s8.replaceAt(8, 6, OUString::createFromAscii("mmmmmmmmmm"));
241 // LLA: TEST_ENSURE( s7.getLength() == 61, "test_OWString error 41");
243 // LLA: s8 = s7.replaceAt(8, 11, OUString());
244 // LLA: TEST_ENSURE( s8.getLength() == 50, "test_OWString error 42");
246 // LLA: s7 = s8.replaceAt(8, 0, OUString::createFromAscii("hallo2|"));
247 // LLA: TEST_ENSURE( s7.getLength() == 57, "test_OWString error 43");
249 // LLA: sal_Int32 pos = 0;
250 // LLA: while ((pos = s7.indexOf(OUString::createFromAscii("|"))) >= 0)
252 // LLA: s8 = s7.replaceAt(pos, 1, OUString::createFromAscii("**"));
255 // LLA: TEST_ENSURE( s7.getLength() == 66, "test_OWString error 44");
257 TEST_ENSURE( OUString::createFromAscii("aaa" ).compareTo( OUString::createFromAscii("bbb" ) ) < 0, "test_OWString error 46" );
258 TEST_ENSURE( OUString::createFromAscii("aaa" ).compareTo( OUString::createFromAscii("aaa" ) ) == 0, "test_OWString error 46" );
259 TEST_ENSURE( OUString::createFromAscii("bbb" ).compareTo( OUString::createFromAscii("aaa" ) ) > 0, "test_OWString error 47" );
260 TEST_ENSURE( OUString::createFromAscii("aaaa" ).compareTo( OUString::createFromAscii("bbb" ) ) < 0, "test_OWString error 48" );
261 TEST_ENSURE( OUString::createFromAscii("aaa" ).compareTo( OUString::createFromAscii("bbbb" ) ) < 0, "test_OWString error 49" );
262 TEST_ENSURE( OUString::createFromAscii("aaa" ).compareTo( OUString::createFromAscii("aaaa" ) ) < 0, "test_OWString error 50" );
263 TEST_ENSURE( OUString::createFromAscii("aaaa" ).compareTo( OUString::createFromAscii("aaa" ) ) > 0, "test_OWString error 51" );
264 TEST_ENSURE( OUString::createFromAscii("bbbb" ).compareTo( OUString::createFromAscii("bbb" ) ) > 0, "test_OWString error 52" );
265 TEST_ENSURE( OUString::createFromAscii("bbb" ) == OUString::createFromAscii("bbb" ), "test_OWString error 53" );
266 TEST_ENSURE( OUString::createFromAscii("bbb" ) == OUString::createFromAscii("bbb" ), "test_OWString error 54" );
269 OUString uStr
= OUString::createFromAscii( "Hallo" );
270 TEST_ENSURE( uStr
.compareTo( OUString::createFromAscii("Hallo"), 5 ) == 0, "test_OWString error 54.2.1" );
271 TEST_ENSURE( uStr
.compareTo( OUString::createFromAscii("Halloa"), 6 ) < 0 , "test_OWString error 54.2.2" );
272 TEST_ENSURE( uStr
.compareTo( OUString::createFromAscii("1Hallo"), 6 ) > 0, "test_OWString error 54.2.3" );
273 TEST_ENSURE( uStr
.compareTo( OUString::createFromAscii("Aallo"), 5 ) > 0, "test_OWString error 54.2.4" );
274 TEST_ENSURE( uStr
.compareTo( OUString::createFromAscii("Halla"), 5 ) > 0, "test_OWString error 54.2.5" );
275 TEST_ENSURE( uStr
.compareTo( OUString::createFromAscii("Mallo"), 5 ) < 0, "test_OWString error 54.2.6" );
276 TEST_ENSURE( uStr
.compareTo( OUString::createFromAscii("Hallp"), 5 ) < 0, "test_OWString error 54.2.7" );
279 #if OSL_DEBUG_LEVEL == 0
280 //YD will fail copy assert on indexes, because ':' returns -1
281 s7
= OUString::createFromAscii("Hallo jetzt komm ich");
282 s8
= s7
.copy(0, s7
.indexOf((sal_Unicode
)':'));
283 TEST_ENSURE( s8
.getLength() == 0, "test_OWString error 55");
284 TEST_ENSURE( s8
.compareTo(OUString()) == 0, "test_OWString error 56");
287 // ASCII-Schnittstellen, AB 15.10.1999
289 // "Ich bin ein reiner ASCII-String mit ein paar Zahlen 0123456789 und Zeichen"
290 // | | | | | | | | | | | | | | |
291 //index 0 5 10 15 20 25 30 35 40 45 50 55 60 65 70
293 // "Ich bin ein weiterer ASCII-String"
295 //index 0 5 10 15 20 25 30
296 sal_Char ascii_str1
[] = "Ich bin ein reiner ASCII-String mit ein paar Zahlen 0123456789 und Zeichen";
297 sal_Char ascii_str2
[] = "Ich bin ein weiterer ASCII-String";
298 OUString OWAsciiStr1
= OUString::createFromAscii( ascii_str1
);
299 sal_Int32 nLen1
= OWAsciiStr1
.getLength();
300 TEST_ENSURE( nLen1
== 74, "test_OWString error 57" );
301 OUString OWAsciiStr2
= OUString::createFromAscii( ascii_str2
);
302 sal_Int32 nLen2
= OWAsciiStr2
.getLength();
303 TEST_ENSURE( nLen2
== 33, "test_OWString error 58" );
305 sal_Int32 nCompareResult11
= OWAsciiStr1
.compareToAscii( ascii_str1
);
306 TEST_ENSURE( nCompareResult11
== 0, "test_OWString error 59" );
307 sal_Int32 nCompareResult12
= OWAsciiStr1
.compareToAscii( ascii_str2
);
308 TEST_ENSURE( nCompareResult12
< 0, "test_OWString error 60" );
310 sal_Int32 nCompareResult21
= OWAsciiStr2
.compareToAscii( ascii_str1
);
311 TEST_ENSURE( nCompareResult21
> 0, "test_OWString error 61" );
312 sal_Int32 nCompareResult22
= OWAsciiStr2
.compareToAscii( ascii_str2
);
313 TEST_ENSURE( nCompareResult22
== 0, "test_OWString error 62" );
315 sal_Int32 nCompareResult12_Len12
= OWAsciiStr1
.compareToAscii( ascii_str2
, 12 );
316 TEST_ENSURE( nCompareResult12_Len12
== 0, "test_OWString error 63" );
317 sal_Int32 nCompareResult12_Len13
= OWAsciiStr1
.compareToAscii( ascii_str2
, 13 );
318 TEST_ENSURE( nCompareResult12_Len13
< 0, "test_OWString error 64" );
320 sal_Int32 nCompareResult21_Len12
= OWAsciiStr2
.compareToAscii( ascii_str1
, 12 );
321 TEST_ENSURE( nCompareResult21_Len12
== 0, "test_OWString error 65" );
322 sal_Int32 nCompareResult21_Len13
= OWAsciiStr2
.compareToAscii( ascii_str1
, 13 );
323 TEST_ENSURE( nCompareResult21_Len13
> 0, "test_OWString error 66" );
326 OUString uStr
= OUString::createFromAscii( "Hallo" );
327 TEST_ENSURE( uStr
.equalsAsciiL( "Hallo", 5 ), "test_OWString error 66.1.1" );
328 TEST_ENSURE( !uStr
.equalsAsciiL( "Hallo1", 6 ), "test_OWString error 66.1.2" );
329 TEST_ENSURE( !uStr
.equalsAsciiL( "1Hallo", 6 ), "test_OWString error 66.1.3" );
330 TEST_ENSURE( !uStr
.equalsAsciiL( "aallo", 5 ), "test_OWString error 66.1.2" );
331 TEST_ENSURE( !uStr
.equalsAsciiL( "Halla", 5 ), "test_OWString error 66.1.3" );
333 TEST_ENSURE( uStr
.reverseCompareToAsciiL( "Hallo", 5 ) == 0, "test_OWString error 66.2.1" );
334 TEST_ENSURE( uStr
.reverseCompareToAsciiL( "Halloa", 6 ) > 0 , "test_OWString error 66.2.2" );
335 TEST_ENSURE( uStr
.reverseCompareToAsciiL( "1Hallo", 6 ) < 0, "test_OWString error 66.2.3" );
336 TEST_ENSURE( uStr
.reverseCompareToAsciiL( "Aallo", 5 ) > 0, "test_OWString error 66.2.4" );
337 TEST_ENSURE( uStr
.reverseCompareToAsciiL( "Halla", 5 ) > 0, "test_OWString error 66.2.5" );
338 TEST_ENSURE( uStr
.reverseCompareToAsciiL( "Mallo", 5 ) < 0, "test_OWString error 66.2.6" );
339 TEST_ENSURE( uStr
.reverseCompareToAsciiL( "Hallp", 5 ) < 0, "test_OWString error 66.2.7" );
343 OUString
s9( OUString::createFromAscii(" -3223372036854775807") );
344 sal_Int64 ln1
= s9
.toInt64();
345 #if (defined UNX) || (defined OS2)
346 TEST_ENSURE( ln1
== -3223372036854775807LL, "test_OWString error 67" );
348 TEST_ENSURE( ln1
== -3223372036854775807, "test_OWString error 67" );
350 OUString
s10( OUString::createFromAscii("13243A65f1H45") );
351 sal_Int64 ln2
= s10
.toInt64();
352 TEST_ENSURE( ln2
== 13243, "test_OWString error 68" );
354 sal_Int64 ln3
= s10
.toInt64( 16 );
355 #if (defined UNX) || (defined OS2)
356 TEST_ENSURE( ln3
== 0x13243A65F1LL
, "test_OWString error 69" );
358 TEST_ENSURE( ln3
== 0x13243A65F1, "test_OWString error 69" );
361 OUString
s11( OUString::createFromAscii("H4A") );
362 sal_Int64 ln4
= s11
.toInt64( 23 );
363 TEST_ENSURE( ln4
== 23*23*17 + 4 * 23 + 10, "test_OWString error 70" );
366 OUString
s12( OUString::createFromAscii(" -220368507") );
367 sal_Int32 n1
= s12
.toInt32();
368 TEST_ENSURE( n1
== -220368507, "test_OWString error 71" );
370 OUString
s13( OUString::createFromAscii("4423A61H45") );
371 sal_Int64 n2
= s13
.toInt32();
372 TEST_ENSURE( n2
== 4423, "test_OWString error 72" );
374 sal_Int64 n3
= s13
.toInt64( 16 );
375 TEST_ENSURE( n3
== 0x4423A61, "test_OWString error 73" );
377 // LLA: Value tests fails most the time, this is not a good test
378 // LLA: double d = 1.23456781;
379 // LLA: OUString sDouble = OUString::valueOf( d );
380 // LLA: char str[] = "1.2345678099999999";
381 // LLA: sal_Int32 nLength = sDouble.getLength();
382 // LLA: TEST_ENSURE( nLength == strlen( str ), "test_OWString error 74" );
383 // LLA: sal_Int32 nCompare = sDouble.compareToAscii( str );
384 // LLA: TEST_ENSURE( nCompare == 0, "test_OWString error 75" );
386 printf("test_OWString OK !!!\n");
390 // -----------------------------------------------------------------------------
392 void oldtests::test_OString2OUStringAndViceVersa()
394 OString
s1("Hallo jetzt komm ich");
395 OUString u1
= OStringToOUString(s1
, RTL_TEXTENCODING_MS_1252
);
396 TEST_ENSURE( u1
.equals(OUString::createFromAscii("Hallo jetzt komm ich")), "test_OString2OWStringAndViceVersa error 1" );
397 u1
= OStringToOUString(s1
, RTL_TEXTENCODING_IBM_850
);
398 TEST_ENSURE( u1
.equals(OUString::createFromAscii("Hallo jetzt komm ich")), "test_OString2OWStringAndViceVersa error 2" );
399 u1
= OStringToOUString(s1
, RTL_TEXTENCODING_ISO_8859_15
);
400 TEST_ENSURE( u1
.equals(OUString::createFromAscii("Hallo jetzt komm ich")), "test_OString2OWStringAndViceVersa error 3" );
401 u1
= OStringToOUString(s1
, RTL_TEXTENCODING_ASCII_US
);
402 TEST_ENSURE( u1
.equals(OUString::createFromAscii("Hallo jetzt komm ich")), "test_OString2OWStringAndViceVersa error 4" );
404 OString s2
= OUStringToOString(u1
, RTL_TEXTENCODING_MS_1252
);
405 TEST_ENSURE( s2
.equals("Hallo jetzt komm ich"), "test_OString2OWStringAndViceVersa error 5" );
406 s2
= OUStringToOString(u1
, RTL_TEXTENCODING_IBM_850
);
407 TEST_ENSURE( s2
.equals("Hallo jetzt komm ich"), "test_OString2OWStringAndViceVersa error 6" );
408 s2
= OUStringToOString(u1
, RTL_TEXTENCODING_ISO_8859_15
);
409 TEST_ENSURE( s2
.equals("Hallo jetzt komm ich"), "test_OString2OWStringAndViceVersa error 7" );
410 s2
= OUStringToOString(u1
, RTL_TEXTENCODING_ASCII_US
);
411 TEST_ENSURE( s2
.equals("Hallo jetzt komm ich"), "test_OString2OWStringAndViceVersa error 8" );
413 printf("test_OString2OWStringAndViceVersa OK !!!\n");
416 } // namespace rtl_OUString
418 // -----------------------------------------------------------------------------
419 CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( rtl_OUString::oldtests
, "rtl_OUString" );
421 // -----------------------------------------------------------------------------