use of android.icu.util.VersionInfo in project j2objc by google.
the class CollationAPITest method TestProperty.
/**
* This tests the properties of a collator object.
* - constructor
* - factory method getInstance
* - compare and getCollationKey
* - get/set decomposition mode and comparison level
*/
@Test
public void TestProperty() {
/*
All the collations have the same version in an ICU
version.
ICU 2.0 currVersionArray = {0x18, 0xC0, 0x02, 0x02};
ICU 2.1 currVersionArray = {0x19, 0x00, 0x03, 0x03};
ICU 2.8 currVersionArray = {0x29, 0x80, 0x00, 0x04};
*/
logln("The property tests begin : ");
logln("Test ctors : ");
Collator col = Collator.getInstance(Locale.ENGLISH);
logln("Test getVersion");
// Check for a version greater than some value rather than equality
// so that we need not update the expected version each time.
// from ICU 4.4/UCA 5.2
VersionInfo expectedVersion = VersionInfo.getInstance(0x31, 0xC0, 0x00, 0x05);
doAssert(col.getVersion().compareTo(expectedVersion) >= 0, "Expected minimum version " + expectedVersion.toString() + " got " + col.getVersion().toString());
logln("Test getUCAVersion");
// Assume that the UCD and UCA versions are the same,
// rather than hardcoding (and updating each time) a particular UCA version.
VersionInfo ucdVersion = UCharacter.getUnicodeVersion();
VersionInfo ucaVersion = col.getUCAVersion();
doAssert(ucaVersion.equals(ucdVersion), "Expected UCA version " + ucdVersion.toString() + " got " + col.getUCAVersion().toString());
doAssert((col.compare("ab", "abc") < 0), "ab < abc comparison failed");
doAssert((col.compare("ab", "AB") < 0), "ab < AB comparison failed");
doAssert((col.compare("blackbird", "black-bird") > 0), "black-bird > blackbird comparison failed");
doAssert((col.compare("black bird", "black-bird") < 0), "black bird > black-bird comparison failed");
doAssert((col.compare("Hello", "hello") > 0), "Hello > hello comparison failed");
logln("Test ctors ends.");
logln("testing Collator.getStrength() method ...");
doAssert((col.getStrength() == Collator.TERTIARY), "collation object has the wrong strength");
doAssert((col.getStrength() != Collator.PRIMARY), "collation object's strength is primary difference");
logln("testing Collator.setStrength() method ...");
col.setStrength(Collator.SECONDARY);
doAssert((col.getStrength() != Collator.TERTIARY), "collation object's strength is secondary difference");
doAssert((col.getStrength() != Collator.PRIMARY), "collation object's strength is primary difference");
doAssert((col.getStrength() == Collator.SECONDARY), "collation object has the wrong strength");
logln("testing Collator.setDecomposition() method ...");
col.setDecomposition(Collator.NO_DECOMPOSITION);
doAssert((col.getDecomposition() != Collator.CANONICAL_DECOMPOSITION), "Decomposition mode != Collator.CANONICAL_DECOMPOSITION");
doAssert((col.getDecomposition() == Collator.NO_DECOMPOSITION), "Decomposition mode = Collator.NO_DECOMPOSITION");
try {
col = Collator.getInstance(Locale.FRENCH);
} catch (Exception e) {
errln("Creating French collation failed.");
return;
}
col.setStrength(Collator.PRIMARY);
logln("testing Collator.getStrength() method again ...");
doAssert((col.getStrength() != Collator.TERTIARY), "collation object has the wrong strength");
doAssert((col.getStrength() == Collator.PRIMARY), "collation object's strength is not primary difference");
logln("testing French Collator.setStrength() method ...");
col.setStrength(Collator.TERTIARY);
doAssert((col.getStrength() == Collator.TERTIARY), "collation object's strength is not tertiary difference");
doAssert((col.getStrength() != Collator.PRIMARY), "collation object's strength is primary difference");
doAssert((col.getStrength() != Collator.SECONDARY), "collation object's strength is secondary difference");
}
use of android.icu.util.VersionInfo in project j2objc by google.
the class UnicodeSet method applyPropertyAlias.
/**
* Modifies this set to contain those code points which have the
* given value for the given property. Prior contents of this
* set are lost.
* @param propertyAlias A string of the property alias.
* @param valueAlias A string of the value alias.
* @param symbols if not null, then symbols are first called to see if a property
* is available. If true, then everything else is skipped.
* @return this set
*/
public UnicodeSet applyPropertyAlias(String propertyAlias, String valueAlias, SymbolTable symbols) {
checkFrozen();
int p;
int v;
boolean mustNotBeEmpty = false, invert = false;
if (symbols != null && (symbols instanceof XSymbolTable) && ((XSymbolTable) symbols).applyPropertyAlias(propertyAlias, valueAlias, this)) {
return this;
}
if (XSYMBOL_TABLE != null) {
if (XSYMBOL_TABLE.applyPropertyAlias(propertyAlias, valueAlias, this)) {
return this;
}
}
if (valueAlias.length() > 0) {
p = UCharacter.getPropertyEnum(propertyAlias);
// Treat gc as gcm
if (p == UProperty.GENERAL_CATEGORY) {
p = UProperty.GENERAL_CATEGORY_MASK;
}
if ((p >= UProperty.BINARY_START && p < UProperty.BINARY_LIMIT) || (p >= UProperty.INT_START && p < UProperty.INT_LIMIT) || (p >= UProperty.MASK_START && p < UProperty.MASK_LIMIT)) {
try {
v = UCharacter.getPropertyValueEnum(p, valueAlias);
} catch (IllegalArgumentException e) {
// Handle numeric CCC
if (p == UProperty.CANONICAL_COMBINING_CLASS || p == UProperty.LEAD_CANONICAL_COMBINING_CLASS || p == UProperty.TRAIL_CANONICAL_COMBINING_CLASS) {
v = Integer.parseInt(PatternProps.trimWhiteSpace(valueAlias));
// old code was wrong; anything between 0 and 255 is valid even if unused.
if (v < 0 || v > 255)
throw e;
} else {
throw e;
}
}
} else {
switch(p) {
case UProperty.NUMERIC_VALUE:
{
double value = Double.parseDouble(PatternProps.trimWhiteSpace(valueAlias));
applyFilter(new NumericValueFilter(value), UCharacterProperty.SRC_CHAR);
return this;
}
case UProperty.NAME:
{
// Must munge name, since
// UCharacter.charFromName() does not do
// 'loose' matching.
String buf = mungeCharName(valueAlias);
int ch = UCharacter.getCharFromExtendedName(buf);
if (ch == -1) {
throw new IllegalArgumentException("Invalid character name");
}
clear();
add_unchecked(ch);
return this;
}
case UProperty.UNICODE_1_NAME:
// ICU 49 deprecates the Unicode_1_Name property APIs.
throw new IllegalArgumentException("Unicode_1_Name (na1) not supported");
case UProperty.AGE:
{
// Must munge name, since
// VersionInfo.getInstance() does not do
// 'loose' matching.
VersionInfo version = VersionInfo.getInstance(mungeCharName(valueAlias));
applyFilter(new VersionFilter(version), UCharacterProperty.SRC_PROPSVEC);
return this;
}
case UProperty.SCRIPT_EXTENSIONS:
v = UCharacter.getPropertyValueEnum(UProperty.SCRIPT, valueAlias);
// fall through to calling applyIntPropertyValue()
break;
default:
// don't support (yet).
throw new IllegalArgumentException("Unsupported property");
}
}
} else {
// valueAlias is empty. Interpret as General Category, Script,
// Binary property, or ANY or ASCII. Upon success, p and v will
// be set.
UPropertyAliases pnames = UPropertyAliases.INSTANCE;
p = UProperty.GENERAL_CATEGORY_MASK;
v = pnames.getPropertyValueEnum(p, propertyAlias);
if (v == UProperty.UNDEFINED) {
p = UProperty.SCRIPT;
v = pnames.getPropertyValueEnum(p, propertyAlias);
if (v == UProperty.UNDEFINED) {
p = pnames.getPropertyEnum(propertyAlias);
if (p == UProperty.UNDEFINED) {
p = -1;
}
if (p >= UProperty.BINARY_START && p < UProperty.BINARY_LIMIT) {
v = 1;
} else if (p == -1) {
if (0 == UPropertyAliases.compare(ANY_ID, propertyAlias)) {
set(MIN_VALUE, MAX_VALUE);
return this;
} else if (0 == UPropertyAliases.compare(ASCII_ID, propertyAlias)) {
set(0, 0x7F);
return this;
} else if (0 == UPropertyAliases.compare(ASSIGNED, propertyAlias)) {
// [:Assigned:]=[:^Cn:]
p = UProperty.GENERAL_CATEGORY_MASK;
v = (1 << UCharacter.UNASSIGNED);
invert = true;
} else {
// Property name was never matched.
throw new IllegalArgumentException("Invalid property alias: " + propertyAlias + "=" + valueAlias);
}
} else {
// must be supplied.
throw new IllegalArgumentException("Missing property value");
}
}
}
}
applyIntPropertyValue(p, v);
if (invert) {
complement();
}
if (mustNotBeEmpty && isEmpty()) {
// invalid input.
throw new IllegalArgumentException("Invalid property value");
}
return this;
}
use of android.icu.util.VersionInfo in project j2objc by google.
the class VersionInfoTest method TestEqualsAndHashCode.
/**
* Test equals and hashCode
*/
@Test
public void TestEqualsAndHashCode() {
VersionInfo v1234a = VersionInfo.getInstance(1, 2, 3, 4);
VersionInfo v1234b = VersionInfo.getInstance(1, 2, 3, 4);
VersionInfo v1235 = VersionInfo.getInstance(1, 2, 3, 5);
assertEquals("v1234a and v1234b", v1234a, v1234b);
assertEquals("v1234a.hashCode() and v1234b.hashCode()", v1234a.hashCode(), v1234b.hashCode());
assertNotEquals("v1234a and v1235", v1234a, v1235);
}
use of android.icu.util.VersionInfo in project j2objc by google.
the class UCharacterTest method TestAdditionalProperties.
/**
* Test binary non core properties
*/
@Test
public void TestAdditionalProperties() {
// test data for hasBinaryProperty()
int[][] props = { // code point, property
{ 0x0627, UProperty.ALPHABETIC, 1 }, { 0x1034a, UProperty.ALPHABETIC, 1 }, { 0x2028, UProperty.ALPHABETIC, 0 }, { 0x0066, UProperty.ASCII_HEX_DIGIT, 1 }, { 0x0067, UProperty.ASCII_HEX_DIGIT, 0 }, { 0x202c, UProperty.BIDI_CONTROL, 1 }, { 0x202f, UProperty.BIDI_CONTROL, 0 }, { 0x003c, UProperty.BIDI_MIRRORED, 1 }, { 0x003d, UProperty.BIDI_MIRRORED, 0 }, /* see Unicode Corrigendum #6 at http://www.unicode.org/versions/corrigendum6.html */
{ 0x2018, UProperty.BIDI_MIRRORED, 0 }, { 0x201d, UProperty.BIDI_MIRRORED, 0 }, { 0x201f, UProperty.BIDI_MIRRORED, 0 }, { 0x301e, UProperty.BIDI_MIRRORED, 0 }, { 0x058a, UProperty.DASH, 1 }, { 0x007e, UProperty.DASH, 0 }, { 0x0c4d, UProperty.DIACRITIC, 1 }, { 0x3000, UProperty.DIACRITIC, 0 }, { 0x0e46, UProperty.EXTENDER, 1 }, { 0x0020, UProperty.EXTENDER, 0 }, { 0xfb1d, UProperty.FULL_COMPOSITION_EXCLUSION, 1 }, { 0x1d15f, UProperty.FULL_COMPOSITION_EXCLUSION, 1 }, { 0xfb1e, UProperty.FULL_COMPOSITION_EXCLUSION, 0 }, { 0x110a, UProperty.NFD_INERT, 1 }, /* Jamo L */
{ 0x0308, UProperty.NFD_INERT, 0 }, { 0x1164, UProperty.NFKD_INERT, 1 }, /* Jamo V */
{ 0x1d79d, UProperty.NFKD_INERT, 0 }, { 0x0021, UProperty.NFC_INERT, 1 }, /* ! */
{ 0x0061, UProperty.NFC_INERT, 0 }, /* a */
{ 0x00e4, UProperty.NFC_INERT, 0 }, /* a-umlaut */
{ 0x0102, UProperty.NFC_INERT, 0 }, /* a-breve */
{ 0xac1c, UProperty.NFC_INERT, 0 }, /* Hangul LV */
{ 0xac1d, UProperty.NFC_INERT, 1 }, { 0x1d79d, UProperty.NFKC_INERT, 0 }, /* math compat version of xi */
{ 0x2a6d6, UProperty.NFKC_INERT, 1 }, { 0x00e4, UProperty.SEGMENT_STARTER, 1 }, { 0x0308, UProperty.SEGMENT_STARTER, 0 }, { 0x110a, UProperty.SEGMENT_STARTER, 1 }, /* Jamo L */
{ 0x1164, UProperty.SEGMENT_STARTER, 0 }, /* Jamo V */
{ 0xac1c, UProperty.SEGMENT_STARTER, 1 }, /* Hangul LV */
{ 0xac1d, UProperty.SEGMENT_STARTER, 1 }, { 0x0044, UProperty.HEX_DIGIT, 1 }, { 0xff46, UProperty.HEX_DIGIT, 1 }, { 0x0047, UProperty.HEX_DIGIT, 0 }, { 0x30fb, UProperty.HYPHEN, 1 }, { 0xfe58, UProperty.HYPHEN, 0 }, { 0x2172, UProperty.ID_CONTINUE, 1 }, { 0x0307, UProperty.ID_CONTINUE, 1 }, { 0x005c, UProperty.ID_CONTINUE, 0 }, { 0x2172, UProperty.ID_START, 1 }, { 0x007a, UProperty.ID_START, 1 }, { 0x0039, UProperty.ID_START, 0 }, { 0x4db5, UProperty.IDEOGRAPHIC, 1 }, { 0x2f999, UProperty.IDEOGRAPHIC, 1 }, { 0x2f99, UProperty.IDEOGRAPHIC, 0 }, { 0x200c, UProperty.JOIN_CONTROL, 1 }, { 0x2029, UProperty.JOIN_CONTROL, 0 }, { 0x1d7bc, UProperty.LOWERCASE, 1 }, { 0x0345, UProperty.LOWERCASE, 1 }, { 0x0030, UProperty.LOWERCASE, 0 }, { 0x1d7a9, UProperty.MATH, 1 }, { 0x2135, UProperty.MATH, 1 }, { 0x0062, UProperty.MATH, 0 }, { 0xfde1, UProperty.NONCHARACTER_CODE_POINT, 1 }, { 0x10ffff, UProperty.NONCHARACTER_CODE_POINT, 1 }, { 0x10fffd, UProperty.NONCHARACTER_CODE_POINT, 0 }, { 0x0022, UProperty.QUOTATION_MARK, 1 }, { 0xff62, UProperty.QUOTATION_MARK, 1 }, { 0xd840, UProperty.QUOTATION_MARK, 0 }, { 0x061f, UProperty.TERMINAL_PUNCTUATION, 1 }, { 0xe003f, UProperty.TERMINAL_PUNCTUATION, 0 }, { 0x1d44a, UProperty.UPPERCASE, 1 }, { 0x2162, UProperty.UPPERCASE, 1 }, { 0x0345, UProperty.UPPERCASE, 0 }, { 0x0020, UProperty.WHITE_SPACE, 1 }, { 0x202f, UProperty.WHITE_SPACE, 1 }, { 0x3001, UProperty.WHITE_SPACE, 0 }, { 0x0711, UProperty.XID_CONTINUE, 1 }, { 0x1d1aa, UProperty.XID_CONTINUE, 1 }, { 0x007c, UProperty.XID_CONTINUE, 0 }, { 0x16ee, UProperty.XID_START, 1 }, { 0x23456, UProperty.XID_START, 1 }, { 0x1d1aa, UProperty.XID_START, 0 }, /*
* Version break:
* The following properties are only supported starting with the
* Unicode version indicated in the second field.
*/
{ -1, 0x320, 0 }, { 0x180c, UProperty.DEFAULT_IGNORABLE_CODE_POINT, 1 }, { 0xfe02, UProperty.DEFAULT_IGNORABLE_CODE_POINT, 1 }, { 0x1801, UProperty.DEFAULT_IGNORABLE_CODE_POINT, 0 }, { 0x0149, UProperty.DEPRECATED, 1 }, /* changed in Unicode 5.2 */
{ 0x0341, UProperty.DEPRECATED, 0 }, /* changed in Unicode 5.2 */
{ 0xe0001, UProperty.DEPRECATED, 1 }, /* Changed from Unicode 5 to 5.1 */
{ 0xe0100, UProperty.DEPRECATED, 0 }, { 0x00a0, UProperty.GRAPHEME_BASE, 1 }, { 0x0a4d, UProperty.GRAPHEME_BASE, 0 }, { 0xff9d, UProperty.GRAPHEME_BASE, 1 }, { 0xff9f, UProperty.GRAPHEME_BASE, 0 }, { 0x0300, UProperty.GRAPHEME_EXTEND, 1 }, { 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 }, { 0x0a4d, UProperty.GRAPHEME_LINK, 1 }, { 0xff9f, UProperty.GRAPHEME_LINK, 0 }, { 0x2ff7, UProperty.IDS_BINARY_OPERATOR, 1 }, { 0x2ff3, UProperty.IDS_BINARY_OPERATOR, 0 }, { 0x2ff3, UProperty.IDS_TRINARY_OPERATOR, 1 }, { 0x2f03, UProperty.IDS_TRINARY_OPERATOR, 0 }, { 0x0ec1, UProperty.LOGICAL_ORDER_EXCEPTION, 1 }, { 0xdcba, UProperty.LOGICAL_ORDER_EXCEPTION, 0 }, { 0x2e9b, UProperty.RADICAL, 1 }, { 0x4e00, UProperty.RADICAL, 0 }, { 0x012f, UProperty.SOFT_DOTTED, 1 }, { 0x0049, UProperty.SOFT_DOTTED, 0 }, { 0xfa11, UProperty.UNIFIED_IDEOGRAPH, 1 }, { 0xfa12, UProperty.UNIFIED_IDEOGRAPH, 0 }, { -1, 0x401, 0 }, { 0x002e, UProperty.S_TERM, 1 }, { 0x0061, UProperty.S_TERM, 0 }, { 0x180c, UProperty.VARIATION_SELECTOR, 1 }, { 0xfe03, UProperty.VARIATION_SELECTOR, 1 }, { 0xe01ef, UProperty.VARIATION_SELECTOR, 1 }, { 0xe0200, UProperty.VARIATION_SELECTOR, 0 }, /* test default Bidi classes for unassigned code points */
{ 0x0590, UProperty.BIDI_CLASS, UCharacterDirection.RIGHT_TO_LEFT }, { 0x05cf, UProperty.BIDI_CLASS, UCharacterDirection.RIGHT_TO_LEFT }, { 0x05ed, UProperty.BIDI_CLASS, UCharacterDirection.RIGHT_TO_LEFT }, { 0x07f2, UProperty.BIDI_CLASS, UCharacterDirection.DIR_NON_SPACING_MARK }, /* Nko, new in Unicode 5.0 */
{ 0x07fe, UProperty.BIDI_CLASS, UCharacterDirection.RIGHT_TO_LEFT }, /* unassigned R */
{ 0x089f, UProperty.BIDI_CLASS, UCharacterDirection.RIGHT_TO_LEFT }, { 0xfb37, UProperty.BIDI_CLASS, UCharacterDirection.RIGHT_TO_LEFT }, { 0xfb42, UProperty.BIDI_CLASS, UCharacterDirection.RIGHT_TO_LEFT }, { 0x10806, UProperty.BIDI_CLASS, UCharacterDirection.RIGHT_TO_LEFT }, { 0x10909, UProperty.BIDI_CLASS, UCharacterDirection.RIGHT_TO_LEFT }, { 0x10fe4, UProperty.BIDI_CLASS, UCharacterDirection.RIGHT_TO_LEFT }, { 0x061d, UProperty.BIDI_CLASS, UCharacterDirection.RIGHT_TO_LEFT_ARABIC }, { 0x063f, UProperty.BIDI_CLASS, UCharacterDirection.RIGHT_TO_LEFT_ARABIC }, { 0x070e, UProperty.BIDI_CLASS, UCharacterDirection.RIGHT_TO_LEFT_ARABIC }, { 0x0775, UProperty.BIDI_CLASS, UCharacterDirection.RIGHT_TO_LEFT_ARABIC }, { 0xfbc2, UProperty.BIDI_CLASS, UCharacterDirection.RIGHT_TO_LEFT_ARABIC }, { 0xfd90, UProperty.BIDI_CLASS, UCharacterDirection.RIGHT_TO_LEFT_ARABIC }, { 0xfefe, UProperty.BIDI_CLASS, UCharacterDirection.RIGHT_TO_LEFT_ARABIC }, { 0x02AF, UProperty.BLOCK, UCharacter.UnicodeBlock.IPA_EXTENSIONS.getID() }, { 0x0C4E, UProperty.BLOCK, UCharacter.UnicodeBlock.TELUGU.getID() }, { 0x155A, UProperty.BLOCK, UCharacter.UnicodeBlock.UNIFIED_CANADIAN_ABORIGINAL_SYLLABICS.getID() }, { 0x1717, UProperty.BLOCK, UCharacter.UnicodeBlock.TAGALOG.getID() }, { 0x1900, UProperty.BLOCK, UCharacter.UnicodeBlock.LIMBU.getID() }, { 0x1CBF, UProperty.BLOCK, UCharacter.UnicodeBlock.NO_BLOCK.getID() }, { 0x3040, UProperty.BLOCK, UCharacter.UnicodeBlock.HIRAGANA.getID() }, { 0x1D0FF, UProperty.BLOCK, UCharacter.UnicodeBlock.BYZANTINE_MUSICAL_SYMBOLS.getID() }, { 0x50000, UProperty.BLOCK, UCharacter.UnicodeBlock.NO_BLOCK.getID() }, { 0xEFFFF, UProperty.BLOCK, UCharacter.UnicodeBlock.NO_BLOCK.getID() }, { 0x10D0FF, UProperty.BLOCK, UCharacter.UnicodeBlock.SUPPLEMENTARY_PRIVATE_USE_AREA_B.getID() }, /* UProperty.CANONICAL_COMBINING_CLASS tested for assigned characters in TestUnicodeData() */
{ 0xd7d7, UProperty.CANONICAL_COMBINING_CLASS, 0 }, { 0x00A0, UProperty.DECOMPOSITION_TYPE, UCharacter.DecompositionType.NOBREAK }, { 0x00A8, UProperty.DECOMPOSITION_TYPE, UCharacter.DecompositionType.COMPAT }, { 0x00bf, UProperty.DECOMPOSITION_TYPE, UCharacter.DecompositionType.NONE }, { 0x00c0, UProperty.DECOMPOSITION_TYPE, UCharacter.DecompositionType.CANONICAL }, { 0x1E9B, UProperty.DECOMPOSITION_TYPE, UCharacter.DecompositionType.CANONICAL }, { 0xBCDE, UProperty.DECOMPOSITION_TYPE, UCharacter.DecompositionType.CANONICAL }, { 0xFB5D, UProperty.DECOMPOSITION_TYPE, UCharacter.DecompositionType.MEDIAL }, { 0x1D736, UProperty.DECOMPOSITION_TYPE, UCharacter.DecompositionType.FONT }, { 0xe0033, UProperty.DECOMPOSITION_TYPE, UCharacter.DecompositionType.NONE }, { 0x0009, UProperty.EAST_ASIAN_WIDTH, UCharacter.EastAsianWidth.NEUTRAL }, { 0x0020, UProperty.EAST_ASIAN_WIDTH, UCharacter.EastAsianWidth.NARROW }, { 0x00B1, UProperty.EAST_ASIAN_WIDTH, UCharacter.EastAsianWidth.AMBIGUOUS }, { 0x20A9, UProperty.EAST_ASIAN_WIDTH, UCharacter.EastAsianWidth.HALFWIDTH }, { 0x2FFB, UProperty.EAST_ASIAN_WIDTH, UCharacter.EastAsianWidth.WIDE }, { 0x3000, UProperty.EAST_ASIAN_WIDTH, UCharacter.EastAsianWidth.FULLWIDTH }, { 0x35bb, UProperty.EAST_ASIAN_WIDTH, UCharacter.EastAsianWidth.WIDE }, { 0x58bd, UProperty.EAST_ASIAN_WIDTH, UCharacter.EastAsianWidth.WIDE }, { 0xD7A3, UProperty.EAST_ASIAN_WIDTH, UCharacter.EastAsianWidth.WIDE }, { 0xEEEE, UProperty.EAST_ASIAN_WIDTH, UCharacter.EastAsianWidth.AMBIGUOUS }, { 0x1D198, UProperty.EAST_ASIAN_WIDTH, UCharacter.EastAsianWidth.NEUTRAL }, { 0x20000, UProperty.EAST_ASIAN_WIDTH, UCharacter.EastAsianWidth.WIDE }, { 0x2F8C7, UProperty.EAST_ASIAN_WIDTH, UCharacter.EastAsianWidth.WIDE }, { 0x3a5bd, UProperty.EAST_ASIAN_WIDTH, UCharacter.EastAsianWidth.WIDE }, { 0x5a5bd, UProperty.EAST_ASIAN_WIDTH, UCharacter.EastAsianWidth.NEUTRAL }, { 0xFEEEE, UProperty.EAST_ASIAN_WIDTH, UCharacter.EastAsianWidth.AMBIGUOUS }, { 0x10EEEE, UProperty.EAST_ASIAN_WIDTH, UCharacter.EastAsianWidth.AMBIGUOUS }, /* UProperty.GENERAL_CATEGORY tested for assigned characters in TestUnicodeData() */
{ 0xd7c7, UProperty.GENERAL_CATEGORY, 0 }, { 0xd7d7, UProperty.GENERAL_CATEGORY, UCharacterEnums.ECharacterCategory.OTHER_LETTER }, { 0x0444, UProperty.JOINING_GROUP, UCharacter.JoiningGroup.NO_JOINING_GROUP }, { 0x0639, UProperty.JOINING_GROUP, UCharacter.JoiningGroup.AIN }, { 0x072A, UProperty.JOINING_GROUP, UCharacter.JoiningGroup.DALATH_RISH }, { 0x0647, UProperty.JOINING_GROUP, UCharacter.JoiningGroup.HEH }, { 0x06C1, UProperty.JOINING_GROUP, UCharacter.JoiningGroup.HEH_GOAL }, { 0x200C, UProperty.JOINING_TYPE, UCharacter.JoiningType.NON_JOINING }, { 0x200D, UProperty.JOINING_TYPE, UCharacter.JoiningType.JOIN_CAUSING }, { 0x0639, UProperty.JOINING_TYPE, UCharacter.JoiningType.DUAL_JOINING }, { 0x0640, UProperty.JOINING_TYPE, UCharacter.JoiningType.JOIN_CAUSING }, { 0x06C3, UProperty.JOINING_TYPE, UCharacter.JoiningType.RIGHT_JOINING }, { 0x0300, UProperty.JOINING_TYPE, UCharacter.JoiningType.TRANSPARENT }, { 0x070F, UProperty.JOINING_TYPE, UCharacter.JoiningType.TRANSPARENT }, { 0xe0033, UProperty.JOINING_TYPE, UCharacter.JoiningType.TRANSPARENT }, /* TestUnicodeData() verifies that no assigned character has "XX" (unknown) */
{ 0xe7e7, UProperty.LINE_BREAK, UCharacter.LineBreak.UNKNOWN }, { 0x10fffd, UProperty.LINE_BREAK, UCharacter.LineBreak.UNKNOWN }, { 0x0028, UProperty.LINE_BREAK, UCharacter.LineBreak.OPEN_PUNCTUATION }, { 0x232A, UProperty.LINE_BREAK, UCharacter.LineBreak.CLOSE_PUNCTUATION }, { 0x3401, UProperty.LINE_BREAK, UCharacter.LineBreak.IDEOGRAPHIC }, { 0x4e02, UProperty.LINE_BREAK, UCharacter.LineBreak.IDEOGRAPHIC }, { 0x20004, UProperty.LINE_BREAK, UCharacter.LineBreak.IDEOGRAPHIC }, { 0xf905, UProperty.LINE_BREAK, UCharacter.LineBreak.IDEOGRAPHIC }, { 0xdb7e, UProperty.LINE_BREAK, UCharacter.LineBreak.SURROGATE }, { 0xdbfd, UProperty.LINE_BREAK, UCharacter.LineBreak.SURROGATE }, { 0xdffc, UProperty.LINE_BREAK, UCharacter.LineBreak.SURROGATE }, { 0x2762, UProperty.LINE_BREAK, UCharacter.LineBreak.EXCLAMATION }, { 0x002F, UProperty.LINE_BREAK, UCharacter.LineBreak.BREAK_SYMBOLS }, { 0x1D49C, UProperty.LINE_BREAK, UCharacter.LineBreak.ALPHABETIC }, { 0x1731, UProperty.LINE_BREAK, UCharacter.LineBreak.ALPHABETIC }, { 0x10ff, UProperty.HANGUL_SYLLABLE_TYPE, 0 }, { 0x1100, UProperty.HANGUL_SYLLABLE_TYPE, UCharacter.HangulSyllableType.LEADING_JAMO }, { 0x1111, UProperty.HANGUL_SYLLABLE_TYPE, UCharacter.HangulSyllableType.LEADING_JAMO }, { 0x1159, UProperty.HANGUL_SYLLABLE_TYPE, UCharacter.HangulSyllableType.LEADING_JAMO }, { 0x115a, UProperty.HANGUL_SYLLABLE_TYPE, UCharacter.HangulSyllableType.LEADING_JAMO }, /* changed in Unicode 5.2 */
{ 0x115e, UProperty.HANGUL_SYLLABLE_TYPE, UCharacter.HangulSyllableType.LEADING_JAMO }, /* changed in Unicode 5.2 */
{ 0x115f, UProperty.HANGUL_SYLLABLE_TYPE, UCharacter.HangulSyllableType.LEADING_JAMO }, { 0xa95f, UProperty.HANGUL_SYLLABLE_TYPE, 0 }, { 0xa960, UProperty.HANGUL_SYLLABLE_TYPE, UCharacter.HangulSyllableType.LEADING_JAMO }, /* changed in Unicode 5.2 */
{ 0xa97c, UProperty.HANGUL_SYLLABLE_TYPE, UCharacter.HangulSyllableType.LEADING_JAMO }, /* changed in Unicode 5.2 */
{ 0xa97d, UProperty.HANGUL_SYLLABLE_TYPE, 0 }, { 0x1160, UProperty.HANGUL_SYLLABLE_TYPE, UCharacter.HangulSyllableType.VOWEL_JAMO }, { 0x1161, UProperty.HANGUL_SYLLABLE_TYPE, UCharacter.HangulSyllableType.VOWEL_JAMO }, { 0x1172, UProperty.HANGUL_SYLLABLE_TYPE, UCharacter.HangulSyllableType.VOWEL_JAMO }, { 0x11a2, UProperty.HANGUL_SYLLABLE_TYPE, UCharacter.HangulSyllableType.VOWEL_JAMO }, { 0x11a3, UProperty.HANGUL_SYLLABLE_TYPE, UCharacter.HangulSyllableType.VOWEL_JAMO }, /* changed in Unicode 5.2 */
{ 0x11a7, UProperty.HANGUL_SYLLABLE_TYPE, UCharacter.HangulSyllableType.VOWEL_JAMO }, { 0xd7af, UProperty.HANGUL_SYLLABLE_TYPE, 0 }, { 0xd7b0, UProperty.HANGUL_SYLLABLE_TYPE, UCharacter.HangulSyllableType.VOWEL_JAMO }, /* changed in Unicode 5.2 */
{ 0xd7c6, UProperty.HANGUL_SYLLABLE_TYPE, UCharacter.HangulSyllableType.VOWEL_JAMO }, /* changed in Unicode 5.2 */
{ 0xd7c7, UProperty.HANGUL_SYLLABLE_TYPE, 0 }, { 0x11a8, UProperty.HANGUL_SYLLABLE_TYPE, UCharacter.HangulSyllableType.TRAILING_JAMO }, { 0x11b8, UProperty.HANGUL_SYLLABLE_TYPE, UCharacter.HangulSyllableType.TRAILING_JAMO }, { 0x11c8, UProperty.HANGUL_SYLLABLE_TYPE, UCharacter.HangulSyllableType.TRAILING_JAMO }, { 0x11f9, UProperty.HANGUL_SYLLABLE_TYPE, UCharacter.HangulSyllableType.TRAILING_JAMO }, { 0x11fa, UProperty.HANGUL_SYLLABLE_TYPE, UCharacter.HangulSyllableType.TRAILING_JAMO }, /* changed in Unicode 5.2 */
{ 0x11ff, UProperty.HANGUL_SYLLABLE_TYPE, UCharacter.HangulSyllableType.TRAILING_JAMO }, /* changed in Unicode 5.2 */
{ 0x1200, UProperty.HANGUL_SYLLABLE_TYPE, 0 }, { 0xd7ca, UProperty.HANGUL_SYLLABLE_TYPE, 0 }, { 0xd7cb, UProperty.HANGUL_SYLLABLE_TYPE, UCharacter.HangulSyllableType.TRAILING_JAMO }, /* changed in Unicode 5.2 */
{ 0xd7fb, UProperty.HANGUL_SYLLABLE_TYPE, UCharacter.HangulSyllableType.TRAILING_JAMO }, /* changed in Unicode 5.2 */
{ 0xd7fc, UProperty.HANGUL_SYLLABLE_TYPE, 0 }, { 0xac00, UProperty.HANGUL_SYLLABLE_TYPE, UCharacter.HangulSyllableType.LV_SYLLABLE }, { 0xac1c, UProperty.HANGUL_SYLLABLE_TYPE, UCharacter.HangulSyllableType.LV_SYLLABLE }, { 0xc5ec, UProperty.HANGUL_SYLLABLE_TYPE, UCharacter.HangulSyllableType.LV_SYLLABLE }, { 0xd788, UProperty.HANGUL_SYLLABLE_TYPE, UCharacter.HangulSyllableType.LV_SYLLABLE }, { 0xac01, UProperty.HANGUL_SYLLABLE_TYPE, UCharacter.HangulSyllableType.LVT_SYLLABLE }, { 0xac1b, UProperty.HANGUL_SYLLABLE_TYPE, UCharacter.HangulSyllableType.LVT_SYLLABLE }, { 0xac1d, UProperty.HANGUL_SYLLABLE_TYPE, UCharacter.HangulSyllableType.LVT_SYLLABLE }, { 0xc5ee, UProperty.HANGUL_SYLLABLE_TYPE, UCharacter.HangulSyllableType.LVT_SYLLABLE }, { 0xd7a3, UProperty.HANGUL_SYLLABLE_TYPE, UCharacter.HangulSyllableType.LVT_SYLLABLE }, { 0xd7a4, UProperty.HANGUL_SYLLABLE_TYPE, 0 }, { -1, 0x410, 0 }, { 0x00d7, UProperty.PATTERN_SYNTAX, 1 }, { 0xfe45, UProperty.PATTERN_SYNTAX, 1 }, { 0x0061, UProperty.PATTERN_SYNTAX, 0 }, { 0x0020, UProperty.PATTERN_WHITE_SPACE, 1 }, { 0x0085, UProperty.PATTERN_WHITE_SPACE, 1 }, { 0x200f, UProperty.PATTERN_WHITE_SPACE, 1 }, { 0x00a0, UProperty.PATTERN_WHITE_SPACE, 0 }, { 0x3000, UProperty.PATTERN_WHITE_SPACE, 0 }, { 0x1d200, UProperty.BLOCK, UCharacter.UnicodeBlock.ANCIENT_GREEK_MUSICAL_NOTATION_ID }, { 0x2c8e, UProperty.BLOCK, UCharacter.UnicodeBlock.COPTIC_ID }, { 0xfe17, UProperty.BLOCK, UCharacter.UnicodeBlock.VERTICAL_FORMS_ID }, { 0x1a00, UProperty.SCRIPT, UScript.BUGINESE }, { 0x2cea, UProperty.SCRIPT, UScript.COPTIC }, { 0xa82b, UProperty.SCRIPT, UScript.SYLOTI_NAGRI }, { 0x103d0, UProperty.SCRIPT, UScript.OLD_PERSIAN }, { 0xcc28, UProperty.LINE_BREAK, UCharacter.LineBreak.H2 }, { 0xcc29, UProperty.LINE_BREAK, UCharacter.LineBreak.H3 }, { 0xac03, UProperty.LINE_BREAK, UCharacter.LineBreak.H3 }, { 0x115f, UProperty.LINE_BREAK, UCharacter.LineBreak.JL }, { 0x11aa, UProperty.LINE_BREAK, UCharacter.LineBreak.JT }, { 0x11a1, UProperty.LINE_BREAK, UCharacter.LineBreak.JV }, { 0xb2c9, UProperty.GRAPHEME_CLUSTER_BREAK, UCharacter.GraphemeClusterBreak.LVT }, { 0x036f, UProperty.GRAPHEME_CLUSTER_BREAK, UCharacter.GraphemeClusterBreak.EXTEND }, { 0x0000, UProperty.GRAPHEME_CLUSTER_BREAK, UCharacter.GraphemeClusterBreak.CONTROL }, { 0x1160, UProperty.GRAPHEME_CLUSTER_BREAK, UCharacter.GraphemeClusterBreak.V }, { 0x05f4, UProperty.WORD_BREAK, UCharacter.WordBreak.MIDLETTER }, { 0x4ef0, UProperty.WORD_BREAK, UCharacter.WordBreak.OTHER }, { 0x19d9, UProperty.WORD_BREAK, UCharacter.WordBreak.NUMERIC }, { 0x2044, UProperty.WORD_BREAK, UCharacter.WordBreak.MIDNUM }, { 0xfffd, UProperty.SENTENCE_BREAK, UCharacter.SentenceBreak.OTHER }, { 0x1ffc, UProperty.SENTENCE_BREAK, UCharacter.SentenceBreak.UPPER }, { 0xff63, UProperty.SENTENCE_BREAK, UCharacter.SentenceBreak.CLOSE }, { 0x2028, UProperty.SENTENCE_BREAK, UCharacter.SentenceBreak.SEP }, { -1, 0x520, 0 }, /* unassigned code points in new default Bidi R blocks */
{ 0x1ede4, UProperty.BIDI_CLASS, UCharacterDirection.RIGHT_TO_LEFT }, { 0x1efe4, UProperty.BIDI_CLASS, UCharacterDirection.RIGHT_TO_LEFT }, /* test some script codes >127 */
{ 0xa6e6, UProperty.SCRIPT, UScript.BAMUM }, { 0xa4d0, UProperty.SCRIPT, UScript.LISU }, { 0x10a7f, UProperty.SCRIPT, UScript.OLD_SOUTH_ARABIAN }, { -1, 0x600, 0 }, /* value changed in Unicode 6.0 */
{ 0x06C3, UProperty.JOINING_GROUP, UCharacter.JoiningGroup.TEH_MARBUTA_GOAL }, { -1, 0x610, 0 }, /* unassigned code points in new/changed default Bidi AL blocks */
{ 0x08ba, UProperty.BIDI_CLASS, UCharacterDirection.RIGHT_TO_LEFT_ARABIC }, { 0x1eee4, UProperty.BIDI_CLASS, UCharacterDirection.RIGHT_TO_LEFT_ARABIC }, { -1, 0x630, 0 }, /* unassigned code points in the currency symbols block now default to ET */
{ 0x20C0, UProperty.BIDI_CLASS, UCharacterDirection.EUROPEAN_NUMBER_TERMINATOR }, { 0x20CF, UProperty.BIDI_CLASS, UCharacterDirection.EUROPEAN_NUMBER_TERMINATOR }, /* new property in Unicode 6.3 */
{ 0x0027, UProperty.BIDI_PAIRED_BRACKET_TYPE, UCharacter.BidiPairedBracketType.NONE }, { 0x0028, UProperty.BIDI_PAIRED_BRACKET_TYPE, UCharacter.BidiPairedBracketType.OPEN }, { 0x0029, UProperty.BIDI_PAIRED_BRACKET_TYPE, UCharacter.BidiPairedBracketType.CLOSE }, { 0xFF5C, UProperty.BIDI_PAIRED_BRACKET_TYPE, UCharacter.BidiPairedBracketType.NONE }, { 0xFF5B, UProperty.BIDI_PAIRED_BRACKET_TYPE, UCharacter.BidiPairedBracketType.OPEN }, { 0xFF5D, UProperty.BIDI_PAIRED_BRACKET_TYPE, UCharacter.BidiPairedBracketType.CLOSE }, { -1, 0x700, 0 }, /* new character range with Joining_Group values */
{ 0x10ABF, UProperty.JOINING_GROUP, UCharacter.JoiningGroup.NO_JOINING_GROUP }, { 0x10AC0, UProperty.JOINING_GROUP, UCharacter.JoiningGroup.MANICHAEAN_ALEPH }, { 0x10AC1, UProperty.JOINING_GROUP, UCharacter.JoiningGroup.MANICHAEAN_BETH }, { 0x10AEF, UProperty.JOINING_GROUP, UCharacter.JoiningGroup.MANICHAEAN_HUNDRED }, { 0x10AF0, UProperty.JOINING_GROUP, UCharacter.JoiningGroup.NO_JOINING_GROUP }, /* undefined UProperty values */
{ 0x61, 0x4a7, 0 }, { 0x234bc, 0x15ed, 0 } };
if (UCharacter.getIntPropertyMinValue(UProperty.DASH) != 0 || UCharacter.getIntPropertyMinValue(UProperty.BIDI_CLASS) != 0 || UCharacter.getIntPropertyMinValue(UProperty.BLOCK) != 0 || /* j2478 */
UCharacter.getIntPropertyMinValue(UProperty.SCRIPT) != 0 || /* JB#2410 */
UCharacter.getIntPropertyMinValue(0x2345) != 0) {
errln("error: UCharacter.getIntPropertyMinValue() wrong");
}
if (UCharacter.getIntPropertyMaxValue(UProperty.DASH) != 1) {
errln("error: UCharacter.getIntPropertyMaxValue(UProperty.DASH) wrong\n");
}
if (UCharacter.getIntPropertyMaxValue(UProperty.ID_CONTINUE) != 1) {
errln("error: UCharacter.getIntPropertyMaxValue(UProperty.ID_CONTINUE) wrong\n");
}
if (UCharacter.getIntPropertyMaxValue(UProperty.BINARY_LIMIT - 1) != 1) {
errln("error: UCharacter.getIntPropertyMaxValue(UProperty.BINARY_LIMIT-1) wrong\n");
}
if (UCharacter.getIntPropertyMaxValue(UProperty.BIDI_CLASS) != UCharacterDirection.CHAR_DIRECTION_COUNT - 1) {
errln("error: UCharacter.getIntPropertyMaxValue(UProperty.BIDI_CLASS) wrong\n");
}
if (UCharacter.getIntPropertyMaxValue(UProperty.BLOCK) != UCharacter.UnicodeBlock.COUNT - 1) {
errln("error: UCharacter.getIntPropertyMaxValue(UProperty.BLOCK) wrong\n");
}
if (UCharacter.getIntPropertyMaxValue(UProperty.LINE_BREAK) != UCharacter.LineBreak.COUNT - 1) {
errln("error: UCharacter.getIntPropertyMaxValue(UProperty.LINE_BREAK) wrong\n");
}
if (UCharacter.getIntPropertyMaxValue(UProperty.SCRIPT) != UScript.CODE_LIMIT - 1) {
errln("error: UCharacter.getIntPropertyMaxValue(UProperty.SCRIPT) wrong\n");
}
if (UCharacter.getIntPropertyMaxValue(UProperty.NUMERIC_TYPE) != UCharacter.NumericType.COUNT - 1) {
errln("error: UCharacter.getIntPropertyMaxValue(UProperty.NUMERIC_TYPE) wrong\n");
}
if (UCharacter.getIntPropertyMaxValue(UProperty.GENERAL_CATEGORY) != UCharacterCategory.CHAR_CATEGORY_COUNT - 1) {
errln("error: UCharacter.getIntPropertyMaxValue(UProperty.GENERAL_CATEGORY) wrong\n");
}
if (UCharacter.getIntPropertyMaxValue(UProperty.HANGUL_SYLLABLE_TYPE) != UCharacter.HangulSyllableType.COUNT - 1) {
errln("error: UCharacter.getIntPropertyMaxValue(UProperty.HANGUL_SYLLABLE_TYPE) wrong\n");
}
if (UCharacter.getIntPropertyMaxValue(UProperty.GRAPHEME_CLUSTER_BREAK) != UCharacter.GraphemeClusterBreak.COUNT - 1) {
errln("error: UCharacter.getIntPropertyMaxValue(UProperty.GRAPHEME_CLUSTER_BREAK) wrong\n");
}
if (UCharacter.getIntPropertyMaxValue(UProperty.SENTENCE_BREAK) != UCharacter.SentenceBreak.COUNT - 1) {
errln("error: UCharacter.getIntPropertyMaxValue(UProperty.SENTENCE_BREAK) wrong\n");
}
if (UCharacter.getIntPropertyMaxValue(UProperty.WORD_BREAK) != UCharacter.WordBreak.COUNT - 1) {
errln("error: UCharacter.getIntPropertyMaxValue(UProperty.WORD_BREAK) wrong\n");
}
if (UCharacter.getIntPropertyMaxValue(UProperty.BIDI_PAIRED_BRACKET_TYPE) != UCharacter.BidiPairedBracketType.COUNT - 1) {
errln("error: UCharacter.getIntPropertyMaxValue(UProperty.BIDI_PAIRED_BRACKET_TYPE) wrong\n");
}
/*JB#2410*/
if (UCharacter.getIntPropertyMaxValue(0x2345) != -1) {
errln("error: UCharacter.getIntPropertyMaxValue(0x2345) wrong\n");
}
if (UCharacter.getIntPropertyMaxValue(UProperty.DECOMPOSITION_TYPE) != (UCharacter.DecompositionType.COUNT - 1)) {
errln("error: UCharacter.getIntPropertyMaxValue(UProperty.DECOMPOSITION_TYPE) wrong\n");
}
if (UCharacter.getIntPropertyMaxValue(UProperty.JOINING_GROUP) != (UCharacter.JoiningGroup.COUNT - 1)) {
errln("error: UCharacter.getIntPropertyMaxValue(UProperty.JOINING_GROUP) wrong\n");
}
if (UCharacter.getIntPropertyMaxValue(UProperty.JOINING_TYPE) != (UCharacter.JoiningType.COUNT - 1)) {
errln("error: UCharacter.getIntPropertyMaxValue(UProperty.JOINING_TYPE) wrong\n");
}
if (UCharacter.getIntPropertyMaxValue(UProperty.EAST_ASIAN_WIDTH) != (UCharacter.EastAsianWidth.COUNT - 1)) {
errln("error: UCharacter.getIntPropertyMaxValue(UProperty.EAST_ASIAN_WIDTH) wrong\n");
}
VersionInfo version = UCharacter.getUnicodeVersion();
// test hasBinaryProperty()
for (int i = 0; i < props.length; ++i) {
int which = props[i][1];
if (props[i][0] < 0) {
if (version.compareTo(VersionInfo.getInstance(which >> 8, (which >> 4) & 0xF, which & 0xF, 0)) < 0) {
break;
}
continue;
}
String whichName;
try {
whichName = UCharacter.getPropertyName(which, UProperty.NameChoice.LONG);
} catch (IllegalArgumentException e) {
// There are intentionally invalid property integer values ("which").
// Catch and ignore the exception from getPropertyName().
whichName = "undefined UProperty value";
}
boolean expect = true;
if (props[i][2] == 0) {
expect = false;
}
if (which < UProperty.INT_START) {
if (UCharacter.hasBinaryProperty(props[i][0], which) != expect) {
errln("error: UCharacter.hasBinaryProperty(U+" + Utility.hex(props[i][0], 4) + ", " + whichName + ") has an error, expected=" + expect);
}
}
int retVal = UCharacter.getIntPropertyValue(props[i][0], which);
if (retVal != props[i][2]) {
errln("error: UCharacter.getIntPropertyValue(U+" + Utility.hex(props[i][0], 4) + ", " + whichName + ") is wrong, expected=" + props[i][2] + " actual=" + retVal);
}
// test separate functions, too
switch(which) {
case UProperty.ALPHABETIC:
if (UCharacter.isUAlphabetic(props[i][0]) != expect) {
errln("error: UCharacter.isUAlphabetic(\\u" + Integer.toHexString(props[i][0]) + ") is wrong expected " + props[i][2]);
}
break;
case UProperty.LOWERCASE:
if (UCharacter.isULowercase(props[i][0]) != expect) {
errln("error: UCharacter.isULowercase(\\u" + Integer.toHexString(props[i][0]) + ") is wrong expected " + props[i][2]);
}
break;
case UProperty.UPPERCASE:
if (UCharacter.isUUppercase(props[i][0]) != expect) {
errln("error: UCharacter.isUUppercase(\\u" + Integer.toHexString(props[i][0]) + ") is wrong expected " + props[i][2]);
}
break;
case UProperty.WHITE_SPACE:
if (UCharacter.isUWhiteSpace(props[i][0]) != expect) {
errln("error: UCharacter.isUWhiteSpace(\\u" + Integer.toHexString(props[i][0]) + ") is wrong expected " + props[i][2]);
}
break;
default:
break;
}
}
}
use of android.icu.util.VersionInfo in project j2objc by google.
the class UCharacterTest method TestLetterNumber.
// public methods ================================================
/**
* Testing the letter and number determination in UCharacter
*/
@Test
public void TestLetterNumber() {
for (int i = 0x0041; i < 0x005B; i++) if (!UCharacter.isLetter(i))
errln("FAIL \\u" + hex(i) + " expected to be a letter");
for (int i = 0x0660; i < 0x066A; i++) if (UCharacter.isLetter(i))
errln("FAIL \\u" + hex(i) + " expected not to be a letter");
for (int i = 0x0660; i < 0x066A; i++) if (!UCharacter.isDigit(i))
errln("FAIL \\u" + hex(i) + " expected to be a digit");
for (int i = 0x0041; i < 0x005B; i++) if (!UCharacter.isLetterOrDigit(i))
errln("FAIL \\u" + hex(i) + " expected not to be a digit");
for (int i = 0x0660; i < 0x066A; i++) if (!UCharacter.isLetterOrDigit(i))
errln("FAIL \\u" + hex(i) + "expected to be either a letter or a digit");
/*
* The following checks work only starting from Unicode 4.0.
* Check the version number here.
*/
VersionInfo version = UCharacter.getUnicodeVersion();
if (version.getMajor() < 4 || version.equals(VersionInfo.getInstance(4, 0, 1))) {
return;
}
/*
* Sanity check:
* Verify that exactly the digit characters have decimal digit values.
* This assumption is used in the implementation of u_digit()
* (which checks nt=de)
* compared with the parallel java.lang.Character.digit()
* (which checks Nd).
*
* This was not true in Unicode 3.2 and earlier.
* Unicode 4.0 fixed discrepancies.
* Unicode 4.0.1 re-introduced problems in this area due to an
* unintentionally incomplete last-minute change.
*/
String digitsPattern = "[:Nd:]";
String decimalValuesPattern = "[:Numeric_Type=Decimal:]";
UnicodeSet digits, decimalValues;
digits = new UnicodeSet(digitsPattern);
decimalValues = new UnicodeSet(decimalValuesPattern);
compareUSets(digits, decimalValues, "[:Nd:]", "[:Numeric_Type=Decimal:]", true);
}
Aggregations