Skip to content

Commit

Permalink
no ICU here
Browse files Browse the repository at this point in the history
  • Loading branch information
eggrobin committed Jan 18, 2024
1 parent cfc1419 commit 1a99d21
Showing 1 changed file with 0 additions and 80 deletions.
80 changes: 0 additions & 80 deletions UnicodeJsps/src/test/java/org/unicode/jsptest/TestUnicodeSet.java
Original file line number Diff line number Diff line change
Expand Up @@ -217,86 +217,6 @@ public void TestICUEnums() {
}
}

@Test
public void TestICUStringProps() {
XPropertyFactory factory = XPropertyFactory.make();
BreakIterator titleIter = BreakIterator.getWordInstance(ULocale.ROOT);
for (int propEnum = UProperty.STRING_START; propEnum < UProperty.STRING_LIMIT; ++propEnum) {
String propName = UCharacter.getPropertyName(propEnum, NameChoice.SHORT);
String propNameLong = UCharacter.getPropertyName(propEnum, NameChoice.LONG);
UnicodeProperty prop3 = factory.getProperty(propName);
logln(Utility.hex(propEnum) + "\t" + propName + "\t" + propNameLong);
int errorCount = 0;
for (int i = 0; i <= 0x10ffff; ++i) {
if (i == 'ß') {
int debug = 0;
}
String icuValue;
try {
switch (propEnum) {
case UProperty.BIDI_PAIRED_BRACKET:
icuValue = UTF16.valueOf(UCharacter.getBidiPairedBracket(i));
break;
case UProperty.CASE_FOLDING:
icuValue = UCharacter.foldCase(UTF16.valueOf(i), true);
break;
case UProperty.LOWERCASE_MAPPING:
icuValue = UCharacter.toLowerCase(UTF16.valueOf(i));
break;
case UProperty.TITLECASE_MAPPING:
icuValue = UCharacter.toTitleCase(UTF16.valueOf(i), titleIter);
break;
case UProperty.UPPERCASE_MAPPING:
icuValue = UCharacter.toUpperCase(UTF16.valueOf(i));
break;
default:
icuValue =
UCharacter.getStringPropertyValue(
propEnum, i, NameChoice.SHORT);
if (propEnum == UProperty.AGE) {
icuValue =
icuValue.equals("0.0.0.0")
? "unassigned"
: VersionInfo.getInstance(icuValue)
.getVersionString(2, 2);
}
}
} catch (Exception e) {
errln(propNameLong + "\t" + e.getMessage());
if (++errorCount > 5) break;
else continue;
}
String propValue = prop3.getValue(i);
if (!Objects.equal(
icuValue, propValue)) { // do to avoid verbose mode being every character
assertEquals("string value", icuValue, propValue);
if (++errorCount > 5) break;
else continue;
}
}
}
}

@Test
public void TestICUDoubleProps() {
XPropertyFactory factory = XPropertyFactory.make();
// currently only one double property
assertEquals("only 1 double property", 1, UProperty.DOUBLE_LIMIT - UProperty.DOUBLE_START);
String propName = UCharacter.getPropertyName(UProperty.NUMERIC_VALUE, NameChoice.SHORT);
UnicodeProperty prop3 = factory.getProperty(propName);
for (int i = 0; i <= 0x10ffff; ++i) {
Double icuValue = UCharacter.getUnicodeNumericValue(i);
if (icuValue == UCharacter.NO_NUMERIC_VALUE) {
icuValue = Double.NaN;
}
String propString = prop3.getValue(i);
Double propValue = propString == null ? Double.NaN : Double.parseDouble(propString);
if (!icuValue.equals(propValue)) { // do to avoid verbose mode being every character
assertEquals("double value", icuValue, propValue);
}
}
}

private void checkProperty(XPropertyFactory factory, int propEnum) {
try {
int min = UCharacter.getIntPropertyMinValue(propEnum);
Expand Down

0 comments on commit 1a99d21

Please sign in to comment.