Apache Lucene open-source search software
LUCENE-6046: remove det state limit for all AutomatonTestUtil.randomAutomaton since they can become biggish
Michael McCandless3f25caefc3fa
diff --git a/lucene/core/src/test/org/apache/lucene/analysis/TestMockAnalyzer.java b/lucene/core/src/test/org/apache/lucene/analysis/TestMockAnalyzer.javaindex 1e4d1df3ce6..0bc7f087c86 100644--- a/lucene/core/src/test/org/apache/lucene/analysis/TestMockAnalyzer.java+++ b/lucene/core/src/test/org/apache/lucene/analysis/TestMockAnalyzer.java@@ -232,7 +232,7 @@ public class TestMockAnalyzer extends BaseTokenStreamTestCase {public void testRandomRegexps() throws Exception {int iters = atLeast(30);for (int i = 0; i < iters; i++) {- final CharacterRunAutomaton dfa = new CharacterRunAutomaton(AutomatonTestUtil.randomAutomaton(random()));+ final CharacterRunAutomaton dfa = new CharacterRunAutomaton(AutomatonTestUtil.randomAutomaton(random()), Integer.MAX_VALUE);final boolean lowercase = random().nextBoolean();final int limit = TestUtil.nextInt(random(), 0, 500);Analyzer a = new Analyzer() {diff --git a/lucene/core/src/test/org/apache/lucene/util/automaton/TestAutomaton.java b/lucene/core/src/test/org/apache/lucene/util/automaton/TestAutomaton.javaindex 2c7853f05ee..ba269fc3eee 100644--- a/lucene/core/src/test/org/apache/lucene/util/automaton/TestAutomaton.java+++ b/lucene/core/src/test/org/apache/lucene/util/automaton/TestAutomaton.java@@ -260,8 +260,8 @@ public class TestAutomaton extends LuceneTestCase {Automaton ra = Operations.reverse(a);Automaton rra = Operations.reverse(ra);assertTrue(Operations.sameLanguage(- Operations.determinize(Operations.removeDeadStates(a), DEFAULT_MAX_DETERMINIZED_STATES),- Operations.determinize(Operations.removeDeadStates(rra), DEFAULT_MAX_DETERMINIZED_STATES)));+ Operations.determinize(Operations.removeDeadStates(a), Integer.MAX_VALUE),+ Operations.determinize(Operations.removeDeadStates(rra), Integer.MAX_VALUE)));}}@@ -274,7 +274,7 @@ public class TestAutomaton extends LuceneTestCase {a = Operations.removeDeadStates(a);}Automaton ra = Operations.reverse(a);- Automaton rda = Operations.determinize(ra, DEFAULT_MAX_DETERMINIZED_STATES);+ Automaton rda = Operations.determinize(ra, Integer.MAX_VALUE);if (Operations.isEmpty(a)) {assertTrue(Operations.isEmpty(rda));@@ -362,9 +362,9 @@ public class TestAutomaton extends LuceneTestCase {}assertTrue(Operations.sameLanguage(- Operations.determinize(Operations.removeDeadStates(a), DEFAULT_MAX_DETERMINIZED_STATES),+ Operations.determinize(Operations.removeDeadStates(a), Integer.MAX_VALUE),Operations.determinize(Operations.removeDeadStates(builder.finish()),- DEFAULT_MAX_DETERMINIZED_STATES)));+ Integer.MAX_VALUE)));}}diff --git a/lucene/core/src/test/org/apache/lucene/util/automaton/TestDeterminism.java b/lucene/core/src/test/org/apache/lucene/util/automaton/TestDeterminism.javaindex a1fbeea2ba9..4a46c88e5ee 100644--- a/lucene/core/src/test/org/apache/lucene/util/automaton/TestDeterminism.java+++ b/lucene/core/src/test/org/apache/lucene/util/automaton/TestDeterminism.java@@ -41,7 +41,7 @@ public class TestDeterminism extends LuceneTestCase {for (int i = 0; i < num; i++) {Automaton a = AutomatonTestUtil.randomAutomaton(random());a = AutomatonTestUtil.determinizeSimple(a);- Automaton b = Operations.determinize(a, DEFAULT_MAX_DETERMINIZED_STATES);+ Automaton b = Operations.determinize(a, Integer.MAX_VALUE);// TODO: more verifications possible?assertTrue(Operations.sameLanguage(a, b));}diff --git a/lucene/core/src/test/org/apache/lucene/util/automaton/TestMinimize.java b/lucene/core/src/test/org/apache/lucene/util/automaton/TestMinimize.javaindex a6c860d2186..5dd5a9cc1d0 100644--- a/lucene/core/src/test/org/apache/lucene/util/automaton/TestMinimize.java+++ b/lucene/core/src/test/org/apache/lucene/util/automaton/TestMinimize.java@@ -19,8 +19,6 @@ package org.apache.lucene.util.automaton;import org.apache.lucene.util.LuceneTestCase;-import static org.apache.lucene.util.automaton.Operations.DEFAULT_MAX_DETERMINIZED_STATES;-/*** This test builds some randomish NFA/DFA and minimizes them.*/@@ -31,9 +29,9 @@ public class TestMinimize extends LuceneTestCase {for (int i = 0; i < num; i++) {Automaton a = AutomatonTestUtil.randomAutomaton(random());Automaton la = Operations.determinize(Operations.removeDeadStates(a),- DEFAULT_MAX_DETERMINIZED_STATES);+ Integer.MAX_VALUE);Automaton lb = MinimizationOperations.minimize(a,- DEFAULT_MAX_DETERMINIZED_STATES);+ Integer.MAX_VALUE);assertTrue(Operations.sameLanguage(la, lb));}}@@ -47,7 +45,7 @@ public class TestMinimize extends LuceneTestCase {Automaton a = AutomatonTestUtil.randomAutomaton(random());a = AutomatonTestUtil.minimizeSimple(a);Automaton b = MinimizationOperations.minimize(a,- DEFAULT_MAX_DETERMINIZED_STATES);+ Integer.MAX_VALUE);assertTrue(Operations.sameLanguage(a, b));assertEquals(a.getNumStates(), b.getNumStates());int numStates = a.getNumStates();diff --git a/lucene/test-framework/src/java/org/apache/lucene/index/BasePostingsFormatTestCase.java b/lucene/test-framework/src/java/org/apache/lucene/index/BasePostingsFormatTestCase.javaindex b6be6f22d7b..5d33f44b671 100644--- a/lucene/test-framework/src/java/org/apache/lucene/index/BasePostingsFormatTestCase.java+++ b/lucene/test-framework/src/java/org/apache/lucene/index/BasePostingsFormatTestCase.java@@ -60,8 +60,8 @@ import org.apache.lucene.util.TestUtil;import org.apache.lucene.util.UnicodeUtil;import org.apache.lucene.util.Version;import org.apache.lucene.util.automaton.Automaton;-import org.apache.lucene.util.automaton.AutomatonTestUtil.RandomAcceptedStrings;import org.apache.lucene.util.automaton.AutomatonTestUtil;+import org.apache.lucene.util.automaton.AutomatonTestUtil.RandomAcceptedStrings;import org.apache.lucene.util.automaton.CompiledAutomaton;import org.junit.AfterClass;import org.junit.BeforeClass;@@ -1247,7 +1247,7 @@ public abstract class BasePostingsFormatTestCase extends BaseIndexFileFormatTestfor(String field : fields.keySet()) {while (true) {Automaton a = AutomatonTestUtil.randomAutomaton(random());- CompiledAutomaton ca = new CompiledAutomaton(a);+ CompiledAutomaton ca = new CompiledAutomaton(a, null, true, Integer.MAX_VALUE);if (ca.type != CompiledAutomaton.AUTOMATON_TYPE.NORMAL) {// Keep retrying until we get an A that will really "use" the PF's intersect code:continue;