You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by mi...@apache.org on 2021/09/09 14:43:56 UTC

[lucene] branch main updated: add a small test to TestVersion to confirm we handle non-floating-point release numbers correctly

This is an automated email from the ASF dual-hosted git repository.

mikemccand pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/lucene.git


The following commit(s) were added to refs/heads/main by this push:
     new 42242b1  add a small test to TestVersion to confirm we handle non-floating-point release numbers correctly
42242b1 is described below

commit 42242b1745d7499b827f4bfb052f4f3ce7823266
Author: Mike McCandless <mi...@apache.org>
AuthorDate: Thu Sep 9 10:43:48 2021 -0400

    add a small test to TestVersion to confirm we handle non-floating-point release numbers correctly
---
 .../core/src/test/org/apache/lucene/util/TestVersion.java   | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/lucene/core/src/test/org/apache/lucene/util/TestVersion.java b/lucene/core/src/test/org/apache/lucene/util/TestVersion.java
index ef02aaf..24bcb44 100644
--- a/lucene/core/src/test/org/apache/lucene/util/TestVersion.java
+++ b/lucene/core/src/test/org/apache/lucene/util/TestVersion.java
@@ -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");