mirror of https://github.com/apache/lucene.git
LUCENE-6365: fix test to not add duplicate strings
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1689404 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
4d8127f437
commit
f0b550a092
|
@ -33,6 +33,9 @@ import java.util.BitSet;
|
|||
* <p>Be aware that the iteration order is implementation dependent
|
||||
* and may change across releases.
|
||||
*
|
||||
* <p>If the automaton is not determinized then it's possible this iterator
|
||||
* will return duplicates.
|
||||
*
|
||||
* @lucene.experimental
|
||||
*/
|
||||
public class FiniteStringsIterator {
|
||||
|
|
|
@ -47,11 +47,12 @@ public class FiniteStringsIteratorTest extends LuceneTestCase {
|
|||
IntsRefBuilder scratch = new IntsRefBuilder();
|
||||
for(int i=0;i<numStrings;i++) {
|
||||
String s = TestUtil.randomSimpleString(random(), 1, 200);
|
||||
automata.add(Automata.makeString(s));
|
||||
Util.toUTF32(s.toCharArray(), 0, s.length(), scratch);
|
||||
strings.add(scratch.toIntsRef());
|
||||
if (VERBOSE) {
|
||||
System.out.println(" add string=" + s);
|
||||
if (strings.add(scratch.toIntsRef())) {
|
||||
automata.add(Automata.makeString(s));
|
||||
if (VERBOSE) {
|
||||
System.out.println(" add string=" + s);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue