You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucenenet.apache.org by ni...@apache.org on 2017/02/26 23:37:37 UTC

[49/72] [abbrv] [partial] lucenenet git commit: Lucene.Net.Tests: Removed \core directory and put its contents in root directory

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/96822396/src/Lucene.Net.Tests/Analysis/TokenAttributes/TestCharTermAttributeImpl.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/Analysis/TokenAttributes/TestCharTermAttributeImpl.cs b/src/Lucene.Net.Tests/Analysis/TokenAttributes/TestCharTermAttributeImpl.cs
new file mode 100644
index 0000000..6501d0c
--- /dev/null
+++ b/src/Lucene.Net.Tests/Analysis/TokenAttributes/TestCharTermAttributeImpl.cs
@@ -0,0 +1,485 @@
+using Lucene.Net.Support;
+using NUnit.Framework;
+using System.Collections.Generic;
+using System.Text;
+using System.Text.RegularExpressions;
+
+namespace Lucene.Net.Analysis.TokenAttributes
+{
+    /*
+    * Licensed to the Apache Software Foundation (ASF) under one or more
+    * contributor license agreements.  See the NOTICE file distributed with
+    * this work for additional information regarding copyright ownership.
+    * The ASF licenses this file to You under the Apache License, Version 2.0
+    * (the "License"); you may not use this file except in compliance with
+    * the License.  You may obtain a copy of the License at
+    *
+    *     http://www.apache.org/licenses/LICENSE-2.0
+    *
+    * Unless required by applicable law or agreed to in writing, software
+    * distributed under the License is distributed on an "AS IS" BASIS,
+    * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    * See the License for the specific language governing permissions and
+    * limitations under the License.
+    */
+
+    using BytesRef = Lucene.Net.Util.BytesRef;
+    using LuceneTestCase = Lucene.Net.Util.LuceneTestCase;
+    using TestUtil = Lucene.Net.Util.TestUtil;
+
+    [TestFixture]
+    public class TestCharTermAttributeImpl : LuceneTestCase
+    {
+        [Test]
+        public virtual void TestResize()
+        {
+            CharTermAttribute t = new CharTermAttribute();
+            char[] content = "hello".ToCharArray();
+            t.CopyBuffer(content, 0, content.Length);
+            for (int i = 0; i < 2000; i++)
+            {
+                t.ResizeBuffer(i);
+                Assert.IsTrue(i <= t.Buffer.Length);
+                Assert.AreEqual("hello", t.ToString());
+            }
+        }
+
+        [Test]
+        public virtual void TestGrow()
+        {
+            CharTermAttribute t = new CharTermAttribute();
+            StringBuilder buf = new StringBuilder("ab");
+            for (int i = 0; i < 20; i++)
+            {
+                char[] content = buf.ToString().ToCharArray();
+                t.CopyBuffer(content, 0, content.Length);
+                Assert.AreEqual(buf.Length, t.Length);
+                Assert.AreEqual(buf.ToString(), t.ToString());
+                buf.Append(buf.ToString());
+            }
+            Assert.AreEqual(1048576, t.Length);
+
+            // now as a StringBuilder, first variant
+            t = new CharTermAttribute();
+            buf = new StringBuilder("ab");
+            for (int i = 0; i < 20; i++)
+            {
+                t.SetEmpty().Append(buf);
+                Assert.AreEqual(buf.Length, t.Length);
+                Assert.AreEqual(buf.ToString(), t.ToString());
+                buf.Append(t);
+            }
+            Assert.AreEqual(1048576, t.Length);
+
+            // Test for slow growth to a long term
+            t = new CharTermAttribute();
+            buf = new StringBuilder("a");
+            for (int i = 0; i < 20000; i++)
+            {
+                t.SetEmpty().Append(buf);
+                Assert.AreEqual(buf.Length, t.Length);
+                Assert.AreEqual(buf.ToString(), t.ToString());
+                buf.Append("a");
+            }
+            Assert.AreEqual(20000, t.Length);
+        }
+
+        [Test]
+        public virtual void TestToString()
+        {
+            char[] b = new char[] { 'a', 'l', 'o', 'h', 'a' };
+            CharTermAttribute t = new CharTermAttribute();
+            t.CopyBuffer(b, 0, 5);
+            Assert.AreEqual("aloha", t.ToString());
+
+            t.SetEmpty().Append("hi there");
+            Assert.AreEqual("hi there", t.ToString());
+        }
+
+        [Test]
+        public virtual void TestClone()
+        {
+            CharTermAttribute t = new CharTermAttribute();
+            char[] content = "hello".ToCharArray();
+            t.CopyBuffer(content, 0, 5);
+            char[] buf = t.Buffer;
+            CharTermAttribute copy = TestToken.AssertCloneIsEqual(t);
+            Assert.AreEqual(t.ToString(), copy.ToString());
+            Assert.AreNotSame(buf, copy.Buffer);
+        }
+
+        [Test]
+        public virtual void TestEquals()
+        {
+            CharTermAttribute t1a = new CharTermAttribute();
+            char[] content1a = "hello".ToCharArray();
+            t1a.CopyBuffer(content1a, 0, 5);
+            CharTermAttribute t1b = new CharTermAttribute();
+            char[] content1b = "hello".ToCharArray();
+            t1b.CopyBuffer(content1b, 0, 5);
+            CharTermAttribute t2 = new CharTermAttribute();
+            char[] content2 = "hello2".ToCharArray();
+            t2.CopyBuffer(content2, 0, 6);
+            Assert.IsTrue(t1a.Equals(t1b));
+            Assert.IsFalse(t1a.Equals(t2));
+            Assert.IsFalse(t2.Equals(t1b));
+        }
+
+        [Test]
+        public virtual void TestCopyTo()
+        {
+            CharTermAttribute t = new CharTermAttribute();
+            CharTermAttribute copy = TestToken.AssertCopyIsEqual(t);
+            Assert.AreEqual("", t.ToString());
+            Assert.AreEqual("", copy.ToString());
+
+            t = new CharTermAttribute();
+            char[] content = "hello".ToCharArray();
+            t.CopyBuffer(content, 0, 5);
+            char[] buf = t.Buffer;
+            copy = TestToken.AssertCopyIsEqual(t);
+            Assert.AreEqual(t.ToString(), copy.ToString());
+            Assert.AreNotSame(buf, copy.Buffer);
+        }
+
+        [Test]
+        public virtual void TestAttributeReflection()
+        {
+            CharTermAttribute t = new CharTermAttribute();
+            t.Append("foobar");
+            TestUtil.AssertAttributeReflection(t, new Dictionary<string, object>()
+            {
+                    { typeof(ICharTermAttribute).Name + "#term", "foobar" },
+                    { typeof(ITermToBytesRefAttribute).Name + "#bytes", new BytesRef("foobar") }
+            });
+        }
+
+        [Test]
+        public virtual void TestCharSequenceInterface()
+        {
+            const string s = "0123456789";
+            CharTermAttribute t = new CharTermAttribute();
+            t.Append(s);
+
+            Assert.AreEqual(s.Length, t.Length);
+            Assert.AreEqual("12", t.SubSequence(1, 3).ToString());
+            Assert.AreEqual(s, t.SubSequence(0, s.Length).ToString());
+
+            Assert.IsTrue(Regex.IsMatch(t.ToString(), "01\\d+"));
+            Assert.IsTrue(Regex.IsMatch(t.SubSequence(3, 5).ToString(), "34"));
+
+            Assert.AreEqual(s.Substring(3, 4), t.SubSequence(3, 7).ToString());
+
+            for (int i = 0; i < s.Length; i++)
+            {
+                Assert.IsTrue(t[i] == s[i]);
+            }
+
+            // LUCENENET specific to test indexer
+            for (int i = 0; i < s.Length; i++)
+            {
+                Assert.IsTrue(t[i] == s[i]);
+            }
+        }
+
+        [Test]
+        public virtual void TestAppendableInterface()
+        {
+            CharTermAttribute t = new CharTermAttribute();
+            //Formatter formatter = new Formatter(t, Locale.ROOT);
+            //formatter.format("%d", 1234);
+            //Assert.AreEqual("1234", t.ToString());
+            //formatter.format("%d", 5678);
+            // LUCENENET: We don't have a formatter in .NET, so continue from here
+            t.Append("12345678"); // LUCENENET specific overload that accepts string
+            Assert.AreEqual("12345678", t.ToString());
+            t.SetEmpty().Append("12345678".ToCharArray()); // LUCENENET specific overload that accepts char[]
+            Assert.AreEqual("12345678", t.ToString());
+            t.Append('9');
+            Assert.AreEqual("123456789", t.ToString());
+            t.Append(new StringCharSequenceWrapper("0"));
+            Assert.AreEqual("1234567890", t.ToString());
+            t.Append(new StringCharSequenceWrapper("0123456789"), 1, 3);
+            Assert.AreEqual("123456789012", t.ToString());
+            //t.Append((ICharSequence) CharBuffer.wrap("0123456789".ToCharArray()), 3, 5);
+            t.Append("0123456789".ToCharArray(), 3, 5); // LUCENENET: no CharBuffer in .NET, so we test char[], start, end overload
+            Assert.AreEqual("12345678901234", t.ToString());
+            t.Append((ICharSequence)t);
+            Assert.AreEqual("1234567890123412345678901234", t.ToString());
+            t.Append(/*(ICharSequence)*/ new StringBuilder("0123456789").ToString(), 5, 7); // LUCENENET: StringBuilder doesn't implement ICharSequence
+            Assert.AreEqual("123456789012341234567890123456", t.ToString());
+            t.Append(/*(ICharSequence)*/ new StringBuilder(t.ToString()));
+            Assert.AreEqual("123456789012341234567890123456123456789012341234567890123456", t.ToString()); // LUCENENET: StringBuilder doesn't implement ICharSequence
+            // very wierd, to test if a subSlice is wrapped correct :)
+            //CharBuffer buf = CharBuffer.wrap("0123456789".ToCharArray(), 3, 5); // LUCENENET: No CharBuffer in .NET
+            StringBuilder buf = new StringBuilder("0123456789", 3, 5, 16);
+            Assert.AreEqual("34567", buf.ToString());
+            t.SetEmpty().Append(/*(ICharSequence)*/ buf, 1, 2); // LUCENENET: StringBuilder doesn't implement ICharSequence
+            Assert.AreEqual("4", t.ToString());
+            ICharTermAttribute t2 = new CharTermAttribute();
+            t2.Append("test");
+            t.Append((ICharSequence)t2);
+            Assert.AreEqual("4test", t.ToString());
+            t.Append((ICharSequence)t2, 1, 2);
+            Assert.AreEqual("4teste", t.ToString());
+
+            try
+            {
+                t.Append((ICharSequence)t2, 1, 5);
+                Assert.Fail("Should throw ArgumentOutOfRangeException");
+            }
+#pragma warning disable 168
+            catch (System.IndexOutOfRangeException iobe)
+#pragma warning restore 168
+            {
+            }
+
+            try
+            {
+                t.Append((ICharSequence)t2, 1, 0);
+                Assert.Fail("Should throw ArgumentOutOfRangeException");
+            }
+#pragma warning disable 168
+            catch (System.IndexOutOfRangeException iobe)
+#pragma warning restore 168
+            {
+            }
+
+            t.Append((ICharSequence)null);
+            Assert.AreEqual("4testenull", t.ToString());
+
+
+            // LUCENENET specific - test string overloads
+            try
+            {
+                t.Append((string)t2.ToString(), 1, 5);
+                Assert.Fail("Should throw IndexOutOfBoundsException");
+            }
+#pragma warning disable 168
+            catch (System.IndexOutOfRangeException iobe)
+#pragma warning restore 168
+            {
+            }
+
+            try
+            {
+                t.Append((string)t2.ToString(), 1, 0);
+                Assert.Fail("Should throw IndexOutOfBoundsException");
+            }
+#pragma warning disable 168
+            catch (System.IndexOutOfRangeException iobe)
+#pragma warning restore 168
+            {
+            }
+
+            t.Append((string)null);
+            Assert.AreEqual("4testenullnull", t.ToString());
+
+
+            // LUCENENET specific - test char[] overloads
+            try
+            {
+                t.Append((char[])t2.ToString().ToCharArray(), 1, 5);
+                Assert.Fail("Should throw IndexOutOfBoundsException");
+            }
+#pragma warning disable 168
+            catch (System.IndexOutOfRangeException iobe)
+#pragma warning restore 168
+            {
+            }
+
+            try
+            {
+                t.Append((char[])t2.ToString().ToCharArray(), 1, 0);
+                Assert.Fail("Should throw IndexOutOfBoundsException");
+            }
+#pragma warning disable 168
+            catch (System.IndexOutOfRangeException iobe)
+#pragma warning restore 168
+            {
+            }
+
+            t.Append((char[])null);
+            Assert.AreEqual("4testenullnullnull", t.ToString());
+        }
+
+        [Test]
+        public virtual void TestAppendableInterfaceWithLongSequences()
+        {
+            CharTermAttribute t = new CharTermAttribute();
+            t.Append("01234567890123456789012345678901234567890123456789"); // LUCENENET specific overload that accepts string
+            assertEquals("01234567890123456789012345678901234567890123456789", t.ToString());
+            t.Append("01234567890123456789012345678901234567890123456789", 3, 50); // LUCENENET specific overload that accepts string, start, end
+            Assert.AreEqual("0123456789012345678901234567890123456789012345678934567890123456789012345678901234567890123456789", t.ToString());
+            t.SetEmpty();
+            t.Append("01234567890123456789012345678901234567890123456789".ToCharArray()); // LUCENENET specific overload that accepts char[]
+            assertEquals("01234567890123456789012345678901234567890123456789", t.ToString());
+            t.Append("01234567890123456789012345678901234567890123456789".ToCharArray(), 3, 50); // LUCENENET specific overload that accepts char[], start, end
+            Assert.AreEqual("0123456789012345678901234567890123456789012345678934567890123456789012345678901234567890123456789", t.ToString());
+            t.SetEmpty();
+            t.Append(new StringCharSequenceWrapper("01234567890123456789012345678901234567890123456789"));
+            //t.Append((ICharSequence) CharBuffer.wrap("01234567890123456789012345678901234567890123456789".ToCharArray()), 3, 50); // LUCENENET: No CharBuffer in .NET
+            t.Append("01234567890123456789012345678901234567890123456789".ToCharArray(), 3, 50); // LUCENENET specific overload that accepts char[], start, end
+            //              "01234567890123456789012345678901234567890123456789"
+            Assert.AreEqual("0123456789012345678901234567890123456789012345678934567890123456789012345678901234567890123456789", t.ToString());
+            t.SetEmpty().Append(/*(ICharSequence)*/ new StringBuilder("01234567890123456789"), 5, 17); // LUCENENET: StringBuilder doesn't implement ICharSequence
+            Assert.AreEqual(new StringCharSequenceWrapper("567890123456"), t.ToString());
+            t.Append(new StringBuilder(t.ToString()));
+            Assert.AreEqual(new StringCharSequenceWrapper("567890123456567890123456"), t.ToString());
+            // very wierd, to test if a subSlice is wrapped correct :)
+            //CharBuffer buf = CharBuffer.wrap("012345678901234567890123456789".ToCharArray(), 3, 15); // LUCENENET: No CharBuffer in .NET
+            StringBuilder buf = new StringBuilder("012345678901234567890123456789", 3, 15, 16);
+            Assert.AreEqual("345678901234567", buf.ToString());
+            t.SetEmpty().Append(buf, 1, 14);
+            Assert.AreEqual("4567890123456", t.ToString());
+
+            // finally use a completely custom ICharSequence that is not catched by instanceof checks
+            const string longTestString = "012345678901234567890123456789";
+            t.Append(new CharSequenceAnonymousInnerClassHelper(this, longTestString));
+            Assert.AreEqual("4567890123456" + longTestString, t.ToString());
+        }
+
+        private class CharSequenceAnonymousInnerClassHelper : ICharSequence
+        {
+            private readonly TestCharTermAttributeImpl OuterInstance;
+
+            private string LongTestString;
+
+            public CharSequenceAnonymousInnerClassHelper(TestCharTermAttributeImpl outerInstance, string longTestString)
+            {
+                this.OuterInstance = outerInstance;
+                this.LongTestString = longTestString;
+            }
+
+            public char CharAt(int i)
+            {
+                return LongTestString[i];
+            }
+
+            // LUCENENET specific - Added to .NETify
+            public char this[int i]
+            {
+                get { return LongTestString[i]; }
+            }
+
+            public int Length
+            {
+                get
+                {
+                    return LongTestString.Length;
+                }
+            }
+
+            public ICharSequence SubSequence(int start, int end)
+            {
+                return new StringCharSequenceWrapper(LongTestString.Substring(start, end - start));
+            }
+
+            public override string ToString()
+            {
+                return LongTestString;
+            }
+        }
+
+        [Test]
+        public virtual void TestNonCharSequenceAppend()
+        {
+            CharTermAttribute t = new CharTermAttribute();
+            t.Append("0123456789");
+            t.Append("0123456789");
+            Assert.AreEqual("01234567890123456789", t.ToString());
+            t.Append(new StringBuilder("0123456789"));
+            Assert.AreEqual("012345678901234567890123456789", t.ToString());
+            ICharTermAttribute t2 = new CharTermAttribute();
+            t2.Append("test");
+            t.Append(t2);
+            Assert.AreEqual("012345678901234567890123456789test", t.ToString());
+            t.Append((string)null);
+            t.Append((StringBuilder)null);
+            t.Append((ICharTermAttribute)null);
+            Assert.AreEqual("012345678901234567890123456789testnullnullnull", t.ToString());
+        }
+
+        [Test]
+        public virtual void TestExceptions()
+        {
+            CharTermAttribute t = new CharTermAttribute();
+            t.Append("test");
+            Assert.AreEqual("test", t.ToString());
+
+            try
+            {
+                var _ = t[-1];
+                Assert.Fail("Should throw IndexOutOfBoundsException");
+            }
+            catch (System.IndexOutOfRangeException)
+            {
+            }
+
+            try
+            {
+                var _ = t[4];
+                Assert.Fail("Should throw IndexOutOfBoundsException");
+            }
+            catch (System.IndexOutOfRangeException)
+            {
+            }
+
+            try
+            {
+                t.SubSequence(0, 5);
+                Assert.Fail("Should throw IndexOutOfBoundsException");
+            }
+            catch (System.IndexOutOfRangeException)
+            {
+            }
+
+            try
+            {
+                t.SubSequence(5, 0);
+                Assert.Fail("Should throw IndexOutOfBoundsException");
+            }
+            catch (System.IndexOutOfRangeException)
+            {
+            }
+        }
+
+        /*
+
+        // test speed of the dynamic instanceof checks in append(ICharSequence),
+        // to find the best max length for the generic while (start<end) loop:
+        public void testAppendPerf() {
+          CharTermAttributeImpl t = new CharTermAttributeImpl();
+          final int count = 32;
+          ICharSequence[] csq = new ICharSequence[count * 6];
+          final StringBuilder sb = new StringBuilder();
+          for (int i=0,j=0; i<count; i++) {
+            sb.append(i%10);
+            final String testString = sb.toString();
+            CharTermAttribute cta = new CharTermAttributeImpl();
+            cta.append(testString);
+            csq[j++] = cta;
+            csq[j++] = testString;
+            csq[j++] = new StringBuilder(sb);
+            csq[j++] = new StringBuffer(sb);
+            csq[j++] = CharBuffer.wrap(testString.toCharArray());
+            csq[j++] = new ICharSequence() {
+              public char charAt(int i) { return testString.charAt(i); }
+              public int length() { return testString.length(); }
+              public ICharSequence subSequence(int start, int end) { return testString.subSequence(start, end); }
+              public String toString() { return testString; }
+            };
+          }
+
+          Random rnd = newRandom();
+          long startTime = System.currentTimeMillis();
+          for (int i=0; i<100000000; i++) {
+            t.SetEmpty().append(csq[rnd.nextInt(csq.length)]);
+          }
+          long endTime = System.currentTimeMillis();
+          System.out.println("Time: " + (endTime-startTime)/1000.0 + " s");
+        }
+
+        */
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/96822396/src/Lucene.Net.Tests/Analysis/TokenAttributes/TestSimpleAttributeImpl.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/Analysis/TokenAttributes/TestSimpleAttributeImpl.cs b/src/Lucene.Net.Tests/Analysis/TokenAttributes/TestSimpleAttributeImpl.cs
new file mode 100644
index 0000000..609e4dc
--- /dev/null
+++ b/src/Lucene.Net.Tests/Analysis/TokenAttributes/TestSimpleAttributeImpl.cs
@@ -0,0 +1,66 @@
+using System.Collections.Generic;
+
+namespace Lucene.Net.Analysis.TokenAttributes
+{
+    using Lucene.Net.Support;
+    using NUnit.Framework;
+    using Attribute = Lucene.Net.Util.Attribute;
+    using LuceneTestCase = Lucene.Net.Util.LuceneTestCase;
+
+    /*
+         * Licensed to the Apache Software Foundation (ASF) under one or more
+         * contributor license agreements.  See the NOTICE file distributed with
+         * this work for additional information regarding copyright ownership.
+         * The ASF licenses this file to You under the Apache License, Version 2.0
+         * (the "License"); you may not use this file except in compliance with
+         * the License.  You may obtain a copy of the License at
+         *
+         *     http://www.apache.org/licenses/LICENSE-2.0
+         *
+         * Unless required by applicable law or agreed to in writing, software
+         * distributed under the License is distributed on an "AS IS" BASIS,
+         * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+         * See the License for the specific language governing permissions and
+         * limitations under the License.
+         */
+
+    using TestUtil = Lucene.Net.Util.TestUtil;
+
+    [TestFixture]
+    public class TestSimpleAttributeImpl : LuceneTestCase
+    {
+        // this checks using reflection API if the defaults are correct
+        [Test]
+        public virtual void TestAttributes()
+        {
+            TestUtil.AssertAttributeReflection(new PositionIncrementAttribute(), Collections.SingletonMap(typeof(IPositionIncrementAttribute).Name + "#positionIncrement", (object)1));
+            TestUtil.AssertAttributeReflection(new PositionLengthAttribute(), Collections.SingletonMap(typeof(IPositionLengthAttribute).Name + "#positionLength", (object)1));
+            TestUtil.AssertAttributeReflection(new FlagsAttribute(), Collections.SingletonMap(typeof(IFlagsAttribute).Name + "#flags", (object)0));
+            TestUtil.AssertAttributeReflection(new TypeAttribute(), Collections.SingletonMap(typeof(ITypeAttribute).Name + "#type", (object)TypeAttribute_Fields.DEFAULT_TYPE));
+            TestUtil.AssertAttributeReflection(new PayloadAttribute(), Collections.SingletonMap(typeof(IPayloadAttribute).Name + "#payload", (object)null));
+            TestUtil.AssertAttributeReflection(new KeywordAttribute(), Collections.SingletonMap(typeof(IKeywordAttribute).Name + "#keyword", (object)false));
+            TestUtil.AssertAttributeReflection(new OffsetAttribute(), new Dictionary<string, object>()
+            {
+                {typeof(IOffsetAttribute).Name + "#startOffset", 0 },
+                {typeof(IOffsetAttribute).Name + "#endOffset", 0}
+            });
+        }
+
+        public static Attribute AssertCloneIsEqual(Attribute att)
+        {
+            Attribute clone = (Attribute)att.Clone();
+            Assert.AreEqual(att, clone, "Clone must be equal");
+            Assert.AreEqual(att.GetHashCode(), clone.GetHashCode(), "Clone's hashcode must be equal");
+            return clone;
+        }
+
+        public static Attribute AssertCopyIsEqual(Attribute att)
+        {
+            Attribute copy = (Attribute)System.Activator.CreateInstance(att.GetType());
+            att.CopyTo(copy);
+            Assert.AreEqual(att, copy, "Copied instance must be equal");
+            Assert.AreEqual(att.GetHashCode(), copy.GetHashCode(), "Copied instance's hashcode must be equal");
+            return copy;
+        }
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/96822396/src/Lucene.Net.Tests/Analysis/TrivialLookaheadFilter.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/Analysis/TrivialLookaheadFilter.cs b/src/Lucene.Net.Tests/Analysis/TrivialLookaheadFilter.cs
new file mode 100644
index 0000000..b422026
--- /dev/null
+++ b/src/Lucene.Net.Tests/Analysis/TrivialLookaheadFilter.cs
@@ -0,0 +1,109 @@
+using Lucene.Net.Analysis.TokenAttributes;
+using System.Collections.Generic;
+
+namespace Lucene.Net.Analysis
+{
+    /*
+     * Licensed to the Apache Software Foundation (ASF) under one or more
+     * contributor license agreements.  See the NOTICE file distributed with
+     * this work for additional information regarding copyright ownership.
+     * The ASF licenses this file to You under the Apache License, Version 2.0
+     * (the "License"); you may not use this file except in compliance with
+     * the License.  You may obtain a copy of the License at
+     *
+     *     http://www.apache.org/licenses/LICENSE-2.0
+     *
+     * Unless required by applicable law or agreed to in writing, software
+     * distributed under the License is distributed on an "AS IS" BASIS,
+     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+     * See the License for the specific language governing permissions and
+     * limitations under the License.
+     */
+
+    /// <summary>
+    /// Simple example of a filter that seems to show some problems with LookaheadTokenFilter.
+    /// </summary>
+    public sealed class TrivialLookaheadFilter : LookaheadTokenFilter<TestPosition>
+    {
+        private readonly ICharTermAttribute TermAtt;
+        new private readonly IPositionIncrementAttribute PosIncAtt;
+        new private readonly IOffsetAttribute OffsetAtt;
+
+        private int InsertUpto;
+
+        internal TrivialLookaheadFilter(TokenStream input)
+            : base(input)
+        {
+            TermAtt = AddAttribute<ICharTermAttribute>();
+            PosIncAtt = AddAttribute<IPositionIncrementAttribute>();
+            OffsetAtt = AddAttribute<IOffsetAttribute>();
+        }
+
+        protected internal override TestPosition NewPosition()
+        {
+            return new TestPosition();
+        }
+
+        public override bool IncrementToken()
+        {
+            // At the outset, getMaxPos is -1. So we'll peek. When we reach the end of the sentence and go to the
+            // first token of the next sentence, maxPos will be the prev sentence's end token, and we'll go again.
+            if (positions.MaxPos < OutputPos)
+            {
+                PeekSentence();
+            }
+
+            return NextToken();
+        }
+
+        public override void Reset()
+        {
+            base.Reset();
+            InsertUpto = -1;
+        }
+
+        protected internal override void AfterPosition()
+        {
+            if (InsertUpto < OutputPos)
+            {
+                InsertToken();
+                // replace term with 'improved' term.
+                ClearAttributes();
+                TermAtt.SetEmpty();
+                PosIncAtt.PositionIncrement = 0;
+                TermAtt.Append(((TestPosition)positions.Get(OutputPos)).Fact);
+                OffsetAtt.SetOffset(positions.Get(OutputPos).StartOffset, positions.Get(OutputPos + 1).EndOffset);
+                InsertUpto = OutputPos;
+            }
+        }
+
+        private void PeekSentence()
+        {
+            IList<string> facts = new List<string>();
+            bool haveSentence = false;
+            do
+            {
+                if (PeekToken())
+                {
+                    string term = new string(TermAtt.Buffer, 0, TermAtt.Length);
+                    facts.Add(term + "-huh?");
+                    if (".".Equals(term))
+                    {
+                        haveSentence = true;
+                    }
+                }
+                else
+                {
+                    haveSentence = true;
+                }
+            } while (!haveSentence);
+
+            // attach the (now disambiguated) analyzed tokens to the positions.
+            for (int x = 0; x < facts.Count; x++)
+            {
+                // sentenceTokens is just relative to sentence, positions is absolute.
+                ((TestPosition)positions.Get(OutputPos + x)).Fact = facts[x];
+            }
+        }
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/96822396/src/Lucene.Net.Tests/App.config
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/App.config b/src/Lucene.Net.Tests/App.config
new file mode 100644
index 0000000..909b15d
--- /dev/null
+++ b/src/Lucene.Net.Tests/App.config
@@ -0,0 +1,47 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements.  See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership.  The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License.  You may obtain a copy of the License at
+
+   http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied.  See the License for the
+ specific language governing permissions and limitations
+ under the License.
+
+-->
+<configuration>
+  <appSettings>
+    <add key="tempDir" value="C:\Windows\Temp\Lucene.Net-Tests" />
+    <add key="ClientSettingsProvider.ServiceUri" value="" />
+  </appSettings>
+  <!-- When I add this setting and run tests, I get 0 success, 0 failures, 0 tests not run
+  <appSettings>
+    <add key="Lucene.Net.CompressionLib.class" value="Lucene.Net.Index.Compression.SharpZipLibAdapter"/>
+  </appSettings>
+  -->
+  <system.web>
+    <membership defaultProvider="ClientAuthenticationMembershipProvider">
+      <providers>
+        <add name="ClientAuthenticationMembershipProvider" type="System.Web.ClientServices.Providers.ClientFormsAuthenticationMembershipProvider, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" serviceUri="" />
+      </providers>
+    </membership>
+    <roleManager defaultProvider="ClientRoleProvider" enabled="true">
+      <providers>
+        <add name="ClientRoleProvider" type="System.Web.ClientServices.Providers.ClientRoleProvider, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" serviceUri="" cacheTimeout="86400" />
+      </providers>
+    </roleManager>
+  </system.web>
+  <system.diagnostics>
+    <assert assertuienabled="false" />
+  </system.diagnostics>
+</configuration>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/96822396/src/Lucene.Net.Tests/AssemblyInfo.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/AssemblyInfo.cs b/src/Lucene.Net.Tests/AssemblyInfo.cs
new file mode 100644
index 0000000..46d6fb9
--- /dev/null
+++ b/src/Lucene.Net.Tests/AssemblyInfo.cs
@@ -0,0 +1,87 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+*/
+
+using NUnit.Framework;
+using System.Reflection;
+using System.Runtime.CompilerServices;
+
+//
+// General Information about an assembly is controlled through the following 
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+//
+[assembly: AssemblyTitle("Apache Lucene.Net")]
+[assembly: AssemblyDescription("The Apache Software Foundation Lucene.Net a full-text search engine library")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("The Apache Software Foundation")]
+[assembly: AssemblyProduct("Lucene.Net.Test")]
+[assembly: AssemblyCopyright("Copyright 2006 - 2011 The Apache Software Foundation")]
+[assembly: AssemblyTrademark("Copyright 2006 - 2011 The Apache Software Foundation")]
+[assembly: AssemblyDefaultAlias("Lucene.Net")]
+[assembly: AssemblyCulture("")]
+
+[assembly: AssemblyInformationalVersionAttribute("4.8.0")]
+
+//
+// Version information for an assembly consists of the following four values:
+//
+//      Major Version
+//      Minor Version 
+//      Build Number
+//      Revision
+//
+// You can specify all the values or you can default the Revision and Build Numbers 
+// by using the '*' as shown below:
+
+[assembly: AssemblyVersion("3.0.3")]
+
+//
+// In order to sign your assembly you must specify a key to use. Refer to the 
+// Microsoft .NET Framework documentation for more information on assembly signing.
+//
+// Use the attributes below to control which key is used for signing. 
+//
+// Notes: 
+//   (*) If no key is specified, the assembly is not signed.
+//   (*) KeyName refers to a key that has been installed in the Crypto Service
+//       Provider (CSP) on your machine. KeyFile refers to a file which contains
+//       a key.
+//   (*) If the KeyFile and the KeyName values are both specified, the 
+//       following processing occurs:
+//       (1) If the KeyName can be found in the CSP, that key is used.
+//       (2) If the KeyName does not exist and the KeyFile does exist, the key 
+//           in the KeyFile is installed into the CSP and used.
+//   (*) In order to create a KeyFile, you can use the sn.exe (Strong Name) utility.
+//       When specifying the KeyFile, the location of the KeyFile should be
+//       relative to the project output directory which is
+//       %Project Directory%\obj\<configuration>. For example, if your KeyFile is
+//       located in the project directory, you would specify the AssemblyKeyFile 
+//       attribute as [assembly: AssemblyKeyFile("..\\..\\mykey.snk")]
+//   (*) Delay Signing is an advanced option - see the Microsoft .NET Framework
+//       documentation for more information on this.
+//
+[assembly: AssemblyDelaySign(false)]
+[assembly: AssemblyKeyFile("")]
+[assembly: AssemblyKeyName("")]
+
+#if !NETSTANDARD
+[assembly: Timeout(20000)]
+#endif 
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/96822396/src/Lucene.Net.Tests/Codecs/Compressing/AbstractTestCompressionMode.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/Codecs/Compressing/AbstractTestCompressionMode.cs b/src/Lucene.Net.Tests/Codecs/Compressing/AbstractTestCompressionMode.cs
new file mode 100644
index 0000000..9dcfcde
--- /dev/null
+++ b/src/Lucene.Net.Tests/Codecs/Compressing/AbstractTestCompressionMode.cs
@@ -0,0 +1,180 @@
+using System;
+using Lucene.Net.Util;
+
+namespace Lucene.Net.Codecs.Compressing
+{
+    using Lucene.Net.Randomized.Generators;
+    using Lucene.Net.Support;
+    using NUnit.Framework;
+
+    /*
+                 * Licensed to the Apache Software Foundation (ASF) under one or more
+                 * contributor license agreements.  See the NOTICE file distributed with
+                 * this work for additional information regarding copyright ownership.
+                 * The ASF licenses this file to You under the Apache License, Version 2.0
+                 * (the "License"); you may not use this file except in compliance with
+                 * the License.  You may obtain a copy of the License at
+                 *
+                 *     http://www.apache.org/licenses/LICENSE-2.0
+                 *
+                 * Unless required by applicable law or agreed to in writing, software
+                 * distributed under the License is distributed on an "AS IS" BASIS,
+                 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+                 * See the License for the specific language governing permissions and
+                 * limitations under the License.
+                 */
+
+    using ByteArrayDataInput = Lucene.Net.Store.ByteArrayDataInput;
+    using ByteArrayDataOutput = Lucene.Net.Store.ByteArrayDataOutput;
+    using BytesRef = Lucene.Net.Util.BytesRef;
+    using LuceneTestCase = Lucene.Net.Util.LuceneTestCase;
+    using TestUtil = Lucene.Net.Util.TestUtil;
+
+    [TestFixture]
+    public abstract class AbstractTestCompressionMode : LuceneTestCase
+    {
+        internal CompressionMode Mode;
+
+        internal static byte[] RandomArray()
+        {
+            int max = Random().NextBoolean() ? Random().Next(4) : Random().Next(256);
+            int length = Random().NextBoolean() ? Random().Next(20) : Random().Next(192 * 1024);
+            return RandomArray(length, max);
+        }
+
+        internal static byte[] RandomArray(int length, int max)
+        {
+            var arr = new byte[length];
+            for (int i = 0; i < arr.Length; ++i)
+            {
+                arr[i] = (byte)RandomInts.NextIntBetween(Random(), 0, max);
+            }
+            return arr;
+        }
+
+        internal virtual byte[] Compress(byte[] decompressed, int off, int len)
+        {
+            Compressor compressor = Mode.NewCompressor();
+            return Compress(compressor, decompressed, off, len);
+        }
+
+        internal static byte[] Compress(Compressor compressor, byte[] decompressed, int off, int len)
+        {
+            var compressed = new byte[len * 2 + 16]; // should be enough
+            ByteArrayDataOutput @out = new ByteArrayDataOutput(compressed);
+            compressor.Compress(decompressed, off, len, @out);
+            int compressedLen = @out.Position;
+            return Arrays.CopyOf(compressed, compressedLen);
+        }
+
+        internal virtual byte[] Decompress(byte[] compressed, int originalLength)
+        {
+            Decompressor decompressor = Mode.NewDecompressor();
+            return Decompress(decompressor, compressed, originalLength);
+        }
+
+        internal static byte[] Decompress(Decompressor decompressor, byte[] compressed, int originalLength)
+        {
+            BytesRef bytes = new BytesRef();
+            decompressor.Decompress(new ByteArrayDataInput(compressed), originalLength, 0, originalLength, bytes);
+            return Arrays.CopyOfRange(bytes.Bytes, bytes.Offset, bytes.Offset + bytes.Length);
+        }
+
+        internal virtual byte[] Decompress(byte[] compressed, int originalLength, int offset, int length)
+        {
+            Decompressor decompressor = Mode.NewDecompressor();
+            BytesRef bytes = new BytesRef();
+            decompressor.Decompress(new ByteArrayDataInput(compressed), originalLength, offset, length, bytes);
+            return Arrays.CopyOfRange(bytes.Bytes, bytes.Offset, bytes.Offset + bytes.Length);
+        }
+
+        // [Test] // LUCENENET NOTE: For now, we are overriding this test in every subclass to pull it into the right context for the subclass
+        public virtual void TestDecompress()
+        {
+            int iterations = AtLeast(10);
+            for (int i = 0; i < iterations; ++i)
+            {
+                var decompressed = RandomArray();
+                int off = Random().NextBoolean() ? 0 : TestUtil.NextInt(Random(), 0, decompressed.Length);
+                int len = Random().NextBoolean() ? decompressed.Length - off : TestUtil.NextInt(Random(), 0, decompressed.Length - off);
+                var compressed = Compress(decompressed, off, len);
+                var restored = Decompress(compressed, len);
+                Assert.AreEqual(Arrays.CopyOfRange(decompressed, off, off + len), restored);//was AssertArrayEquals
+            }
+        }
+
+        // [Test] // LUCENENET NOTE: For now, we are overriding this test in every subclass to pull it into the right context for the subclass
+        public virtual void TestPartialDecompress()
+        {
+            int iterations = AtLeast(10);
+            for (int i = 0; i < iterations; ++i)
+            {
+                var decompressed = RandomArray();
+                var compressed = Compress(decompressed, 0, decompressed.Length);
+                int offset, length;
+                if (decompressed.Length == 0)
+                {
+                    offset = length = 0;
+                }
+                else
+                {
+                    offset = Random().Next(decompressed.Length);
+                    length = Random().Next(decompressed.Length - offset);
+                }
+                var restored = Decompress(compressed, decompressed.Length, offset, length);
+                Assert.AreEqual(Arrays.CopyOfRange(decompressed, offset, offset + length), restored); //was AssertArrayEquals
+            }
+        }
+
+        public virtual byte[] Test(byte[] decompressed)
+        {
+            return Test(decompressed, 0, decompressed.Length);
+        }
+
+        public virtual byte[] Test(byte[] decompressed, int off, int len)
+        {
+            var compressed = Compress(decompressed, off, len);
+            var restored = Decompress(compressed, len);
+            Assert.AreEqual(len, restored.Length);
+            return compressed;
+        }
+
+        // [Test] // LUCENENET NOTE: For now, we are overriding this test in every subclass to pull it into the right context for the subclass
+        public virtual void TestEmptySequence()
+        {
+            Test(new byte[0]);
+        }
+
+        // [Test] // LUCENENET NOTE: For now, we are overriding this test in every subclass to pull it into the right context for the subclass
+        public virtual void TestShortSequence()
+        {
+            Test(new[] { (byte)Random().Next(256) });
+        }
+
+        // [Test] // LUCENENET NOTE: For now, we are overriding this test in every subclass to pull it into the right context for the subclass
+        public virtual void TestIncompressible()
+        {
+            var decompressed = new byte[RandomInts.NextIntBetween(Random(), 20, 256)];
+            for (int i = 0; i < decompressed.Length; ++i)
+            {
+                decompressed[i] = (byte)i;
+            }
+            Test(decompressed);
+        }
+
+        // [Test] // LUCENENET NOTE: For now, we are overriding this test in every subclass to pull it into the right context for the subclass
+        public virtual void TestConstant()
+        {
+            var decompressed = new byte[TestUtil.NextInt(Random(), 1, 10000)];
+            Arrays.Fill(decompressed, (byte)Random().Next());
+            Test(decompressed);
+        }
+
+        // [Test] // LUCENENET NOTE: For now, we are overriding this test in every subclass to pull it into the right context for the subclass
+        public virtual void TestLUCENE5201()
+        {
+            sbyte[] data = { 14, 72, 14, 85, 3, 72, 14, 85, 3, 72, 14, 72, 14, 72, 14, 85, 3, 72, 14, 72, 14, 72, 14, 72, 14, 72, 14, 72, 14, 85, 3, 72, 14, 85, 3, 72, 14, 85, 3, 72, 14, 85, 3, 72, 14, 85, 3, 72, 14, 85, 3, 72, 14, 50, 64, 0, 46, -1, 0, 0, 0, 29, 3, 85, 8, -113, 0, 68, -97, 3, 0, 2, 3, -97, 6, 0, 68, -113, 0, 2, 3, -97, 6, 0, 68, -113, 0, 2, 3, 85, 8, -113, 0, 68, -97, 3, 0, 2, 3, -97, 6, 0, 68, -113, 0, 2, 3, -97, 6, 0, 68, -113, 0, 2, 3, -97, 6, 0, 68, -113, 0, 2, 3, -97, 6, 0, 68, -113, 0, 2, 3, -97, 6, 0, 68, -113, 0, 2, 3, -97, 6, 0, 68, -113, 0, 2, 3, -97, 6, 0, 68, -113, 0, 2, 3, -97, 6, 0, 68, -113, 0, 2, 3, -97, 6, 0, 68, -113, 0, 2, 3, -97, 6, 0, 68, -113, 0, 50, 64, 0, 47, -105, 0, 0, 0, 30, 3, -97, 6, 0, 68, -113, 0, 2, 3, -97, 6, 0, 68, -113, 0, 2, 3, 85, 8, -113, 0, 68, -97, 3, 0, 2, 3, 85, 8, -113, 0, 68, -97, 3, 0, 2, 3, 85, 8, -113, 0, 68, -97, 3, 0, 2, -97, 6, 0, 2, 3, 85, 8, -113, 0, 68, -97, 3, 0, 2, 3, -97, 6, 0, 68, -113, 0, 2, 3, -97, 6, 0, 68
 , -113, 0, 120, 64, 0, 48, 4, 0, 0, 0, 31, 34, 72, 29, 72, 37, 72, 35, 72, 45, 72, 23, 72, 46, 72, 20, 72, 40, 72, 33, 72, 25, 72, 39, 72, 38, 72, 26, 72, 28, 72, 42, 72, 24, 72, 27, 72, 36, 72, 41, 72, 32, 72, 18, 72, 30, 72, 22, 72, 31, 72, 43, 72, 19, 72, 34, 72, 29, 72, 37, 72, 35, 72, 45, 72, 23, 72, 46, 72, 20, 72, 40, 72, 33, 72, 25, 72, 39, 72, 38, 72, 26, 72, 28, 72, 42, 72, 24, 72, 27, 72, 36, 72, 41, 72, 32, 72, 18, 72, 30, 72, 22, 72, 31, 72, 43, 72, 19, 72, 34, 72, 29, 72, 37, 72, 35, 72, 45, 72, 23, 72, 46, 72, 20, 72, 40, 72, 33, 72, 25, 72, 39, 72, 38, 72, 26, 72, 28, 72, 42, 72, 24, 72, 27, 72, 36, 72, 41, 72, 32, 72, 18, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 39, 24, 32, 34, 124, 0, 120, 64, 0, 48, 80, 0, 0, 0, 31, 30, 72, 22, 72, 31, 72, 43, 72, 19, 72, 34, 72, 29, 72, 37, 72, 35, 72, 45, 72, 23, 72, 46, 72, 20, 72, 40, 72, 33, 72, 25, 72, 39, 72, 38, 72, 26, 72, 28, 72, 42, 72, 24, 72, 27, 72, 36, 72, 41, 72, 32, 72, 
 18, 72, 30, 72, 22, 72, 31, 72, 43, 72, 19, 72, 34, 72, 29, 72, 37, 72, 35, 72, 45, 72, 23, 72, 46, 72, 20, 72, 40, 72, 33, 72, 25, 72, 39, 72, 38, 72, 26, 72, 28, 72, 42, 72, 24, 72, 27, 72, 36, 72, 41, 72, 32, 72, 18, 72, 30, 72, 22, 72, 31, 72, 43, 72, 19, 72, 34, 72, 29, 72, 37, 72, 35, 72, 45, 72, 23, 72, 46, 72, 20, 72, 40, 72, 33, 72, 25, 72, 39, 72, 38, 72, 26, 72, 28, 72, 42, 72, 24, 72, 27, 72, 36, 72, 41, 72, 32, 72, 18, 72, 30, 72, 22, 72, 31, 72, 43, 72, 19, 72, 34, 72, 29, 72, 37, 72, 35, 72, 45, 72, 23, 72, 46, 72, 20, 72, 40, 72, 33, 72, 25, 72, 39, 72, 38, 72, 26, 72, 28, 72, 42, 72, 24, 72, 27, 72, 36, 72, 41, 72, 32, 72, 18, 72, 30, 72, 22, 72, 31, 72, 43, 72, 19, 72, 34, 72, 29, 72, 37, 72, 35, 72, 45, 72, 23, 72, 46, 72, 20, 72, 40, 72, 33, 72, 25, 72, 39, 72, 38, 72, 26, 72, 28, 72, 42, 72, 24, 72, 27, 72, 36, 72, 41, 72, 32, 72, 18, 72, 30, 72, 22, 72, 31, 72, 43, 72, 19, 72, 34, 72, 29, 72, 37, 72, 35, 72, 45, 72, 23, 72, 46, 72, 20, 72, 40, 72, 33, 72, 25, 7
 2, 39, 72, 38, 72, 26, 72, 28, 72, 42, 72, 24, 72, 27, 72, 36, 72, 41, 72, 32, 72, 18, 72, 30, 72, 22, 72, 31, 72, 43, 72, 19, 72, 34, 72, 29, 72, 37, 72, 35, 72, 45, 72, 23, 72, 46, 72, 20, 72, 40, 72, 33, 72, 25, 72, 39, 72, 38, 72, 26, 72, 28, 72, 42, 72, 24, 72, 27, 72, 36, 72, 41, 72, 32, 72, 18, 72, 30, 72, 22, 72, 31, 72, 43, 72, 19, 50, 64, 0, 49, 20, 0, 0, 0, 32, 3, -97, 6, 0, 68, -113, 0, 2, 3, 85, 8, -113, 0, 68, -97, 3, 0, 2, 3, -97, 6, 0, 68, -113, 0, 2, 3, -97, 6, 0, 68, -113, 0, 2, 3, -97, 6, 0, 68, -113, 0, 2, 3, 85, 8, -113, 0, 68, -97, 3, 0, 2, 3, -97, 6, 0, 68, -113, 0, 2, 3, -97, 6, 0, 68, -113, 0, 2, 3, -97, 6, 0, 68, -113, 0, 2, 3, -97, 6, 0, 68, -113, 0, 2, 3, -97, 6, 0, 68, -113, 0, 2, 3, -97, 6, 0, 68, -113, 0, 2, 3, -97, 6, 0, 50, 64, 0, 50, 53, 0, 0, 0, 34, 3, -97, 6, 0, 68, -113, 0, 2, 3, 85, 8, -113, 0, 68, -113, 0, 2, 3, -97, 6, 0, 68, -113, 0, 2, 3, 85, 8, -113, 0, 68, -113, 0, 2, 3, -97, 6, 0, 68, -113, 0, 2, 3, -97, 6, 0, 68, -113, 0, 2, 3, -97, 6, 0
 , 68, -113, 0, 2, 3, 85, 8, -113, 0, 68, -97, 3, 0, 2, 3, -97, 6, 0, 68, -113, 0, 2, 3, 85, 8, -113, 0, 68, -97, 3, 0, 2, 3, 85, 8, -113, 0, 68, -97, 3, 0, 2, 3, -97, 6, 0, 68, -113, 0, 2, 3, 85, 8, -113, 0, 68, -97, 3, 0, 2, 3, 85, 8, -113, 0, 68, -97, 3, 0, 2, 3, -97, 6, 0, 68, -113, 0, 2, 3, -97, 6, 0, 68, -113, 0, 2, 3, -97, 6, 0, 68, -113, 0, 2, 3, 85, 8, -113, 0, 68, -97, 3, 0, 2, 3, 85, 8, -113, 0, 68, -97, 3, 0, 2, 3, 85, 8, -113, 0, 68, -97, 3, 0, 2, 3, -97, 6, 0, 50, 64, 0, 51, 85, 0, 0, 0, 36, 3, 85, 8, -113, 0, 68, -97, 3, 0, 2, 3, -97, 6, 0, 68, -113, 0, 2, 3, -97, 6, 0, 68, -113, 0, 2, 3, -97, 6, 0, 68, -113, 0, 2, 3, -97, 6, 0, 68, -113, 0, 2, -97, 5, 0, 2, 3, 85, 8, -113, 0, 68, -97, 3, 0, 2, 3, -97, 6, 0, 68, -113, 0, 2, 3, -97, 6, 0, 68, -113, 0, 2, 3, -97, 6, 0, 68, -113, 0, 2, 3, -97, 6, 0, 68, -113, 0, 2, 3, -97, 6, 0, 50, -64, 0, 51, -45, 0, 0, 0, 37, 68, -113, 0, 2, 3, -97, 6, 0, 68, -113, 0, 2, 3, -97, 6, 0, 68, -113, 0, 2, 3, -97, 6, 0, 68, -113, 0, 2, 3, -9
 7, 6, 0, 68, -113, 0, 2, 3, 85, 8, -113, 0, 68, -113, 0, 2, 3, -97, 6, 0, 68, -113, 0, 2, 3, 85, 8, -113, 0, 68, -97, 3, 0, 2, 3, 85, 8, -113, 0, 68, -97, 3, 0, 120, 64, 0, 52, -88, 0, 0, 0, 39, 13, 85, 5, 72, 13, 85, 5, 72, 13, 85, 5, 72, 13, 72, 13, 85, 5, 72, 13, 85, 5, 72, 13, 85, 5, 72, 13, 85, 5, 72, 13, 72, 13, 85, 5, 72, 13, 85, 5, 72, 13, 72, 13, 72, 13, 85, 5, 72, 13, 85, 5, 72, 13, 85, 5, 72, 13, 85, 5, 72, 13, 85, 5, 72, 13, 85, 5, 72, 13, 72, 13, 72, 13, 72, 13, 85, 5, 72, 13, 85, 5, 72, 13, 72, 13, 85, 5, 72, 13, 85, 5, 72, 13, 85, 5, 72, 13, 85, 5, 72, 13, 85, 5, 72, 13, 85, 5, 72, 13, 85, 5, 72, 13, 85, 5, 72, 13, 85, 5, 72, 13, 85, 5, 72, 13, 85, 5, 72, 13, 85, 5, 72, 13, 72, 13, 72, 13, 72, 13, 85, 5, 72, 13, 85, 5, 72, 13, 85, 5, 72, 13, 72, 13, 85, 5, 72, 13, 72, 13, 85, 5, 72, 13, 72, 13, 85, 5, 72, 13, -19, -24, -101, -35 };
+            Test(data.ToByteArray(), 9, data.Length - 9);
+        }
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/96822396/src/Lucene.Net.Tests/Codecs/Compressing/AbstractTestLZ4CompressionMode.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/Codecs/Compressing/AbstractTestLZ4CompressionMode.cs b/src/Lucene.Net.Tests/Codecs/Compressing/AbstractTestLZ4CompressionMode.cs
new file mode 100644
index 0000000..334ae8d
--- /dev/null
+++ b/src/Lucene.Net.Tests/Codecs/Compressing/AbstractTestLZ4CompressionMode.cs
@@ -0,0 +1,129 @@
+using Lucene.Net.Randomized.Generators;
+using Lucene.Net.Support;
+using NUnit.Framework;
+using System;
+using System.Text;
+
+namespace Lucene.Net.Codecs.Compressing
+{
+    /*
+     * Licensed to the Apache Software Foundation (ASF) under one or more
+     * contributor license agreements.  See the NOTICE file distributed with
+     * this work for additional information regarding copyright ownership.
+     * The ASF licenses this file to You under the Apache License, Version 2.0
+     * (the "License"); you may not use this file except in compliance with
+     * the License.  You may obtain a copy of the License at
+     *
+     *     http://www.apache.org/licenses/LICENSE-2.0
+     *
+     * Unless required by applicable law or agreed to in writing, software
+     * distributed under the License is distributed on an "AS IS" BASIS,
+     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+     * See the License for the specific language governing permissions and
+     * limitations under the License.
+     */
+
+    [TestFixture]
+    public abstract class AbstractTestLZ4CompressionMode : AbstractTestCompressionMode
+    {
+        public override byte[] Test(byte[] decompressed)
+        {
+            var compressed = base.Test(decompressed);
+            int off = 0;
+            int decompressedOff = 0;
+            for (; ; )
+            {
+                int token = compressed[off++] & 0xFF;
+                int literalLen = (int)((uint)token >> 4);
+                if (literalLen == 0x0F)
+                {
+                    while (compressed[off] == 0xFF)
+                    {
+                        literalLen += 0xFF;
+                        ++off;
+                    }
+                    literalLen += compressed[off++] & 0xFF;
+                }
+                // skip literals
+                off += literalLen;
+                decompressedOff += literalLen;
+
+                // check that the stream ends with literals and that there are at least
+                // 5 of them
+                if (off == compressed.Length)
+                {
+                    Assert.AreEqual(decompressed.Length, decompressedOff);
+                    Assert.IsTrue(literalLen >= LZ4.LAST_LITERALS || literalLen == decompressed.Length, "lastLiterals=" + literalLen + ", bytes=" + decompressed.Length);
+                    break;
+                }
+
+                int matchDec = (compressed[off++] & 0xFF) | ((compressed[off++] & 0xFF) << 8);
+                // check that match dec is not 0
+                Assert.IsTrue(matchDec > 0 && matchDec <= decompressedOff, matchDec + " " + decompressedOff);
+
+                int matchLen = token & 0x0F;
+                if (matchLen == 0x0F)
+                {
+                    while (compressed[off] == 0xFF)
+                    {
+                        matchLen += 0xFF;
+                        ++off;
+                    }
+                    matchLen += compressed[off++] & 0xFF;
+                }
+                matchLen += LZ4.MIN_MATCH;
+
+                // if the match ends prematurely, the next sequence should not have
+                // literals or this means we are wasting space
+                if (decompressedOff + matchLen < decompressed.Length - LZ4.LAST_LITERALS)
+                {
+                    bool moreCommonBytes = decompressed[decompressedOff + matchLen] == decompressed[decompressedOff - matchDec + matchLen];
+                    bool nextSequenceHasLiterals = ((int)((uint)(compressed[off] & 0xFF) >> 4)) != 0;
+                    Assert.IsTrue(!moreCommonBytes || !nextSequenceHasLiterals);
+                }
+
+                decompressedOff += matchLen;
+            }
+            Assert.AreEqual(decompressed.Length, decompressedOff);
+            return compressed;
+        }
+
+        // [Test] // LUCENENET NOTE: For now, we are overriding this test in every subclass to pull it into the right context for the subclass
+        public virtual void TestShortLiteralsAndMatchs()
+        {
+            // literals and matchs lengths <= 15
+            var decompressed = "1234562345673456745678910123".GetBytes(Encoding.UTF8);
+            Test(decompressed);
+        }
+
+        // [Test] // LUCENENET NOTE: For now, we are overriding this test in every subclass to pull it into the right context for the subclass
+        public virtual void TestLongMatchs()
+        {
+            // match length >= 20
+            var decompressed = new byte[RandomInts.NextIntBetween(Random(), 300, 1024)];
+            for (int i = 0; i < decompressed.Length; ++i)
+            {
+                decompressed[i] = (byte)i;
+            }
+            Test(decompressed);
+        }
+
+        // [Test] // LUCENENET NOTE: For now, we are overriding this test in every subclass to pull it into the right context for the subclass
+        public virtual void TestLongLiterals()
+        {
+            // long literals (length >= 16) which are not the last literals
+            var decompressed = RandomArray(RandomInts.NextIntBetween(Random(), 400, 1024), 256);
+            int matchRef = Random().Next(30);
+            int matchOff = RandomInts.NextIntBetween(Random(), decompressed.Length - 40, decompressed.Length - 20);
+            int matchLength = RandomInts.NextIntBetween(Random(), 4, 10);
+            Array.Copy(decompressed, matchRef, decompressed, matchOff, matchLength);
+            Test(decompressed);
+        }
+
+        // [Test] // LUCENENET NOTE: For now, we are overriding this test in every subclass to pull it into the right context for the subclass
+        public virtual void TestMatchRightBeforeLastLiterals()
+        {
+            Test(new byte[] { 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4, 5 });
+        }
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/96822396/src/Lucene.Net.Tests/Codecs/Compressing/TestCompressingStoredFieldsFormat.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/Codecs/Compressing/TestCompressingStoredFieldsFormat.cs b/src/Lucene.Net.Tests/Codecs/Compressing/TestCompressingStoredFieldsFormat.cs
new file mode 100644
index 0000000..ef5ac7e
--- /dev/null
+++ b/src/Lucene.Net.Tests/Codecs/Compressing/TestCompressingStoredFieldsFormat.cs
@@ -0,0 +1,200 @@
+using Lucene.Net.Documents;
+using Field = Lucene.Net.Documents.Field;
+
+namespace Lucene.Net.Codecs.Compressing
+{
+    using Lucene.Net.Randomized.Generators;
+    using NUnit.Framework;
+    using System;
+    using BaseStoredFieldsFormatTestCase = Lucene.Net.Index.BaseStoredFieldsFormatTestCase;
+    using Directory = Lucene.Net.Store.Directory;
+    using Document = Documents.Document;
+    using Field = Field;
+    using FieldType = FieldType;
+    using IndexWriterConfig = Lucene.Net.Index.IndexWriterConfig;
+    using Int32Field = Int32Field;
+
+    /*
+         * Licensed to the Apache Software Foundation (ASF) under one or more
+         * contributor license agreements.  See the NOTICE file distributed with
+         * this work for additional information regarding copyright ownership.
+         * The ASF licenses this file to You under the Apache License, Version 2.0
+         * (the "License"); you may not use this file except in compliance with
+         * the License.  You may obtain a copy of the License at
+         *
+         *     http://www.apache.org/licenses/LICENSE-2.0
+         *
+         * Unless required by applicable law or agreed to in writing, software
+         * distributed under the License is distributed on an "AS IS" BASIS,
+         * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+         * See the License for the specific language governing permissions and
+         * limitations under the License.
+         */
+
+    using MockAnalyzer = Lucene.Net.Analysis.MockAnalyzer;
+    using RandomIndexWriter = Lucene.Net.Index.RandomIndexWriter;
+    using Attributes;
+
+    [TestFixture]
+    public class TestCompressingStoredFieldsFormat : BaseStoredFieldsFormatTestCase
+    {
+        protected override Codec Codec
+        {
+            get
+            {
+                return CompressingCodec.RandomInstance(Random());
+            }
+        }
+
+        [Test]
+        public virtual void TestDeletePartiallyWrittenFilesIfAbort()
+        {
+            Directory dir = NewDirectory();
+            IndexWriterConfig iwConf = NewIndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(Random()));
+            iwConf.SetMaxBufferedDocs(RandomInts.NextIntBetween(Random(), 2, 30));
+            iwConf.SetCodec(CompressingCodec.RandomInstance(Random()));
+            // disable CFS because this test checks file names
+            iwConf.SetMergePolicy(NewLogMergePolicy(false));
+            iwConf.SetUseCompoundFile(false);
+            RandomIndexWriter iw = new RandomIndexWriter(Random(), dir, iwConf);
+
+            Document validDoc = new Document();
+            validDoc.Add(new Int32Field("id", 0, Field.Store.YES));
+            iw.AddDocument(validDoc);
+            iw.Commit();
+
+            // make sure that #writeField will fail to trigger an abort
+            Document invalidDoc = new Document();
+            FieldType fieldType = new FieldType();
+            fieldType.IsStored = true;
+            invalidDoc.Add(new FieldAnonymousInnerClassHelper(this, fieldType));
+
+            try
+            {
+                Assert.Throws<ArgumentException>(() => {
+                    iw.AddDocument(invalidDoc);
+                    iw.Commit();
+                });
+            }
+            finally
+            {
+                int counter = 0;
+                foreach (string fileName in dir.ListAll())
+                {
+                    if (fileName.EndsWith(".fdt") || fileName.EndsWith(".fdx"))
+                    {
+                        counter++;
+                    }
+                }
+                // Only one .fdt and one .fdx files must have been found
+                Assert.AreEqual(2, counter);
+                iw.Dispose();
+                dir.Dispose();
+            }
+        }
+
+        private class FieldAnonymousInnerClassHelper : Field
+        {
+            private readonly TestCompressingStoredFieldsFormat OuterInstance;
+
+            public FieldAnonymousInnerClassHelper(TestCompressingStoredFieldsFormat outerInstance, FieldType fieldType)
+                : base("invalid", fieldType)
+            {
+                this.OuterInstance = outerInstance;
+            }
+        }
+
+
+        #region BaseStoredFieldsFormatTestCase
+        // LUCENENET NOTE: Tests in an abstract base class are not pulled into the correct
+        // context in Visual Studio. This fixes that with the minimum amount of code necessary
+        // to run them in the correct context without duplicating all of the tests.
+
+        [Test]
+        public override void TestRandomStoredFields()
+        {
+            base.TestRandomStoredFields();
+        }
+
+        [Test]
+        // LUCENE-1727: make sure doc fields are stored in order
+        public override void TestStoredFieldsOrder()
+        {
+            base.TestStoredFieldsOrder();
+        }
+
+        [Test]
+        // LUCENE-1219
+        public override void TestBinaryFieldOffsetLength()
+        {
+            base.TestBinaryFieldOffsetLength();
+        }
+
+        [Test]
+        public override void TestNumericField()
+        {
+            base.TestNumericField();
+        }
+
+        [Test]
+        public override void TestIndexedBit()
+        {
+            base.TestIndexedBit();
+        }
+
+        [Test]
+        public override void TestReadSkip()
+        {
+            base.TestReadSkip();
+        }
+
+        [Test]
+        public override void TestEmptyDocs()
+        {
+            base.TestEmptyDocs();
+        }
+
+        [Test]
+        public override void TestConcurrentReads()
+        {
+            base.TestConcurrentReads();
+        }
+
+        [Test]
+        public override void TestWriteReadMerge()
+        {
+            base.TestWriteReadMerge();
+        }
+
+#if !NETSTANDARD
+        // LUCENENET: There is no Timeout on NUnit for .NET Core.
+        [Timeout(300000)]
+#endif
+        [Test, HasTimeout]
+        public override void TestBigDocuments()
+        {
+            base.TestBigDocuments();
+        }
+
+        [Test]
+        public override void TestBulkMergeWithDeletes()
+        {
+            base.TestBulkMergeWithDeletes();
+        }
+
+        #endregion
+
+        #region BaseIndexFileFormatTestCase
+        // LUCENENET NOTE: Tests in an abstract base class are not pulled into the correct
+        // context in Visual Studio. This fixes that with the minimum amount of code necessary
+        // to run them in the correct context without duplicating all of the tests.
+
+        [Test]
+        public override void TestMergeStability()
+        {
+            base.TestMergeStability();
+        }
+
+        #endregion
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/96822396/src/Lucene.Net.Tests/Codecs/Compressing/TestCompressingTermVectorsFormat.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/Codecs/Compressing/TestCompressingTermVectorsFormat.cs b/src/Lucene.Net.Tests/Codecs/Compressing/TestCompressingTermVectorsFormat.cs
new file mode 100644
index 0000000..1ce3276
--- /dev/null
+++ b/src/Lucene.Net.Tests/Codecs/Compressing/TestCompressingTermVectorsFormat.cs
@@ -0,0 +1,164 @@
+using Lucene.Net.Documents;
+
+namespace Lucene.Net.Codecs.Compressing
+{
+    using Attributes;
+    using NUnit.Framework;
+    using AtomicReader = Lucene.Net.Index.AtomicReader;
+    using BaseTermVectorsFormatTestCase = Lucene.Net.Index.BaseTermVectorsFormatTestCase;
+    using BytesRef = Lucene.Net.Util.BytesRef;
+    using Directory = Lucene.Net.Store.Directory;
+    using Document = Documents.Document;
+    using Field = Field;
+    using FieldType = FieldType;
+    using RandomIndexWriter = Lucene.Net.Index.RandomIndexWriter;
+    using Terms = Lucene.Net.Index.Terms;
+    using TermsEnum = Lucene.Net.Index.TermsEnum;
+    using TextField = TextField;
+
+    //using Repeat = com.carrotsearch.randomizedtesting.annotations.Repeat;
+
+    /*
+     * Licensed to the Apache Software Foundation (ASF) under one or more
+     * contributor license agreements.  See the NOTICE file distributed with
+     * this work for additional information regarding copyright ownership.
+     * The ASF licenses this file to You under the Apache License, Version 2.0
+     * (the "License"); you may not use this file except in compliance with
+     * the License.  You may obtain a copy of the License at
+     *
+     *     http://www.apache.org/licenses/LICENSE-2.0
+     *
+     * Unless required by applicable law or agreed to in writing, software
+     * distributed under the License is distributed on an "AS IS" BASIS,
+     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+     * See the License for the specific language governing permissions and
+     * limitations under the License.
+     */
+
+    [TestFixture]
+    public class TestCompressingTermVectorsFormat : BaseTermVectorsFormatTestCase
+    {
+        protected override Codec Codec
+        {
+            get
+            {
+                return CompressingCodec.RandomInstance(Random());
+            }
+        }
+
+        // https://issues.apache.org/jira/browse/LUCENE-5156
+        [Test]
+        public virtual void TestNoOrds()
+        {
+            Directory dir = NewDirectory();
+            RandomIndexWriter iw = new RandomIndexWriter(Random(), dir, Similarity, TimeZone);
+            Document doc = new Document();
+            FieldType ft = new FieldType(TextField.TYPE_NOT_STORED);
+            ft.StoreTermVectors = true;
+            doc.Add(new Field("foo", "this is a test", ft));
+            iw.AddDocument(doc);
+            AtomicReader ir = GetOnlySegmentReader(iw.Reader);
+            Terms terms = ir.GetTermVector(0, "foo");
+            Assert.IsNotNull(terms);
+            TermsEnum termsEnum = terms.GetIterator(null);
+            Assert.AreEqual(TermsEnum.SeekStatus.FOUND, termsEnum.SeekCeil(new BytesRef("this")));
+            try
+            {
+                var _ = termsEnum.Ord;
+                Assert.Fail();
+            }
+#pragma warning disable 168
+            catch (System.NotSupportedException expected)
+#pragma warning restore 168
+            {
+                // expected exception
+            }
+
+            try
+            {
+                termsEnum.SeekExact(0);
+                Assert.Fail();
+            }
+#pragma warning disable 168
+            catch (System.NotSupportedException expected)
+#pragma warning restore 168
+            {
+                // expected exception
+            }
+            ir.Dispose();
+            iw.Dispose();
+            dir.Dispose();
+        }
+
+
+        #region BaseTermVectorsFormatTestCase
+        // LUCENENET NOTE: Tests in an abstract base class are not pulled into the correct
+        // context in Visual Studio. This fixes that with the minimum amount of code necessary
+        // to run them in the correct context without duplicating all of the tests.
+
+        [Test]
+        // only one doc with vectors
+        public override void TestRareVectors()
+        {
+            base.TestRareVectors();
+        }
+
+        [Test]
+        public override void TestHighFreqs()
+        {
+            base.TestHighFreqs();
+        }
+
+        [Test]
+        public override void TestLotsOfFields()
+        {
+            base.TestLotsOfFields();
+        }
+
+        [Test]
+        // different options for the same field
+        public override void TestMixedOptions()
+        {
+            base.TestMixedOptions();
+        }
+
+        [Test]
+        public override void TestRandom()
+        {
+            base.TestRandom();
+        }
+
+#if !NETSTANDARD
+        // LUCENENET: There is no Timeout on NUnit for .NET Core.
+        [Timeout(30000)]
+#endif
+        [Test, HasTimeout]
+        public override void TestMerge()
+        {
+            base.TestMerge();
+        }
+
+        [Test]
+        // run random tests from different threads to make sure the per-thread clones
+        // don't share mutable data
+        public override void TestClone()
+        {
+            base.TestClone();
+        }
+
+        #endregion
+
+        #region BaseIndexFileFormatTestCase
+        // LUCENENET NOTE: Tests in an abstract base class are not pulled into the correct
+        // context in Visual Studio. This fixes that with the minimum amount of code necessary
+        // to run them in the correct context without duplicating all of the tests.
+
+        [Test]
+        public override void TestMergeStability()
+        {
+            base.TestMergeStability();
+        }
+
+        #endregion
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/96822396/src/Lucene.Net.Tests/Codecs/Compressing/TestFastCompressionMode.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/Codecs/Compressing/TestFastCompressionMode.cs b/src/Lucene.Net.Tests/Codecs/Compressing/TestFastCompressionMode.cs
new file mode 100644
index 0000000..6a74a51
--- /dev/null
+++ b/src/Lucene.Net.Tests/Codecs/Compressing/TestFastCompressionMode.cs
@@ -0,0 +1,113 @@
+using NUnit.Framework;
+
+namespace Lucene.Net.Codecs.Compressing
+{
+    /*
+     * Licensed to the Apache Software Foundation (ASF) under one or more
+     * contributor license agreements.  See the NOTICE file distributed with
+     * this work for additional information regarding copyright ownership.
+     * The ASF licenses this file to You under the Apache License, Version 2.0
+     * (the "License"); you may not use this file except in compliance with
+     * the License.  You may obtain a copy of the License at
+     *
+     *     http://www.apache.org/licenses/LICENSE-2.0
+     *
+     * Unless required by applicable law or agreed to in writing, software
+     * distributed under the License is distributed on an "AS IS" BASIS,
+     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+     * See the License for the specific language governing permissions and
+     * limitations under the License.
+     */
+
+    [TestFixture]
+    public class TestFastCompressionMode : AbstractTestLZ4CompressionMode
+    {
+        [SetUp]
+        public override void SetUp()
+        {
+            base.SetUp();
+            Mode = CompressionMode.FAST;
+        }
+
+
+        #region AbstractTestLZ4CompressionMode
+        // LUCENENET NOTE: Tests in an abstract base class are not pulled into the correct
+        // context in Visual Studio. This fixes that with the minimum amount of code necessary
+        // to run them in the correct context without duplicating all of the tests.
+
+        [Test]
+        public override void TestShortLiteralsAndMatchs()
+        {
+            base.TestShortLiteralsAndMatchs();
+        }
+
+        [Test]
+        public override void TestLongMatchs()
+        {
+            base.TestLongMatchs();
+        }
+
+        [Test]
+        public override void TestLongLiterals()
+        {
+            base.TestLongLiterals();
+        }
+
+        [Test]
+        public override void TestMatchRightBeforeLastLiterals()
+        {
+            base.TestMatchRightBeforeLastLiterals();
+        }
+
+        #endregion
+
+        #region AbstractTestCompressionMode
+        // LUCENENET NOTE: Tests in an abstract base class are not pulled into the correct
+        // context in Visual Studio. This fixes that with the minimum amount of code necessary
+        // to run them in the correct context without duplicating all of the tests.
+
+        [Test]
+        public override void TestDecompress()
+        {
+            base.TestDecompress();
+        }
+
+        [Test]
+        public override void TestPartialDecompress()
+        {
+            base.TestPartialDecompress();
+        }
+
+        [Test]
+        public override void TestEmptySequence()
+        {
+            base.TestEmptySequence();
+        }
+
+        [Test]
+        public override void TestShortSequence()
+        {
+            base.TestShortSequence();
+        }
+
+        [Test]
+        public override void TestIncompressible()
+        {
+            base.TestIncompressible();
+        }
+
+        [Test]
+        public override void TestConstant()
+        {
+            base.TestConstant();
+        }
+
+        [Test]
+        public override void TestLUCENE5201()
+        {
+            base.TestLUCENE5201();
+        }
+
+        #endregion
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/96822396/src/Lucene.Net.Tests/Codecs/Compressing/TestFastDecompressionMode.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/Codecs/Compressing/TestFastDecompressionMode.cs b/src/Lucene.Net.Tests/Codecs/Compressing/TestFastDecompressionMode.cs
new file mode 100644
index 0000000..b90a582
--- /dev/null
+++ b/src/Lucene.Net.Tests/Codecs/Compressing/TestFastDecompressionMode.cs
@@ -0,0 +1,123 @@
+using NUnit.Framework;
+
+namespace Lucene.Net.Codecs.Compressing
+{
+    /*
+     * Licensed to the Apache Software Foundation (ASF) under one or more
+     * contributor license agreements.  See the NOTICE file distributed with
+     * this work for additional information regarding copyright ownership.
+     * The ASF licenses this file to You under the Apache License, Version 2.0
+     * (the "License"); you may not use this file except in compliance with
+     * the License.  You may obtain a copy of the License at
+     *
+     *     http://www.apache.org/licenses/LICENSE-2.0
+     *
+     * Unless required by applicable law or agreed to in writing, software
+     * distributed under the License is distributed on an "AS IS" BASIS,
+     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+     * See the License for the specific language governing permissions and
+     * limitations under the License.
+     */
+
+    [TestFixture]
+    public class TestFastDecompressionMode : AbstractTestLZ4CompressionMode
+    {
+        [SetUp]
+        public override void SetUp()
+        {
+            base.SetUp();
+            Mode = CompressionMode.FAST_DECOMPRESSION;
+        }
+
+        public override byte[] Test(byte[] decompressed, int off, int len)
+        {
+            var compressed = base.Test(decompressed, off, len);
+            var compressed2 = Compress(CompressionMode.FAST.NewCompressor(), decompressed, off, len);
+            // because of the way this compression mode works, its output is necessarily
+            // smaller than the output of CompressionMode.FAST
+            Assert.IsTrue(compressed.Length <= compressed2.Length);
+            return compressed;
+        }
+
+
+        #region AbstractTestLZ4CompressionMode
+        // LUCENENET NOTE: Tests in an abstract base class are not pulled into the correct
+        // context in Visual Studio. This fixes that with the minimum amount of code necessary
+        // to run them in the correct context without duplicating all of the tests.
+
+        [Test]
+        public override void TestShortLiteralsAndMatchs()
+        {
+            base.TestShortLiteralsAndMatchs();
+        }
+
+        [Test]
+        public override void TestLongMatchs()
+        {
+            base.TestLongMatchs();
+        }
+
+        [Test]
+        public override void TestLongLiterals()
+        {
+            base.TestLongLiterals();
+        }
+
+        [Test]
+        public override void TestMatchRightBeforeLastLiterals()
+        {
+            base.TestMatchRightBeforeLastLiterals();
+        }
+
+        #endregion
+
+        #region AbstractTestCompressionMode
+        // LUCENENET NOTE: Tests in an abstract base class are not pulled into the correct
+        // context in Visual Studio. This fixes that with the minimum amount of code necessary
+        // to run them in the correct context without duplicating all of the tests.
+
+        [Test]
+        public override void TestDecompress()
+        {
+            base.TestDecompress();
+        }
+
+        [Test]
+        public override void TestPartialDecompress()
+        {
+            base.TestPartialDecompress();
+        }
+
+        [Test]
+        public override void TestEmptySequence()
+        {
+            base.TestEmptySequence();
+        }
+
+        [Test]
+        public override void TestShortSequence()
+        {
+            base.TestShortSequence();
+        }
+
+        [Test]
+        public override void TestIncompressible()
+        {
+            base.TestIncompressible();
+        }
+
+        [Test]
+        public override void TestConstant()
+        {
+            base.TestConstant();
+        }
+
+        [Test]
+        public override void TestLUCENE5201()
+        {
+            base.TestLUCENE5201();
+        }
+
+        #endregion
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/96822396/src/Lucene.Net.Tests/Codecs/Compressing/TestHighCompressionMode.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/Codecs/Compressing/TestHighCompressionMode.cs b/src/Lucene.Net.Tests/Codecs/Compressing/TestHighCompressionMode.cs
new file mode 100644
index 0000000..679d1f0
--- /dev/null
+++ b/src/Lucene.Net.Tests/Codecs/Compressing/TestHighCompressionMode.cs
@@ -0,0 +1,82 @@
+using NUnit.Framework;
+
+namespace Lucene.Net.Codecs.Compressing
+{
+    /*
+     * Licensed to the Apache Software Foundation (ASF) under one or more
+     * contributor license agreements.  See the NOTICE file distributed with
+     * this work for additional information regarding copyright ownership.
+     * The ASF licenses this file to You under the Apache License, Version 2.0
+     * (the "License"); you may not use this file except in compliance with
+     * the License.  You may obtain a copy of the License at
+     *
+     *     http://www.apache.org/licenses/LICENSE-2.0
+     *
+     * Unless required by applicable law or agreed to in writing, software
+     * distributed under the License is distributed on an "AS IS" BASIS,
+     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+     * See the License for the specific language governing permissions and
+     * limitations under the License.
+     */
+
+    [TestFixture]
+    public class TestHighCompressionMode : AbstractTestCompressionMode
+    {
+        [SetUp]
+        public override void SetUp()
+        {
+            base.SetUp();
+            Mode = CompressionMode.HIGH_COMPRESSION;
+        }
+
+
+        #region AbstractTestCompressionMode
+        // LUCENENET NOTE: Tests in an abstract base class are not pulled into the correct
+        // context in Visual Studio. This fixes that with the minimum amount of code necessary
+        // to run them in the correct context without duplicating all of the tests.
+
+        [Test]
+        public override void TestDecompress()
+        {
+            base.TestDecompress();
+        }
+
+        [Test]
+        public override void TestPartialDecompress()
+        {
+            base.TestPartialDecompress();
+        }
+
+        [Test]
+        public override void TestEmptySequence()
+        {
+            base.TestEmptySequence();
+        }
+
+        [Test]
+        public override void TestShortSequence()
+        {
+            base.TestShortSequence();
+        }
+
+        [Test]
+        public override void TestIncompressible()
+        {
+            base.TestIncompressible();
+        }
+
+        [Test]
+        public override void TestConstant()
+        {
+            base.TestConstant();
+        }
+
+        [Test]
+        public override void TestLUCENE5201()
+        {
+            base.TestLUCENE5201();
+        }
+        #endregion
+
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/96822396/src/Lucene.Net.Tests/Codecs/Lucene3x/TestImpersonation.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/Codecs/Lucene3x/TestImpersonation.cs b/src/Lucene.Net.Tests/Codecs/Lucene3x/TestImpersonation.cs
new file mode 100644
index 0000000..ca9e9b9
--- /dev/null
+++ b/src/Lucene.Net.Tests/Codecs/Lucene3x/TestImpersonation.cs
@@ -0,0 +1,39 @@
+namespace Lucene.Net.Codecs.Lucene3x
+{
+    using NUnit.Framework;
+
+    /*
+         * Licensed to the Apache Software Foundation (ASF) under one or more
+         * contributor license agreements.  See the NOTICE file distributed with
+         * this work for additional information regarding copyright ownership.
+         * The ASF licenses this file to You under the Apache License, Version 2.0
+         * (the "License"); you may not use this file except in compliance with
+         * the License.  You may obtain a copy of the License at
+         *
+         *     http://www.apache.org/licenses/LICENSE-2.0
+         *
+         * Unless required by applicable law or agreed to in writing, software
+         * distributed under the License is distributed on an "AS IS" BASIS,
+         * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+         * See the License for the specific language governing permissions and
+         * limitations under the License.
+         */
+
+    using LuceneTestCase = Lucene.Net.Util.LuceneTestCase;
+
+    /// <summary>
+    /// Test that the SPI magic is returning "PreFlexRWCodec" for Lucene3x
+    ///
+    /// @lucene.experimental
+    /// </summary>
+    [TestFixture]
+    public class TestImpersonation : LuceneTestCase
+    {
+        [Test]
+        public virtual void Test()
+        {
+            Codec codec = Codec.ForName("Lucene3x");
+            Assert.IsTrue(codec is PreFlexRWCodec);
+        }
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/96822396/src/Lucene.Net.Tests/Codecs/Lucene3x/TestLucene3xPostingsFormat.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/Codecs/Lucene3x/TestLucene3xPostingsFormat.cs b/src/Lucene.Net.Tests/Codecs/Lucene3x/TestLucene3xPostingsFormat.cs
new file mode 100644
index 0000000..0ab9a7b
--- /dev/null
+++ b/src/Lucene.Net.Tests/Codecs/Lucene3x/TestLucene3xPostingsFormat.cs
@@ -0,0 +1,109 @@
+using NUnit.Framework;
+
+namespace Lucene.Net.Codecs.Lucene3x
+{
+    using BasePostingsFormatTestCase = Lucene.Net.Index.BasePostingsFormatTestCase;
+    using LuceneTestCase = Lucene.Net.Util.LuceneTestCase;
+
+    /*
+     * Licensed to the Apache Software Foundation (ASF) under one or more
+     * contributor license agreements.  See the NOTICE file distributed with
+     * this work for additional information regarding copyright ownership.
+     * The ASF licenses this file to You under the Apache License, Version 2.0
+     * (the "License"); you may not use this file except in compliance with
+     * the License.  You may obtain a copy of the License at
+     *
+     *     http://www.apache.org/licenses/LICENSE-2.0
+     *
+     * Unless required by applicable law or agreed to in writing, software
+     * distributed under the License is distributed on an "AS IS" BASIS,
+     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+     * See the License for the specific language governing permissions and
+     * limitations under the License.
+     */
+
+    /// <summary>
+    /// Tests Lucene3x postings format
+    /// </summary>
+    public class TestLucene3xPostingsFormat : BasePostingsFormatTestCase
+    {
+        private readonly Codec Codec_Renamed;
+
+        public TestLucene3xPostingsFormat() : base()
+        {
+            OLD_FORMAT_IMPERSONATION_IS_ACTIVE = true; // explicitly instantiates ancient codec
+            Codec_Renamed = new PreFlexRWCodec(OLD_FORMAT_IMPERSONATION_IS_ACTIVE);
+        }
+
+        protected override Codec Codec
+        {
+            get
+            {
+                return Codec_Renamed;
+            }
+        }
+
+
+        #region BasePostingsFormatTestCase
+        // LUCENENET NOTE: Tests in an abstract base class are not pulled into the correct
+        // context in Visual Studio. This fixes that with the minimum amount of code necessary
+        // to run them in the correct context without duplicating all of the tests.
+
+        [Test]
+        public override void TestDocsOnly()
+        {
+            base.TestDocsOnly();
+        }
+
+        [Test]
+        public override void TestDocsAndFreqs()
+        {
+            base.TestDocsAndFreqs();
+        }
+
+        [Test]
+        public override void TestDocsAndFreqsAndPositions()
+        {
+            base.TestDocsAndFreqsAndPositions();
+        }
+
+        [Test]
+        public override void TestDocsAndFreqsAndPositionsAndPayloads()
+        {
+            base.TestDocsAndFreqsAndPositionsAndPayloads();
+        }
+
+        [Test]
+        public override void TestDocsAndFreqsAndPositionsAndOffsets()
+        {
+            base.TestDocsAndFreqsAndPositionsAndOffsets();
+        }
+
+        [Test]
+        public override void TestDocsAndFreqsAndPositionsAndOffsetsAndPayloads()
+        {
+            base.TestDocsAndFreqsAndPositionsAndOffsetsAndPayloads();
+        }
+
+        [Test]
+        public override void TestRandom()
+        {
+            base.TestRandom();
+        }
+
+        #endregion
+
+        #region BaseIndexFileFormatTestCase
+        // LUCENENET NOTE: Tests in an abstract base class are not pulled into the correct
+        // context in Visual Studio. This fixes that with the minimum amount of code necessary
+        // to run them in the correct context without duplicating all of the tests.
+
+        [Test]
+        public override void TestMergeStability()
+        {
+            base.TestMergeStability();
+        }
+
+        #endregion
+    }
+}
\ No newline at end of file