lucenenet-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aro...@apache.org
Subject svn commit: r420388 - in /incubator/lucene.net/trunk/C#/src/Test/Index: TestMultiReader.cs TestSegmentMerger.cs TestSegmentReader.cs TestSegmentTermDocs.cs
Date Mon, 10 Jul 2006 01:23:09 GMT
Author: aroush
Date: Sun Jul  9 18:23:09 2006
New Revision: 420388

URL: http://svn.apache.org/viewvc?rev=420388&view=rev
Log: (empty)

Modified:
    incubator/lucene.net/trunk/C#/src/Test/Index/TestMultiReader.cs
    incubator/lucene.net/trunk/C#/src/Test/Index/TestSegmentMerger.cs
    incubator/lucene.net/trunk/C#/src/Test/Index/TestSegmentReader.cs
    incubator/lucene.net/trunk/C#/src/Test/Index/TestSegmentTermDocs.cs

Modified: incubator/lucene.net/trunk/C#/src/Test/Index/TestMultiReader.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Test/Index/TestMultiReader.cs?rev=420388&r1=420387&r2=420388&view=diff
==============================================================================
--- incubator/lucene.net/trunk/C#/src/Test/Index/TestMultiReader.cs (original)
+++ incubator/lucene.net/trunk/C#/src/Test/Index/TestMultiReader.cs Sun Jul  9 18:23:09 2006
@@ -34,10 +34,23 @@
 		private SegmentReader[] readers = new SegmentReader[2];
 		private SegmentInfos sis = new SegmentInfos();
 		
-		
+		// This is needed if for the test to pass and mimic what happens wiht JUnit
+        // For some reason, JUnit is creating a new member variable for each sub-test
+        // but NUnit is not -- who is wrong/right, I don't know.
+        private void SetUpInternal()        // {{Aroush-1.9}} See note above
+        {
+		    dir = new RAMDirectory();
+		    doc1 = new Lucene.Net.Documents.Document();
+		    doc2 = new Lucene.Net.Documents.Document();
+		    readers = new SegmentReader[2];
+		    sis = new SegmentInfos();
+        }
+
 		[SetUp]
         public virtual void  SetUp()
 		{
+            SetUpInternal();    // We need this for NUnit; see note above
+
 			DocHelper.SetupDoc(doc1);
 			DocHelper.SetupDoc(doc2);
 			DocHelper.WriteDoc(dir, "seg-1", doc1);
@@ -59,7 +72,7 @@
 		}
 		
 		[Test]
-        public virtual void  TestDocument()     // {{Aroush-1.9}} this test will fail if
run within the group
+        public virtual void  TestDocument()
 		{
 			sis.Read(dir);
 			MultiReader reader = new MultiReader(dir, sis, false, readers);

Modified: incubator/lucene.net/trunk/C#/src/Test/Index/TestSegmentMerger.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Test/Index/TestSegmentMerger.cs?rev=420388&r1=420387&r2=420388&view=diff
==============================================================================
--- incubator/lucene.net/trunk/C#/src/Test/Index/TestSegmentMerger.cs (original)
+++ incubator/lucene.net/trunk/C#/src/Test/Index/TestSegmentMerger.cs Sun Jul  9 18:23:09
2006
@@ -41,9 +41,31 @@
 		private SegmentReader reader2 = null;
 		
 		
+        // This is needed if for the test to pass and mimic what happens wiht JUnit
+        // For some reason, JUnit is creating a new member variable for each sub-test
+        // but NUnit is not -- who is wrong/right, I don't know.
+        private void SetUpInternal()        // {{Aroush-1.9}} See note above
+        {
+		    //The variables for the new merged segment
+		    mergedDir = new RAMDirectory();
+		    mergedSegment = "test";
+		    //First segment to be merged
+		    merge1Dir = new RAMDirectory();
+		    doc1 = new Lucene.Net.Documents.Document();
+		    merge1Segment = "test-1";
+		    reader1 = null;
+		    //Second Segment to be merged
+		    merge2Dir = new RAMDirectory();
+		    doc2 = new Lucene.Net.Documents.Document();
+		    merge2Segment = "test-2";
+		    reader2 = null;
+        }
+
 		[SetUp]
         public virtual void  SetUp()
 		{
+            SetUpInternal();    // We need this for NUnit; see note above
+
 			DocHelper.SetupDoc(doc1);
 			DocHelper.WriteDoc(merge1Dir, merge1Segment, doc1);
 			DocHelper.SetupDoc(doc2);

Modified: incubator/lucene.net/trunk/C#/src/Test/Index/TestSegmentReader.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Test/Index/TestSegmentReader.cs?rev=420388&r1=420387&r2=420388&view=diff
==============================================================================
--- incubator/lucene.net/trunk/C#/src/Test/Index/TestSegmentReader.cs (original)
+++ incubator/lucene.net/trunk/C#/src/Test/Index/TestSegmentReader.cs Sun Jul  9 18:23:09
2006
@@ -31,10 +31,22 @@
 		private Lucene.Net.Documents.Document testDoc = new Lucene.Net.Documents.Document();
 		private SegmentReader reader = null;
 		
+        // This is needed if for the test to pass and mimic what happens wiht JUnit
+        // For some reason, JUnit is creating a new member variable for each sub-test
+        // but NUnit is not -- who is wrong/right, I don't know.
+        private void SetUpInternal()        // {{Aroush-1.9}} See note above
+        {
+		    dir = new RAMDirectory();
+		    testDoc = new Lucene.Net.Documents.Document();
+		    reader = null;
+        }
+
 		//TODO: Setup the reader w/ multiple documents
 		[SetUp]
         public virtual void  SetUp()
 		{
+            SetUpInternal();    // We need this for NUnit; see note above
+
 			DocHelper.SetupDoc(testDoc);
 			DocHelper.WriteDoc(dir, testDoc);
 			reader = SegmentReader.Get(new SegmentInfo("test", 1, dir));
@@ -56,7 +68,7 @@
 		}
 		
 		[Test]
-        public virtual void  TestDocument()     // {{Aroush-1.9}} this test failes when run
as a group
+        public virtual void  TestDocument()
 		{
 			Assert.IsTrue(reader.NumDocs() == 1);
 			Assert.IsTrue(reader.MaxDoc() >= 1);

Modified: incubator/lucene.net/trunk/C#/src/Test/Index/TestSegmentTermDocs.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Test/Index/TestSegmentTermDocs.cs?rev=420388&r1=420387&r2=420388&view=diff
==============================================================================
--- incubator/lucene.net/trunk/C#/src/Test/Index/TestSegmentTermDocs.cs (original)
+++ incubator/lucene.net/trunk/C#/src/Test/Index/TestSegmentTermDocs.cs Sun Jul  9 18:23:09
2006
@@ -31,10 +31,20 @@
 		private Lucene.Net.Documents.Document testDoc = new Lucene.Net.Documents.Document();
 		private Directory dir = new RAMDirectory();
 		
-		
+        // This is needed if for the test to pass and mimic what happens wiht JUnit
+        // For some reason, JUnit is creating a new member variable for each sub-test
+        // but NUnit is not -- who is wrong/right, I don't know.
+        private void SetUpInternal()        // {{Aroush-1.9}} See note above
+        {
+		    testDoc = new Lucene.Net.Documents.Document();
+		    dir = new RAMDirectory();
+        }
+
 		[SetUp]
         public virtual void  SetUp()
 		{
+            SetUpInternal();    // We need this for NUnit; see note above
+
 			DocHelper.SetupDoc(testDoc);
 			DocHelper.WriteDoc(dir, testDoc);
 		}
@@ -52,14 +62,8 @@
 		}
 		
 		[Test]
-        public virtual void  TestTermDocs()     // {{Aroush-1.9}} this test is failing when
run as a group
+        public virtual void  TestTermDocs()
 		{
-            // {{Aroush-1.9}} unless if we add the following 4 lines
-		    Lucene.Net.Documents.Document testDoc = new Lucene.Net.Documents.Document();
-		    Directory dir = new RAMDirectory();
-            DocHelper.SetupDoc(testDoc);
-            DocHelper.WriteDoc(dir, testDoc);
-
 			//After adding the document, we should be able to read it back in
 			SegmentReader reader = SegmentReader.Get(new SegmentInfo("test", 1, dir));
 			Assert.IsTrue(reader != null);
@@ -72,7 +76,7 @@
 				Assert.IsTrue(docId == 0);
 				int freq = segTermDocs.Freq();
                 System.Console.Out.WriteLine("freq: " + freq);
-				Assert.IsTrue(freq == 3);       // {{Aroush-1.9}} this is the assert that fails; because
'freq' is 12
+				Assert.IsTrue(freq == 3);
 			}
 			reader.Close();
 		}



Mime
View raw message