Home | History | Annotate | Download | only in lang

Lines Matching defs:UTF16

21 import com.ibm.icu.text.UTF16;
22 import com.ibm.icu.text.UTF16.StringComparator;
25 * Testing class for UTF16
44 * Testing UTF16 class methods append
58 UTF16.append(strbuff, i);
59 arraysize = UTF16.append(array, arraysize, i);
73 if (UTF16.countCodePoint(strbuff) != strsize + (i / 100) + 1) {
82 UTF16.appendCodePoint(strbuff, 0x10000);
89 * Testing UTF16 class methods bounds
99 int boundtype[] = {UTF16.SINGLE_CHAR_BOUNDARY,
100 UTF16.SINGLE_CHAR_BOUNDARY,
101 UTF16.SINGLE_CHAR_BOUNDARY,
102 UTF16.SINGLE_CHAR_BOUNDARY,
103 UTF16.SINGLE_CHAR_BOUNDARY,
104 UTF16.LEAD_SURROGATE_BOUNDARY,
105 UTF16.TRAIL_SURROGATE_BOUNDARY,
106 UTF16.LEAD_SURROGATE_BOUNDARY,
107 UTF16.TRAIL_SURROGATE_BOUNDARY,
108 UTF16.SINGLE_CHAR_BOUNDARY};
111 if (UTF16.bounds(str, i) != boundtype[i]) {
114 if (UTF16.bounds(strbuff, i) != boundtype[i]) {
117 if (UTF16.bounds(array, 0, length, i) != boundtype[i]) {
124 int subboundtype1[] = {UTF16.SINGLE_CHAR_BOUNDARY,
125 UTF16.LEAD_SURROGATE_BOUNDARY,
126 UTF16.TRAIL_SURROGATE_BOUNDARY,
127 UTF16.LEAD_SURROGATE_BOUNDARY,
128 UTF16.TRAIL_SURROGATE_BOUNDARY};
130 UTF16.bounds(array, start, limit, -1);
138 if (UTF16.bounds(array, start, limit, i) != subboundtype1[i]) {
145 int subboundtype2[] = {UTF16.SINGLE_CHAR_BOUNDARY,
146 UTF16.LEAD_SURROGATE_BOUNDARY,
147 UTF16.TRAIL_SURROGATE_BOUNDARY};
152 if (UTF16.bounds(array, start, limit, i) != subboundtype2[i]) {
159 int subboundtype3[] = {UTF16.LEAD_SURROGATE_BOUNDARY,
160 UTF16.TRAIL_SURROGATE_BOUNDARY,
161 UTF16.SINGLE_CHAR_BOUNDARY};
165 if (UTF16.bounds(array, start, limit, i) != subboundtype3[i]) {
173 * Testing UTF16 class methods charAt and charAtCodePoint
180 if (UTF16.charAt(strbuff, 0) != '1' || UTF16.charAt(strbuff, 2) != '3'
181 || UTF16.charAt(strbuff, 5) != 0x10001 ||
182 UTF16.charAt(strbuff, 6) != 0x10001 ||
183 UTF16.charAt(strbuff, 12) != 0x10002 ||
184 UTF16.charAt(strbuff, 13) != 0x10002) {
188 if (UTF16.charAt(str, 0) != '1' || UTF16.charAt(str, 2) != '3' ||
189 UTF16.charAt(str, 5) != 0x10001 || UTF16.charAt(str, 6) != 0x10001
190 || UTF16.charAt(str, 12) != 0x10002 ||
191 UTF16.charAt(str, 13) != 0x10002)
198 if (UTF16.charAt(array, start, limit, 0) != '1' ||
199 UTF16.charAt(array, start, limit, 2) != '3' ||
200 UTF16.charAt(array, start, limit, 5) != 0x10001 ||
201 UTF16.charAt(array, start, limit, 6) != 0x10001 ||
202 UTF16.charAt(array, start, limit, 12) != 0x10002 ||
203 UTF16.charAt(array, start, limit, 13) != 0x10002) {
210 UTF16.charAt(array, start, limit, -1);
216 UTF16.charAt(array, start, limit, 8);
221 if (UTF16.charAt(array, start, limit, 0) != 0xdc01) {
224 if (UTF16.charAt(array, start, limit, 6) != 0xd800) {
228 if (UTF16.charAt(replaceable, 0) != '1' ||
229 UTF16.charAt(replaceable, 2) != '3' ||
230 UTF16.charAt(replaceable, 5) != 0x10001 ||
231 UTF16.charAt(replaceable, 6) != 0x10001 ||
232 UTF16.charAt(replaceable, 12) != 0x10002 ||
233 UTF16.charAt(replaceable, 13) != 0x10002) {
238 UTF16.charAt((CharSequence)strbuffer, 0);
242 * Testing UTF16 class methods countCodePoint
249 if (UTF16.countCodePoint(strbuff) != 0 ||
250 UTF16.countCodePoint("") != 0 ||
251 UTF16.countCodePoint(array,0 ,0) != 0) {
260 if (UTF16.countCodePoint(array, 0, 0) != 0) {
264 if (UTF16.countCodePoint(str) != size ||
265 UTF16.countCodePoint(strbuff) != size ||
266 UTF16.countCodePoint(array, 0, size) != size) {
270 UTF16.append(strbuff, 0x10000);
273 if (UTF16.countCodePoint(str) != size + 1 ||
274 UTF16.countCodePoint(strbuff) != size + 1 ||
275 UTF16.countCodePoint(array, 0, size + 1) != size + 1 ||
276 UTF16.countCodePoint(array, 0, size + 2) != size + 1) {
279 UTF16.append(strbuff, 0x61);
282 if (UTF16.countCodePoint(str) != size + 2 ||
283 UTF16.countCodePoint(strbuff) != size + 2 ||
284 UTF16.countCodePoint(array, 0, size + 1) != size + 1 ||
285 UTF16.countCodePoint(array, 0, size + 2) != size + 1 ||
286 UTF16.countCodePoint(array, 0, size + 3) != size + 2) {
292 * Testing UTF16 class methods delete
301 UTF16.delete(strbuff, 3);
302 UTF16.delete(strbuff, 3);
303 UTF16.delete(strbuff, 3);
304 UTF16.delete(strbuff, 3);
305 UTF16.delete(strbuff, 3);
306 UTF16.delete(strbuff, 3);
308 UTF16.delete(strbuff, strbuff.length());
313 UTF16.delete(strbuff, strbuff.length() - 1);
319 size = UTF16.delete(array, size, 3);
320 size = UTF16.delete(array, size, 3);
321 size = UTF16.delete(array, size, 3);
322 size = UTF16.delete(array, size, 3);
323 size = UTF16.delete(array, size, 3);
324 size = UTF16.delete(array, size, 3);
326 UTF16.delete(array, size, size);
331 size = UTF16.delete(array, size, size - 1);
342 UTF16.delete(strbuff, 8);
343 UTF16.delete(strbuff, 8);
344 UTF16.delete(strbuff, 9);
345 UTF16.delete(strbuff, 8);
346 UTF16.delete(strbuff, 9);
347 UTF16.delete(strbuff, 6);
348 UTF16.delete(strbuff, 6);
353 size = UTF16.delete(array, size, 8);
354 size = UTF16.delete(array, size, 8);
355 size = UTF16.delete(array, size, 9);
356 size = UTF16.delete(array, size, 8);
357 size = UTF16.delete(array, size, 9);
358 size = UTF16.delete(array, size, 6);
359 size = UTF16.delete(array, size, 6);
377 if (UTF16.findCodePointOffset(str, 0) != 0 ||
378 UTF16.findOffsetFromCodePoint(str, 0) != 0 ||
379 UTF16.findCodePointOffset(strbuff, 0) != 0 ||
380 UTF16.findOffsetFromCodePoint(strbuff, 0) != 0 ||
381 UTF16.findCodePointOffset(array, 0, limit, 0) != 0 ||
382 UTF16.findOffsetFromCodePoint(array, 0, limit, 0) != 0) {
386 if (UTF16.findCodePointOffset(str, 1) != 1 ||
387 UTF16.findOffsetFromCodePoint(str, 1) != 1 ||
388 UTF16.findCodePointOffset(strbuff, 1) != 1 ||
389 UTF16.findOffsetFromCodePoint(strbuff, 1) != 1 ||
390 UTF16.findCodePointOffset(array, 0, limit, 1) != 1 ||
391 UTF16.findOffsetFromCodePoint(array, 0, limit, 1) != 1) {
395 if (UTF16.findCodePointOffset(str, 2) != 1 ||
396 UTF16.findOffsetFromCodePoint(str, 2) != 3 ||
397 UTF16.findCodePointOffset(strbuff, 2) != 1 ||
398 UTF16.findOffsetFromCodePoint(strbuff, 2) != 3 ||
399 UTF16.findCodePointOffset(array, 0, limit, 2) != 1 ||
400 UTF16.findOffsetFromCodePoint(array, 0, limit, 2) != 3) {
404 if (UTF16.findCodePointOffset(str, 3) != 2 ||
405 UTF16.findOffsetFromCodePoint(str, 3) != 4 ||
406 UTF16.findCodePointOffset(strbuff, 3) != 2 ||
407 UTF16.findOffsetFromCodePoint(strbuff, 3) != 4 ||
408 UTF16.findCodePointOffset(array, 0, limit, 3) != 2 ||
409 UTF16.findOffsetFromCodePoint(array, 0, limit, 3) != 4) {
413 if (UTF16.findCodePointOffset(str, 4) != 3 ||
414 UTF16.findCodePointOffset(strbuff, 4) != 3 ||
415 UTF16.findCodePointOffset(array, 0, limit, 4) != 3) {
420 UTF16.findCodePointOffset(str, 5);
428 UTF16.findOffsetFromCodePoint(str, 4);
436 UTF16.findCodePointOffset(strbuff, 5);
444 UTF16.findOffsetFromCodePoint(strbuff, 4);
452 UTF16.findCodePointOffset(array, 0, limit, 5);
460 UTF16.findOffsetFromCodePoint(array, 0, limit, 4);
468 if (UTF16.findCodePointOffset(array, 1, 3, 0) != 0 ||
469 UTF16.findOffsetFromCodePoint(array, 1, 3, 0) != 0 ||
470 UTF16.findCodePointOffset(array, 1, 3, 1) != 0 ||
471 UTF16.findCodePointOffset(array, 1, 3, 2) != 1 ||
472 UTF16.findOffsetFromCodePoint(array, 1, 3, 1) != 2) {
478 * Testing UTF16 class methods getCharCount, *Surrogate
483 if (UTF16.getCharCount(0x61) != 1 ||
484 UTF16.getCharCount(0x10000) != 2) {
487 if (UTF16.getLeadSurrogate(0x61) != 0 ||
488 UTF16.getTrailSurrogate(0x61) != 0x61 ||
489 UTF16.isLeadSurrogate((char)0x61) ||
490 UTF16.isTrailSurrogate((char)0x61) ||
491 UTF16.getLeadSurrogate(0x10000) != 0xd800 ||
492 UTF16.getTrailSurrogate(0x10000) != 0xdc00 ||
493 UTF16.isLeadSurrogate((char)0xd800) != true ||
494 UTF16.isTrailSurrogate((char)0xd800) ||
495 UTF16.isLeadSurrogate((char)0xdc00) ||
496 UTF16.isTrailSurrogate((char)0xdc00) != true) {
500 if (UTF16.isSurrogate((char)0x61) || !UTF16.isSurrogate((char)0xd800)
501 || !UTF16.isSurrogate((char)0xdc00)) {
507 * Testing UTF16 class method insert
519 UTF16.insert(strbuff, 5, 't');
520 UTF16.insert(strbuff, 5, 's');
521 UTF16.insert(strbuff, 5, 'e');
522 UTF16.insert(strbuff, 5, 't');
526 length = UTF16.insert(array, length, 5, 't');
527 length = UTF16.insert(array, length, 5, 's');
528 length = UTF16.insert(array, length, 5, 'e');
529 length = UTF16.insert(array, length, 5, 't');
534 UTF16.insert(strbuff, 0, 0x10000);
535 UTF16.insert(strbuff, 11, 0x10000);
536 UTF16.insert(strbuff, strbuff.length(), 0x10000);
541 length = UTF16.insert(array, length, 0, 0x10000);
542 length = UTF16.insert(array, length, 11, 0x10000);
543 length = UTF16.insert(array, length, length, 0x10000);
551 UTF16.insert(strbuff, -1, 0);
557 UTF16.insert(strbuff, 64, 0);
563 UTF16.insert(array, length, -1, 0);
569 UTF16.insert(array, length, 64, 0);
576 UTF16.insert(array, array.length, 64, 0);
599 int result = UTF16.moveCodePointOffset(s, startIdx, amount);
601 errln("FAIL: UTF16.moveCodePointOffset(String \"" + s + "\", " + startIdx + ", " + amount + ")" +
608 errln("FAIL: UTF16.moveCodePointOffset(String \"" + s + "\", " + startIdx + ", " + amount + ")" +
616 int result = UTF16.moveCodePointOffset(sb, startIdx, amount);
618 errln("FAIL: UTF16.moveCodePointOffset(StringBuffer \"" + s + "\", " + startIdx + ", " + amount + ")" +
625 errln("FAIL: UTF16.moveCodePointOffset(StringBuffer \"" + s + "\", " + startIdx + ", " + amount + ")" +
633 int result = UTF16.moveCodePointOffset(ca, 0, s.length(), startIdx, amount);
635 errln("FAIL: UTF16.moveCodePointOffset(char[] \"" + s + "\", 0, " + s.length()
643 errln("FAIL: UTF16.moveCodePointOffset(char[] \"" + s + "\", 0, " + s.length()
656 int result = UTF16.moveCodePointOffset(ca2, 1, s.length()+1, startIdx, amount);
658 errln("UTF16.moveCodePointOffset(char[] \"" + "." + s + ".\", 1, " + (s.length()+1)
666 errln("UTF16.moveCodePointOffset(char[] \"" + "." + s + ".\", 1, " + (s.length()+1)
804 if (UTF16.moveCodePointOffset(strarray, 9, 13, 0, 2) != 3) {
808 if (UTF16.moveCodePointOffset(strarray, 9, 13, 1, 2) != 4) {
812 if (UTF16.moveCodePointOffset(strarray, 11, 14, 0, 2) != 3) {
819 * Testing UTF16 class methods setCharAt
832 UTF16.setCharAt(strbuff, i, '0');
833 UTF16.setCharAt(array, length, i, '0');
840 UTF16.setCharAt(strbuff, 0, 0x10000);
841 UTF16.setCharAt(strbuff, 4, 0x10000);
842 UTF16.setCharAt(strbuff, 7, 0x10000);
847 length = UTF16.setCharAt(array, length, 0, 0x10000);
848 length = UTF16.setCharAt(array, length, 4, 0x10000);
849 length = UTF16.setCharAt(array, length, 7, 0x10000);
854 UTF16.setCharAt(strbuff, 0, '0');
855 UTF16.setCharAt(strbuff, 1, '1');
856 UTF16.setCharAt(strbuff, 2, '2');
857 UTF16.setCharAt(strbuff, 4, '3');
858 UTF16.setCharAt(strbuff, 4, '4');
859 UTF16.setCharAt(strbuff, 5, '5');
864 length = UTF16.setCharAt(array, length, 0, '0');
865 length = UTF16.setCharAt(array, length, 1, '1');
866 length = UTF16.setCharAt(array, length, 2, '2');
867 length = UTF16.setCharAt(array, length, 4, '3');
868 length = UTF16.setCharAt(array, length, 4, '4');
869 length = UTF16.setCharAt(array, length, 5, '5');
876 UTF16.setCharAt(strbuff, -1, 0);
882 UTF16.setCharAt(array, length, -1, 0);
888 UTF16.setCharAt(strbuff, length, 0);
894 UTF16.setCharAt(array, length, length, 0);
902 * Testing UTF16 valueof APIs
910 if (!UTF16.valueOf(0x61).equals("a") ||
911 !UTF16.valueOf(0x10000).equals("\ud800\udc00")) {
922 if (!UTF16.valueOf(str, i).equals(expected[i]) ||
923 !UTF16.valueOf(strbuff, i).equals(expected[i]) ||
924 !UTF16.valueOf(array, 0, length, i).equals(expected[i])) {
929 UTF16.valueOf(str, -1);
935 UTF16.valueOf(strbuff, -1);
941 UTF16.valueOf(array, 0, length, -1);
947 UTF16.valueOf(str, length);
953 UTF16.valueOf(strbuff, length);
959 UTF16.valueOf(array, 0, length, length);
964 if (!UTF16.valueOf(array, 6, length, 0).equals("\udc00") ||
965 !UTF16.valueOf(array, 0, 6, 5).equals("\ud800")) {
969 UTF16.valueOf(array, 3, 5, -1);
975 UTF16.valueOf(array, 3, 5, 3);
995 if (UTF16.indexOf(test1, test2) != 0 ||
996 UTF16.indexOf(test1, test2, 0) != 0) {
1000 if (UTF16.indexOf(test1, testChar1) != 0 ||
1001 UTF16.indexOf(test1, testChar1, 0) != 0) {
1006 if (UTF16.indexOf(test3, testChar2) != 0 ||
1007 UTF16.indexOf(test3, testChar2, 0) != 0) {
1013 if (UTF16.indexOf(test5, testChar2) != 1 ||
1014 UTF16.indexOf(test5, testChar2, 0) != 1) {
1019 if (UTF16.lastIndexOf(test1, test2) != 29 ||
1020 UTF16.lastIndexOf(test1, test2, test1.length()) != 29) {
1024 if (UTF16.lastIndexOf(test1, testChar1) != 35 ||
1025 UTF16.lastIndexOf(test1, testChar1, test1.length()) != 35) {
1030 if (UTF16.lastIndexOf(test3, testChar2) != 13 ||
1031 UTF16.lastIndexOf(test3, testChar2, test3.length()) != 13) {
1039 startPos = UTF16.indexOf(test1, test2, startPos);
1053 startPos = UTF16.indexOf(test1, test2, startPos);
1067 startPos = UTF16.indexOf(test3, test4, startPos);
1081 startPos = UTF16.indexOf(test3, test4, startPos);
1095 startPos = UTF16.indexOf(test1, testChar1, startPos);
1109 startPos = UTF16.indexOf(test1, testChar1, startPos);
1123 startPos = UTF16.indexOf(test3, testChar2, startPos);
1136 startPos = UTF16.indexOf(test3, testChar2, startPos);
1148 startPos = UTF16.lastIndexOf(test1, test2, startPos);
1160 startPos = UTF16.lastIndexOf(test1, testChar1, startPos);
1174 startPos = UTF16.lastIndexOf(test3, testChar2, startPos - 5);
1194 if (UTF16.indexOf(INDEXOF_SUPPLEMENTARY_STRING_, ch, index) !=
1196 UTF16.indexOf(INDEXOF_SUPPLEMENTARY_STRING_,
1206 if (UTF16.lastIndexOf(INDEXOF_SUPPLEMENTARY_STRING_, ch,
1208 UTF16.lastIndexOf(INDEXOF_SUPPLEMENTARY_STRING_,
1224 if (UTF16.indexOf(INDEXOF_SUPPLEMENTARY_STRING_,
1233 if (UTF16.lastIndexOf(INDEXOF_SUPPLEMENTARY_STRING_,
1248 String result = UTF16.replace(test1, test2, test3);
1255 result = UTF16.replace(test1, test3, test2);
1262 result = UTF16.replace(test1, ',', 'e');
1269 result = UTF16.replace(test1, ',', 0x10000);
1276 result = UTF16.replace(test1, "potato", "\ud800\udc00\ud801\udc01");
1284 result = UTF16.replace(test4, 0xd800, 'A');
1291 result = UTF16.replace(test4, 0xdC00, 'A');
1298 result = UTF16.replace(test4, 0x10000, 'A');
1312 StringBuffer result = UTF16.reverse(test);
1318 UTF16.append(testbuffer, 0x2f999);
1319 UTF16.append(testbuffer, 0x1d15f);
1320 UTF16.append(testbuffer, 0x00c4);
1321 UTF16.append(testbuffer, 0x1ed0);
1322 result = UTF16.reverse(testbuffer);
1325 UTF16.charAt(result, 2) != 0x1d15f ||
1326 UTF16.charAt(result, 4)!=0x2f999) {
1337 UTF16.StringComparator compare = new UTF16.StringComparator();
1345 != UTF16.StringComparator.FOLD_CASE_DEFAULT) {
1356 compare.setIgnoreCase(true, UTF16.StringComparator.FOLD_CASE_DEFAULT);
1359 != UTF16.StringComparator.FOLD_CASE_DEFAULT) {
1362 compare.setIgnoreCase(false, UTF16.StringComparator.FOLD_CASE_EXCLUDE_SPECIAL_I);
1365 != UTF16.StringComparator.FOLD_CASE_EXCLUDE_SPECIAL_I) {
1368 compare.setIgnoreCase(true, UTF16.StringComparator.FOLD_CASE_EXCLUDE_SPECIAL_I);
1371 != UTF16.StringComparator.FOLD_CASE_EXCLUDE_SPECIAL_I) {
1374 compare.setIgnoreCase(false, UTF16.StringComparator.FOLD_CASE_DEFAULT);
1377 != UTF16.StringComparator.FOLD_CASE_DEFAULT) {
1390 UTF16.StringComparator cpcompare
1391 = new UTF16.StringComparator(true, false,
1392 UTF16.StringComparator.FOLD_CASE_DEFAULT);
1393 UTF16.StringComparator cucompare
1394 = new UTF16.StringComparator();
1419 UTF16.StringComparator compare = new UTF16.StringComparator();
1420 compare.setIgnoreCase(true, UTF16.StringComparator.FOLD_CASE_DEFAULT);
1430 UTF16.StringComparator.FOLD_CASE_EXCLUDE_SPECIAL_I);
1439 UTF16.StringComparator.FOLD_CASE_DEFAULT);
1448 UTF16.StringComparator.FOLD_CASE_DEFAULT);
1457 UTF16.StringComparator.FOLD_CASE_DEFAULT);
1476 boolean flag = UTF16.hasMoreCodePointsThan(s, number);
1477 if (flag != (UTF16.countCodePoint(s) > number)) {
1490 boolean flag = UTF16.hasMoreCodePointsThan((String)null,
1492 if (flag != (UTF16.countCodePoint((String)null) > number)) {
1505 boolean flag = UTF16.hasMoreCodePointsThan(s, number);
1506 if (flag != (UTF16.countCodePoint(s) > number)) {
1519 boolean flag = UTF16.hasMoreCodePointsThan(
1522 != (UTF16.countCodePoint((StringBuffer)null) > number))
1537 boolean flag = UTF16.hasMoreCodePointsThan(strarray,
1539 if (flag != (UTF16.countCodePoint(strarray, start,
1556 boolean flag = UTF16.hasMoreCodePointsThan(
1559 != (UTF16.countCodePoint((StringBuffer)null) > number))
1570 UTF16.hasMoreCodePointsThan(strarray, -2, -1, 5);
1573 logln("PASS: UTF16.hasMoreCodePointsThan failed as expected");
1576 UTF16.hasMoreCodePointsThan(strarray, 5, 2, 5);
1579 logln("PASS: UTF16.hasMoreCodePointsThan failed as expected");
1582 if (UTF16.hasMoreCodePointsThan(strarray, -2, 2, 5)) {
1605 StringComparator sc = new UTF16.StringComparator(true,false,0);
1608 int count = UTF16.countCodePoint(nonNull1);
1610 assertEquals("codepoint test " + Utility.hex(nonNull1), expected, UTF16.getSingleCodePoint(item1));
1617 int fValue = Integer.signum(UTF16.compareCodePoint(expected, item2));
1663 String str = UTF16.newString(codePoints, s, c);