lucenenet-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From synhers...@apache.org
Subject [1/3] git commit: Various
Date Mon, 07 Apr 2014 22:08:28 GMT
Repository: lucenenet
Updated Branches:
  refs/heads/branch_4x da25f85ac -> f1fbbd9f1


Various


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

Branch: refs/heads/branch_4x
Commit: 5ecbe9260500686e9ccf53849e1a930076007b44
Parents: da25f85
Author: synhershko <itamar@code972.com>
Authored: Tue Apr 8 01:07:23 2014 +0300
Committer: synhershko <itamar@code972.com>
Committed: Tue Apr 8 01:07:23 2014 +0300

----------------------------------------------------------------------
 src/core/Support/Character.cs                   | 19 +++++
 test/core/Document/TestDocument.cs              |  2 +-
 test/test-framework/LuceneTestCase.cs           | 76 ++++++++++++--------
 .../Randomized/RandomizedContext.cs             |  4 +-
 4 files changed, 66 insertions(+), 35 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucenenet/blob/5ecbe926/src/core/Support/Character.cs
----------------------------------------------------------------------
diff --git a/src/core/Support/Character.cs b/src/core/Support/Character.cs
index 3575b7f..d870f38 100644
--- a/src/core/Support/Character.cs
+++ b/src/core/Support/Character.cs
@@ -45,6 +45,8 @@ namespace Lucene.Net.Support
         public const char MIN_HIGH_SURROGATE = '\uD800';
         public const char MAX_HIGH_SURROGATE = '\uDBFF';
 
+        public static int MIN_SUPPLEMENTARY_CODE_POINT = 0x010000;
+
         /// <summary>
         /// 
         /// </summary>
@@ -80,6 +82,23 @@ namespace Lucene.Net.Support
             return 1; // always 1 char written in .NET
         }
 
+        public static char[] ToChars(int codePoint)
+        {
+            // .NET Port: we don't have to do anything funky with surrogates here. chars
are always UTF-16.           
+            return new[] {(char)codePoint};
+        }
+
+        public static int ToCodePoint(char high, char low)
+        {
+            // Optimized form of:
+            // return ((high - MIN_HIGH_SURROGATE) << 10)
+            //         + (low - MIN_LOW_SURROGATE)
+            //         + MIN_SUPPLEMENTARY_CODE_POINT;
+            return ((high << 10) + low) + (MIN_SUPPLEMENTARY_CODE_POINT
+                                           - (MIN_HIGH_SURROGATE << 10)
+                                           - MIN_LOW_SURROGATE);
+        }
+
         public static int ToLowerCase(int codePoint)
         {
             // .NET Port: chars are always UTF-16 in .NET

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/5ecbe926/test/core/Document/TestDocument.cs
----------------------------------------------------------------------
diff --git a/test/core/Document/TestDocument.cs b/test/core/Document/TestDocument.cs
index f232b9a..bf99159 100644
--- a/test/core/Document/TestDocument.cs
+++ b/test/core/Document/TestDocument.cs
@@ -148,7 +148,7 @@ namespace Lucene.Net.Documents
 		/// </summary>
 		/// <throws>  Exception on error </throws>
 		[Test]
-		public virtual void  TestGetValuesForNewDocument()
+		public virtual void testGetValuesForNewDocument()
 		{
 			doAssert(makeDocumentWithFields(), false);
 		}

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/5ecbe926/test/test-framework/LuceneTestCase.cs
----------------------------------------------------------------------
diff --git a/test/test-framework/LuceneTestCase.cs b/test/test-framework/LuceneTestCase.cs
index 9d14d52..dc0bcd4 100644
--- a/test/test-framework/LuceneTestCase.cs
+++ b/test/test-framework/LuceneTestCase.cs
@@ -16,6 +16,9 @@
  */
 
 using System;
+using Lucene.Net.Analysis;
+using Lucene.Net.Index;
+using Lucene.Net.Randomized;
 using Lucene.Net.Util;
 using NUnit.Framework;
 
@@ -27,6 +30,7 @@ using System.Collections.Generic;
 using Lucene.Net.Search;
 
 using Lucene.Net.TestFramework;
+using Version = Lucene.Net.Util.Version;
 
 namespace Lucene.Net
 {
@@ -69,7 +73,7 @@ namespace Lucene.Net
         private const string SYSPROP_FAILFAST = "tests.failfast";
 
 
-     
+
 
         public static readonly Util.Version TEST_VERSION_CURRENT = Util.Version.LUCENE_43;
 
@@ -85,17 +89,20 @@ namespace Lucene.Net
 
         public static readonly string TEST_CODEC = SystemProperties.GetProperty("tests.codec",
"random");
 
-        public static readonly string TEST_DOCVALUESFORMAT = SystemProperties.GetProperty("tests.docvaluesformat",
"random");
+        public static readonly string TEST_DOCVALUESFORMAT = SystemProperties.GetProperty("tests.docvaluesformat",
+            "random");
 
         public static readonly string TEST_DIRECTORY = SystemProperties.GetProperty("tests.directory",
"random");
 
-        public static readonly string TEST_LINE_DOCS_FILE = SystemProperties.GetProperty("tests.linedocsfile",
DEFAULT_LINE_DOCS_FILE);
+        public static readonly string TEST_LINE_DOCS_FILE = SystemProperties.GetProperty("tests.linedocsfile",
+            DEFAULT_LINE_DOCS_FILE);
 
         public static readonly bool TEST_NIGHTLY = RandomizedTest.SystemPropertyAsBoolean(NightlyAttribute.KEY,
false);
 
         public static readonly bool TEST_WEEKLY = RandomizedTest.SystemPropertyAsBoolean(WeeklyAttribute.KEY,
false);
 
-        public static readonly bool TEST_AWAITSFIX = RandomizedTest.SystemPropertyAsBoolean(AwaitsFixAttribute.KEY,
false);
+        public static readonly bool TEST_AWAITSFIX = RandomizedTest.SystemPropertyAsBoolean(AwaitsFixAttribute.KEY,
+            false);
 
         public static readonly bool TEST_SLOW = RandomizedTest.SystemPropertyAsBoolean(SlowAttribute.KEY,
false);
 
@@ -107,7 +114,8 @@ namespace Lucene.Net
         {
             String s = SystemProperties.GetProperty("tempDir", System.IO.Path.GetTempPath());
             if (s == null)
-                throw new SystemException("To run tests, you need to define system property
'tempDir' or 'java.io.tmpdir'.");
+                throw new SystemException(
+                    "To run tests, you need to define system property 'tempDir' or 'java.io.tmpdir'.");
 
             TEMP_DIR = new System.IO.DirectoryInfo(s);
             if (!TEMP_DIR.Exists) TEMP_DIR.Create();
@@ -115,18 +123,20 @@ namespace Lucene.Net
             CORE_DIRECTORIES = new List<string>(FS_DIRECTORIES);
             CORE_DIRECTORIES.Add("RAMDirectory");
 
-            
+
         }
 
-        private static readonly string[] IGNORED_INVARIANT_PROPERTIES = {
+        private static readonly string[] IGNORED_INVARIANT_PROPERTIES =
+        {
             "user.timezone", "java.rmi.server.randomIDs"
         };
 
-        private static readonly IList<String> FS_DIRECTORIES = new[] {
-            "SimpleFSDirectory",
-            "NIOFSDirectory",
-            "MMapDirectory"
-        };
+        private static readonly IList<String> FS_DIRECTORIES = new[]
+                                                               {
+                                                                   "SimpleFSDirectory",
+                                                                   "NIOFSDirectory",
+                                                                   "MMapDirectory"
+                                                               };
 
         private static readonly IList<String> CORE_DIRECTORIES;
 
@@ -136,17 +146,18 @@ namespace Lucene.Net
         //  CORE_DIRECTORIES.add("RAMDirectory");
         //};
 
-        protected static readonly ISet<String> doesntSupportOffsets = new HashSet<String>(new[]
{
-            "Lucene3x",
-            "MockFixedIntBlock",
-            "MockVariableIntBlock",
-            "MockSep",
-            "MockRandom"
-        });
+        protected static readonly ISet<String> doesntSupportOffsets = new HashSet<String>(new[]
+                                                                                        
 {
+                                                                                        
     "Lucene3x",
+                                                                                        
     "MockFixedIntBlock",
+                                                                                        
     "MockVariableIntBlock",
+                                                                                        
     "MockSep",
+                                                                                        
     "MockRandom"
+                                                                                        
 });
 
         public void Test()
         {
-            
+
         }
 
         public static bool PREFLEX_IMPERSONATION_IS_ACTIVE;
@@ -160,7 +171,7 @@ namespace Lucene.Net
 
         //internal static readonly TestRuleIgnoreAfterMaxFailures ignoreAfterMaxFailures;
 
-        private const long STATIC_LEAK_THRESHOLD = 10 * 1024 * 1024;
+        private const long STATIC_LEAK_THRESHOLD = 10*1024*1024;
 
         //private static readonly ISet<String> STATIC_LEAK_IGNORED_TYPES =
         //    new HashSet<String>(new[] {
@@ -223,7 +234,7 @@ namespace Lucene.Net
         {
         }
 
-        
+
 
         public LuceneTestCase(System.String name)
         {
@@ -317,7 +328,8 @@ namespace Lucene.Net
                 catch (System.SystemException e)
                 {
                     System.IO.StreamWriter temp_writer;
-                    temp_writer = new System.IO.StreamWriter(System.Console.OpenStandardError(),
System.Console.Error.Encoding);
+                    temp_writer = new System.IO.StreamWriter(System.Console.OpenStandardError(),
+                        System.Console.Error.Encoding);
                     temp_writer.AutoFlush = true;
                     DumpArray(msg + ": FieldCache", entries, temp_writer);
                     throw e;
@@ -334,7 +346,8 @@ namespace Lucene.Net
                 if (null != insanity)
                 {
                     System.IO.StreamWriter temp_writer2;
-                    temp_writer2 = new System.IO.StreamWriter(System.Console.OpenStandardError(),
System.Console.Error.Encoding);
+                    temp_writer2 = new System.IO.StreamWriter(System.Console.OpenStandardError(),
+                        System.Console.Error.Encoding);
                     temp_writer2.AutoFlush = true;
                     DumpArray(msg + ": Insane FieldCache usage(s)", insanity, temp_writer2);
                 }
@@ -348,7 +361,8 @@ namespace Lucene.Net
         /// </param>
         /// <param name="stream">Stream to log messages to.
         /// </param>
-        public static void DumpIterator(System.String label, System.Collections.IEnumerator
iter, System.IO.StreamWriter stream)
+        public static void DumpIterator(System.String label, System.Collections.IEnumerator
iter,
+            System.IO.StreamWriter stream)
         {
             stream.WriteLine("*** BEGIN " + label + " ***");
             if (null == iter)
@@ -370,7 +384,9 @@ namespace Lucene.Net
         /// </seealso>
         public static void DumpArray(System.String label, System.Object[] objs, System.IO.StreamWriter
stream)
         {
-            System.Collections.IEnumerator iter = (null == objs) ? null : new System.Collections.ArrayList(objs).GetEnumerator();
+            System.Collections.IEnumerator iter = (null == objs)
+                ? null
+                : new System.Collections.ArrayList(objs).GetEnumerator();
             DumpIterator(label, iter, stream);
         }
 
@@ -403,14 +419,12 @@ namespace Lucene.Net
         }
 
         // recorded seed
-        [NonSerialized]
-        protected internal int? seed = null;
+        [NonSerialized] protected internal int? seed = null;
         //protected internal bool seed_init = false;
 
         // static members
-        [NonSerialized]
-        private static readonly System.Random seedRnd = new System.Random();
-             
+        [NonSerialized] private static readonly System.Random seedRnd = new System.Random();
+
 
         protected static void Ok(bool condition, string message = null)
         {

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/5ecbe926/test/test-framework/Randomized/RandomizedContext.cs
----------------------------------------------------------------------
diff --git a/test/test-framework/Randomized/RandomizedContext.cs b/test/test-framework/Randomized/RandomizedContext.cs
index 1eb6365..6823229 100644
--- a/test/test-framework/Randomized/RandomizedContext.cs
+++ b/test/test-framework/Randomized/RandomizedContext.cs
@@ -17,8 +17,6 @@
 
 using System;
 using System.Collections.Generic;
-using System.Linq;
-using System.Text;
 using System.Threading;
 using Lucene.Net.Support;
 
@@ -74,7 +72,7 @@ namespace Lucene.Net.Randomized
             this.runner = runner; 
         }
 
-
+        public static RandomizedContext Current { get { return Context(Thread.CurrentThread);
} }
 
         private static RandomizedContext Context(Thread thread)
         {


Mime
View raw message