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 2014/08/05 20:13:31 UTC
git commit: adding AtLeast test. Added ToString overrides to
FlagsAttribute & TypeAttribute to fix tests.
Repository: lucenenet
Updated Branches:
refs/heads/branch_4x 27cae3f46 -> dad8de083
adding AtLeast test. Added ToString overrides to FlagsAttribute & TypeAttribute to fix tests.
Project: http://git-wip-us.apache.org/repos/asf/lucenenet/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucenenet/commit/dad8de08
Tree: http://git-wip-us.apache.org/repos/asf/lucenenet/tree/dad8de08
Diff: http://git-wip-us.apache.org/repos/asf/lucenenet/diff/dad8de08
Branch: refs/heads/branch_4x
Commit: dad8de083fcc3ffaa06bb91eb63150b75dc86cc7
Parents: 27cae3f
Author: Michael Herndon <mh...@michaelherndon.com>
Authored: Tue Aug 5 14:11:30 2014 -0400
Committer: Michael Herndon <mh...@michaelherndon.com>
Committed: Tue Aug 5 14:11:30 2014 -0400
----------------------------------------------------------------------
.../Analysis/Tokenattributes/FlagsAttribute.cs | 5 +++
.../Analysis/Tokenattributes/TypeAttribute.cs | 5 +++
test/core/Lucene.Net.Test.csproj | 6 +--
test/core/Util/LuceneTestCaseTests.cs | 41 ++++++++++++++++++++
.../Lucene.Net.TestFramework.csproj | 3 +-
test/test-framework/Util/HelperExtensions.cs | 18 +++++++++
6 files changed, 74 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/dad8de08/src/core/Analysis/Tokenattributes/FlagsAttribute.cs
----------------------------------------------------------------------
diff --git a/src/core/Analysis/Tokenattributes/FlagsAttribute.cs b/src/core/Analysis/Tokenattributes/FlagsAttribute.cs
index 84fe16c..694fa56 100644
--- a/src/core/Analysis/Tokenattributes/FlagsAttribute.cs
+++ b/src/core/Analysis/Tokenattributes/FlagsAttribute.cs
@@ -74,5 +74,10 @@ namespace Lucene.Net.Analysis.Tokenattributes
impl.Flags = Flags;
return impl;
}
+
+ public override string ToString()
+ {
+ return "flags=" + this.Flags.ToString();
+ }
}
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/dad8de08/src/core/Analysis/Tokenattributes/TypeAttribute.cs
----------------------------------------------------------------------
diff --git a/src/core/Analysis/Tokenattributes/TypeAttribute.cs b/src/core/Analysis/Tokenattributes/TypeAttribute.cs
index 76c0664..792b72c 100644
--- a/src/core/Analysis/Tokenattributes/TypeAttribute.cs
+++ b/src/core/Analysis/Tokenattributes/TypeAttribute.cs
@@ -77,5 +77,10 @@ namespace Lucene.Net.Analysis.Tokenattributes
impl.Type = Type;
return impl;
}
+
+ public override string ToString()
+ {
+ return "type=" + this.Type.ToString();
+ }
}
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/dad8de08/test/core/Lucene.Net.Test.csproj
----------------------------------------------------------------------
diff --git a/test/core/Lucene.Net.Test.csproj b/test/core/Lucene.Net.Test.csproj
index 5df9bec..864cfc3 100644
--- a/test/core/Lucene.Net.Test.csproj
+++ b/test/core/Lucene.Net.Test.csproj
@@ -177,9 +177,8 @@
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\lib\ICSharpCode\SharpZipLib\0.85\ICSharpCode.SharpZipLib.dll</HintPath>
</Reference>
- <Reference Include="nunit.framework, Version=2.6.3.13283, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77, processorArchitecture=MSIL">
- <SpecificVersion>False</SpecificVersion>
- <HintPath>..\..\packages\NUnit.2.6.3\lib\nunit.framework.dll</HintPath>
+ <Reference Include="nunit.framework">
+ <HintPath>..\..\build\vs2013\test\packages\NUnit.2.6.3\lib\nunit.framework.dll</HintPath>
</Reference>
<Reference Include="System">
<Name>System</Name>
@@ -208,6 +207,7 @@
<Compile Include="SupportClassException.cs" />
<Compile Include="Util\Fst\TestBytesStore.cs" />
<Compile Include="Util\LocalizedTestCase.cs" />
+ <Compile Include="Util\LuceneTestCaseTests.cs" />
<Compile Include="Util\TestArrayUtil.cs" />
<Compile Include="Util\TestBytesRef.cs" />
<None Include="App.config" />
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/dad8de08/test/core/Util/LuceneTestCaseTests.cs
----------------------------------------------------------------------
diff --git a/test/core/Util/LuceneTestCaseTests.cs b/test/core/Util/LuceneTestCaseTests.cs
new file mode 100644
index 0000000..fe3294d
--- /dev/null
+++ b/test/core/Util/LuceneTestCaseTests.cs
@@ -0,0 +1,41 @@
+
+
+namespace Lucene.Net.Test.Util
+{
+ using System;
+ using System.Collections.Generic;
+ using System.Linq;
+ using System.Text;
+ using NUnit.Framework;
+ using Lucene.Net.Util;
+
+ [TestFixture]
+ public class LuceneTestCaseTests : LuceneTestCase
+ {
+ [Test]
+ public void TestAtLeast()
+ {
+ var random = new Random();
+
+ Assert.DoesNotThrow(() => {
+ AtLeast(10);
+ });
+
+ 13.Times(() => {
+ var least = random.Next(1, 5000);
+ var result = AtLeast(least);
+
+ Assert.True(result >= least, string.Format(" {0} result should be at least {1}", result, least));
+ });
+
+
+ 13.Times(() => {
+ var least = random.Next(1, 5000);
+ var localRandom = new Random();
+ var localResult = AtLeast(localRandom, least);
+
+ Assert.True(localResult >= least, string.Format(" {0} result should be at least {1}", localResult, least));
+ });
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/dad8de08/test/test-framework/Lucene.Net.TestFramework.csproj
----------------------------------------------------------------------
diff --git a/test/test-framework/Lucene.Net.TestFramework.csproj b/test/test-framework/Lucene.Net.TestFramework.csproj
index cdce341..acf8430 100644
--- a/test/test-framework/Lucene.Net.TestFramework.csproj
+++ b/test/test-framework/Lucene.Net.TestFramework.csproj
@@ -44,7 +44,7 @@
<ItemGroup>
<Reference Include="nunit.framework, Version=2.6.3.13283, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
- <HintPath>..\..\packages\NUnit.2.6.3\lib\nunit.framework.dll</HintPath>
+ <HintPath>..\..\build\vs2013\test\packages\NUnit.2.6.3\lib\nunit.framework.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.configuration" />
@@ -87,6 +87,7 @@
<Compile Include="Attributes.cs" />
<Compile Include="LuceneTestCase.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
+ <Compile Include="Util\HelperExtensions.cs" />
<Compile Include="Util\_TestUtil.cs" />
</ItemGroup>
<ItemGroup>
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/dad8de08/test/test-framework/Util/HelperExtensions.cs
----------------------------------------------------------------------
diff --git a/test/test-framework/Util/HelperExtensions.cs b/test/test-framework/Util/HelperExtensions.cs
new file mode 100644
index 0000000..506fe6e
--- /dev/null
+++ b/test/test-framework/Util/HelperExtensions.cs
@@ -0,0 +1,18 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace Lucene.Net.Util
+{
+ public static class HelperExtensions
+ {
+
+ public static void Times(this int times, Action action)
+ {
+ var i = 0;
+ for (; i < times; i++)
+ action();
+ }
+ }
+}