lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mikemcc...@apache.org
Subject svn commit: r967135 - /lucene/dev/branches/preflexfixes/lucene/src/test/org/apache/lucene/search/TestRegexpRandom2.java
Date Fri, 23 Jul 2010 15:32:33 GMT
Author: mikemccand
Date: Fri Jul 23 15:32:33 2010
New Revision: 967135

URL: http://svn.apache.org/viewvc?rev=967135&view=rev
Log:
LUCENE-2554: add some verbosity to TRR2

Modified:
    lucene/dev/branches/preflexfixes/lucene/src/test/org/apache/lucene/search/TestRegexpRandom2.java

Modified: lucene/dev/branches/preflexfixes/lucene/src/test/org/apache/lucene/search/TestRegexpRandom2.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/preflexfixes/lucene/src/test/org/apache/lucene/search/TestRegexpRandom2.java?rev=967135&r1=967134&r2=967135&view=diff
==============================================================================
--- lucene/dev/branches/preflexfixes/lucene/src/test/org/apache/lucene/search/TestRegexpRandom2.java
(original)
+++ lucene/dev/branches/preflexfixes/lucene/src/test/org/apache/lucene/search/TestRegexpRandom2.java
Fri Jul 23 15:32:33 2010
@@ -19,6 +19,9 @@ package org.apache.lucene.search;
 
 import java.io.IOException;
 import java.util.Random;
+import java.util.Collections;
+import java.util.List;
+import java.util.ArrayList;
 
 import org.apache.lucene.analysis.MockAnalyzer;
 import org.apache.lucene.analysis.MockTokenizer;
@@ -53,6 +56,7 @@ public class TestRegexpRandom2 extends L
   @Override
   protected void setUp() throws Exception {
     super.setUp();
+    // nocommit seed
     random = newRandom();
     dir = new MockRAMDirectory();
     // TODO: fix mocktokenizer to not extend chartokenizer, so you can have an 'empty' keyword.
@@ -64,11 +68,23 @@ public class TestRegexpRandom2 extends L
     Document doc = new Document();
     Field field = new Field("field", "", Field.Store.NO, Field.Index.ANALYZED);
     doc.add(field);
-
+    List<String> terms = new ArrayList<String>();
     for (int i = 0; i < 2000*_TestUtil.getRandomMultiplier(); i++) {
-      field.setValue(_TestUtil.randomUnicodeString(random));
+      String s = _TestUtil.randomUnicodeString(random);
+      field.setValue(s);
+      terms.add(s);
       writer.addDocument(doc);
     }
+
+    if (VERBOSE) {
+      // utf16 order
+      Collections.sort(terms);
+      System.out.println("UTF16 order:");
+      for(String s : terms) {
+        System.out.println("  " + UnicodeUtil.toHexString(s));
+      }
+    }
+    
     reader = writer.getReader();
     searcher = new IndexSearcher(reader);
     writer.close();
@@ -122,8 +138,11 @@ public class TestRegexpRandom2 extends L
   
   /** test a bunch of random regular expressions */
   public void testRegexps() throws Exception {
-      for (int i = 0; i < 1000*_TestUtil.getRandomMultiplier(); i++)
-        assertSame(AutomatonTestUtil.randomRegexp(random).toString());
+
+    for (int i = 0; i < 1000*_TestUtil.getRandomMultiplier(); i++) {
+      String reg = AutomatonTestUtil.randomRegexp(random).toString();
+      assertSame(reg);
+    }
   }
   
   /** check that the # of hits is the same as from a very



Mime
View raw message