add a small test to TestVersion to confirm we handle non-floating-point release numbers correctly

This commit is contained in:
Mike McCandless 2021-09-09 10:43:48 -04:00
parent cc58c51941
commit 42242b1745
1 changed files with 13 additions and 0 deletions

View File

@ -236,6 +236,19 @@ public class TestVersion extends LuceneTestCase {
assertTrue(atLeastOne);
}
public void testNonFloatingPointCompliantVersionNumbers() throws ParseException {
Version version800 = Version.parse("8.0.0");
assertTrue(Version.parse("8.10.0").onOrAfter(version800));
assertTrue(Version.parse("8.10.0").onOrAfter(Version.parse("8.9.255")));
assertTrue(Version.parse("8.128.0").onOrAfter(version800));
assertTrue(Version.parse("8.255.0").onOrAfter(version800));
Version version400 = Version.parse("4.0.0");
assertTrue(version800.onOrAfter(version400));
assertTrue(Version.parse("8.128.0").onOrAfter(version400));
assertFalse(version400.onOrAfter(version800));
}
public void testLatestVersionCommonBuild() {
// common-build.xml sets 'tests.LUCENE_VERSION', if not, we skip this test!
String commonBuildVersion = System.getProperty("tests.LUCENE_VERSION");