You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucenenet.apache.org by mh...@apache.org on 2011/07/24 03:21:30 UTC

[Lucene.Net] svn commit: r1150245 [2/2] - in /incubator/lucene.net/branches/Lucene.Net_2_9_4g: ./ src/core/ src/core/Analysis/ src/core/Analysis/Tokenattributes/ src/core/Store/ src/core/Util/ test/core/ test/core/Analysis/ test/core/Analysis/Tokenattributes/ test/...

Modified: incubator/lucene.net/branches/Lucene.Net_2_9_4g/test/core/Analysis/Tokenattributes/TestSimpleAttributeImpls.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net_2_9_4g/test/core/Analysis/Tokenattributes/TestSimpleAttributeImpls.cs?rev=1150245&r1=1150244&r2=1150245&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net_2_9_4g/test/core/Analysis/Tokenattributes/TestSimpleAttributeImpls.cs (original)
+++ incubator/lucene.net/branches/Lucene.Net_2_9_4g/test/core/Analysis/Tokenattributes/TestSimpleAttributeImpls.cs Sun Jul 24 01:21:27 2011
@@ -27,13 +27,10 @@ namespace Lucene.Net.Analysis.Tokenattri
 {
 	
     [TestFixture]
-	public class TestSimpleAttributeImpls:LuceneTestCase
+    [Category(Categories.Unit)]
+	public class TestSimpleAttributeImpls 
 	{
 		
-		public TestSimpleAttributeImpls():base("")
-		{
-		}
-        
         [Test]
 		public virtual void  TestFlagsAttribute()
 		{
@@ -116,7 +113,8 @@ namespace Lucene.Net.Analysis.Tokenattri
 		public virtual void  TestOffsetAttribute()
 		{
 			OffsetAttributeImpl att = new OffsetAttributeImpl();
-			Assert.AreEqual(0, att.StartOffset());
+			
+            Assert.AreEqual(0, att.StartOffset());
 			Assert.AreEqual(0, att.EndOffset());
 			
 			att.SetOffset(12, 34);
@@ -138,17 +136,22 @@ namespace Lucene.Net.Analysis.Tokenattri
 		public static AttributeImpl AssertCloneIsEqual(AttributeImpl att)
 		{
 			AttributeImpl clone = (AttributeImpl) att.Clone();
-			Assert.AreEqual(att, clone, "Clone must be equal");
+			
+            Assert.AreEqual(att, clone, "Clone must be equal");
 			Assert.AreEqual(att.GetHashCode(), clone.GetHashCode(), "Clone's hashcode must be equal");
-			return clone;
+			
+            return clone;
 		}
 		
 		public static AttributeImpl AssertCopyIsEqual(AttributeImpl att)
 		{
 			AttributeImpl copy = (AttributeImpl) System.Activator.CreateInstance(att.GetType());
-			att.CopyTo(copy);
+			
+            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;
 		}
 	}

Modified: incubator/lucene.net/branches/Lucene.Net_2_9_4g/test/core/Analysis/Tokenattributes/TestTermAttributeImpl.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net_2_9_4g/test/core/Analysis/Tokenattributes/TestTermAttributeImpl.cs?rev=1150245&r1=1150244&r2=1150245&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net_2_9_4g/test/core/Analysis/Tokenattributes/TestTermAttributeImpl.cs (original)
+++ incubator/lucene.net/branches/Lucene.Net_2_9_4g/test/core/Analysis/Tokenattributes/TestTermAttributeImpl.cs Sun Jul 24 01:21:27 2011
@@ -20,28 +20,29 @@ using System;
 using NUnit.Framework;
 
 using LuceneTestCase = Lucene.Net.Util.LuceneTestCase;
+using System.Text;
 
 namespace Lucene.Net.Analysis.Tokenattributes
 {
 	
     [TestFixture]
-	public class TestTermAttributeImpl:LuceneTestCase
+    [Category(Categories.Unit)]
+	public class TestTermAttributeImpl
 	{
-		
-		public TestTermAttributeImpl():base("")
-		{
-		}
 
         [Test]
 		public virtual void  TestResize()
 		{
 			TermAttributeImpl t = new TermAttributeImpl();
 			char[] content = "hello".ToCharArray();
-			t.SetTermBuffer(content, 0, content.Length);
-			for (int i = 0; i < 2000; i++)
+			
+            t.SetTermBuffer(content, 0, content.Length);
+			
+            for (int i = 0; i < 2000; i++)
 			{
 				t.ResizeTermBuffer(i);
-				Assert.IsTrue(i <= t.TermBuffer().Length);
+				
+                Assert.IsTrue(i <= t.TermBuffer().Length);
 				Assert.AreEqual("hello", t.Term());
 			}
 		}
@@ -50,30 +51,38 @@ namespace Lucene.Net.Analysis.Tokenattri
 		public virtual void  TestGrow()
 		{
 			TermAttributeImpl t = new TermAttributeImpl();
-			System.Text.StringBuilder buf = new System.Text.StringBuilder("ab");
+			StringBuilder buf = new System.Text.StringBuilder("ab");
+
 			for (int i = 0; i < 20; i++)
 			{
 				char[] content = buf.ToString().ToCharArray();
 				t.SetTermBuffer(content, 0, content.Length);
-				Assert.AreEqual(buf.Length, t.TermLength());
+				
+                Assert.AreEqual(buf.Length, t.TermLength());
 				Assert.AreEqual(buf.ToString(), t.Term());
-				buf.Append(buf.ToString());
+				
+                buf.Append(buf.ToString());
 			}
-			Assert.AreEqual(1048576, t.TermLength());
+			
+            Assert.AreEqual(1048576, t.TermLength());
 			Assert.AreEqual(1179654, t.TermBuffer().Length);
 			
 			// now as a string, first variant
 			t = new TermAttributeImpl();
 			buf = new System.Text.StringBuilder("ab");
-			for (int i = 0; i < 20; i++)
+			
+            for (int i = 0; i < 20; i++)
 			{
 				System.String content = buf.ToString();
 				t.SetTermBuffer(content, 0, content.Length);
-				Assert.AreEqual(content.Length, t.TermLength());
+			
+                Assert.AreEqual(content.Length, t.TermLength());
 				Assert.AreEqual(content, t.Term());
-				buf.Append(content);
+				
+                buf.Append(content);
 			}
-			Assert.AreEqual(1048576, t.TermLength());
+			
+            Assert.AreEqual(1048576, t.TermLength());
 			Assert.AreEqual(1179654, t.TermBuffer().Length);
 			
 			// now as a string, second variant
@@ -83,9 +92,11 @@ namespace Lucene.Net.Analysis.Tokenattri
 			{
 				System.String content = buf.ToString();
 				t.SetTermBuffer(content);
-				Assert.AreEqual(content.Length, t.TermLength());
+				
+                Assert.AreEqual(content.Length, t.TermLength());
 				Assert.AreEqual(content, t.Term());
-				buf.Append(content);
+				
+                buf.Append(content);
 			}
 			Assert.AreEqual(1048576, t.TermLength());
 			Assert.AreEqual(1179654, t.TermBuffer().Length);
@@ -93,29 +104,37 @@ namespace Lucene.Net.Analysis.Tokenattri
 			// Test for slow growth to a long term
 			t = new TermAttributeImpl();
 			buf = new System.Text.StringBuilder("a");
-			for (int i = 0; i < 20000; i++)
+			
+            for (int i = 0; i < 20000; i++)
 			{
 				System.String content = buf.ToString();
 				t.SetTermBuffer(content);
-				Assert.AreEqual(content.Length, t.TermLength());
+				
+                Assert.AreEqual(content.Length, t.TermLength());
 				Assert.AreEqual(content, t.Term());
-				buf.Append("a");
+				
+                buf.Append("a");
 			}
-			Assert.AreEqual(20000, t.TermLength());
+			
+            Assert.AreEqual(20000, t.TermLength());
 			Assert.AreEqual(20167, t.TermBuffer().Length);
 			
 			// Test for slow growth to a long term
 			t = new TermAttributeImpl();
 			buf = new System.Text.StringBuilder("a");
-			for (int i = 0; i < 20000; i++)
+			
+            for (int i = 0; i < 20000; i++)
 			{
 				System.String content = buf.ToString();
 				t.SetTermBuffer(content);
-				Assert.AreEqual(content.Length, t.TermLength());
+				
+                Assert.AreEqual(content.Length, t.TermLength());
 				Assert.AreEqual(content, t.Term());
-				buf.Append("a");
+			
+                buf.Append("a");
 			}
-			Assert.AreEqual(20000, t.TermLength());
+			
+            Assert.AreEqual(20000, t.TermLength());
 			Assert.AreEqual(20167, t.TermBuffer().Length);
 		}
 		
@@ -124,8 +143,9 @@ namespace Lucene.Net.Analysis.Tokenattri
 		{
 			char[] b = new char[]{'a', 'l', 'o', 'h', 'a'};
 			TermAttributeImpl t = new TermAttributeImpl();
-			t.SetTermBuffer(b, 0, 5);
-			Assert.AreEqual("term=aloha", t.ToString());
+			
+            t.SetTermBuffer(b, 0, 5);
+            Assert.AreEqual("term=aloha", t.ToString());
 			
 			t.SetTermBuffer("hi there");
 			Assert.AreEqual("term=hi there", t.ToString());
@@ -135,13 +155,16 @@ namespace Lucene.Net.Analysis.Tokenattri
 		public virtual void  TestMixedStringArray()
 		{
 			TermAttributeImpl t = new TermAttributeImpl();
-			t.SetTermBuffer("hello");
+			
+            t.SetTermBuffer("hello");
 			Assert.AreEqual(t.TermLength(), 5);
 			Assert.AreEqual(t.Term(), "hello");
-			t.SetTermBuffer("hello2");
+			
+            t.SetTermBuffer("hello2");
 			Assert.AreEqual(t.TermLength(), 6);
 			Assert.AreEqual(t.Term(), "hello2");
-			t.SetTermBuffer("hello3".ToCharArray(), 0, 6);
+			
+            t.SetTermBuffer("hello3".ToCharArray(), 0, 6);
 			Assert.AreEqual(t.Term(), "hello3");
 			
 			// Make sure if we get the buffer and change a character
@@ -156,10 +179,13 @@ namespace Lucene.Net.Analysis.Tokenattri
 		{
 			TermAttributeImpl t = new TermAttributeImpl();
 			char[] content = "hello".ToCharArray();
-			t.SetTermBuffer(content, 0, 5);
-			char[] buf = t.TermBuffer();
+			
+            t.SetTermBuffer(content, 0, 5);
+			
+            char[] buf = t.TermBuffer();
 			TermAttributeImpl copy = (TermAttributeImpl) TestSimpleAttributeImpls.AssertCloneIsEqual(t);
-			Assert.AreEqual(t.Term(), copy.Term());
+			
+            Assert.AreEqual(t.Term(), copy.Term());
 			Assert.AreNotSame(buf, copy.TermBuffer());
 		}
 		
@@ -169,13 +195,16 @@ namespace Lucene.Net.Analysis.Tokenattri
 			TermAttributeImpl t1a = new TermAttributeImpl();
 			char[] content1a = "hello".ToCharArray();
 			t1a.SetTermBuffer(content1a, 0, 5);
-			TermAttributeImpl t1b = new TermAttributeImpl();
+			
+            TermAttributeImpl t1b = new TermAttributeImpl();
 			char[] content1b = "hello".ToCharArray();
 			t1b.SetTermBuffer(content1b, 0, 5);
-			TermAttributeImpl t2 = new TermAttributeImpl();
+			
+            TermAttributeImpl t2 = new TermAttributeImpl();
 			char[] content2 = "hello2".ToCharArray();
 			t2.SetTermBuffer(content2, 0, 6);
-			Assert.IsTrue(t1a.Equals(t1b));
+			
+            Assert.IsTrue(t1a.Equals(t1b));
 			Assert.IsFalse(t1a.Equals(t2));
 			Assert.IsFalse(t2.Equals(t1b));
 		}
@@ -185,13 +214,15 @@ namespace Lucene.Net.Analysis.Tokenattri
 		{
 			TermAttributeImpl t = new TermAttributeImpl();
 			TermAttributeImpl copy = (TermAttributeImpl) TestSimpleAttributeImpls.AssertCopyIsEqual(t);
-			Assert.AreEqual("", t.Term());
+			
+            Assert.AreEqual("", t.Term());
 			Assert.AreEqual("", copy.Term());
 			
 			t = new TermAttributeImpl();
 			char[] content = "hello".ToCharArray();
 			t.SetTermBuffer(content, 0, 5);
-			char[] buf = t.TermBuffer();
+			
+            char[] buf = t.TermBuffer();
 			copy = (TermAttributeImpl) TestSimpleAttributeImpls.AssertCopyIsEqual(t);
 			Assert.AreEqual(t.Term(), copy.Term());
 			Assert.AreNotSame(buf, copy.TermBuffer());

Added: incubator/lucene.net/branches/Lucene.Net_2_9_4g/test/core/Categories.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net_2_9_4g/test/core/Categories.cs?rev=1150245&view=auto
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net_2_9_4g/test/core/Categories.cs (added)
+++ incubator/lucene.net/branches/Lucene.Net_2_9_4g/test/core/Categories.cs Sun Jul 24 01:21:27 2011
@@ -0,0 +1,56 @@
+/* 
+ * 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 System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace Lucene.Net
+{
+    /// <summary>
+    /// The 
+    /// </summary>
+    internal static class Categories
+    {
+        /// <summary>
+        /// Tests that validate small units of code are functioning 
+        /// as intended.  The unit tests should always pass.
+        /// </summary>
+        public const string Unit = "Unit";
+
+        /// <summary>
+        /// Tests that are integration style tests. These tend to
+        /// test more than small units of code or other external dependencies.  
+        /// Integration tests should let you know if something is not set up 
+        /// correctly.
+        /// </summary>
+        public const string Integration = "Integration";
+
+        /// <summary>
+        /// Tests for validating how well Lucene.Net is performing. 
+        /// </summary>
+        public const string Performance = "Performance";
+
+        /// <summary>
+        /// Tests that validate the integrity of dependencies like
+        /// file paths, test data, that are required for other tests
+        /// to work correctly. 
+        /// </summary>
+        public const string Infrastructure = "Infrastructure";
+    }
+}

Modified: incubator/lucene.net/branches/Lucene.Net_2_9_4g/test/core/Lucene.Net.Test.csproj
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net_2_9_4g/test/core/Lucene.Net.Test.csproj?rev=1150245&r1=1150244&r2=1150245&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net_2_9_4g/test/core/Lucene.Net.Test.csproj (original)
+++ incubator/lucene.net/branches/Lucene.Net_2_9_4g/test/core/Lucene.Net.Test.csproj Sun Jul 24 01:21:27 2011
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="utf-8"?>
+<?xml version="1.0" encoding="utf-8"?>
 <Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
   <PropertyGroup>
     <ProjectType>Local</ProjectType>
@@ -141,6 +141,7 @@
     <Compile Include="AssemblyInfo.cs">
       <SubType>Code</SubType>
     </Compile>
+    <Compile Include="Categories.cs" />
     <Compile Include="Document\TestBinaryDocument.cs" />
     <Compile Include="Document\TestDateTools.cs" />
     <Compile Include="Document\TestDocument.cs" />

Modified: incubator/lucene.net/branches/Lucene.Net_2_9_4g/test/core/Util/_TestUtil.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net_2_9_4g/test/core/Util/_TestUtil.cs?rev=1150245&r1=1150244&r2=1150245&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net_2_9_4g/test/core/Util/_TestUtil.cs (original)
+++ incubator/lucene.net/branches/Lucene.Net_2_9_4g/test/core/Util/_TestUtil.cs Sun Jul 24 01:21:27 2011
@@ -30,6 +30,11 @@ namespace Lucene.Net.Util
 	
 	public class _TestUtil
 	{
+
+        public static Version CurrentVersion
+        {
+            get { return Version.LUCENE_29; }
+        }
 		
 		/// <summary>Returns temp dir, containing String arg in its name;
 		/// does not create the directory.