mirror of https://github.com/apache/lucene.git
LUCENE-10010: fix TestMockAnalyzer to determinize
Test would randomly fail, if RegExp parsing returned an NFA, because it wasn't explicitly determinizing itself. This is a bit of a trap in RegExp, it calls minimize()-as-it-parses, so at least most of the time, it returns a DFA. This may be unnecessary...
This commit is contained in:
parent
c8f5b9127d
commit
a39337e595
|
@ -35,6 +35,7 @@ import org.apache.lucene.index.TermsEnum;
|
|||
import org.apache.lucene.util.BytesRef;
|
||||
import org.apache.lucene.util.TestUtil;
|
||||
import org.apache.lucene.util.automaton.Automata;
|
||||
import org.apache.lucene.util.automaton.Automaton;
|
||||
import org.apache.lucene.util.automaton.AutomatonTestUtil;
|
||||
import org.apache.lucene.util.automaton.CharacterRunAutomaton;
|
||||
import org.apache.lucene.util.automaton.Operations;
|
||||
|
@ -221,8 +222,11 @@ public class TestMockAnalyzer extends BaseTokenStreamTestCase {
|
|||
public void testRandomRegexps() throws Exception {
|
||||
int iters = TEST_NIGHTLY ? atLeast(30) : atLeast(1);
|
||||
for (int i = 0; i < iters; i++) {
|
||||
final CharacterRunAutomaton dfa =
|
||||
new CharacterRunAutomaton(AutomatonTestUtil.randomAutomaton(random()));
|
||||
Automaton automaton =
|
||||
Operations.determinize(
|
||||
AutomatonTestUtil.randomAutomaton(random()),
|
||||
Operations.DEFAULT_DETERMINIZE_WORK_LIMIT);
|
||||
final CharacterRunAutomaton dfa = new CharacterRunAutomaton(automaton);
|
||||
final boolean lowercase = random().nextBoolean();
|
||||
final int limit = TestUtil.nextInt(random(), 0, 500);
|
||||
Analyzer a =
|
||||
|
|
Loading…
Reference in New Issue