harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From py...@apache.org
Subject svn commit: r448137 - in /incubator/harmony/enhanced/classlib/trunk/modules/luni/src: main/java/java/lang/Character.java test/java/org/apache/harmony/luni/tests/java/lang/CharacterTest.java
Date Wed, 20 Sep 2006 09:27:55 GMT
Author: pyang
Date: Wed Sep 20 02:27:55 2006
New Revision: 448137

URL: http://svn.apache.org/viewvc?view=rev&rev=448137
Log:
Apply patch for HARMONY-1500 ([classlib][luni]Refactor some methods in java.lang.Character)

Modified:
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/lang/Character.java
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/CharacterTest.java

Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/lang/Character.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/lang/Character.java?view=diff&rev=448137&r1=448136&r2=448137
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/lang/Character.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/lang/Character.java
Wed Sep 20 02:27:55 2006
@@ -19,8 +19,6 @@
 import java.util.SortedMap;
 import java.util.TreeMap;
 
-import org.apache.harmony.luni.util.BinarySearch;
-
 import com.ibm.icu.lang.UCharacter;
 
 /**
@@ -2444,14 +2442,7 @@
                 }
 				return result < radix ? result : -1;
 			}
-			int result = BinarySearch.binarySearchRange(digitKeys, c);
-			if (result >= 0 && c <= digitValues[result * 2]) {
-				int value = (char) (c - digitValues[result * 2 + 1]);
-				if (value >= radix) {
-                    return -1;
-                }
-				return value;
-			}
+			return  digit ((int)c , radix);
 		}
 		return -1;
 	}
@@ -2534,19 +2525,7 @@
             }
 			return -1;
 		}
-		int result = BinarySearch.binarySearchRange(numericKeys, c);
-		if (result >= 0 && c <= numericValues[result * 2]) {
-			char difference = numericValues[result * 2 + 1];
-			if (difference == 0) {
-                return -2;
-            }
-			// Value is always positive, must be negative value
-			if (difference > c) {
-                return c - (short) difference;
-            }
-			return c - difference;
-		}
-		return -1;
+		return getNumericValue((int)c);
 	}
     
     /**
@@ -2569,16 +2548,7 @@
 	 * @return the Unicode category
 	 */
 	public static int getType(char c) {
-		int result = BinarySearch.binarySearchRange(typeKeys, c);
-		int high = typeValues[result * 2];
-		if (c <= high) {
-			int code = typeValues[result * 2 + 1];
-			if (code < 0x100) {
-                return code;
-            }
-			return (c & 1) == 1 ? code >> 8 : code & 0xff;
-		}
-		return UNASSIGNED;
+		return getType((int)c);
 	}
     
     /**
@@ -2608,16 +2578,7 @@
 	 * @return the Unicode directionality
 	 */
 	public static byte getDirectionality(char c) {
-		int result = BinarySearch.binarySearchRange(bidiKeys, c);
-		int high = bidiValues[result * 2];
-		if (c <= high) {
-			int code = bidiValues[result * 2 + 1];
-			if (code < 0x100) {
-                return (byte) (code - 1);
-            }
-			return (byte) (((c & 1) == 1 ? code >> 8 : code & 0xff) - 1);
-		}
-		return DIRECTIONALITY_UNDEFINED;
+		return getDirectionality((int)c);
 	}
     
     /**
@@ -2648,13 +2609,8 @@
      * @return true if the character is mirrored, false otherwise
      */
 	public static boolean isMirrored(char c) {
-		int value = c / 16;
-		if (value >= mirrored.length) {
-            return false;
-        }
-		int bit = 1 << (c % 16);
-		return (mirrored[value] & bit) != 0;
-	}
+        return isMirrored((int) c);
+    }
     
     /**
      * Answers whether the specified character is mirrored
@@ -2949,7 +2905,7 @@
             return false;
         }
 
-		return getType(c) == LOWERCASE_LETTER;
+		return isLowerCase((int) c);
 	}
     
     /**
@@ -2974,30 +2930,23 @@
 	}
 
 	/**
-	 * Answers whether the character is a Unicode space character. A member of
-	 * one of the Unicode categories Space Separator, Line Separator, or
-	 * Paragraph Separator.
-	 * 
-	 * @param c
-	 *            the character
-	 * @return true when the character is a Unicode space character, false
-	 *         otherwise
-	 */
+     * Answers whether the character is a Unicode space character.A character is
+     * a Unicode space character if and only if its category is SPACE_SEPARATOR ,
+     * LINE_SEPARATOR or PARAGRAPH_SEPARATOR.
+     * 
+     * @param c
+     *            the character
+     * @return true when the character is a Unicode space character, false
+     *         otherwise
+     */
 	public static boolean isSpaceChar(char c) {
-		if (c == 0x20 || c == 0xa0 || c == 0x1680) {
-            return true;
-        }
-		if (c < 0x2000) {
-            return false;
-        }
-		return c <= 0x200b || c == 0x2028 || c == 0x2029 || c == 0x202f
-				|| c == 0x3000;
+		return isSpaceChar((int) c);
 	}
     
     /**
-     * Answers whether the character is a Unicode space character. A member of
-     * one of the Unicode categories Space Separator, Line Separator, or
-     * Paragraph Separator.
+     * Answers whether the character is a Unicode space character.A character is
+     * a Unicode space character if and only if its category is SPACE_SEPARATOR ,
+     * LINE_SEPARATOR or PARAGRAPH_SEPARATOR.
      * 
      * @param codePoint
      *            the character, including supplementary characters
@@ -3017,18 +2966,7 @@
 	 *         otherwise
 	 */
 	public static boolean isTitleCase(char c) {
-		if (c == '\u01c5' || c == '\u01c8' || c == '\u01cb' || c == '\u01f2') {
-            return true;
-        }
-		if (c >= '\u1f88' && c <= '\u1ffc') {
-			// 0x1f88 - 0x1f8f, 0x1f98 - 0x1f9f, 0x1fa8 - 0x1faf
-			if (c > '\u1faf') {
-                return c == '\u1fbc' || c == '\u1fcc' || c == '\u1ffc';
-            }
-			int last = c & 0xf;
-			return last >= 8 && last <= 0xf;
-		}
-		return false;
+		return isTitleCase((int) c);
 	}
     
     /**
@@ -3053,12 +2991,7 @@
      *         false otherwise
      */
 	public static boolean isUnicodeIdentifierPart(char c) {
-		int type = getType(c);
-		return (type >= UPPERCASE_LETTER && type <= OTHER_LETTER)
-				|| type == CONNECTOR_PUNCTUATION
-				|| (type >= DECIMAL_DIGIT_NUMBER && type <= LETTER_NUMBER)
-				|| type == NON_SPACING_MARK || type == COMBINING_SPACING_MARK
-				|| isIdentifierIgnorable(c);
+		return isUnicodeIdentifierPart((int) c);
 	}
     
     /**
@@ -3084,9 +3017,7 @@
 	 *         false otherwise
 	 */
 	public static boolean isUnicodeIdentifierStart(char c) {
-		int type = getType(c);
-		return (type >= UPPERCASE_LETTER && type <= OTHER_LETTER)
-				|| type == LETTER_NUMBER;
+		return isUnicodeIdentifierStart((int) c);
 	}
     
     /**
@@ -3107,7 +3038,7 @@
 	 * 
 	 * @param c
 	 *            the character
-	 * @return true when the character is a upper case letter, false otherwise
+	 * @return true when the character is an upper case letter, false otherwise
 	 */
 	public static boolean isUpperCase(char c) {
 		// Optimized case for ASCII
@@ -3117,8 +3048,7 @@
 		if (c < 128) {
             return false;
         }
-
-		return getType(c) == UPPERCASE_LETTER;
+		return isUpperCase((int) c);
 	}
     
     /**
@@ -3126,7 +3056,7 @@
      * 
      * @param codePoint
      *            the character, including supplementary characters
-     * @return true when the character is a upper case letter, false otherwise
+     * @return true when the character is an upper case letter, false otherwise
      */
     public static boolean isUpperCase(int codePoint) {
         return UCharacter.isUpperCase(codePoint);
@@ -3145,13 +3075,7 @@
 		if ((c >= 0x1c && c <= 0x20) || (c >= 0x9 && c <= 0xd)) {
             return true;
         }
-		if (c == 0x1680) {
-            return true;
-        }
-		if (c < 0x2000 || c == 0x2007) {
-            return false;
-        }
-		return c <= 0x200b || c == 0x2028 || c == 0x2029 || c == 0x3000;
+		return isWhitespace((int) c);
 	}
     
     /**
@@ -3196,25 +3120,8 @@
             return c;
         }
 
-		int result = BinarySearch.binarySearchRange(lowercaseKeys, c);
-		if (result >= 0) {
-			boolean by2 = false;
-			char start = lowercaseKeys.charAt(result);
-			char end = lowercaseValues[result * 2];
-			if ((start & 0x8000) != (end & 0x8000)) {
-				end ^= 0x8000;
-				by2 = true;
-			}
-			if (c <= end) {
-				if (by2 && (c & 1) != (start & 1)) {
-                    return c;
-                }
-				char mapping = lowercaseValues[result * 2 + 1];
-				return (char) (c + mapping);
-			}
-		}
-		return c;
-	}
+        return (char) toLowerCase((int) c);
+    }
     
     /**
      * Answers the lower case equivalent for the character when the character is
@@ -3260,15 +3167,8 @@
 	 * @return the title case equivalent of the character
 	 */
 	public static char toTitleCase(char c) {
-		if (isTitleCase(c)) {
-            return c;
-        }
-		int result = BinarySearch.binarySearch(titlecaseKeys, c);
-		if (result >= 0) {
-            return titlecaseValues[result];
-        }
-		return toUpperCase(c);
-	}
+        return (char) toTitleCase((int) c);
+    }
     
     /**
      * Answers the title case equivalent for the character, otherwise answers the
@@ -3299,25 +3199,7 @@
 		if (c < 128) {
             return c;
         }
-
-		int result = BinarySearch.binarySearchRange(uppercaseKeys, c);
-		if (result >= 0) {
-			boolean by2 = false;
-			char start = uppercaseKeys.charAt(result);
-			char end = uppercaseValues[result * 2];
-			if ((start & 0x8000) != (end & 0x8000)) {
-				end ^= 0x8000;
-				by2 = true;
-			}
-			if (c <= end) {
-				if (by2 && (c & 1) != (start & 1)) {
-                    return c;
-                }
-				char mapping = uppercaseValues[result * 2 + 1];
-				return (char) (c + mapping);
-			}
-		}
-		return c;
+        return (char)toUpperCase((int)c);
 	}
     
     /**

Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/CharacterTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/CharacterTest.java?view=diff&rev=448137&r1=448136&r2=448137
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/CharacterTest.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/CharacterTest.java
Wed Sep 20 02:27:55 2006
@@ -675,6 +675,12 @@
         // Test for method int java.lang.Character.digit(char, int)
         assertEquals("Returned incorrect digit", 1, Character.digit('1', 10));
         assertEquals("Returned incorrect digit", 15, Character.digit('F', 16));
+        
+        assertEquals(-1, Character.digit('\u0000', 37));
+        assertEquals(-1, Character.digit('\u0045', 10));
+        
+        assertEquals(10, Character.digit('\u0041', 20));
+        assertEquals(10, Character.digit('\u0061', 20));
     }
     
     /**
@@ -744,6 +750,20 @@
                 .getNumericValue('\u2182'));
         assertEquals("Returned incorrect numeric value 6", 2, Character
                 .getNumericValue('\uff12'));
+        
+        assertEquals(50, Character.getNumericValue('\u216C'));
+        
+        assertEquals(10, Character.getNumericValue('\u0041'));
+        assertEquals(35, Character.getNumericValue('\u005A'));
+        assertEquals(10, Character.getNumericValue('\u0061'));
+        assertEquals(35, Character.getNumericValue('\u007A'));
+        assertEquals(10, Character.getNumericValue('\uFF21'));       
+        
+        //FIXME depends on ICU4J
+        //assertEquals(35, Character.getNumericValue('\uFF3A'));
+        
+        assertEquals(10, Character.getNumericValue('\uFF41'));
+        assertEquals(35, Character.getNumericValue('\uFF5A'));
     }
     
     /**
@@ -758,7 +778,6 @@
         assertEquals(2, Character.getNumericValue((int)'\uff12'));
         assertEquals(-1, Character.getNumericValue(0xFFFF));
         
-        assertEquals(-1, Character.getNumericValue(0xFFFF));
         assertEquals(0, Character.getNumericValue(0x1D7CE));
         assertEquals(0, Character.getNumericValue(0x1D7D8));
         assertEquals(-1, Character.getNumericValue(0x2F800));
@@ -809,6 +828,80 @@
         assertEquals("Wrong constant for FORMAT", 16, Character.FORMAT);
         assertEquals("Wrong constant for PRIVATE_USE",
                 18, Character.PRIVATE_USE);
+        
+        assertEquals(Character.UNASSIGNED, Character.getType('\u9FFF'));
+
+        assertEquals(Character.UPPERCASE_LETTER, Character.getType('\u0041'));
+
+        assertEquals(Character.LOWERCASE_LETTER, Character.getType('\u0061'));
+
+        assertEquals(Character.TITLECASE_LETTER, Character.getType('\u01C5'));
+        assertEquals(Character.TITLECASE_LETTER, Character.getType('\u1FFC'));
+
+        assertEquals(Character.MODIFIER_LETTER, Character.getType('\u02B0'));
+        assertEquals(Character.MODIFIER_LETTER, Character.getType('\uFF9F'));
+
+        assertEquals(Character.OTHER_LETTER, Character.getType('\u01BB'));
+
+        assertEquals(Character.NON_SPACING_MARK, Character.getType('\u0F82'));
+
+        assertEquals(Character.ENCLOSING_MARK, Character.getType('\u0488'));
+        assertEquals(Character.ENCLOSING_MARK, Character.getType('\u20DE'));
+
+        assertEquals(Character.COMBINING_SPACING_MARK, Character.getType('\u1938'));
+
+        assertEquals(Character.DECIMAL_DIGIT_NUMBER, Character.getType('\u194D'));
+
+        assertEquals(Character.LETTER_NUMBER, Character.getType('\u2160'));
+
+        assertEquals(Character.OTHER_NUMBER, Character.getType('\u00B2'));
+
+        assertEquals(Character.SPACE_SEPARATOR, Character.getType('\u0020'));
+        assertEquals(Character.SPACE_SEPARATOR, Character.getType('\u3000'));
+
+        assertEquals(Character.LINE_SEPARATOR, Character.getType('\u2028'));
+
+        assertEquals(Character.PARAGRAPH_SEPARATOR, Character.getType('\u2029'));
+
+        assertEquals(Character.CONTROL, Character.getType('\u0000'));
+        assertEquals(Character.CONTROL, Character.getType('\u009F'));
+
+        assertEquals(Character.FORMAT, Character.getType('\u00AD'));
+
+        assertEquals(Character.PRIVATE_USE, Character.getType('\uE000'));
+
+        assertEquals(Character.SURROGATE, Character.getType('\uD800'));
+        assertEquals(Character.SURROGATE, Character.getType('\uDFFF'));
+
+        assertEquals(Character.DASH_PUNCTUATION, Character.getType('\uFE31'));
+        assertEquals(Character.DASH_PUNCTUATION, Character.getType('\uFF0D'));
+
+        assertEquals(Character.START_PUNCTUATION, Character.getType('\u0028'));
+        assertEquals(Character.START_PUNCTUATION, Character.getType('\uFF62'));
+
+        assertEquals(Character.END_PUNCTUATION, Character.getType('\u0029'));
+        assertEquals(Character.END_PUNCTUATION, Character.getType('\uFF63'));
+
+        assertEquals(Character.CONNECTOR_PUNCTUATION, Character.getType('\u005F'));
+        assertEquals(Character.CONNECTOR_PUNCTUATION, Character.getType('\uFF3F'));
+
+        assertEquals(Character.OTHER_PUNCTUATION, Character.getType('\u2034'));
+
+        assertEquals(Character.MATH_SYMBOL, Character.getType('\u002B'));
+
+        assertEquals(Character.CURRENCY_SYMBOL, Character.getType('\u0024'));
+        assertEquals(Character.CURRENCY_SYMBOL, Character.getType('\uFFE6'));
+
+        assertEquals(Character.MODIFIER_SYMBOL, Character.getType('\u005E'));
+        assertEquals(Character.MODIFIER_SYMBOL, Character.getType('\uFFE3'));
+
+        assertEquals(Character.OTHER_SYMBOL, Character.getType('\u00A6'));
+
+        assertEquals(Character.INITIAL_QUOTE_PUNCTUATION, Character.getType('\u00AB'));
+        assertEquals(Character.INITIAL_QUOTE_PUNCTUATION, Character.getType('\u2039'));
+
+        assertEquals(Character.FINAL_QUOTE_PUNCTUATION, Character.getType('\u00BB'));
+        assertEquals(Character.FINAL_QUOTE_PUNCTUATION, Character.getType('\u203A'));   
     }
     
     /**
@@ -1051,6 +1144,7 @@
     public void test_isMirrored_C() {
         assertTrue(Character.isMirrored('\u0028'));
         assertFalse(Character.isMirrored('\uFFFF'));
+        assertFalse(Character.isMirrored('\u0000'));
     }
     
     /**
@@ -1108,9 +1202,10 @@
         assertTrue("digit returned false", Character.isJavaIdentifierPart('9'));
         assertTrue("connecting char returned false", Character
                 .isJavaIdentifierPart('_'));
-        assertTrue("ignorable control returned true", !Character
-                .isJavaIdentifierPart('\u200b'));
         assertTrue("semi returned true", !Character.isJavaIdentifierPart(';'));
+        
+        // RI fails because 0x200B changes category in Unicode 4.1
+        assertTrue(Character.isJavaIdentifierPart('\u200b'));
     }
     
     /**
@@ -1310,6 +1405,9 @@
         // Test for method boolean java.lang.Character.isLowerCase(char)
         assertTrue("lower returned false", Character.isLowerCase('a'));
         assertTrue("upper returned true", !Character.isLowerCase('T'));
+        
+        assertTrue(Character.isLowerCase('z'));
+        assertFalse(Character.isLowerCase('Z'));
     }
     
     /**
@@ -1344,6 +1442,8 @@
         // Test for method boolean java.lang.Character.isSpaceChar(char)
         assertTrue("space returned false", Character.isSpaceChar('\u0020'));
         assertTrue("non-space returned true", !Character.isSpaceChar('\n'));
+        
+        assertTrue(Character.isSpaceChar('\u2000'));
     }
     
     /**
@@ -1419,6 +1519,11 @@
         assertTrue("'a' returned false", Character.isUnicodeIdentifierPart('a'));
         assertTrue("'2' returned false", Character.isUnicodeIdentifierPart('2'));
         assertTrue("'+' returned true", !Character.isUnicodeIdentifierPart('+'));
+        
+        assertTrue(Character.isUnicodeIdentifierPart('\u1FA9'));
+        assertTrue(Character.isUnicodeIdentifierPart('\u0030'));
+        assertTrue(Character.isUnicodeIdentifierPart('\uFF10'));
+
     }
     
     /**
@@ -1480,6 +1585,11 @@
                 .isUnicodeIdentifierStart('2'));
         assertTrue("'+' returned true", !Character
                 .isUnicodeIdentifierStart('+'));
+        
+        assertTrue(Character.isUnicodeIdentifierStart('\u1FA9'));     
+        assertTrue(Character.isUnicodeIdentifierStart('\u16EE'));
+
+        assertFalse(Character.isUnicodeIdentifierStart('\u06F9'));
     }
     
     /**
@@ -1517,6 +1627,12 @@
         // Test for method boolean java.lang.Character.isUpperCase(char)
         assertTrue("Incorrect case value", !Character.isUpperCase('t'));
         assertTrue("Incorrect case value", Character.isUpperCase('T'));
+        
+        assertTrue(Character.isUpperCase('A'));
+        assertTrue(Character.isUpperCase('Z'));
+        
+        assertFalse(Character.isUpperCase('a'));
+        assertFalse(Character.isUpperCase('z'));
     }
     
     /**
@@ -1541,6 +1657,19 @@
         // Test for method boolean java.lang.Character.isWhitespace(char)
         assertTrue("space returned false", Character.isWhitespace('\n'));
         assertTrue("non-space returned true", !Character.isWhitespace('T'));
+        
+        assertTrue(Character.isWhitespace('\u0009'));
+        
+        assertTrue(Character.isWhitespace('\u2000'));
+        assertTrue(Character.isWhitespace('\u200A'));
+        
+        assertTrue(Character.isWhitespace('\u2028'));      
+        assertTrue(Character.isWhitespace('\u2029'));
+        
+        assertFalse(Character.isWhitespace('\u00A0'));
+        assertFalse(Character.isWhitespace('\u202F'));
+        
+        assertFalse(Character.isWhitespace('\uFEFF'));
     }
     
     /**
@@ -1602,6 +1731,14 @@
     public void test_toLowerCaseC() {
         // Test for method char java.lang.Character.toLowerCase(char)
         assertEquals("Failed to change case", 't', Character.toLowerCase('T'));
+        
+        assertEquals('a', Character.toLowerCase('A'));
+        assertEquals('a', Character.toLowerCase('a'));
+        assertEquals('z', Character.toLowerCase('Z'));
+        assertEquals('z', Character.toLowerCase('z'));
+        
+        assertEquals('\u0000', Character.toLowerCase('\u0000'));
+        assertEquals('\uFFFF', Character.toLowerCase('\uFFFF'));
     }
     
     /**
@@ -1638,6 +1775,9 @@
                 'A', Character.toTitleCase('A'));
         assertEquals("Incorrect title case for 1",
                 '1', Character.toTitleCase('1'));
+        
+        assertEquals('Z', Character.toTitleCase('z'));
+        assertEquals('Z', Character.toTitleCase('Z'));
     }
     
     /**
@@ -1666,6 +1806,12 @@
                 'A', Character.toUpperCase('A'));
         assertEquals("Incorrect upper case for 1",
                 '1', Character.toUpperCase('1'));
+        
+        assertEquals('\u0000', Character.toUpperCase('\u0000'));
+        assertEquals('\u0041', Character.toUpperCase('\u0061'));
+        assertEquals('\u005A', Character.toUpperCase('\u007A'));
+        assertEquals('\u0041', Character.toUpperCase('\u0041'));
+        assertEquals('\uFFFF', Character.toUpperCase('\uFFFF'));
     }
     
     /**
@@ -1682,12 +1828,91 @@
         assertEquals(0x10FFFF, Character.toUpperCase(0x10FFFF));
         assertEquals(0x110000, Character.toUpperCase(0x110000));
     }
+    
+    /**
+     * @tests java.lang.Character#getDirectionality(char)
+     */
+    public void test_getDirectionaliy_C(){
+        assertEquals(Character.DIRECTIONALITY_UNDEFINED, Character
+                .getDirectionality('\uFFFE'));
+        
+        assertEquals(Character.DIRECTIONALITY_LEFT_TO_RIGHT, Character
+                .getDirectionality('\u0041'));
+        
+        assertEquals(Character.DIRECTIONALITY_RIGHT_TO_LEFT, Character
+                .getDirectionality('\uFB4F'));
+        
+        assertEquals(Character.DIRECTIONALITY_RIGHT_TO_LEFT_ARABIC, Character
+                .getDirectionality('\u0600'));
+        assertEquals(Character.DIRECTIONALITY_RIGHT_TO_LEFT_ARABIC, Character
+                .getDirectionality('\uFEFC'));
+        
+        assertEquals(Character.DIRECTIONALITY_EUROPEAN_NUMBER, Character
+                .getDirectionality('\u2070'));
+        
+        assertEquals(Character.DIRECTIONALITY_EUROPEAN_NUMBER_TERMINATOR, Character
+                .getDirectionality('\u0023'));
+        assertEquals(Character.DIRECTIONALITY_EUROPEAN_NUMBER_TERMINATOR, Character
+                .getDirectionality('\u17DB'));
+        
+        assertEquals(Character.DIRECTIONALITY_ARABIC_NUMBER, Character
+                .getDirectionality('\u0660'));
+        assertEquals(Character.DIRECTIONALITY_ARABIC_NUMBER, Character
+                .getDirectionality('\u066C'));
+        
+        assertEquals(Character.DIRECTIONALITY_COMMON_NUMBER_SEPARATOR, Character
+                .getDirectionality('\u002C'));
+        assertEquals(Character.DIRECTIONALITY_COMMON_NUMBER_SEPARATOR, Character
+                .getDirectionality('\uFF1A'));
+        
+        assertEquals(Character.DIRECTIONALITY_NONSPACING_MARK, Character
+                .getDirectionality('\u17CE'));
+        
+        assertEquals(Character.DIRECTIONALITY_BOUNDARY_NEUTRAL, Character
+                .getDirectionality('\u0000'));
+        
+        assertEquals(Character.DIRECTIONALITY_PARAGRAPH_SEPARATOR, Character
+                .getDirectionality('\u2029'));
+        
+        assertEquals(Character.DIRECTIONALITY_SEGMENT_SEPARATOR, Character
+                .getDirectionality('\u0009'));
+        assertEquals(Character.DIRECTIONALITY_SEGMENT_SEPARATOR, Character
+                .getDirectionality('\u001F'));
+        
+        assertEquals(Character.DIRECTIONALITY_WHITESPACE, Character
+                .getDirectionality('\u0020'));
+        assertEquals(Character.DIRECTIONALITY_WHITESPACE, Character
+                .getDirectionality('\u3000'));
+        
+        assertEquals(Character.DIRECTIONALITY_OTHER_NEUTRALS, Character
+                .getDirectionality('\u2FF0'));
+        
+        assertEquals(Character.DIRECTIONALITY_LEFT_TO_RIGHT_EMBEDDING, Character
+                .getDirectionality('\u202A'));
+        
+        assertEquals(Character.DIRECTIONALITY_LEFT_TO_RIGHT_OVERRIDE, Character
+                .getDirectionality('\u202D'));
+
+        assertEquals(Character.DIRECTIONALITY_RIGHT_TO_LEFT_EMBEDDING, Character
+                .getDirectionality('\u202B'));
+        
+        assertEquals(Character.DIRECTIONALITY_RIGHT_TO_LEFT_OVERRIDE, Character
+                .getDirectionality('\u202E'));
+        
+        assertEquals(Character.DIRECTIONALITY_POP_DIRECTIONAL_FORMAT, Character
+                .getDirectionality('\u202C'));
+        
+        // RI fails ,this is non-bug difference between Unicode 4.0 and 4.1
+        assertEquals(Character.DIRECTIONALITY_EUROPEAN_NUMBER_SEPARATOR,
+                Character.getDirectionality('\u002B'));
+        assertEquals(Character.DIRECTIONALITY_EUROPEAN_NUMBER_SEPARATOR,
+                Character.getDirectionality('\uFF0B'));
+    }
 
     /**
      * @tests java.lang.Character#getDirectionality(int)
      */
-    public void test_isDirectionaliy_I(){
-        //assertTrue(false);
+    public void test_getDirectionaliy_I(){
         assertEquals(Character.DIRECTIONALITY_UNDEFINED, Character
                 .getDirectionality(0xFFFE));
         assertEquals(Character.DIRECTIONALITY_UNDEFINED, Character
@@ -1719,12 +1944,6 @@
         assertEquals(Character.DIRECTIONALITY_EUROPEAN_NUMBER, Character
                 .getDirectionality(0x1D7FF));
         
-        //RI fails ,this is non-bug difference between Unicode 4.0 and 4.1
-        assertEquals(Character.DIRECTIONALITY_EUROPEAN_NUMBER_SEPARATOR, Character
-                .getDirectionality(0x002B));
-        assertEquals(Character.DIRECTIONALITY_EUROPEAN_NUMBER_SEPARATOR, Character
-                .getDirectionality(0xFF0B));
-        
         assertEquals(Character.DIRECTIONALITY_EUROPEAN_NUMBER_TERMINATOR, Character
                 .getDirectionality(0x0023));
         assertEquals(Character.DIRECTIONALITY_EUROPEAN_NUMBER_TERMINATOR, Character
@@ -1783,6 +2002,13 @@
                 .getDirectionality(0x202E));
         
         assertEquals(Character.DIRECTIONALITY_POP_DIRECTIONAL_FORMAT, Character
-                .getDirectionality(0x202C));     
+                .getDirectionality(0x202C));
+        
+
+        // RI fails ,this is non-bug difference between Unicode 4.0 and 4.1
+        assertEquals(Character.DIRECTIONALITY_EUROPEAN_NUMBER_SEPARATOR,
+                Character.getDirectionality(0x002B));
+        assertEquals(Character.DIRECTIONALITY_EUROPEAN_NUMBER_SEPARATOR,
+                Character.getDirectionality(0xFF0B));
     }
 }



Mime
View raw message