2 *******************************************************************************
3 * Copyright (C) 1996-2013, International Business Machines Corporation and
4 * others. All Rights Reserved.
5 *******************************************************************************
8 package com.ibm.icu.dev.test.lang;
10 import java.util.BitSet;
11 import java.util.Locale;
13 import com.ibm.icu.dev.test.TestFmwk;
14 import com.ibm.icu.lang.UProperty;
15 import com.ibm.icu.lang.UScript;
16 import com.ibm.icu.lang.UScript.ScriptUsage;
17 import com.ibm.icu.text.UnicodeSet;
18 import com.ibm.icu.util.ULocale;
20 public class TestUScript extends TestFmwk {
29 public static void main(String[] args) throws Exception {
30 new TestUScript().run(args);
32 public void TestLocaleGetCode(){
33 final ULocale[] testNames={
35 new ULocale("en"), new ULocale("en_US"),
36 new ULocale("sr"), new ULocale("ta") ,
39 new ULocale("he"), new ULocale("ar"),
41 new ULocale("abcde_cdef"),
44 final int[] expected ={
45 /* locales should return */
46 UScript.LATIN, UScript.LATIN,
47 UScript.CYRILLIC, UScript.TAMIL,
48 UScript.TELUGU,UScript.DEVANAGARI,
49 UScript.HEBREW, UScript.ARABIC,
50 UScript.INVALID_CODE,UScript.INVALID_CODE,
56 for( ; i<testNames.length; i++){
57 int[] code = UScript.getCode(testNames[i]);
60 if(expected[i]!=UScript.INVALID_CODE){
61 logln("Error getting script code Got: null" + " Expected: " +expected[i] +" for name "+testNames[i]);
64 // getCode returns null if the code could not be found
67 if((code[0] != expected[i])){
68 logln("Error getting script code Got: " +code[0] + " Expected: " +expected[i] +" for name "+testNames[i]);
72 reportDataErrors(numErrors);
75 ULocale defaultLoc = ULocale.getDefault();
76 ULocale esparanto = new ULocale("eo_DE");
77 ULocale.setDefault(esparanto);
78 int[] code = UScript.getCode(esparanto);
80 if( code[0] != UScript.LATIN){
81 errln("Did not get the expected script code for Esparanto");
84 warnln("Could not load the locale data.");
86 ULocale.setDefault(defaultLoc);
89 private void reportDataErrors(int numErrors) {
91 // assume missing locale data, so not an error, just a warning
92 if (isModularBuild() || noData()) {
93 // if nodata is set don't even warn
94 warnln("Could not find locale data");
96 errln("encountered " + numErrors + " errors.");
101 public void TestMultipleCode(){
102 final String[] testNames = { "ja" ,"ko_KR","zh","zh_TW"};
103 final int[][] expected = {
104 {UScript.KATAKANA,UScript.HIRAGANA,UScript.HAN},
105 {UScript.HANGUL, UScript.HAN},
107 {UScript.HAN,UScript.BOPOMOFO}
111 for(int i=0; i<testNames.length;i++){
112 int[] code = UScript.getCode(testNames[i]);
113 int[] expt = (int[]) expected[i];
115 for(int j =0; j< code.length;j++){
116 if(code[j]!=expt[j]){
118 logln("Error getting script code Got: " +code[j] + " Expected: " +expt[j] +" for name "+testNames[i]);
123 logln("Error getting script code for name "+testNames[i]);
126 reportDataErrors(numErrors);
128 //cover UScript.getCode(Locale)
129 Locale[] testLocales = new Locale[] {
134 logln("Testing UScript.getCode(Locale) ...");
136 for(int i=0; i<testNames.length;i++){
137 logln(" Testing locale: " + testLocales[i].getDisplayName());
138 int[] code = UScript.getCode(testLocales[i]);
139 int[] expt = (int[]) expected[i];
141 for(int j =0; j< code.length;j++){
142 if(code[j]!=expt[j]){
144 logln(" Error getting script code Got: " +code[j] + " Expected: " +expt[j] +" for name "+testNames[i]);
149 logln(" Error getting script code for name "+testNames[i]);
152 reportDataErrors(numErrors);
155 public void TestGetCode(){
157 final String[] testNames={
159 "en", "en_US", "sr", "ta", "gu", "te_IN",
162 "Hani", "Hang","Hebr","Hira",
163 "Knda","Kana","Khmr","Lao",
164 "Latn",/*"Latf","Latg",*/
168 "CYRILLIC","DESERET","DEVANAGARI","ETHIOPIC","GEORGIAN",
169 "GOTHIC", "GREEK", "GUJARATI", "COMMON", "INHERITED",
170 /* test lower case names */
171 "malayalam", "mongolian", "myanmar", "ogham", "old-italic",
172 "oriya", "runic", "sinhala", "syriac","tamil",
173 "telugu", "thaana", "thai", "tibetan",
175 "Cans", "arabic","Yi","Zyyy"
177 final int[] expected ={
178 /* locales should return */
179 UScript.LATIN, UScript.LATIN,
180 UScript.CYRILLIC, UScript.TAMIL, UScript.GUJARATI,
181 UScript.TELUGU,UScript.DEVANAGARI,
182 UScript.HEBREW, UScript.ARABIC,
183 /* abbr should return */
184 UScript.HAN, UScript.HANGUL, UScript.HEBREW, UScript.HIRAGANA,
185 UScript.KANNADA, UScript.KATAKANA, UScript.KHMER, UScript.LAO,
186 UScript.LATIN,/* UScript.LATIN, UScript.LATIN,*/
187 UScript.MALAYALAM, UScript.MONGOLIAN,
188 /* names should return */
189 UScript.CYRILLIC, UScript.DESERET, UScript.DEVANAGARI, UScript.ETHIOPIC, UScript.GEORGIAN,
190 UScript.GOTHIC, UScript.GREEK, UScript.GUJARATI, UScript.COMMON, UScript.INHERITED,
191 /* lower case names should return */
192 UScript.MALAYALAM, UScript.MONGOLIAN, UScript.MYANMAR, UScript.OGHAM, UScript.OLD_ITALIC,
193 UScript.ORIYA, UScript.RUNIC, UScript.SINHALA, UScript.SYRIAC, UScript.TAMIL,
194 UScript.TELUGU, UScript.THAANA, UScript.THAI, UScript.TIBETAN,
196 UScript.CANADIAN_ABORIGINAL, UScript.ARABIC, UScript.YI, UScript.COMMON
201 for( ; i<testNames.length; i++){
202 int[] code = UScript.getCode(testNames[i]);
204 if(expected[i]==UScript.INVALID_CODE){
205 // getCode returns null if the code could not be found
208 // currently commented out until jitterbug#2678 is fixed
209 logln("Error getting script code Got: null" + " Expected: " +expected[i] +" for name "+testNames[i]);
213 if((code[0] != expected[i])){
214 logln("Error getting script code Got: " +code[0] + " Expected: " +expected[i] +" for name "+testNames[i]);
218 reportDataErrors(numErrors);
221 public void TestGetName(){
223 final int[] testCodes={
224 /* names should return */
225 UScript.CYRILLIC, UScript.DESERET, UScript.DEVANAGARI, UScript.ETHIOPIC, UScript.GEORGIAN,
226 UScript.GOTHIC, UScript.GREEK, UScript.GUJARATI,
229 final String[] expectedNames={
232 "Cyrillic","Deseret","Devanagari","Ethiopic","Georgian",
233 "Gothic", "Greek", "Gujarati",
237 while(i< testCodes.length){
238 String scriptName = UScript.getName(testCodes[i]);
239 if(!expectedNames[i].equals(scriptName)){
240 logln("Error getting abbreviations Got: " +scriptName +" Expected: "+expectedNames[i]);
246 warnln("encountered " + numErrors + " errors in UScript.getName()");
250 public void TestGetShortName(){
251 final int[] testCodes={
252 /* abbr should return */
253 UScript.HAN, UScript.HANGUL, UScript.HEBREW, UScript.HIRAGANA,
254 UScript.KANNADA, UScript.KATAKANA, UScript.KHMER, UScript.LAO,
256 UScript.MALAYALAM, UScript.MONGOLIAN,
259 final String[] expectedAbbr={
261 "Hani", "Hang","Hebr","Hira",
262 "Knda","Kana","Khmr","Laoo",
268 while(i<testCodes.length){
269 String shortName = UScript.getShortName(testCodes[i]);
270 if(!expectedAbbr[i].equals(shortName)){
271 logln("Error getting abbreviations Got: " +shortName+ " Expected: " +expectedAbbr[i]);
277 warnln("encountered " + numErrors + " errors in UScript.getShortName()");
280 public void TestGetScript(){
281 int codepoints[][] = new int[][] {
282 {0x0000FF9D, UScript.KATAKANA },
283 {0x0000FFBE, UScript.HANGUL },
284 {0x0000FFC7, UScript.HANGUL },
285 {0x0000FFCF, UScript.HANGUL },
286 {0x0000FFD7, UScript.HANGUL},
287 {0x0000FFDC, UScript.HANGUL},
288 {0x00010300, UScript.OLD_ITALIC},
289 {0x00010330, UScript.GOTHIC},
290 {0x0001034A, UScript.GOTHIC},
291 {0x00010400, UScript.DESERET},
292 {0x00010428, UScript.DESERET},
293 {0x0001D167, UScript.INHERITED},
294 {0x0001D17B, UScript.INHERITED},
295 {0x0001D185, UScript.INHERITED},
296 {0x0001D1AA, UScript.INHERITED},
297 {0x00020000, UScript.HAN},
298 {0x00000D02, UScript.MALAYALAM},
299 {0x00000D00, UScript.UNKNOWN},
300 {0x00000000, UScript.COMMON},
301 {0x0001D169, UScript.INHERITED },
302 {0x0001D182, UScript.INHERITED },
303 {0x0001D18B, UScript.INHERITED },
304 {0x0001D1AD, UScript.INHERITED },
308 int code = UScript.INVALID_CODE;
309 boolean passed = true;
311 while(i< codepoints.length){
312 code = UScript.getScript(codepoints[i][0]);
314 if(code != codepoints[i][1]){
315 logln("UScript.getScript for codepoint 0x"+ hex(codepoints[i][0])+" failed");
322 errln("UScript.getScript failed.");
326 public void TestGetScriptOfCharsWithScriptExtensions() {
327 /* test characters which have Script_Extensions */
329 UScript.COMMON==UScript.getScript(0x0640) &&
330 UScript.INHERITED==UScript.getScript(0x0650) &&
331 UScript.ARABIC==UScript.getScript(0xfdf2))
333 errln("UScript.getScript(character with Script_Extensions) failed");
337 public void TestHasScript() {
339 !UScript.hasScript(0x063f, UScript.COMMON) &&
340 UScript.hasScript(0x063f, UScript.ARABIC) && /* main Script value */
341 !UScript.hasScript(0x063f, UScript.SYRIAC) &&
342 !UScript.hasScript(0x063f, UScript.THAANA))
344 errln("UScript.hasScript(U+063F, ...) is wrong");
347 !UScript.hasScript(0x0640, UScript.COMMON) && /* main Script value */
348 UScript.hasScript(0x0640, UScript.ARABIC) &&
349 UScript.hasScript(0x0640, UScript.SYRIAC) &&
350 !UScript.hasScript(0x0640, UScript.THAANA))
352 errln("UScript.hasScript(U+0640, ...) is wrong");
355 !UScript.hasScript(0x0650, UScript.INHERITED) && /* main Script value */
356 UScript.hasScript(0x0650, UScript.ARABIC) &&
357 UScript.hasScript(0x0650, UScript.SYRIAC) &&
358 !UScript.hasScript(0x0650, UScript.THAANA))
360 errln("UScript.hasScript(U+0650, ...) is wrong");
363 !UScript.hasScript(0x0660, UScript.COMMON) && /* main Script value */
364 UScript.hasScript(0x0660, UScript.ARABIC) &&
365 !UScript.hasScript(0x0660, UScript.SYRIAC) &&
366 UScript.hasScript(0x0660, UScript.THAANA))
368 errln("UScript.hasScript(U+0660, ...) is wrong");
371 !UScript.hasScript(0xfdf2, UScript.COMMON) &&
372 UScript.hasScript(0xfdf2, UScript.ARABIC) && /* main Script value */
373 !UScript.hasScript(0xfdf2, UScript.SYRIAC) &&
374 UScript.hasScript(0xfdf2, UScript.THAANA))
376 errln("UScript.hasScript(U+FDF2, ...) is wrong");
378 if(UScript.hasScript(0x0640, 0xaffe)) {
379 // An unguarded implementation might go into an infinite loop.
380 errln("UScript.hasScript(U+0640, bogus 0xaffe) is wrong");
384 public void TestGetScriptExtensions() {
385 BitSet scripts=new BitSet(UScript.CODE_LIMIT);
387 /* invalid code points */
388 if(UScript.getScriptExtensions(-1, scripts)!=UScript.UNKNOWN || scripts.cardinality()!=1 ||
389 !scripts.get(UScript.UNKNOWN)) {
390 errln("UScript.getScriptExtensions(-1) is not {UNKNOWN}");
392 if(UScript.getScriptExtensions(0x110000, scripts)!=UScript.UNKNOWN || scripts.cardinality()!=1 ||
393 !scripts.get(UScript.UNKNOWN)) {
394 errln("UScript.getScriptExtensions(0x110000) is not {UNKNOWN}");
398 if(UScript.getScriptExtensions(0x063f, scripts)!=UScript.ARABIC || scripts.cardinality()!=1 ||
399 !scripts.get(UScript.ARABIC)) {
400 errln("UScript.getScriptExtensions(U+063F) is not {ARABIC}");
402 if(UScript.getScriptExtensions(0x0640, scripts)!=-3 || scripts.cardinality()!=3 ||
403 !scripts.get(UScript.ARABIC) || !scripts.get(UScript.SYRIAC) || !scripts.get(UScript.MANDAIC)
405 errln("UScript.getScriptExtensions(U+0640) failed");
407 if(UScript.getScriptExtensions(0xfdf2, scripts)!=-2 || scripts.cardinality()!=2 ||
408 !scripts.get(UScript.ARABIC) || !scripts.get(UScript.THAANA)) {
409 errln("UScript.getScriptExtensions(U+FDF2) failed");
411 if(UScript.getScriptExtensions(0xff65, scripts)!=-6 || scripts.cardinality()!=6 ||
412 !scripts.get(UScript.BOPOMOFO) || !scripts.get(UScript.YI)) {
413 errln("UScript.getScriptExtensions(U+FF65) failed");
417 public void TestScriptMetadataAPI() {
418 /* API & code coverage. */
419 String sample = UScript.getSampleString(UScript.LATIN);
420 if(sample.length()!=1 || UScript.getScript(sample.charAt(0))!=UScript.LATIN) {
421 errln("UScript.getSampleString(Latn) failed");
423 sample = UScript.getSampleString(UScript.INVALID_CODE);
424 if(sample.length()!=0) {
425 errln("UScript.getSampleString(invalid) failed");
428 if(UScript.getUsage(UScript.LATIN)!=ScriptUsage.RECOMMENDED ||
429 UScript.getUsage(UScript.YI)!=ScriptUsage.ASPIRATIONAL ||
430 UScript.getUsage(UScript.CHEROKEE)!=ScriptUsage.LIMITED_USE ||
431 UScript.getUsage(UScript.COPTIC)!=ScriptUsage.EXCLUDED ||
432 UScript.getUsage(UScript.CIRTH)!=ScriptUsage.NOT_ENCODED ||
433 UScript.getUsage(UScript.INVALID_CODE)!=ScriptUsage.NOT_ENCODED ||
434 UScript.getUsage(UScript.CODE_LIMIT)!=ScriptUsage.NOT_ENCODED) {
435 errln("UScript.getUsage() failed");
438 if(UScript.isRightToLeft(UScript.LATIN) ||
439 UScript.isRightToLeft(UScript.CIRTH) ||
440 !UScript.isRightToLeft(UScript.ARABIC) ||
441 !UScript.isRightToLeft(UScript.HEBREW)) {
442 errln("UScript.isRightToLeft() failed");
445 if(UScript.breaksBetweenLetters(UScript.LATIN) ||
446 UScript.breaksBetweenLetters(UScript.CIRTH) ||
447 !UScript.breaksBetweenLetters(UScript.HAN) ||
448 !UScript.breaksBetweenLetters(UScript.THAI)) {
449 errln("UScript.breaksBetweenLetters() failed");
452 if(UScript.isCased(UScript.CIRTH) ||
453 UScript.isCased(UScript.HAN) ||
454 !UScript.isCased(UScript.LATIN) ||
455 !UScript.isCased(UScript.GREEK)) {
456 errln("UScript.isCased() failed");
461 * Maps a special script code to the most common script of its encoded characters.
463 private static final int getCharScript(int script) {
465 case UScript.SIMPLIFIED_HAN:
466 case UScript.TRADITIONAL_HAN:
468 case UScript.JAPANESE:
469 return UScript.HIRAGANA;
471 return UScript.HANGUL;
477 public void TestScriptMetadata() {
478 UnicodeSet rtl = new UnicodeSet("[[:bc=R:][:bc=AL:]-[:Cn:]-[:sc=Common:]]");
479 // So far, sample characters are uppercase.
480 // Georgian is special.
481 UnicodeSet cased = new UnicodeSet("[[:Lu:]-[:sc=Common:]-[:sc=Geor:]]");
482 for(int sc = 0; sc < UScript.CODE_LIMIT; ++sc) {
483 String sn = UScript.getShortName(sc);
484 ScriptUsage usage = UScript.getUsage(sc);
485 String sample = UScript.getSampleString(sc);
486 UnicodeSet scriptSet = new UnicodeSet();
487 scriptSet.applyIntPropertyValue(UProperty.SCRIPT, sc);
488 if(usage == ScriptUsage.NOT_ENCODED) {
489 assertTrue(sn + " not encoded, no sample", sample.length() == 0); // Java 6: sample.isEmpty()
490 assertFalse(sn + " not encoded, not RTL", UScript.isRightToLeft(sc));
491 assertFalse(sn + " not encoded, not LB letters", UScript.breaksBetweenLetters(sc));
492 assertFalse(sn + " not encoded, not cased", UScript.isCased(sc));
493 assertTrue(sn + " not encoded, no characters", scriptSet.isEmpty());
495 assertFalse(sn + " encoded, has a sample character", sample.length() == 0); // Java 6: sample.isEmpty()
496 int firstChar = sample.codePointAt(0);
497 int charScript = getCharScript(sc);
498 assertEquals(sn + " script(sample(script))",
499 charScript, UScript.getScript(firstChar));
500 assertEquals(sn + " RTL vs. set", rtl.contains(firstChar), UScript.isRightToLeft(sc));
501 assertEquals(sn + " cased vs. set", cased.contains(firstChar), UScript.isCased(sc));
502 assertEquals(sn + " encoded, has characters", sc == charScript, !scriptSet.isEmpty());
503 if(UScript.isRightToLeft(sc)) {
504 rtl.removeAll(scriptSet);
506 if(UScript.isCased(sc)) {
507 cased.removeAll(scriptSet);
511 assertEquals("no remaining RTL characters", "[]", rtl.toPattern(true));
512 assertEquals("no remaining cased characters", "[]", cased.toPattern(true));
514 assertTrue("Hani breaks between letters", UScript.breaksBetweenLetters(UScript.HAN));
515 assertTrue("Thai breaks between letters", UScript.breaksBetweenLetters(UScript.THAI));
516 assertFalse("Latn does not break between letters", UScript.breaksBetweenLetters(UScript.LATIN));
519 public void TestScriptNames(){
520 for(int i=0; i<UScript.CODE_LIMIT;i++){
521 String name = UScript.getName(i);
522 if(name.equals("") ){
523 errln("FAILED: getName for code : "+i);
525 String shortName= UScript.getShortName(i);
526 if(shortName.equals("")){
527 errln("FAILED: getName for code : "+i);
531 public void TestAllCodepoints(){
534 //String oldAbbrId="";
535 for( int i =0; i <= 0x10ffff; i++){
536 code =UScript.INVALID_CODE;
537 code = UScript.getScript(i);
538 if(code==UScript.INVALID_CODE){
539 errln("UScript.getScript for codepoint 0x"+ hex(i)+" failed");
541 String id =UScript.getName(code);
542 if(id.indexOf("INVALID")>=0){
543 errln("UScript.getScript for codepoint 0x"+ hex(i)+" failed");
545 String abbr = UScript.getShortName(code);
546 if(abbr.indexOf("INV")>=0){
547 errln("UScript.getScript for codepoint 0x"+ hex(i)+" failed");
551 public void TestNewCode(){
553 * These script codes were originally added to ICU pre-3.6, so that ICU would
554 * have all ISO 15924 script codes. ICU was then based on Unicode 4.1.
555 * These script codes were added with only short names because we don't
556 * want to invent long names ourselves.
557 * Unicode 5 and later encode some of these scripts and give them long names.
558 * Whenever this happens, the long script names here need to be updated.
560 String[] expectedLong = new String[]{
561 "Balinese", "Batak", "Blis", "Brahmi", "Cham", "Cirt", "Cyrs", "Egyd", "Egyh", "Egyptian_Hieroglyphs",
562 "Geok", "Hans", "Hant", "Hmng", "Hung", "Inds", "Javanese", "Kayah_Li", "Latf", "Latg",
563 "Lepcha", "Lina", "Mandaic", "Maya", "Meroitic_Hieroglyphs", "Nko", "Old_Turkic", "Perm", "Phags_Pa", "Phoenician",
564 "Miao", "Roro", "Sara", "Syre", "Syrj", "Syrn", "Teng", "Vai", "Visp", "Cuneiform",
566 "Carian", "Jpan", "Tai_Tham", "Lycian", "Lydian", "Ol_Chiki", "Rejang", "Saurashtra", "Sgnw", "Sundanese",
567 "Moon", "Meetei_Mayek",
570 "Imperial_Aramaic", "Avestan", "Chakma", "Kore",
571 "Kaithi", "Mani", "Inscriptional_Pahlavi", "Phlp", "Phlv", "Inscriptional_Parthian", "Samaritan", "Tai_Viet",
574 "Bamum", "Lisu", "Nkgb", "Old_South_Arabian",
576 "Bass", "Dupl", "Elba", "Gran", "Kpel", "Loma", "Mend", "Meroitic_Cursive",
577 "Narb", "Nbat", "Palm", "Sind", "Wara",
579 "Afak", "Jurc", "Mroo", "Nshu", "Sharada", "Sora_Sompeng", "Takri", "Tang", "Wole",
581 "Hluw", "Khoj", "Tirh",
585 String[] expectedShort = new String[]{
586 "Bali", "Batk", "Blis", "Brah", "Cham", "Cirt", "Cyrs", "Egyd", "Egyh", "Egyp",
587 "Geok", "Hans", "Hant", "Hmng", "Hung", "Inds", "Java", "Kali", "Latf", "Latg",
588 "Lepc", "Lina", "Mand", "Maya", "Mero", "Nkoo", "Orkh", "Perm", "Phag", "Phnx",
589 "Plrd", "Roro", "Sara", "Syre", "Syrj", "Syrn", "Teng", "Vaii", "Visp", "Xsux",
591 "Cari", "Jpan", "Lana", "Lyci", "Lydi", "Olck", "Rjng", "Saur", "Sgnw", "Sund",
595 "Armi", "Avst", "Cakm", "Kore", "Kthi", "Mani", "Phli", "Phlp", "Phlv", "Prti",
596 "Samr", "Tavt", "Zmth", "Zsym",
598 "Bamu", "Lisu", "Nkgb", "Sarb",
600 "Bass", "Dupl", "Elba", "Gran", "Kpel", "Loma", "Mend", "Merc",
601 "Narb", "Nbat", "Palm", "Sind", "Wara",
603 "Afak", "Jurc", "Mroo", "Nshu", "Shrd", "Sora", "Takr", "Tang", "Wole",
605 "Hluw", "Khoj", "Tirh",
609 if(expectedLong.length!=(UScript.CODE_LIMIT-UScript.BALINESE)) {
610 errln("need to add new script codes in lang.TestUScript.java!");
615 for(i=UScript.BALINESE; i<UScript.CODE_LIMIT; i++, j++){
616 String name = UScript.getName(i);
617 if(name==null || !name.equals(expectedLong[j])){
618 errln("UScript.getName failed for code"+ i + name +"!=" +expectedLong[j]);
620 name = UScript.getShortName(i);
621 if(name==null || !name.equals(expectedShort[j])){
622 errln("UScript.getShortName failed for code"+ i + name +"!=" +expectedShort[j]);
625 for(i=0; i<expectedLong.length; i++){
626 int[] ret = UScript.getCode(expectedShort[i]);
628 errln("UScript.getCode did not return expected number of codes for script"+ expectedShort[i]+". EXPECTED: 1 GOT: "+ ret.length);
630 if(ret[0]!= (UScript.BALINESE+i)){
631 errln("UScript.getCode did not return expected code for script"+ expectedShort[i]+". EXPECTED: "+ (UScript.BALINESE+i)+" GOT: %i\n"+ ret[0] );