use of android.icu.util.VersionInfo in project j2objc by google.
the class VersionInfoTest method TestComparable.
/**
* Test Comparable interface
*/
@Test
public void TestComparable() {
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_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]);
}
}
}
use of android.icu.util.VersionInfo in project j2objc by google.
the class UCharacterTest method TestGetAge.
/**
* Testing getAge
*/
@Test
public void TestGetAge() {
int[] ages = { 0x41, 1, 1, 0, 0, 0xffff, 1, 1, 0, 0, 0x20ab, 2, 0, 0, 0, 0x2fffe, 2, 0, 0, 0, 0x20ac, 2, 1, 0, 0, 0xfb1d, 3, 0, 0, 0, 0x3f4, 3, 1, 0, 0, 0x10300, 3, 1, 0, 0, 0x220, 3, 2, 0, 0, 0xff60, 3, 2, 0, 0 };
for (int i = 0; i < ages.length; i += 5) {
VersionInfo age = UCharacter.getAge(ages[i]);
if (age != VersionInfo.getInstance(ages[i + 1], ages[i + 2], ages[i + 3], ages[i + 4])) {
errln("error: getAge(\\u" + Integer.toHexString(ages[i]) + ") == " + age.toString() + " instead of " + ages[i + 1] + "." + ages[i + 2] + "." + ages[i + 3] + "." + 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]);
} catch (Exception e) {
errln("UCharacter.getAge(int) was not suppose to have " + "an exception. Value passed: " + valid_tests[i]);
}
}
for (int i = 0; i < invalid_tests.length; i++) {
try {
UCharacter.getAge(invalid_tests[i]);
errln("UCharacter.getAge(int) was suppose to have " + "an exception. Value passed: " + invalid_tests[i]);
} catch (Exception e) {
}
}
}
Aggregations