LUCENE-6046: remove det state limit for all AutomatonTestUtil.randomAutomaton since they can become biggish

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1637078 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Michael McCandless 2014-11-06 11:16:58 +00:00
parent 4162890bb6
commit 3f25caefc3
5 changed files with 12 additions and 14 deletions

View File

@ -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() {

View File

@ -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)));
}
}

View File

@ -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));
}

View File

@ -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();

View File

@ -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 BaseIndexFileFormatTest
for(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;