]> granicus.if.org Git - icu/commitdiff
ICU-12716 Fix formatting in tests to resolve ErrorProne warnings
authorCraig Cornelius <ccornelius@google.com>
Tue, 27 Sep 2016 23:56:40 +0000 (23:56 +0000)
committerCraig Cornelius <ccornelius@google.com>
Tue, 27 Sep 2016 23:56:40 +0000 (23:56 +0000)
X-SVN-Rev: 39370

icu4j/main/tests/collate/src/com/ibm/icu/dev/test/collator/UCAConformanceTest.java
icu4j/main/tests/core/src/com/ibm/icu/dev/test/lang/UCharacterTest.java
icu4j/main/tests/core/src/com/ibm/icu/dev/test/util/CharsTrieTest.java

index 1ad2716450ad439e368c96c5a1ada50768e9ec88..ec0c876d6e0dee81de514a9ae9eb173086185f06 100644 (file)
@@ -7,7 +7,7 @@
 
 /**
  * UCAConformanceTest performs conformance tests defined in the data
- * files. ICU ships with stub data files, as the whole test are too 
+ * files. ICU ships with stub data files, as the whole test are too
  * long. To do the whole test, download the test files.
  */
 
@@ -33,18 +33,17 @@ public class UCAConformanceTest extends TestFmwk {
 
     public UCAConformanceTest() {
     }
-    
+
     @Before
     public void init() throws Exception {
-        UCA = (RuleBasedCollator)Collator.getInstance(ULocale.ROOT);
+        UCA = (RuleBasedCollator) Collator.getInstance(ULocale.ROOT);
         comparer = new UTF16.StringComparator(true, false, UTF16.StringComparator.FOLD_CASE_DEFAULT);
     }
-    
+
     private RuleBasedCollator UCA;
     private RuleBasedCollator rbUCA;
     private UTF16.StringComparator comparer;
-    private boolean isAtLeastUCA62 =
-        UCharacter.getUnicodeVersion().compareTo(VersionInfo.UNICODE_6_2) >= 0;
+    private boolean isAtLeastUCA62 = UCharacter.getUnicodeVersion().compareTo(VersionInfo.UNICODE_6_2) >= 0;
 
     @Test
     public void TestTableNonIgnorable() {
@@ -62,9 +61,13 @@ public class UCAConformanceTest extends TestFmwk {
 
     @Test
     public void TestRulesNonIgnorable() {
-        if(logKnownIssue("cldrbug:6745", "UCARules.txt has problems")) { return; }
+        if (logKnownIssue("cldrbug:6745", "UCARules.txt has problems")) {
+            return;
+        }
         initRbUCA();
-        if(rbUCA == null) { return; }
+        if (rbUCA == null) {
+            return;
+        }
 
         setCollNonIgnorable(rbUCA);
         openTestFile("NON_IGNORABLE");
@@ -73,45 +76,41 @@ public class UCAConformanceTest extends TestFmwk {
 
     @Test
     public void TestRulesShifted() {
-        logln("This test is currently disabled, as it is impossible to "+
-        "wholly represent fractional UCA using tailoring rules.");
+        logln("This test is currently disabled, as it is impossible to "
+                + "wholly represent fractional UCA using tailoring rules.");
         return;
         /*
-        initRbUCA();
-        if(rbUCA == null) { return; }
-
-        setCollShifted(rbUCA);
-        openTestFile("SHIFTED");
-        testConformance(rbUCA);
-        */
+         * initRbUCA(); if(rbUCA == null) { return; }
+         *
+         * setCollShifted(rbUCA); openTestFile("SHIFTED"); testConformance(rbUCA);
+         */
     }
+
     BufferedReader in;
-    private void openTestFile(String type)
-    {
+
+    private void openTestFile(String type) {
         String collationTest = "CollationTest_";
         String ext = ".txt";
         try {
-            in = TestUtil.getDataReader(collationTest+type+"_SHORT"+ext);
+            in = TestUtil.getDataReader(collationTest + type + "_SHORT" + ext);
         } catch (Exception e) {
             try {
-                in = TestUtil.getDataReader(collationTest+type+ext);
+                in = TestUtil.getDataReader(collationTest + type + ext);
             } catch (Exception e1) {
                 try {
-                    in = TestUtil.getDataReader(collationTest+type+"_STUB"+ext);
-                    logln( "INFO: Working with the stub file.\n"+
-                            "If you need the full conformance test, please\n"+
-                            "download the appropriate data files from:\n"+
-                            "http://unicode.org/cldr/trac/browser/trunk/common/uca");
+                    in = TestUtil.getDataReader(collationTest + type + "_STUB" + ext);
+                    logln("INFO: Working with the stub file.\n" + "If you need the full conformance test, please\n"
+                            + "download the appropriate data files from:\n"
+                            + "http://unicode.org/cldr/trac/browser/trunk/common/uca");
                 } catch (Exception e11) {
                     errln("ERROR: Could not find any of the test files");
                 }
             }
         }
-    }          
+    }
 
-    private void setCollNonIgnorable(RuleBasedCollator coll) 
-    {
-        if(coll != null) {
+    private void setCollNonIgnorable(RuleBasedCollator coll) {
+        if (coll != null) {
             coll.setDecomposition(Collator.CANONICAL_DECOMPOSITION);
             coll.setLowerCaseFirst(false);
             coll.setCaseLevel(false);
@@ -120,9 +119,8 @@ public class UCAConformanceTest extends TestFmwk {
         }
     }
 
-    private void setCollShifted(RuleBasedCollator coll) 
-    {
-        if(coll != null) {
+    private void setCollShifted(RuleBasedCollator coll) {
+        if (coll != null) {
             coll.setDecomposition(Collator.CANONICAL_DECOMPOSITION);
             coll.setLowerCaseFirst(false);
             coll.setCaseLevel(false);
@@ -131,15 +129,12 @@ public class UCAConformanceTest extends TestFmwk {
         }
     }
 
-
-
-    private void initRbUCA() 
-    {
-        if(rbUCA == null) {
+    private void initRbUCA() {
+        if (rbUCA == null) {
             String ucarules = UCA.getRules(true);
             try {
                 rbUCA = new RuleBasedCollator(ucarules);
-            } catch(Exception e) {
+            } catch (Exception e) {
                 errln("Failure creating UCA rule-based collator: " + e);
             }
         }
@@ -149,15 +144,15 @@ public class UCAConformanceTest extends TestFmwk {
         int i = 0, value;
         StringBuilder result = new StringBuilder(), buffer = new StringBuilder();
 
-        for(;;) {
-            while(i < line.length() && Character.isWhitespace(line.charAt(i))) {
+        for (;;) {
+            while (i < line.length() && Character.isWhitespace(line.charAt(i))) {
                 i++;
             }
-            while(i < line.length() && Character.isLetterOrDigit(line.charAt(i))) {
+            while (i < line.length() && Character.isLetterOrDigit(line.charAt(i))) {
                 buffer.append(line.charAt(i));
                 i++;
             }
-            if(buffer.length() == 0) {
+            if (buffer.length() == 0) {
                 // We hit something that was not whitespace/letter/digit.
                 // Should be ';' or end of string.
                 return result.toString();
@@ -184,14 +179,14 @@ public class UCAConformanceTest extends TestFmwk {
     }
 
     private void conformanceTest(RuleBasedCollator coll) {
-        if(in == null || coll == null) {
+        if (in == null || coll == null) {
             return;
         }
         int skipFlags = 0;
-        if(coll.isAlternateHandlingShifted()) {
+        if (coll.isAlternateHandlingShifted()) {
             skipFlags |= IS_SHIFTED;
         }
-        if(coll == rbUCA) {
+        if (coll == rbUCA) {
             skipFlags |= FROM_RULES;
         }
 
@@ -207,42 +202,43 @@ public class UCAConformanceTest extends TestFmwk {
         try {
             while ((line = in.readLine()) != null) {
                 lineNo++;
-                if(line.length() == 0 || line.charAt(0) == '#') {
+                if (line.length() == 0 || line.charAt(0) == '#') {
                     continue;
                 }
                 buffer = parseString(line);
 
-                if(skipLineBecauseOfBug(buffer, skipFlags)) {
+                if (skipLineBecauseOfBug(buffer, skipFlags)) {
                     logln("Skipping line " + lineNo + " because of a known bug");
                     continue;
                 }
 
-                if(withSortKeys) {
+                if (withSortKeys) {
                     coll.getRawCollationKey(buffer, newSk);
                 }
-                if(oldSk != null) {
+                if (oldSk != null) {
                     boolean ok = true;
                     int skres = withSortKeys ? oldSk.compareTo(newSk) : 0;
                     int cmpres = coll.compare(oldB, buffer);
                     int cmpres2 = coll.compare(buffer, oldB);
 
-                    if(cmpres != -cmpres2) {
+                    if (cmpres != -cmpres2) {
                         errln(String.format(
-                                "Compare result not symmetrical on line %i: " +
-                                "previous vs. current (%d) / current vs. previous (%d)",
+                                "Compare result not symmetrical on line %d: "
+                                        + "previous vs. current (%d) / current vs. previous (%d)",
                                 lineNo, cmpres, cmpres2));
                         ok = false;
                     }
 
                     // TODO: Compare with normalization turned off if the input passes the FCD test.
 
-                    if(withSortKeys && cmpres != normalizeResult(skres)) {
-                        errln("Difference between coll.compare (" + cmpres + ") and sortkey compare (" + skres + ") on line " + lineNo);
+                    if (withSortKeys && cmpres != normalizeResult(skres)) {
+                        errln("Difference between coll.compare (" + cmpres + ") and sortkey compare (" + skres
+                                + ") on line " + lineNo);
                         ok = false;
                     }
 
                     int res = cmpres;
-                    if(res == 0 && !isAtLeastUCA62) {
+                    if (res == 0 && !isAtLeastUCA62) {
                         // Up to UCA 6.1, the collation test files use a custom tie-breaker,
                         // comparing the raw input strings.
                         res = comparer.compare(oldB, buffer);
@@ -250,15 +246,15 @@ public class UCAConformanceTest extends TestFmwk {
                         // comparing the NFD versions of the input strings,
                         // which we do via setting strength=identical.
                     }
-                    if(res > 0) {
+                    if (res > 0) {
                         errln("Line " + lineNo + " is not greater or equal than previous line");
                         ok = false;
                     }
 
-                    if(!ok) {
+                    if (!ok) {
                         errln("  Previous data line " + oldLine);
                         errln("  Current data line  " + line);
-                        if(withSortKeys) {
+                        if (withSortKeys) {
                             errln("  Previous key: " + CollationTest.prettify(oldSk));
                             errln("  Current key:  " + CollationTest.prettify(newSk));
                         }
@@ -268,14 +264,14 @@ public class UCAConformanceTest extends TestFmwk {
                 oldSk = newSk;
                 oldB = buffer;
                 oldLine = line;
-                if(oldSk == sk1) {
+                if (oldSk == sk1) {
                     newSk = sk2;
                 } else {
                     newSk = sk1;
                 }
             }
         } catch (Exception e) {
-            errln("Unexpected exception "+e);
+            errln("Unexpected exception " + e);
         } finally {
             try {
                 in.close();
index 95d66f6fbc6d92a387dbd89143b58b4e02c793d7..4548f6275c21089fd783b69b628be165fc5d3c85 100644 (file)
@@ -813,7 +813,7 @@ public final class UCharacterTest extends TestFmwk
                     dm=null;
                 }
                 if(dt<0) {
-                    errln(String.format("error in UnicodeData.txt: syntax error in U+%04lX decomposition field", ch));
+                    errln(String.format("error in UnicodeData.txt: syntax error in U+%04x decomposition field", ch));
                     return;
                 }
                 int i=UCharacter.getIntPropertyValue(ch, UProperty.DECOMPOSITION_TYPE);
@@ -898,7 +898,7 @@ public final class UCharacterTest extends TestFmwk
                     break;
                 }
 
-                
+
 
                 String title = fields[14];
                 tempchar = ch;
@@ -1697,14 +1697,14 @@ public final class UCharacterTest extends TestFmwk
                       "." + ages[i + 4]);
             }
         }
-        
+
         int[] valid_tests = {
                 UCharacter.MIN_VALUE, UCharacter.MIN_VALUE+1,
                 UCharacter.MAX_VALUE-1, UCharacter.MAX_VALUE};
         int[] invalid_tests = {
                 UCharacter.MIN_VALUE-1, UCharacter.MIN_VALUE-2,
                 UCharacter.MAX_VALUE+1, UCharacter.MAX_VALUE+2};
-        
+
         for(int i=0; i< valid_tests.length; i++){
             try{
                 UCharacter.getAge(valid_tests[i]);
@@ -1713,7 +1713,7 @@ public final class UCharacterTest extends TestFmwk
                         "an exception. Value passed: " + valid_tests[i]);
             }
         }
-            
+
         for(int i=0; i< invalid_tests.length; i++){
             try{
                 UCharacter.getAge(invalid_tests[i]);
@@ -1866,7 +1866,7 @@ public final class UCharacterTest extends TestFmwk
             { 0xff9f, UProperty.GRAPHEME_BASE, 0 },      /* changed from Unicode 3.2 to 4  and again 5 to 5.1 */
 
             { 0x0300, UProperty.GRAPHEME_EXTEND, 1 },
-            { 0xff9d, UProperty.GRAPHEME_EXTEND, 0 }, 
+            { 0xff9d, UProperty.GRAPHEME_EXTEND, 0 },
             { 0xff9f, UProperty.GRAPHEME_EXTEND, 1 },   /* changed from Unicode 3.2 to 4 and again 5 to 5.1 */
             { 0x0603, UProperty.GRAPHEME_EXTEND, 0 },
 
@@ -2715,16 +2715,16 @@ public final class UCharacterTest extends TestFmwk
     public void TestBlockData()
     {
         Class ubc = UCharacter.UnicodeBlock.class;
-        
+
         for (int b = 1; b < UCharacter.UnicodeBlock.COUNT; b += 1) {
             UCharacter.UnicodeBlock blk = UCharacter.UnicodeBlock.getInstance(b);
             int id = blk.getID();
             String name = blk.toString();
-            
+
             if (id != b) {
                 errln("UCharacter.UnicodeBlock.getInstance(" + b + ") returned a block with id = " + id);
             }
-            
+
             try {
                 if (ubc.getField(name + "_ID").getInt(blk) != b) {
                     errln("UCharacter.UnicodeBlock.getInstance(" + b + ") returned a block with a name of " + name +
@@ -2777,7 +2777,7 @@ public final class UCharacterTest extends TestFmwk
         //UCharacter.UnicodeBlock.forName("");
         //Tests when "if (b == null)" is true
     }
-    
+
     /*
      * The following method tests
      *      public static int getNumericValue(int ch)
@@ -2796,7 +2796,7 @@ public final class UCharacterTest extends TestFmwk
              65834,65835,65836,65837,65838,65839,65840,65841,65842,65843,65861,
              65862,65863,65868,65869,65870,65875,65876,65877,65878,65899,65900,
              65901,65902,65903,65904,65905,65906,66378,68167};
-        
+
         int[] results =
             {1000,1000,10000,500,1000,500,1000,1000,5000,10000,50000,100000,
              10000,100000000,1000,100000000,-2,1000,10000,1000,300,400,500,
@@ -2804,7 +2804,7 @@ public final class UCharacterTest extends TestFmwk
              10000,20000,30000,40000,50000,60000,70000,80000,90000,500,5000,
              50000,500,1000,5000,500,1000,10000,50000,300,500,500,500,500,500,
              1000,5000,900,1000};
-        
+
         if(valid_values.length != results.length){
             errln("The valid_values array and the results array need to be "+
                     "the same length.");
@@ -2836,7 +2836,7 @@ public final class UCharacterTest extends TestFmwk
          *  could not be covered even with input values from UTF16.CODEPOINT_MIN_VALUE
          *  to UTF16.CODEPOINT_MAX_VALUE. I also tested from UTF16.CODEPOINT_MAX_VALUE to
          *  Integer.MAX_VALUE and didn't recieve any code coverage there too.
-         *  Therefore, the code could either be dead code or meaningless. 
+         *  Therefore, the code could either be dead code or meaningless.
          */
     }
 
@@ -2852,7 +2852,7 @@ public final class UCharacterTest extends TestFmwk
         int[] invalid_tests = {
                 UCharacter.MIN_VALUE-1, UCharacter.MIN_VALUE-2,
                 UCharacter.MAX_VALUE+1, UCharacter.MAX_VALUE+2};
-        
+
         for(int i=0; i< valid_tests.length; i++){
             if(UCharacter.toString(valid_tests[i]) == null){
                 errln("UCharacter.toString(int) was not suppose to return " +
@@ -2860,7 +2860,7 @@ public final class UCharacterTest extends TestFmwk
                 valid_tests[i] + ". Got null.");
             }
         }
-        
+
         for(int i=0; i< invalid_tests.length; i++){
             if(UCharacter.toString(invalid_tests[i]) != null){
                 errln("UCharacter.toString(int) was suppose to return " +
@@ -2882,7 +2882,7 @@ public final class UCharacterTest extends TestFmwk
         int[] invalid_tests = {
                 UCharacter.MIN_VALUE-1, UCharacter.MIN_VALUE-2,
                 UCharacter.MAX_VALUE+1, UCharacter.MAX_VALUE+2};
-        
+
         for(int i=0; i< valid_tests.length; i++){
             try{
                 UCharacter.getCombiningClass(valid_tests[i]);
@@ -2891,7 +2891,7 @@ public final class UCharacterTest extends TestFmwk
                         "an exception. Value passed: " + valid_tests[i]);
             }
         }
-            
+
         for(int i=0; i< invalid_tests.length; i++){
             try{
                 assertEquals("getCombiningClass(out of range)",
@@ -2927,7 +2927,7 @@ public final class UCharacterTest extends TestFmwk
             }
         }
     }
-    
+
     /*
      * The following method tests
      *      public static String getISOComment(int ch)
@@ -2937,7 +2937,7 @@ public final class UCharacterTest extends TestFmwk
         int[] invalid_tests = {
                 UCharacter.MIN_VALUE-1, UCharacter.MIN_VALUE-2,
                 UCharacter.MAX_VALUE+1, UCharacter.MAX_VALUE+2};
-        
+
         for(int i=0; i< invalid_tests.length; i++){
             if(UCharacter.getISOComment(invalid_tests[i]) != null){
                 errln("UCharacter.getISOComment(int) was suppose to return " +
@@ -2989,11 +2989,11 @@ public final class UCharacterTest extends TestFmwk
         for(int i=0; i<locale.length; i++){
             UCharacter.toTitleCase(new Locale(locale[i]), "", null);
         }
-        
+
         // Calls the function "String toTitleCase(ULocale locale, String str, BreakIterator titleIter, int options)"
         // Tests when "if (locale == null)" is true
         UCharacter.toTitleCase((ULocale)null, "", null, 0);
-        
+
         // TODO: Tests when "if(index==BreakIterator.DONE || index>srcLength)" is true
         // TODO: Tests when "while((c=iter.nextCaseMapCP())>=0 && UCaseProps.NONE==gCsp.getType(c))" is false
         // TODO: Tests when "if(prev<titleStart)" is false
@@ -3080,29 +3080,29 @@ public final class UCharacterTest extends TestFmwk
                 0x824c, //CJK_IDEOGRAPH_TEN_THOUSAND_
                 0x5104, //CJK_IDEOGRAPH_HUNDRED_MILLION_
         };
-        
+
         int[] invalid = {-5,-2,-1,0};
-        
+
         int[] results = {0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,100,100,
                 1000,1000,10000,100000000};
-        
+
         if(valid.length != results.length){
             errln("The arrays valid and results are suppose to be the same length " +
                     "to test getHanNumericValue(int ch).");
         } else{
             for(int i=0; i<valid.length; i++){
                 if(UCharacter.getHanNumericValue(valid[i]) != results[i]){
-                    errln("UCharacter.getHanNumericValue does not return the " + 
+                    errln("UCharacter.getHanNumericValue does not return the " +
                             "same result as expected. Passed value: " + valid[i] +
                             ". Got: " + UCharacter.getHanNumericValue(valid[i]) +
                             ". Expected: " + results[i]);
                 }
             }
         }
-        
+
         for(int i=0; i<invalid.length; i++){
             if(UCharacter.getHanNumericValue(invalid[i]) != -1){
-                errln("UCharacter.getHanNumericValue does not return the " + 
+                errln("UCharacter.getHanNumericValue does not return the " +
                         "same result as expected. Passed value: " + invalid[i] +
                         ". Got: " + UCharacter.getHanNumericValue(invalid[i]) +
                         ". Expected: -1");
@@ -3112,7 +3112,7 @@ public final class UCharacterTest extends TestFmwk
 
     /*
      * The following method tests
-     *      public static boolean hasBinaryProperty(int ch, int property) 
+     *      public static boolean hasBinaryProperty(int ch, int property)
      */
     @Test
     public void TestHasBinaryProperty(){
@@ -3165,7 +3165,7 @@ public final class UCharacterTest extends TestFmwk
 
             }
         }
-        
+
         // Testing when "if(ch<NormalizerImpl.JAMO_L_BASE)" is true
         for(int i=Normalizer2Impl.Hangul.JAMO_L_BASE-5; i<Normalizer2Impl.Hangul.JAMO_L_BASE; i++){
             if(UCharacter.getIntPropertyValue(i, UProperty.HANGUL_SYLLABLE_TYPE) != 0){
@@ -3174,7 +3174,7 @@ public final class UCharacterTest extends TestFmwk
 
             }
         }
-        
+
         // Testing when "else if((ch-=NormalizerImpl.HANGUL_BASE)<0)" is true
         for(int i=Normalizer2Impl.Hangul.HANGUL_BASE-5; i<Normalizer2Impl.Hangul.HANGUL_BASE; i++){
             if(UCharacter.getIntPropertyValue(i, UProperty.HANGUL_SYLLABLE_TYPE) != 0){
@@ -3201,12 +3201,12 @@ public final class UCharacterTest extends TestFmwk
                         "but got " + UCharacter.getIntPropertyMaxValue(cases[i]));
             }
         }
-        
+
         // TODO: Testing when the case statment reaches "default"
         // After testing between values of UProperty.INT_START and
         // UProperty.INT_LIMIT are covered, none of the values reaches default.
     }
-    
+
     /*
      * The following method tests
      *      public static final int codePointAt(CharSequence seq, int index)
@@ -3214,7 +3214,7 @@ public final class UCharacterTest extends TestFmwk
      */
     @Test
     public void TestCodePointAt(){
-        
+
         // {LEAD_SURROGATE_MIN_VALUE,
         //  LEAD_SURROGATE_MAX_VALUE, LEAD_SURROGATE_MAX_VALUE-1
         String[] cases = {"\uD800","\uDBFF","\uDBFE"};
@@ -3222,12 +3222,12 @@ public final class UCharacterTest extends TestFmwk
         for(int i=0; i < cases.length; i++){
             /* Testing UCharacter.codePointAt(seq, index) */
             // Testing when "if (index < seq.length())" is false
-            if(UCharacter.codePointAt((CharSequence) cases[i], 0) != result[i])
+            if(UCharacter.codePointAt(cases[i], 0) != result[i])
                 errln("UCharacter.codePointAt(CharSequence ...) did not return as expected. " +
                         "Passed value: " + cases[i] + ". Expected: " +
                         result[i] + ". Got: " +
-                        UCharacter.codePointAt((CharSequence) cases[i], 0));
-            
+                        UCharacter.codePointAt(cases[i], 0));
+
             /* Testing UCharacter.codePointAt(text, index) */
             // Testing when "if (index < text.length)" is false
             if(UCharacter.codePointAt(cases[i].toCharArray(), 0) != result[i])
@@ -3235,7 +3235,7 @@ public final class UCharacterTest extends TestFmwk
                         "Passed value: " + cases[i] + ". Expected: " +
                         result[i] + ". Got: " +
                         UCharacter.codePointAt(cases[i].toCharArray(), 0));
-            
+
             /* Testing UCharacter.codePointAt(text, index, limit) */
             // Testing when "if (index < limit)" is false
             if(UCharacter.codePointAt(cases[i].toCharArray(), 0, 1) != result[i])
@@ -3251,7 +3251,7 @@ public final class UCharacterTest extends TestFmwk
         char[] one_char_text = {'a'};
         char[] reg_text = {'d','u','m','m','y'};
         int[] limitCases = {2,3,5,10,25};
-        
+
         // When index >= limit
         for(int i=0; i < limitCases.length; i++){
             try{
@@ -3263,7 +3263,7 @@ public final class UCharacterTest extends TestFmwk
             } catch(Exception e){
             }
         }
-        
+
         // When limit > text.length
         for(int i=0; i < limitCases.length; i++){
             try{
@@ -3274,7 +3274,7 @@ public final class UCharacterTest extends TestFmwk
                         0 + ", Limit: " + limitCases[i] + ".");
             } catch(Exception e){
             }
-            
+
             try{
                 UCharacter.codePointCount(one_char_text, 0, limitCases[i]);
                 errln("UCharacter.codePointCount was suppose to return an exception " +
@@ -3301,12 +3301,12 @@ public final class UCharacterTest extends TestFmwk
         for(int i=0; i < cases.length; i++){
             /* Testing UCharacter.codePointBefore(seq, index) */
             // Testing when "if (index > 0)" is false
-            if(UCharacter.codePointBefore((CharSequence) cases[i], 1) != result[i])
+            if(UCharacter.codePointBefore(cases[i], 1) != result[i])
                 errln("UCharacter.codePointBefore(CharSequence ...) did not return as expected. " +
                         "Passed value: " + cases[i] + ". Expected: " +
                         result[i] + ". Got: " +
-                        UCharacter.codePointBefore((CharSequence) cases[i], 1));
-            
+                        UCharacter.codePointBefore(cases[i], 1));
+
             /* Testing UCharacter.codePointBefore(text, index) */
             // Testing when "if (index > 0)" is false
             if(UCharacter.codePointBefore(cases[i].toCharArray(), 1) != result[i])
@@ -3314,7 +3314,7 @@ public final class UCharacterTest extends TestFmwk
                         "Passed value: " + cases[i] + ". Expected: " +
                         result[i] + ". Got: " +
                         UCharacter.codePointBefore(cases[i].toCharArray(), 1));
-            
+
             /* Testing UCharacter.codePointBefore(text, index, limit) */
             // Testing when "if (index > limit)" is false
             if(UCharacter.codePointBefore(cases[i].toCharArray(), 1, 0) != result[i])
@@ -3323,13 +3323,13 @@ public final class UCharacterTest extends TestFmwk
                         result[i] + ". Got: " +
                         UCharacter.codePointBefore(cases[i].toCharArray(), 1, 0));
         }
-        
+
         /* Testing UCharacter.codePointBefore(text, index, limit) */
         char[] dummy = {'d','u','m','m','y'};
         // Testing when "if (index <= limit || limit < 0)" is true
         int[] negative_cases = {-100,-10,-5,-2,-1};
         int[] index_cases = {0,1,2,5,10,100};
-        
+
         for(int i=0; i < negative_cases.length; i++){
             try{
                 UCharacter.codePointBefore(dummy, 10000, negative_cases[i]);
@@ -3337,7 +3337,7 @@ public final class UCharacterTest extends TestFmwk
                         "when the parameter limit of " + negative_cases[i] + " is a negative number.");
             } catch(Exception e) {}
         }
-        
+
         for(int i=0; i < index_cases.length; i++){
             try{
                 UCharacter.codePointBefore(dummy, index_cases[i], 101);
@@ -3356,7 +3356,7 @@ public final class UCharacterTest extends TestFmwk
     public void TestToChars(){
         int[] positive_cases = {1,2,5,10,100};
         char[] dst = {'a'};
-        
+
         /* Testing UCharacter.toChars(cp, dst, dstIndex) */
         for(int i=0; i < positive_cases.length; i++){
             // Testing negative values when cp < 0 for if (cp >= 0)
@@ -3366,13 +3366,13 @@ public final class UCharacterTest extends TestFmwk
                         "when the parameter " + (-1*positive_cases[i]) + " is a negative number.");
             } catch(Exception e){
             }
-            
+
             // Testing when "if (cp < MIN_SUPPLEMENTARY_CODE_POINT)" is true
             if(UCharacter.toChars(UCharacter.MIN_SUPPLEMENTARY_CODE_POINT-positive_cases[i], dst, 0) != 1){
                 errln("UCharacter.toChars(int,char[],int) was suppose to return a value of 1. Got: " +
                         UCharacter.toChars(UCharacter.MIN_SUPPLEMENTARY_CODE_POINT-positive_cases[i], dst, 0));
             }
-            
+
             // Testing when "if (cp < MIN_SUPPLEMENTARY_CODE_POINT)" is false and
             //     when "if (cp <= MAX_CODE_POINT)" is false
             try{
@@ -3383,8 +3383,8 @@ public final class UCharacterTest extends TestFmwk
             } catch(Exception e){
             }
         }
-        
-        
+
+
         /* Testing UCharacter.toChars(cp)*/
         for(int i=0; i<positive_cases.length; i++){
             // Testing negative values when cp < 0 for if (cp >= 0)
@@ -3394,13 +3394,13 @@ public final class UCharacterTest extends TestFmwk
                         "when the parameter " + positive_cases[i] + " is a negative number.");
             } catch(Exception e){
             }
-            
+
             // Testing when "if (cp < MIN_SUPPLEMENTARY_CODE_POINT)" is true
             if(UCharacter.toChars(UCharacter.MIN_SUPPLEMENTARY_CODE_POINT-positive_cases[i]).length <= 0){
                 errln("UCharacter.toChars(int) was suppose to return some result result when the parameter " +
                         (UCharacter.MIN_SUPPLEMENTARY_CODE_POINT-positive_cases[i]) + "is passed.");
             }
-            
+
             // Testing when "if (cp < MIN_SUPPLEMENTARY_CODE_POINT)" is false and
             //     when "if (cp <= MAX_CODE_POINT)" is false
             try{
@@ -3427,14 +3427,14 @@ public final class UCharacterTest extends TestFmwk
         char[] reg_text = {'d','u','m','m','y'};
         int[] invalid_startCases = {-1,-2,-5,-10,-100};
         int[] limitCases = {2,3,5,10,25};
-        
+
         // When start < 0
         for(int i=0; i < invalid_startCases.length; i++){
             try{
                 UCharacter.codePointCount(reg_text, invalid_startCases[i], 1);
                 errln("UCharacter.codePointCount was suppose to return an exception " +
                         "but got " + UCharacter.codePointCount(reg_text, invalid_startCases[i], 1) +
-                        ". The following passed parameters were Text: " + String.valueOf(reg_text) + ", Start: " + 
+                        ". The following passed parameters were Text: " + String.valueOf(reg_text) + ", Start: " +
                         invalid_startCases[i] + ", Limit: " + 1 + ".");
             } catch(Exception e){
             }
@@ -3451,7 +3451,7 @@ public final class UCharacterTest extends TestFmwk
             } catch(Exception e){
             }
         }
-        
+
         // When limit > text.length
         for(int i=0; i < limitCases.length; i++){
             try{
@@ -3462,7 +3462,7 @@ public final class UCharacterTest extends TestFmwk
                         0 + ", Limit: " + limitCases[i] + ".");
             } catch(Exception e){
             }
-            
+
             try{
                 UCharacter.codePointCount(one_char_text, 0, limitCases[i]);
                 errln("UCharacter.codePointCount was suppose to return an exception " +
@@ -3473,7 +3473,7 @@ public final class UCharacterTest extends TestFmwk
             }
         }
     }
-    
+
     /*
      * The following method tests
      *      private static int getEuropeanDigit(int ch)
@@ -3485,15 +3485,15 @@ public final class UCharacterTest extends TestFmwk
         //The number retrieved from 0xFF41 to 0xFF5A is due to
         //  exhaustive testing from UTF16.CODEPOINT_MIN_VALUE to
         //  UTF16.CODEPOINT_MAX_VALUE return a value of -1.
-        
+
         int[] radixResult = {
                 10,11,12,13,14,15,16,17,18,19,20,21,22,
                 23,24,25,26,27,28,29,30,31,32,33,34,35};
-        // Invalid and too-small-for-these-digits radix values. 
+        // Invalid and too-small-for-these-digits radix values.
         int[] radixCase1 = {0,1,5,10,100};
         // Radix values that work for at least some of the "digits".
         int[] radixCase2 = {12,16,20,36};
-        
+
         for(int i=0xFF41; i<=0xFF5A; i++){
             for(int j=0; j < radixCase1.length; j++){
                 if(UCharacter.digit(i, radixCase1[j]) != -1){
@@ -3514,7 +3514,7 @@ public final class UCharacterTest extends TestFmwk
             }
         }
     }
-    
+
     /* Tests the method
      *      private static final int getProperty(int ch)
      * from public static int getType(int ch)
@@ -3528,7 +3528,7 @@ public final class UCharacterTest extends TestFmwk
                         + "did not return 0 for passed value of " + cases[i] +
                         " but got " + UCharacter.getType(cases[i]));
     }
-    
+
     /* Tests the class
      *      abstract public static class XSymbolTable implements SymbolTable
      */
@@ -3536,11 +3536,11 @@ public final class UCharacterTest extends TestFmwk
     public void TestXSymbolTable(){
         class MyXSymbolTable extends UnicodeSet.XSymbolTable {}
         MyXSymbolTable st = new MyXSymbolTable();
-        
+
         // Tests "public UnicodeMatcher lookupMatcher(int i)"
         if(st.lookupMatcher(0) != null)
             errln("XSymbolTable.lookupMatcher(int i) was suppose to return null.");
-        
+
         // Tests "public boolean applyPropertyAlias(String propertyName, String propertyValue, UnicodeSet result)"
         if(st.applyPropertyAlias("", "", new UnicodeSet()) != false)
             errln("XSymbolTable.applyPropertyAlias(String propertyName, String propertyValue, UnicodeSet result) was suppose to return false.");
@@ -3548,12 +3548,12 @@ public final class UCharacterTest extends TestFmwk
         // Tests "public char[] lookup(String s)"
         if(st.lookup("") != null)
             errln("XSymbolTable.lookup(String s) was suppose to return null.");
-        
+
         // Tests "public String parseReference(String text, ParsePosition pos, int limit)"
         if(st.parseReference("", null, 0) != null)
             errln("XSymbolTable.parseReference(String text, ParsePosition pos, int limit) was suppose to return null.");
     }
-    
+
     /* Tests the method
      *      public boolean isFrozen()
      */
@@ -3562,7 +3562,7 @@ public final class UCharacterTest extends TestFmwk
         UnicodeSet us = new UnicodeSet();
         if(us.isFrozen() != false)
             errln("Unicode.isFrozen() was suppose to return false.");
-        
+
         us.freeze();
         if(us.isFrozen() != true)
             errln("Unicode.isFrozen() was suppose to return true.");
index 7b5c2179974eebae46acc565b974b45f07d7ca0b..efff2e284095fbbb975a5078b62a1984a95e8013 100644 (file)
@@ -329,8 +329,8 @@ public class CharsTrieTest extends TestFmwk {
                 index=0;
             } else {
                 if(trie.first(x.charAt(0))==BytesTrie.Result.NO_MATCH) {
-                    errln(String.format("first(first char U+%04X)=BytesTrie.Result.NO_MATCH for string %d\n",
-                                        x.charAt(0), gen.getIndex()));
+                    errln(String.format("first(first char U+%04x)=BytesTrie.Result.NO_MATCH for string %d\n",
+                            Character.getNumericValue(x.charAt(0)), gen.getIndex()));
                     break;
                 }
                 index=1;
@@ -732,7 +732,7 @@ public class CharsTrieTest extends TestFmwk {
     }
 
     private void checkNext(CharsTrie trie, StringAndValue[] data, int dataLength) {
-        CharsTrie.State state=new CharsTrie.State(); 
+        CharsTrie.State state=new CharsTrie.State();
         for(int i=0; i<dataLength; ++i) {
             String expectedString=data[i].s;
             int stringLength=expectedString.length();