lucenenet-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aro...@apache.org
Subject svn commit: r421754 - in /incubator/lucene.net/trunk/C#/src/Test: Index/TestCompoundFile.cs StoreTest.cs Test.csproj Test.csproj.user Test.suo
Date Fri, 14 Jul 2006 00:06:17 GMT
Author: aroush
Date: Thu Jul 13 17:06:16 2006
New Revision: 421754

URL: http://svn.apache.org/viewvc?rev=421754&view=rev
Log:
Lucene.Net 1.9.1 build 001

Modified:
    incubator/lucene.net/trunk/C#/src/Test/Index/TestCompoundFile.cs
    incubator/lucene.net/trunk/C#/src/Test/StoreTest.cs
    incubator/lucene.net/trunk/C#/src/Test/Test.csproj
    incubator/lucene.net/trunk/C#/src/Test/Test.csproj.user
    incubator/lucene.net/trunk/C#/src/Test/Test.suo

Modified: incubator/lucene.net/trunk/C#/src/Test/Index/TestCompoundFile.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Test/Index/TestCompoundFile.cs?rev=421754&r1=421753&r2=421754&view=diff
==============================================================================
--- incubator/lucene.net/trunk/C#/src/Test/Index/TestCompoundFile.cs (original)
+++ incubator/lucene.net/trunk/C#/src/Test/Index/TestCompoundFile.cs Thu Jul 13 17:06:16 2006
@@ -637,5 +637,34 @@
 			is_Renamed.Close();
 			cr.Close();
 		}
+
+        /// <summary>
+        /// This test that writes larger than the size of the buffer output
+        /// will correctly increment the file pointer.
+        /// </summary>
+        [Test]
+        public virtual void  TestLargeWrites()
+                                               {
+            IndexOutput os = dir.CreateOutput("testBufferStart.txt");
+
+            byte[] largeBuf = new byte[2048];
+            for (int i=0; i<largeBuf.Length; i++)
+            {
+                largeBuf[i] = (byte) ((new System.Random().NextDouble()) * 256);
+            }
+
+            long currentPos = os.GetFilePointer();
+            os.WriteBytes(largeBuf, largeBuf.Length);
+
+            try
+            {
+                Assert.AreEqual(currentPos + largeBuf.Length, os.GetFilePointer());
+            }
+            finally
+            {
+                os.Close();
+            }
+        }
+
 	}
 }

Modified: incubator/lucene.net/trunk/C#/src/Test/StoreTest.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Test/StoreTest.cs?rev=421754&r1=421753&r2=421754&view=diff
==============================================================================
--- incubator/lucene.net/trunk/C#/src/Test/StoreTest.cs (original)
+++ incubator/lucene.net/trunk/C#/src/Test/StoreTest.cs Thu Jul 13 17:06:16 2006
@@ -31,15 +31,15 @@
 		{
 			try
 			{
-				Test(1000, true);
+				Test(1000, true, true);
 			}
 			catch (System.Exception e)
 			{
-				System.Console.Out.WriteLine(" caught a " + e.GetType() + "\n with message: " + e.Message);
+                System.Console.Out.WriteLine(e.StackTrace);
 			}
 		}
 		
-        public static void  Test(int count, bool ram)
+        public static void  Test(int count, bool ram, bool buffered)
 		{
 			System.Random gen = new System.Random((System.Int32) 1251971);
 			int i;
@@ -54,6 +54,8 @@
 				store = FSDirectory.GetDirectory("test.store", true);
 			
 			int LENGTH_MASK = 0xFFF;
+
+            byte[] buffer = new byte[LENGTH_MASK];
 			
 			for (i = 0; i < count; i++)
 			{
@@ -64,8 +66,17 @@
 				
 				IndexOutput file = store.CreateOutput(name);
 				
-				for (int j = 0; j < length; j++)
-					file.WriteByte(b);
+                if (buffered)
+                {
+                    for (int j = 0; j < length; j++)
+                        buffer[j] = b;
+                    file.WriteBytes(buffer, length);
+                }
+                else
+                {
+                    for (int j = 0; j < length; j++)
+                        file.WriteByte(b);
+                }
 				
 				file.Close();
 			}
@@ -96,9 +107,21 @@
 				if (file.Length() != length)
 					throw new System.Exception("length incorrect");
 				
-				for (int j = 0; j < length; j++)
-					if (file.ReadByte() != b)
-						throw new System.Exception("contents incorrect");
+                byte[] content = new byte[length];
+                if (buffered)
+                {
+                    file.ReadBytes(content, 0, length);
+                    // check the buffer
+                    for (int j = 0; j < length; j++)
+                        if (content[j] != b)
+                            throw new System.Exception("contents incorrect");
+                }
+                else
+                {
+                    for (int j = 0; j < length; j++)
+                        if (file.ReadByte() != b)
+                            throw new System.Exception("contents incorrect");
+                }
 				
 				file.Close();
 			}

Modified: incubator/lucene.net/trunk/C#/src/Test/Test.csproj
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Test/Test.csproj?rev=421754&r1=421753&r2=421754&view=diff
==============================================================================
--- incubator/lucene.net/trunk/C#/src/Test/Test.csproj (original)
+++ incubator/lucene.net/trunk/C#/src/Test/Test.csproj Thu Jul 13 17:06:16 2006
@@ -85,42 +85,6 @@
                     HintPath = "..\..\..\..\..\..\WINDOWS\Microsoft.NET\Framework\v1.1.4322\system.runtime.remoting.dll"
                 />
                 <Reference
-                    Name = "nunit.framework"
-                    AssemblyName = "nunit.framework"
-                    HintPath = "D:\DEVS\NUnit\bin\nunit.framework.dll"
-                    AssemblyFolderKey = "hklm\dn\nunit.framework"
-                />
-                <Reference
-                    Name = "nunit.core"
-                    AssemblyName = "nunit.core"
-                    HintPath = "D:\DEVS\NUnit\bin\nunit.core.dll"
-                    AssemblyFolderKey = "hklm\dn\nunit.framework"
-                />
-                <Reference
-                    Name = "nunit.tests"
-                    AssemblyName = "nunit.tests"
-                    HintPath = "D:\DEVS\NUnit\bin\nunit.tests.dll"
-                    AssemblyFolderKey = "hklm\dn\nunit.framework"
-                />
-                <Reference
-                    Name = "nunit.extensions"
-                    AssemblyName = "nunit.extensions"
-                    HintPath = "D:\DEVS\NUnit\bin\nunit.extensions.dll"
-                    AssemblyFolderKey = "hklm\dn\nunit.framework"
-                />
-                <Reference
-                    Name = "nunit.mocks"
-                    AssemblyName = "nunit.mocks"
-                    HintPath = "D:\DEVS\NUnit\bin\nunit.mocks.dll"
-                    AssemblyFolderKey = "hklm\dn\nunit.framework"
-                />
-                <Reference
-                    Name = "nunit.util"
-                    AssemblyName = "nunit.util"
-                    HintPath = "D:\DEVS\NUnit\bin\nunit.util.dll"
-                    AssemblyFolderKey = "hklm\dn\nunit.framework"
-                />
-                <Reference
                     Name = "DemoLib"
                     AssemblyName = "DemoLib"
                     HintPath = "..\Demo\DemoLib\bin\Debug\DemoLib.dll"
@@ -129,6 +93,18 @@
                     Name = "Lucene.Net"
                     AssemblyName = "Lucene.Net"
                     HintPath = "..\Lucene.Net\bin\Debug\Lucene.Net.dll"
+                />
+                <Reference
+                    Name = "nunit.core"
+                    AssemblyName = "nunit.core"
+                    HintPath = ".\NUnit\bin\nunit.core.dll"
+                    AssemblyFolderKey = "hklm\dn\nunit.framework"
+                />
+                <Reference
+                    Name = "nunit.framework"
+                    AssemblyName = "nunit.framework"
+                    HintPath = ".\NUnit\bin\nunit.framework.dll"
+                    AssemblyFolderKey = "hklm\dn\nunit.framework"
                 />
             </References>
         </Build>

Modified: incubator/lucene.net/trunk/C#/src/Test/Test.csproj.user
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Test/Test.csproj.user?rev=421754&r1=421753&r2=421754&view=diff
==============================================================================
--- incubator/lucene.net/trunk/C#/src/Test/Test.csproj.user (original)
+++ incubator/lucene.net/trunk/C#/src/Test/Test.csproj.user Thu Jul 13 17:06:16 2006
@@ -1,7 +1,7 @@
 <VisualStudioProject>
     <CSHARP LastOpenVersion = "7.10.3077" >
         <Build>
-            <Settings ReferencePath = "E:\Aroush.proj\Lucene.Net-1.9.rc1-003.src\Lucene.Net\bin\Debug\;E:\Aroush.proj\Lucene.Net-1.9.rc1-003.src\Demo\DemoLib\bin\Debug\"
>
+            <Settings ReferencePath = "" >
                 <Config
                     Name = "Debug"
                     EnableASPDebugging = "false"

Modified: incubator/lucene.net/trunk/C#/src/Test/Test.suo
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Test/Test.suo?rev=421754&r1=421753&r2=421754&view=diff
==============================================================================
Binary files - no diff available.



Mime
View raw message