lucenenet-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From synhers...@apache.org
Subject lucenenet git commit: Random() needs to be initialized once per test
Date Sun, 08 Feb 2015 10:02:37 GMT
Repository: lucenenet
Updated Branches:
  refs/heads/master b7108d486 -> b8ec924c0


Random() needs to be initialized once per test

Closes #85 (hopefully fixing it too)


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

Branch: refs/heads/master
Commit: b8ec924c080d0b577619b9f259d6c323a4532801
Parents: b7108d4
Author: Itamar Syn-Hershko <itamar@code972.com>
Authored: Sun Feb 8 12:02:19 2015 +0200
Committer: Itamar Syn-Hershko <itamar@code972.com>
Committed: Sun Feb 8 12:02:19 2015 +0200

----------------------------------------------------------------------
 src/Lucene.Net.TestFramework/Randomized/RandomizedContext.cs | 2 +-
 src/Lucene.Net.TestFramework/Util/LuceneTestCase.cs          | 5 ++++-
 2 files changed, 5 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucenenet/blob/b8ec924c/src/Lucene.Net.TestFramework/Randomized/RandomizedContext.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.TestFramework/Randomized/RandomizedContext.cs b/src/Lucene.Net.TestFramework/Randomized/RandomizedContext.cs
index 7156915..0f3f6b8 100644
--- a/src/Lucene.Net.TestFramework/Randomized/RandomizedContext.cs
+++ b/src/Lucene.Net.TestFramework/Randomized/RandomizedContext.cs
@@ -64,6 +64,7 @@ namespace Lucene.Net.Randomized
             }
         }
 
+        // LUCENENET TODO
         /*public Random Random
         {
             get { return this.Randomness.Random; }
@@ -167,7 +168,6 @@ namespace Lucene.Net.Randomized
 
         public void Dispose()
         {
-            throw new NotImplementedException();
         }
     }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/b8ec924c/src/Lucene.Net.TestFramework/Util/LuceneTestCase.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.TestFramework/Util/LuceneTestCase.cs b/src/Lucene.Net.TestFramework/Util/LuceneTestCase.cs
index c23e659..ed0a17d 100644
--- a/src/Lucene.Net.TestFramework/Util/LuceneTestCase.cs
+++ b/src/Lucene.Net.TestFramework/Util/LuceneTestCase.cs
@@ -607,10 +607,13 @@ namespace Lucene.Net.Util
         /// </summary>
         public static Random Random()
         {
-            return new Random();
+            return _random ?? (_random = new Random( /* LUCENENET TODO seed */));
             //return RandomizedContext.Current.Random;
         }
 
+        [ThreadStatic]
+        private static Random _random;
+
         /// <summary>
         /// Registers a <seealso cref="IDisposable"/> resource that should be closed
after the test
         /// completes.


Mime
View raw message