lucenenet-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From synhers...@apache.org
Subject [2/3] lucenenet git commit: use proper random.next
Date Tue, 05 May 2015 17:44:17 GMT
use proper random.next


Project: http://git-wip-us.apache.org/repos/asf/lucenenet/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucenenet/commit/b22388e1
Tree: http://git-wip-us.apache.org/repos/asf/lucenenet/tree/b22388e1
Diff: http://git-wip-us.apache.org/repos/asf/lucenenet/diff/b22388e1

Branch: refs/heads/master
Commit: b22388e19134b1d263cf3aa702f63e7f35a62d8f
Parents: 784eba7
Author: Laimonas Simutis <laimis@gmail.com>
Authored: Mon May 4 21:50:00 2015 -0400
Committer: Laimonas Simutis <laimis@gmail.com>
Committed: Mon May 4 21:50:00 2015 -0400

----------------------------------------------------------------------
 .../Index/BaseStoredFieldsFormatTestCase.cs               | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucenenet/blob/b22388e1/src/Lucene.Net.TestFramework/Index/BaseStoredFieldsFormatTestCase.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.TestFramework/Index/BaseStoredFieldsFormatTestCase.cs b/src/Lucene.Net.TestFramework/Index/BaseStoredFieldsFormatTestCase.cs
index 943bb86..6f202a5 100644
--- a/src/Lucene.Net.TestFramework/Index/BaseStoredFieldsFormatTestCase.cs
+++ b/src/Lucene.Net.TestFramework/Index/BaseStoredFieldsFormatTestCase.cs
@@ -475,7 +475,7 @@ namespace Lucene.Net.Index
             AtomicReference<Exception> ex = new AtomicReference<Exception>();
             for (int i = 0; i < concurrentReads; ++i)
             {
-                readThreads.Add(new ThreadAnonymousInnerClassHelper(this, numDocs, rd, searcher,
readsPerThread, ex, i));
+                readThreads.Add(new ThreadAnonymousInnerClassHelper(numDocs, rd, searcher,
readsPerThread, ex, i));
             }
             foreach (ThreadClass thread in readThreads)
             {
@@ -497,8 +497,6 @@ namespace Lucene.Net.Index
 
         private class ThreadAnonymousInnerClassHelper : ThreadClass
         {
-            private readonly BaseStoredFieldsFormatTestCase OuterInstance;
-
             private int NumDocs;
             private readonly DirectoryReader Rd;
             private readonly IndexSearcher Searcher;
@@ -507,9 +505,8 @@ namespace Lucene.Net.Index
             private int i;
             private readonly int[] queries;
 
-            public ThreadAnonymousInnerClassHelper(BaseStoredFieldsFormatTestCase outerInstance,
int numDocs, DirectoryReader rd, IndexSearcher searcher, int readsPerThread, AtomicReference<Exception>
ex, int i)
+            public ThreadAnonymousInnerClassHelper(int numDocs, DirectoryReader rd, IndexSearcher
searcher, int readsPerThread, AtomicReference<Exception> ex, int i)
             {
-                this.OuterInstance = outerInstance;
                 this.NumDocs = numDocs;
                 this.Rd = rd;
                 this.Searcher = searcher;
@@ -520,7 +517,7 @@ namespace Lucene.Net.Index
                 queries = new int[ReadsPerThread];
                 for (int j = 0; j < queries.Length; ++j)
                 {
-                    queries[j] = Random().NextIntBetween(0, NumDocs);
+                    queries[j] = Random().Next(NumDocs);
                 }
             }
 
@@ -534,6 +531,7 @@ namespace Lucene.Net.Index
                         TopDocs topDocs = Searcher.Search(query, 1);
                         if (topDocs.TotalHits != 1)
                         {
+                            Console.WriteLine(query);
                             throw new InvalidOperationException("Expected 1 hit, got " +
topDocs.TotalHits);
                         }
                         Document sdoc = Rd.Document(topDocs.ScoreDocs[0].Doc);


Mime
View raw message