use of android.icu.util.VersionInfo in project j2objc by google.
the class BidiFmwk method initCharFromDirProps.
private static void initCharFromDirProps() {
final VersionInfo ucd401 = VersionInfo.getInstance(4, 0, 1, 0);
VersionInfo ucdVersion = VersionInfo.getInstance(0, 0, 0, 0);
/* lazy initialization */
if (ucdVersion.getMajor() > 0) {
return;
}
ucdVersion = UCharacter.getUnicodeVersion();
if (ucdVersion.compareTo(ucd401) >= 0) {
/* Unicode 4.0.1 changes bidi classes for +-/ */
/* change ES character from / to + */
charFromDirProp[TestData.ES] = 0x2b;
}
}
use of android.icu.util.VersionInfo in project j2objc by google.
the class ULocaleTest method TestCLDRVersion.
@Test
public void TestCLDRVersion() {
// VersionInfo zeroVersion = VersionInfo.getInstance(0, 0, 0, 0);
VersionInfo testExpect;
VersionInfo testCurrent;
VersionInfo cldrVersion;
cldrVersion = LocaleData.getCLDRVersion();
TestFmwk.logln("uloc_getCLDRVersion() returned: '" + cldrVersion + "'");
// why isn't this public for tests somewhere?
final ClassLoader testLoader = ICUResourceBundleTest.class.getClassLoader();
UResourceBundle bundle = UResourceBundle.getBundleInstance("android/icu/dev/data/testdata", ULocale.ROOT, testLoader);
testExpect = VersionInfo.getInstance(bundle.getString("ExpectCLDRVersionAtLeast"));
testCurrent = VersionInfo.getInstance(bundle.getString("CurrentCLDRVersion"));
logln("(data) ExpectCLDRVersionAtLeast { " + testExpect + "");
if (cldrVersion.compareTo(testExpect) < 0) {
errln("CLDR version is too old, expect at least " + testExpect + ".");
}
int r = cldrVersion.compareTo(testCurrent);
if (r < 0) {
logln("CLDR version is behind 'current' (for testdata/root.txt) " + testCurrent + ". Some things may fail.\n");
} else if (r > 0) {
logln("CLDR version is ahead of 'current' (for testdata/root.txt) " + testCurrent + ". Some things may fail.\n");
} else {
// CLDR version is OK.
}
}
use of android.icu.util.VersionInfo in project j2objc by google.
the class VersionInfoTest method TesttoString.
/**
* Test toString()
*/
@Test
public void TesttoString() {
for (int i = 0; i < TOSTRING_STRING_.length; i++) {
VersionInfo v = VersionInfo.getInstance(TOSTRING_STRING_[i]);
if (!v.toString().equals(TOSTRING_RESULT_[i])) {
errln("toString() for " + TOSTRING_STRING_[i] + " should produce " + TOSTRING_RESULT_[i]);
}
v = getInstance(TOSTRING_INT_[i]);
if (!v.toString().equals(TOSTRING_RESULT_[i])) {
errln("toString() for " + Arrays.toString(TOSTRING_INT_[i]) + " should produce " + TOSTRING_RESULT_[i]);
}
}
}
use of android.icu.util.VersionInfo in project j2objc by google.
the class VersionInfoTest method TestGetter.
/**
* Test that the getter function works
*/
@Test
public void TestGetter() {
for (int i = 0; i < GET_STRING_.length; i++) {
VersionInfo v = VersionInfo.getInstance(GET_STRING_[i]);
if (v.getMajor() != GET_RESULT_[i << 2] || v.getMinor() != GET_RESULT_[(i << 2) + 1] || v.getMilli() != GET_RESULT_[(i << 2) + 2] || v.getMicro() != GET_RESULT_[(i << 2) + 3]) {
errln(GET_STRING_[i] + " should return major=" + GET_RESULT_[i << 2] + " minor=" + GET_RESULT_[(i << 2) + 1] + " milli=" + GET_RESULT_[(i << 2) + 2] + " micro=" + GET_RESULT_[(i << 2) + 3]);
}
v = getInstance(GET_INT_[i]);
if (v.getMajor() != GET_RESULT_[i << 2] || v.getMinor() != GET_RESULT_[(i << 2) + 1] || v.getMilli() != GET_RESULT_[(i << 2) + 2] || v.getMicro() != GET_RESULT_[(i << 2) + 3]) {
errln(GET_STRING_[i] + " should return major=" + GET_RESULT_[i << 2] + " minor=" + GET_RESULT_[(i << 2) + 1] + " milli=" + GET_RESULT_[(i << 2) + 2] + " micro=" + GET_RESULT_[(i << 2) + 3]);
}
}
}
use of android.icu.util.VersionInfo in project j2objc by google.
the class VersionInfoTest method TestCompare.
/**
* Test that the comparison works
*/
@Test
public void TestCompare() {
for (int i = 0; i < COMPARE_NOT_EQUAL_STRING_.length; i += 2) {
VersionInfo v1 = VersionInfo.getInstance(COMPARE_NOT_EQUAL_STRING_[i]);
VersionInfo v2 = VersionInfo.getInstance(COMPARE_NOT_EQUAL_STRING_[i + 1]);
if (v1.compareTo(v2) == 0) {
errln(COMPARE_NOT_EQUAL_STRING_[i] + " should not equal " + COMPARE_NOT_EQUAL_STRING_[i + 1]);
}
}
for (int i = 0; i < COMPARE_NOT_EQUAL_INT_.length; i += 2) {
VersionInfo v1 = getInstance(COMPARE_NOT_EQUAL_INT_[i]);
VersionInfo v2 = getInstance(COMPARE_NOT_EQUAL_INT_[i + 1]);
if (v1.compareTo(v2) == 0) {
errln(Arrays.toString(COMPARE_NOT_EQUAL_INT_[i]) + " should not equal " + Arrays.toString(COMPARE_NOT_EQUAL_INT_[i + 1]));
}
}
for (int i = 0; i < COMPARE_EQUAL_STRING_.length - 1; i++) {
VersionInfo v1 = VersionInfo.getInstance(COMPARE_EQUAL_STRING_[i]);
VersionInfo v2 = VersionInfo.getInstance(COMPARE_EQUAL_STRING_[i + 1]);
if (v1.compareTo(v2) != 0) {
errln(COMPARE_EQUAL_STRING_[i] + " should equal " + COMPARE_EQUAL_STRING_[i + 1]);
}
}
for (int i = 0; i < COMPARE_EQUAL_INT_.length - 1; i++) {
VersionInfo v1 = getInstance(COMPARE_EQUAL_INT_[i]);
VersionInfo v2 = getInstance(COMPARE_EQUAL_INT_[i + 1]);
if (v1.compareTo(v2) != 0) {
errln(Arrays.toString(COMPARE_EQUAL_INT_[i]) + " should equal " + Arrays.toString(COMPARE_EQUAL_INT_[i + 1]));
}
}
for (int i = 0; i < COMPARE_LESS_.length - 1; i++) {
VersionInfo v1 = VersionInfo.getInstance(COMPARE_LESS_[i]);
VersionInfo v2 = VersionInfo.getInstance(COMPARE_LESS_[i + 1]);
if (v1.compareTo(v2) >= 0) {
errln(COMPARE_LESS_[i] + " should be less than " + COMPARE_LESS_[i + 1]);
}
if (v2.compareTo(v1) <= 0) {
errln(COMPARE_LESS_[i + 1] + " should be greater than " + COMPARE_LESS_[i]);
}
}
}
Aggregations