Home | History | Annotate | Download | only in lang

Lines Matching defs:UTF16

22 import android.icu.text.UTF16;
23 import android.icu.text.UTF16.StringComparator;
27 * Testing class for UTF16
47 * Testing UTF16 class methods append
61 UTF16.append(strbuff, i);
62 arraysize = UTF16.append(array, arraysize, i);
76 if (UTF16.countCodePoint(strbuff) != strsize + (i / 100) + 1) {
85 UTF16.appendCodePoint(strbuff, 0x10000);
92 * Testing UTF16 class methods bounds
102 int boundtype[] = {UTF16.SINGLE_CHAR_BOUNDARY,
103 UTF16.SINGLE_CHAR_BOUNDARY,
104 UTF16.SINGLE_CHAR_BOUNDARY,
105 UTF16.SINGLE_CHAR_BOUNDARY,
106 UTF16.SINGLE_CHAR_BOUNDARY,
107 UTF16.LEAD_SURROGATE_BOUNDARY,
108 UTF16.TRAIL_SURROGATE_BOUNDARY,
109 UTF16.LEAD_SURROGATE_BOUNDARY,
110 UTF16.TRAIL_SURROGATE_BOUNDARY,
111 UTF16.SINGLE_CHAR_BOUNDARY};
114 if (UTF16.bounds(str, i) != boundtype[i]) {
117 if (UTF16.bounds(strbuff, i) != boundtype[i]) {
120 if (UTF16.bounds(array, 0, length, i) != boundtype[i]) {
127 int subboundtype1[] = {UTF16.SINGLE_CHAR_BOUNDARY,
128 UTF16.LEAD_SURROGATE_BOUNDARY,
129 UTF16.TRAIL_SURROGATE_BOUNDARY,
130 UTF16.LEAD_SURROGATE_BOUNDARY,
131 UTF16.TRAIL_SURROGATE_BOUNDARY};
133 UTF16.bounds(array, start, limit, -1);
141 if (UTF16.bounds(array, start, limit, i) != subboundtype1[i]) {
148 int subboundtype2[] = {UTF16.SINGLE_CHAR_BOUNDARY,
149 UTF16.LEAD_SURROGATE_BOUNDARY,
150 UTF16.TRAIL_SURROGATE_BOUNDARY};
155 if (UTF16.bounds(array, start, limit, i) != subboundtype2[i]) {
162 int subboundtype3[] = {UTF16.LEAD_SURROGATE_BOUNDARY,
163 UTF16.TRAIL_SURROGATE_BOUNDARY,
164 UTF16.SINGLE_CHAR_BOUNDARY};
168 if (UTF16.bounds(array, start, limit, i) != subboundtype3[i]) {
176 * Testing UTF16 class methods charAt and charAtCodePoint
183 if (UTF16.charAt(strbuff, 0) != '1' || UTF16.charAt(strbuff, 2) != '3'
184 || UTF16.charAt(strbuff, 5) != 0x10001 ||
185 UTF16.charAt(strbuff, 6) != 0x10001 ||
186 UTF16.charAt(strbuff, 12) != 0x10002 ||
187 UTF16.charAt(strbuff, 13) != 0x10002) {
191 if (UTF16.charAt(str, 0) != '1' || UTF16.charAt(str, 2) != '3' ||
192 UTF16.charAt(str, 5) != 0x10001 || UTF16.charAt(str, 6) != 0x10001
193 || UTF16.charAt(str, 12) != 0x10002 ||
194 UTF16.charAt(str, 13) != 0x10002)
201 if (UTF16.charAt(array, start, limit, 0) != '1' ||
202 UTF16.charAt(array, start, limit, 2) != '3' ||
203 UTF16.charAt(array, start, limit, 5) != 0x10001 ||
204 UTF16.charAt(array, start, limit, 6) != 0x10001 ||
205 UTF16.charAt(array, start, limit, 12) != 0x10002 ||
206 UTF16.charAt(array, start, limit, 13) != 0x10002) {
213 UTF16.charAt(array, start, limit, -1);
219 UTF16.charAt(array, start, limit, 8);
224 if (UTF16.charAt(array, start, limit, 0) != 0xdc01) {
227 if (UTF16.charAt(array, start, limit, 6) != 0xd800) {
231 if (UTF16.charAt(replaceable, 0) != '1' ||
232 UTF16.charAt(replaceable, 2) != '3' ||
233 UTF16.charAt(replaceable, 5) != 0x10001 ||
234 UTF16.charAt(replaceable, 6) != 0x10001 ||
235 UTF16.charAt(replaceable, 12) != 0x10002 ||
236 UTF16.charAt(replaceable, 13) != 0x10002) {
241 UTF16.charAt((CharSequence)strbuffer, 0);
245 * Testing UTF16 class methods countCodePoint
252 if (UTF16.countCodePoint(strbuff) != 0 ||
253 UTF16.countCodePoint("") != 0 ||
254 UTF16.countCodePoint(array,0 ,0) != 0) {
263 if (UTF16.countCodePoint(array, 0, 0) != 0) {
267 if (UTF16.countCodePoint(str) != size ||
268 UTF16.countCodePoint(strbuff) != size ||
269 UTF16.countCodePoint(array, 0, size) != size) {
273 UTF16.append(strbuff, 0x10000);
276 if (UTF16.countCodePoint(str) != size + 1 ||
277 UTF16.countCodePoint(strbuff) != size + 1 ||
278 UTF16.countCodePoint(array, 0, size + 1) != size + 1 ||
279 UTF16.countCodePoint(array, 0, size + 2) != size + 1) {
282 UTF16.append(strbuff, 0x61);
285 if (UTF16.countCodePoint(str) != size + 2 ||
286 UTF16.countCodePoint(strbuff) != size + 2 ||
287 UTF16.countCodePoint(array, 0, size + 1) != size + 1 ||
288 UTF16.countCodePoint(array, 0, size + 2) != size + 1 ||
289 UTF16.countCodePoint(array, 0, size + 3) != size + 2) {
295 * Testing UTF16 class methods delete
304 UTF16.delete(strbuff, 3);
305 UTF16.delete(strbuff, 3);
306 UTF16.delete(strbuff, 3);
307 UTF16.delete(strbuff, 3);
308 UTF16.delete(strbuff, 3);
309 UTF16.delete(strbuff, 3);
311 UTF16.delete(strbuff, strbuff.length());
316 UTF16.delete(strbuff, strbuff.length() - 1);
322 size = UTF16.delete(array, size, 3);
323 size = UTF16.delete(array, size, 3);
324 size = UTF16.delete(array, size, 3);
325 size = UTF16.delete(array, size, 3);
326 size = UTF16.delete(array, size, 3);
327 size = UTF16.delete(array, size, 3);
329 UTF16.delete(array, size, size);
334 size = UTF16.delete(array, size, size - 1);
345 UTF16.delete(strbuff, 8);
346 UTF16.delete(strbuff, 8);
347 UTF16.delete(strbuff, 9);
348 UTF16.delete(strbuff, 8);
349 UTF16.delete(strbuff, 9);
350 UTF16.delete(strbuff, 6);
351 UTF16.delete(strbuff, 6);
356 size = UTF16.delete(array, size, 8);
357 size = UTF16.delete(array, size, 8);
358 size = UTF16.delete(array, size, 9);
359 size = UTF16.delete(array, size, 8);
360 size = UTF16.delete(array, size, 9);
361 size = UTF16.delete(array, size, 6);
362 size = UTF16.delete(array, size, 6);
380 if (UTF16.findCodePointOffset(str, 0) != 0 ||
381 UTF16.findOffsetFromCodePoint(str, 0) != 0 ||
382 UTF16.findCodePointOffset(strbuff, 0) != 0 ||
383 UTF16.findOffsetFromCodePoint(strbuff, 0) != 0 ||
384 UTF16.findCodePointOffset(array, 0, limit, 0) != 0 ||
385 UTF16.findOffsetFromCodePoint(array, 0, limit, 0) != 0) {
389 if (UTF16.findCodePointOffset(str, 1) != 1 ||
390 UTF16.findOffsetFromCodePoint(str, 1) != 1 ||
391 UTF16.findCodePointOffset(strbuff, 1) != 1 ||
392 UTF16.findOffsetFromCodePoint(strbuff, 1) != 1 ||
393 UTF16.findCodePointOffset(array, 0, limit, 1) != 1 ||
394 UTF16.findOffsetFromCodePoint(array, 0, limit, 1) != 1) {
398 if (UTF16.findCodePointOffset(str, 2) != 1 ||
399 UTF16.findOffsetFromCodePoint(str, 2) != 3 ||
400 UTF16.findCodePointOffset(strbuff, 2) != 1 ||
401 UTF16.findOffsetFromCodePoint(strbuff, 2) != 3 ||
402 UTF16.findCodePointOffset(array, 0, limit, 2) != 1 ||
403 UTF16.findOffsetFromCodePoint(array, 0, limit, 2) != 3) {
407 if (UTF16.findCodePointOffset(str, 3) != 2 ||
408 UTF16.findOffsetFromCodePoint(str, 3) != 4 ||
409 UTF16.findCodePointOffset(strbuff, 3) != 2 ||
410 UTF16.findOffsetFromCodePoint(strbuff, 3) != 4 ||
411 UTF16.findCodePointOffset(array, 0, limit, 3) != 2 ||
412 UTF16.findOffsetFromCodePoint(array, 0, limit, 3) != 4) {
416 if (UTF16.findCodePointOffset(str, 4) != 3 ||
417 UTF16.findCodePointOffset(strbuff, 4) != 3 ||
418 UTF16.findCodePointOffset(array, 0, limit, 4) != 3) {
423 UTF16.findCodePointOffset(str, 5);
431 UTF16.findOffsetFromCodePoint(str, 4);
439 UTF16.findCodePointOffset(strbuff, 5);
447 UTF16.findOffsetFromCodePoint(strbuff, 4);
455 UTF16.findCodePointOffset(array, 0, limit, 5);
463 UTF16.findOffsetFromCodePoint(array, 0, limit, 4);
471 if (UTF16.findCodePointOffset(array, 1, 3, 0) != 0 ||
472 UTF16.findOffsetFromCodePoint(array, 1, 3, 0) != 0 ||
473 UTF16.findCodePointOffset(array, 1, 3, 1) != 0 ||
474 UTF16.findCodePointOffset(array, 1, 3, 2) != 1 ||
475 UTF16.findOffsetFromCodePoint(array, 1, 3, 1) != 2) {
481 * Testing UTF16 class methods getCharCount, *Surrogate
486 if (UTF16.getCharCount(0x61) != 1 ||
487 UTF16.getCharCount(0x10000) != 2) {
490 if (UTF16.getLeadSurrogate(0x61) != 0 ||
491 UTF16.getTrailSurrogate(0x61) != 0x61 ||
492 UTF16.isLeadSurrogate((char)0x61) ||
493 UTF16.isTrailSurrogate((char)0x61) ||
494 UTF16.getLeadSurrogate(0x10000) != 0xd800 ||
495 UTF16.getTrailSurrogate(0x10000) != 0xdc00 ||
496 UTF16.isLeadSurrogate((char)0xd800) != true ||
497 UTF16.isTrailSurrogate((char)0xd800) ||
498 UTF16.isLeadSurrogate((char)0xdc00) ||
499 UTF16.isTrailSurrogate((char)0xdc00) != true) {
503 if (UTF16.isSurrogate((char)0x61) || !UTF16.isSurrogate((char)0xd800)
504 || !UTF16.isSurrogate((char)0xdc00)) {
510 * Testing UTF16 class method insert
522 UTF16.insert(strbuff, 5, 't');
523 UTF16.insert(strbuff, 5, 's');
524 UTF16.insert(strbuff, 5, 'e');
525 UTF16.insert(strbuff, 5, 't');
529 length = UTF16.insert(array, length, 5, 't');
530 length = UTF16.insert(array, length, 5, 's');
531 length = UTF16.insert(array, length, 5, 'e');
532 length = UTF16.insert(array, length, 5, 't');
537 UTF16.insert(strbuff, 0, 0x10000);
538 UTF16.insert(strbuff, 11, 0x10000);
539 UTF16.insert(strbuff, strbuff.length(), 0x10000);
544 length = UTF16.insert(array, length, 0, 0x10000);
545 length = UTF16.insert(array, length, 11, 0x10000);
546 length = UTF16.insert(array, length, length, 0x10000);
554 UTF16.insert(strbuff, -1, 0);
560 UTF16.insert(strbuff, 64, 0);
566 UTF16.insert(array, length, -1, 0);
572 UTF16.insert(array, length, 64, 0);
579 UTF16.insert(array, array.length, 64, 0);
602 int result = UTF16.moveCodePointOffset(s, startIdx, amount);
604 errln("FAIL: UTF16.moveCodePointOffset(String \"" + s + "\", " + startIdx + ", " + amount + ")" +
611 errln("FAIL: UTF16.moveCodePointOffset(String \"" + s + "\", " + startIdx + ", " + amount + ")" +
619 int result = UTF16.moveCodePointOffset(sb, startIdx, amount);
621 errln("FAIL: UTF16.moveCodePointOffset(StringBuffer \"" + s + "\", " + startIdx + ", " + amount + ")" +
628 errln("FAIL: UTF16.moveCodePointOffset(StringBuffer \"" + s + "\", " + startIdx + ", " + amount + ")" +
636 int result = UTF16.moveCodePointOffset(ca, 0, s.length(), startIdx, amount);
638 errln("FAIL: UTF16.moveCodePointOffset(char[] \"" + s + "\", 0, " + s.length()
646 errln("FAIL: UTF16.moveCodePointOffset(char[] \"" + s + "\", 0, " + s.length()
659 int result = UTF16.moveCodePointOffset(ca2, 1, s.length()+1, startIdx, amount);
661 errln("UTF16.moveCodePointOffset(char[] \"" + "." + s + ".\", 1, " + (s.length()+1)
669 errln("UTF16.moveCodePointOffset(char[] \"" + "." + s + ".\", 1, " + (s.length()+1)
807 if (UTF16.moveCodePointOffset(strarray, 9, 13, 0, 2) != 3) {
811 if (UTF16.moveCodePointOffset(strarray, 9, 13, 1, 2) != 4) {
815 if (UTF16.moveCodePointOffset(strarray, 11, 14, 0, 2) != 3) {
822 * Testing UTF16 class methods setCharAt
835 UTF16.setCharAt(strbuff, i, '0');
836 UTF16.setCharAt(array, length, i, '0');
843 UTF16.setCharAt(strbuff, 0, 0x10000);
844 UTF16.setCharAt(strbuff, 4, 0x10000);
845 UTF16.setCharAt(strbuff, 7, 0x10000);
850 length = UTF16.setCharAt(array, length, 0, 0x10000);
851 length = UTF16.setCharAt(array, length, 4, 0x10000);
852 length = UTF16.setCharAt(array, length, 7, 0x10000);
857 UTF16.setCharAt(strbuff, 0, '0');
858 UTF16.setCharAt(strbuff, 1, '1');
859 UTF16.setCharAt(strbuff, 2, '2');
860 UTF16.setCharAt(strbuff, 4, '3');
861 UTF16.setCharAt(strbuff, 4, '4');
862 UTF16.setCharAt(strbuff, 5, '5');
867 length = UTF16.setCharAt(array, length, 0, '0');
868 length = UTF16.setCharAt(array, length, 1, '1');
869 length = UTF16.setCharAt(array, length, 2, '2');
870 length = UTF16.setCharAt(array, length, 4, '3');
871 length = UTF16.setCharAt(array, length, 4, '4');
872 length = UTF16.setCharAt(array, length, 5, '5');
879 UTF16.setCharAt(strbuff, -1, 0);
885 UTF16.setCharAt(array, length, -1, 0);
891 UTF16.setCharAt(strbuff, length, 0);
897 UTF16.setCharAt(array, length, length, 0);
905 * Testing UTF16 valueof APIs
913 if (!UTF16.valueOf(0x61).equals("a") ||
914 !UTF16.valueOf(0x10000).equals("\ud800\udc00")) {
925 if (!UTF16.valueOf(str, i).equals(expected[i]) ||
926 !UTF16.valueOf(strbuff, i).equals(expected[i]) ||
927 !UTF16.valueOf(array, 0, length, i).equals(expected[i])) {
932 UTF16.valueOf(str, -1);
938 UTF16.valueOf(strbuff, -1);
944 UTF16.valueOf(array, 0, length, -1);
950 UTF16.valueOf(str, length);
956 UTF16.valueOf(strbuff, length);
962 UTF16.valueOf(array, 0, length, length);
967 if (!UTF16.valueOf(array, 6, length, 0).equals("\udc00") ||
968 !UTF16.valueOf(array, 0, 6, 5).equals("\ud800")) {
972 UTF16.valueOf(array, 3, 5, -1);
978 UTF16.valueOf(array, 3, 5, 3);
998 if (UTF16.indexOf(test1, test2) != 0 ||
999 UTF16.indexOf(test1, test2, 0) != 0) {
1003 if (UTF16.indexOf(test1, testChar1) != 0 ||
1004 UTF16.indexOf(test1, testChar1, 0) != 0) {
1009 if (UTF16.indexOf(test3, testChar2) != 0 ||
1010 UTF16.indexOf(test3, testChar2, 0) != 0) {
1016 if (UTF16.indexOf(test5, testChar2) != 1 ||
1017 UTF16.indexOf(test5, testChar2, 0) != 1) {
1022 if (UTF16.lastIndexOf(test1, test2) != 29 ||
1023 UTF16.lastIndexOf(test1, test2, test1.length()) != 29) {
1027 if (UTF16.lastIndexOf(test1, testChar1) != 35 ||
1028 UTF16.lastIndexOf(test1, testChar1, test1.length()) != 35) {
1033 if (UTF16.lastIndexOf(test3, testChar2) != 13 ||
1034 UTF16.lastIndexOf(test3, testChar2, test3.length()) != 13) {
1042 startPos = UTF16.indexOf(test1, test2, startPos);
1056 startPos = UTF16.indexOf(test1, test2, startPos);
1070 startPos = UTF16.indexOf(test3, test4, startPos);
1084 startPos = UTF16.indexOf(test3, test4, startPos);
1098 startPos = UTF16.indexOf(test1, testChar1, startPos);
1112 startPos = UTF16.indexOf(test1, testChar1, startPos);
1126 startPos = UTF16.indexOf(test3, testChar2, startPos);
1139 startPos = UTF16.indexOf(test3, testChar2, startPos);
1151 startPos = UTF16.lastIndexOf(test1, test2, startPos);
1163 startPos = UTF16.lastIndexOf(test1, testChar1, startPos);
1177 startPos = UTF16.lastIndexOf(test3, testChar2, startPos - 5);
1197 if (UTF16.indexOf(INDEXOF_SUPPLEMENTARY_STRING_, ch, index) !=
1199 UTF16.indexOf(INDEXOF_SUPPLEMENTARY_STRING_,
1209 if (UTF16.lastIndexOf(INDEXOF_SUPPLEMENTARY_STRING_, ch,
1211 UTF16.lastIndexOf(INDEXOF_SUPPLEMENTARY_STRING_,
1227 if (UTF16.indexOf(INDEXOF_SUPPLEMENTARY_STRING_,
1236 if (UTF16.lastIndexOf(INDEXOF_SUPPLEMENTARY_STRING_,
1251 String result = UTF16.replace(test1, test2, test3);
1258 result = UTF16.replace(test1, test3, test2);
1265 result = UTF16.replace(test1, ',', 'e');
1272 result = UTF16.replace(test1, ',', 0x10000);
1279 result = UTF16.replace(test1, "potato", "\ud800\udc00\ud801\udc01");
1287 result = UTF16.replace(test4, 0xd800, 'A');
1294 result = UTF16.replace(test4, 0xdC00, 'A');
1301 result = UTF16.replace(test4, 0x10000, 'A');
1315 StringBuffer result = UTF16.reverse(test);
1321 UTF16.append(testbuffer, 0x2f999);
1322 UTF16.append(testbuffer, 0x1d15f);
1323 UTF16.append(testbuffer, 0x00c4);
1324 UTF16.append(testbuffer, 0x1ed0);
1325 result = UTF16.reverse(testbuffer);
1328 UTF16.charAt(result, 2) != 0x1d15f ||
1329 UTF16.charAt(result, 4)!=0x2f999) {
1340 UTF16.StringComparator compare = new UTF16.StringComparator();
1348 != UTF16.StringComparator.FOLD_CASE_DEFAULT) {
1359 compare.setIgnoreCase(true, UTF16.StringComparator.FOLD_CASE_DEFAULT);
1362 != UTF16.StringComparator.FOLD_CASE_DEFAULT) {
1365 compare.setIgnoreCase(false, UTF16.StringComparator.FOLD_CASE_EXCLUDE_SPECIAL_I);
1368 != UTF16.StringComparator.FOLD_CASE_EXCLUDE_SPECIAL_I) {
1371 compare.setIgnoreCase(true, UTF16.StringComparator.FOLD_CASE_EXCLUDE_SPECIAL_I);
1374 != UTF16.StringComparator.FOLD_CASE_EXCLUDE_SPECIAL_I) {
1377 compare.setIgnoreCase(false, UTF16.StringComparator.FOLD_CASE_DEFAULT);
1380 != UTF16.StringComparator.FOLD_CASE_DEFAULT) {
1393 UTF16.StringComparator cpcompare
1394 = new UTF16.StringComparator(true, false,
1395 UTF16.StringComparator.FOLD_CASE_DEFAULT);
1396 UTF16.StringComparator cucompare
1397 = new UTF16.StringComparator();
1422 UTF16.StringComparator compare = new UTF16.StringComparator();
1423 compare.setIgnoreCase(true, UTF16.StringComparator.FOLD_CASE_DEFAULT);
1433 UTF16.StringComparator.FOLD_CASE_EXCLUDE_SPECIAL_I);
1442 UTF16.StringComparator.FOLD_CASE_DEFAULT);
1451 UTF16.StringComparator.FOLD_CASE_DEFAULT);
1460 UTF16.StringComparator.FOLD_CASE_DEFAULT);
1479 boolean flag = UTF16.hasMoreCodePointsThan(s, number);
1480 if (flag != (UTF16.countCodePoint(s) > number)) {
1493 boolean flag = UTF16.hasMoreCodePointsThan((String)null,
1495 if (flag != (UTF16.countCodePoint((String)null) > number)) {
1508 boolean flag = UTF16.hasMoreCodePointsThan(s, number);
1509 if (flag != (UTF16.countCodePoint(s) > number)) {
1522 boolean flag = UTF16.hasMoreCodePointsThan(
1525 != (UTF16.countCodePoint((StringBuffer)null) > number))
1540 boolean flag = UTF16.hasMoreCodePointsThan(strarray,
1542 if (flag != (UTF16.countCodePoint(strarray, start,
1559 boolean flag = UTF16.hasMoreCodePointsThan(
1562 != (UTF16.countCodePoint((StringBuffer)null) > number))
1573 UTF16.hasMoreCodePointsThan(strarray, -2, -1, 5);
1576 logln("PASS: UTF16.hasMoreCodePointsThan failed as expected");
1579 UTF16.hasMoreCodePointsThan(strarray, 5, 2, 5);
1582 logln("PASS: UTF16.hasMoreCodePointsThan failed as expected");
1585 if (UTF16.hasMoreCodePointsThan(strarray, -2, 2, 5)) {
1608 StringComparator sc = new UTF16.StringComparator(true,false,0);
1611 int count = UTF16.countCodePoint(nonNull1);
1613 assertEquals("codepoint test " + Utility.hex(nonNull1), expected, UTF16.getSingleCodePoint(item1));
1620 int fValue = Integer.signum(UTF16.compareCodePoint(expected, item2));
1666 String str = UTF16.newString(codePoints, s, c);