* Test that the comparison works
*/
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(COMPARE_NOT_EQUAL_INT_[i] + " should not equal " +
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(COMPARE_EQUAL_INT_[i] + " should equal " +
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]);
}
}
}