You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucenenet.apache.org by sy...@apache.org on 2016/09/01 14:40:07 UTC

[46/52] [abbrv] lucenenet git commit: Ported Analysis.Core.TestRandomChains and moved the CheckThatYouDidntReadAnythingReaderWrapper back into that class from TestBugInSomething.

Ported Analysis.Core.TestRandomChains and moved the CheckThatYouDidntReadAnythingReaderWrapper back into that class from TestBugInSomething.


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

Branch: refs/heads/master
Commit: 0a5198ecdacaf3ca71d4dbcf486ffa1430bad4e6
Parents: 4e9fd4f
Author: Shad Storhaug <sh...@shadstorhaug.com>
Authored: Fri Aug 26 12:37:29 2016 +0700
Committer: Shad Storhaug <sh...@shadstorhaug.com>
Committed: Sat Aug 27 02:19:59 2016 +0700

----------------------------------------------------------------------
 .../Analysis/Core/TestBugInSomething.cs         |   76 +-
 .../Analysis/Core/TestRandomChains.cs           | 2679 ++++++++----------
 .../Lucene.Net.Tests.Analysis.Common.csproj     |    1 +
 3 files changed, 1115 insertions(+), 1641 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucenenet/blob/0a5198ec/src/Lucene.Net.Tests.Analysis.Common/Analysis/Core/TestBugInSomething.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests.Analysis.Common/Analysis/Core/TestBugInSomething.cs b/src/Lucene.Net.Tests.Analysis.Common/Analysis/Core/TestBugInSomething.cs
index 0d9d742..42994be 100644
--- a/src/Lucene.Net.Tests.Analysis.Common/Analysis/Core/TestBugInSomething.cs
+++ b/src/Lucene.Net.Tests.Analysis.Common/Analysis/Core/TestBugInSomething.cs
@@ -66,7 +66,7 @@ namespace Lucene.Net.Analysis.Core
 
             public override TokenStreamComponents CreateComponents(string fieldName, TextReader reader)
             {
-                Tokenizer t = new MockTokenizer(new /* TestRandomChains. */ CheckThatYouDidntReadAnythingReaderWrapper(reader), MockTokenFilter.ENGLISH_STOPSET, false, -65);
+                Tokenizer t = new MockTokenizer(new TestRandomChains.CheckThatYouDidntReadAnythingReaderWrapper(reader), MockTokenFilter.ENGLISH_STOPSET, false, -65);
                 TokenFilter f = new CommonGramsFilter(TEST_VERSION_CURRENT, t, cas);
                 return new TokenStreamComponents(t, f);
             }
@@ -151,7 +151,7 @@ namespace Lucene.Net.Analysis.Core
         [Test]
         public virtual void TestWrapping()
         {
-            CharFilter cs = new /* TestRandomChains. */ CheckThatYouDidntReadAnythingReaderWrapper(wrappedStream);
+            CharFilter cs = new TestRandomChains.CheckThatYouDidntReadAnythingReaderWrapper(wrappedStream);
             try
             {
                 cs.Mark(1);
@@ -361,77 +361,5 @@ namespace Lucene.Net.Analysis.Core
                 return new TokenStreamComponents(tokenizer, stream);
             }
         }
-
-
-
-        // LUCENENET NOTE: Borrowed this class from the TestRandomChains class. It was in a commented section
-        // that said "ignore". But it is required for this test. If/when TestRandomChains is ported, we can
-        // use it there.
-        private class CheckThatYouDidntReadAnythingReaderWrapper : CharFilter
-        {
-            bool readSomething;
-
-            public CheckThatYouDidntReadAnythingReaderWrapper(TextReader @in)
-                : base(@in)
-            { }
-
-            private CharFilter Input
-            {
-                get { return (CharFilter)this.input; }
-            }
-
-            protected override int Correct(int currentOff)
-            {
-                return currentOff; // we don't change any offsets
-            }
-
-            public override int Read(char[] cbuf, int off, int len)
-            {
-                readSomething = true;
-                return input.Read(cbuf, off, len);
-            }
-
-            public override int Read()
-            {
-                readSomething = true;
-                return input.Read();
-            }
-
-            // LUCENENET: TextReader dosn't support this overload 
-            //public int read(char[] cbuf)
-            //{
-            //    readSomething = true;
-            //    return input.read(cbuf);
-            //}
-
-            public override long Skip(int n)
-            {
-                readSomething = true;
-                return Input.Skip(n);
-            }
-
-            public override void Mark(int readAheadLimit)
-            {
-                Input.Mark(readAheadLimit);
-            }
-
-            public override bool IsMarkSupported
-            {
-                get
-                {
-                    return Input.IsMarkSupported;
-                }
-            }
-
-            public override bool Ready()
-            {
-                return Input.Ready();
-            }
-
-            public override void Reset()
-            {
-                Input.Reset();
-            }
-        }
     }
 }
\ No newline at end of file