lucenenet-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From synhers...@apache.org
Subject [1/5] lucenenet git commit: Adding Expressions with some failing tests
Date Sat, 31 Jan 2015 20:03:49 GMT
Repository: lucenenet
Updated Branches:
  refs/heads/master 69f29113e -> b6c1b5d2e


http://git-wip-us.apache.org/repos/asf/lucenenet/blob/b6c1b5d2/src/Lucene.Net.Tests.Expressions/TestExpressionSortField.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests.Expressions/TestExpressionSortField.cs b/src/Lucene.Net.Tests.Expressions/TestExpressionSortField.cs
new file mode 100644
index 0000000..fb54d18
--- /dev/null
+++ b/src/Lucene.Net.Tests.Expressions/TestExpressionSortField.cs
@@ -0,0 +1,92 @@
+using Lucene.Net.Expressions;
+using Lucene.Net.Expressions.JS;
+using Lucene.Net.Search;
+using NUnit.Framework;
+
+namespace Lucene.Net.Tests.Expressions
+{
+	public class TestExpressionSortField : Util.LuceneTestCase
+	{
+		[Test]
+		public virtual void TestToString()
+		{
+			Expression expr = JavascriptCompiler.Compile("sqrt(_score) + ln(popularity)");
+			SimpleBindings bindings = new SimpleBindings();
+			bindings.Add(new SortField("_score", SortField.Type_e.SCORE));
+			bindings.Add(new SortField("popularity", SortField.Type_e.INT));
+			SortField sf = expr.GetSortField(bindings, true);
+			AreEqual("<expr \"sqrt(_score) + ln(popularity)\">!", sf.ToString());
+		}
+
+		[Test]
+		public virtual void TestEquals()
+		{
+			Expression expr = JavascriptCompiler.Compile("sqrt(_score) + ln(popularity)");
+			SimpleBindings bindings = new SimpleBindings();
+			bindings.Add(new SortField("_score", SortField.Type_e.SCORE));
+			bindings.Add(new SortField("popularity", SortField.Type_e.INT));
+			SimpleBindings otherBindings = new SimpleBindings();
+			otherBindings.Add(new SortField("_score", SortField.Type_e.LONG));
+			otherBindings.Add(new SortField("popularity", SortField.Type_e.INT));
+			SortField sf1 = expr.GetSortField(bindings, true);
+			// different order
+			SortField sf2 = expr.GetSortField(bindings, false);
+			IsFalse(sf1.Equals(sf2));
+			// different bindings
+			sf2 = expr.GetSortField(otherBindings, true);
+			IsFalse(sf1.Equals(sf2));
+			// different expression
+			Expression other = JavascriptCompiler.Compile("popularity/2");
+			sf2 = other.GetSortField(bindings, true);
+			IsFalse(sf1.Equals(sf2));
+			// null
+			IsFalse(sf1.Equals(null));
+			// same instance:
+			AreEqual(sf1, sf1);
+		}
+
+		[Test]
+		public virtual void TestNeedsScores()
+		{
+			SimpleBindings bindings = new SimpleBindings();
+			// refers to score directly
+			Expression exprA = JavascriptCompiler.Compile("_score");
+			// constant
+			Expression exprB = JavascriptCompiler.Compile("0");
+			// field
+			Expression exprC = JavascriptCompiler.Compile("intfield");
+			// score + constant
+			Expression exprD = JavascriptCompiler.Compile("_score + 0");
+			// field + constant
+			Expression exprE = JavascriptCompiler.Compile("intfield + 0");
+			// expression + constant (score ref'd)
+			Expression exprF = JavascriptCompiler.Compile("a + 0");
+			// expression + constant
+			Expression exprG = JavascriptCompiler.Compile("e + 0");
+			// several variables (score ref'd)
+			Expression exprH = JavascriptCompiler.Compile("b / c + e * g - sqrt(f)");
+			// several variables
+			Expression exprI = JavascriptCompiler.Compile("b / c + e * g");
+			bindings.Add(new SortField("_score", SortField.Type_e.SCORE));
+			bindings.Add(new SortField("intfield", SortField.Type_e.INT));
+			bindings.Add("a", exprA);
+			bindings.Add("b", exprB);
+			bindings.Add("c", exprC);
+			bindings.Add("d", exprD);
+			bindings.Add("e", exprE);
+			bindings.Add("f", exprF);
+			bindings.Add("g", exprG);
+			bindings.Add("h", exprH);
+			bindings.Add("i", exprI);
+			IsTrue(exprA.GetSortField(bindings, true).NeedsScores());
+			IsFalse(exprB.GetSortField(bindings, true).NeedsScores());
+			IsFalse(exprC.GetSortField(bindings, true).NeedsScores());
+			IsTrue(exprD.GetSortField(bindings, true).NeedsScores());
+			IsFalse(exprE.GetSortField(bindings, true).NeedsScores());
+			IsTrue(exprF.GetSortField(bindings, true).NeedsScores());
+			IsFalse(exprG.GetSortField(bindings, true).NeedsScores());
+			IsTrue(exprH.GetSortField(bindings, true).NeedsScores());
+			IsFalse(exprI.GetSortField(bindings, false).NeedsScores());
+		}
+	}
+}

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/b6c1b5d2/src/Lucene.Net.Tests.Expressions/TestExpressionSorts.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests.Expressions/TestExpressionSorts.cs b/src/Lucene.Net.Tests.Expressions/TestExpressionSorts.cs
new file mode 100644
index 0000000..d6b0fef
--- /dev/null
+++ b/src/Lucene.Net.Tests.Expressions/TestExpressionSorts.cs
@@ -0,0 +1,151 @@
+using Lucene.Net.Documents;
+using Lucene.Net.Expressions;
+using Lucene.Net.Expressions.JS;
+using Lucene.Net.Index;
+using Lucene.Net.Randomized.Generators;
+using Lucene.Net.Search;
+using Lucene.Net.Store;
+using Lucene.Net.Support;
+using Lucene.Net.Util;
+using NUnit.Framework;
+
+namespace Lucene.Net.Tests.Expressions
+{
+    /// <summary>
+    /// Tests some basic expressions against different queries,
+    /// and fieldcache/docvalues fields against an equivalent sort.
+    /// </summary>
+    /// <remarks>
+    /// Tests some basic expressions against different queries,
+    /// and fieldcache/docvalues fields against an equivalent sort.
+    /// </remarks>
+    public class TestExpressionSorts : Util.LuceneTestCase
+    {
+        private Directory dir;
+
+        private IndexReader reader;
+
+        private IndexSearcher searcher;
+
+        [SetUp]
+        public override void SetUp()
+        {
+            base.SetUp();
+            dir = NewDirectory();
+            var iw = new RandomIndexWriter(Random(), dir);
+            int numDocs = TestUtil.NextInt(Random(), 2049, 4000);
+            for (int i = 0; i < numDocs; i++)
+            {
+                var document = new Document
+				{
+				    NewTextField("english", English.IntToEnglish(i), Field.Store.NO),
+				    NewTextField("oddeven", (i%2 == 0) ? "even" : "odd", Field.Store.NO
+				        ),
+				    NewStringField("byte", string.Empty + (unchecked((byte) Random().Next
+				        ())), Field.Store.NO),
+				    NewStringField("short", string.Empty + ((short) Random().Next()), Field.Store
+				        .NO),
+				    new IntField("int", Random().Next(), Field.Store.NO),
+				    new LongField("long", Random().NextLong(), Field.Store.NO),
+				    new FloatField("float", Random().NextFloat(), Field.Store.NO),
+				    new DoubleField("double", Random().NextDouble(), Field.Store.NO),
+				    new NumericDocValuesField("intdocvalues", Random().Next()),
+				    new FloatDocValuesField("floatdocvalues", Random().NextFloat())
+				};
+                iw.AddDocument(document);
+            }
+            reader = iw.Reader;
+            iw.Dispose();
+            searcher = NewSearcher(reader);
+        }
+
+        [TearDown]
+        public override void TearDown()
+        {
+            reader.Dispose();
+            dir.Dispose();
+            base.TearDown();
+        }
+
+        [Test]
+        public virtual void TestQueries()
+        {
+            int n = AtLeast(4);
+            for (int i = 0; i < n; i++)
+            {
+                Filter odd = new QueryWrapperFilter(new TermQuery(new Term("oddeven", "odd")));
+                AssertQuery(new MatchAllDocsQuery(), null);
+                AssertQuery(new TermQuery(new Term("english", "one")), null);
+                AssertQuery(new MatchAllDocsQuery(), odd);
+                AssertQuery(new TermQuery(new Term("english", "four")), odd);
+                BooleanQuery bq = new BooleanQuery();
+                bq.Add(new TermQuery(new Term("english", "one")), BooleanClause.Occur.SHOULD);
+                bq.Add(new TermQuery(new Term("oddeven", "even")), BooleanClause.Occur.SHOULD);
+                AssertQuery(bq, null);
+                // force in order
+                bq.Add(new TermQuery(new Term("english", "two")), BooleanClause.Occur.SHOULD);
+                bq.MinimumNumberShouldMatch = 2;
+                AssertQuery(bq, null);
+            }
+        }
+
+        
+        internal virtual void AssertQuery(Query query, Filter filter)
+        {
+            for (int i = 0; i < 10; i++)
+            {
+                bool reversed = Random().NextBoolean();
+                SortField[] fields =
+				{ new SortField("int", SortField.Type_e.INT, reversed
+				    ), new SortField("long", SortField.Type_e.LONG, reversed), new SortField("float",

+				        SortField.Type_e.FLOAT, reversed), new SortField("double", SortField.Type_e.DOUBLE,

+				            reversed), new SortField("intdocvalues", SortField.Type_e.INT, reversed),
new SortField
+				                ("floatdocvalues", SortField.Type_e.FLOAT, reversed), new SortField("score",
SortField.Type_e.SCORE) };
+                //TODO: Add Shuffle extension
+                //Collections.Shuffle(Arrays.AsList(fields), Random());
+                int numSorts = TestUtil.NextInt(Random(), 1, fields.Length);
+                AssertQuery(query, filter, new Sort(Arrays.CopyOfRange(fields, 0, numSorts)));
+            }
+        }
+
+        
+        internal virtual void AssertQuery(Query query, Filter filter, Sort sort)
+        {
+            int size = TestUtil.NextInt(Random(), 1, searcher.IndexReader.MaxDoc / 5);
+            TopDocs expected = searcher.Search(query, filter, size, sort, Random().NextBoolean
+                (), Random().NextBoolean());
+            // make our actual sort, mutating original by replacing some of the 
+            // sortfields with equivalent expressions
+            SortField[] original = sort.GetSort();
+            SortField[] mutated = new SortField[original.Length];
+            for (int i = 0; i < mutated.Length; i++)
+            {
+                if (Random().Next(3) > 0)
+                {
+                    SortField s = original[i];
+                    Expression expr = JavascriptCompiler.Compile(s.Field);
+                    SimpleBindings simpleBindings = new SimpleBindings();
+                    simpleBindings.Add(s);
+                    bool reverse = s.Type == SortField.Type_e.SCORE || s.Reverse;
+                    mutated[i] = expr.GetSortField(simpleBindings, reverse);
+                }
+                else
+                {
+                    mutated[i] = original[i];
+                }
+            }
+            Sort mutatedSort = new Sort(mutated);
+            TopDocs actual = searcher.Search(query, filter, size, mutatedSort, Random().NextBoolean
+                (), Random().NextBoolean());
+            CheckHits.CheckEqual(query, expected.ScoreDocs, actual.ScoreDocs);
+            if (size < actual.TotalHits)
+            {
+                expected = searcher.SearchAfter(expected.ScoreDocs[size - 1], query, filter,
size
+                    , sort);
+                actual = searcher.SearchAfter(actual.ScoreDocs[size - 1], query, filter,
size, mutatedSort
+                    );
+                CheckHits.CheckEqual(query, expected.ScoreDocs, actual.ScoreDocs);
+            }
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/b6c1b5d2/src/Lucene.Net.Tests.Expressions/TestExpressionValidation.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests.Expressions/TestExpressionValidation.cs b/src/Lucene.Net.Tests.Expressions/TestExpressionValidation.cs
new file mode 100644
index 0000000..dfb6c95
--- /dev/null
+++ b/src/Lucene.Net.Tests.Expressions/TestExpressionValidation.cs
@@ -0,0 +1,151 @@
+using System;
+using Lucene.Net.Expressions;
+using Lucene.Net.Expressions.JS;
+using Lucene.Net.Search;
+using NUnit.Framework;
+
+namespace Lucene.Net.Tests.Expressions
+{
+	/// <summary>Tests validation of bindings</summary>
+	public class TestExpressionValidation : Util.LuceneTestCase
+	{
+		[Test]
+		public virtual void TestValidExternals()
+		{
+			SimpleBindings bindings = new SimpleBindings();
+			bindings.Add(new SortField("valid0", SortField.Type_e.INT));
+			bindings.Add(new SortField("valid1", SortField.Type_e.INT));
+			bindings.Add(new SortField("valid2", SortField.Type_e.INT));
+			bindings.Add(new SortField("_score", SortField.Type_e.SCORE));
+			bindings.Add("valide0", JavascriptCompiler.Compile("valid0 - valid1 + valid2 + _score"
+				));
+			bindings.Validate();
+			bindings.Add("valide1", JavascriptCompiler.Compile("valide0 + valid0"));
+			bindings.Validate();
+			bindings.Add("valide2", JavascriptCompiler.Compile("valide0 * valide1"));
+			bindings.Validate();
+		}
+
+		[Test]
+		public virtual void TestInvalidExternal()
+		{
+			SimpleBindings bindings = new SimpleBindings();
+			bindings.Add(new SortField("valid", SortField.Type_e.INT));
+			bindings.Add("invalid", JavascriptCompiler.Compile("badreference"));
+			try
+			{
+				bindings.Validate();
+				Fail("didn't get expected exception");
+			}
+			catch (ArgumentException expected)
+			{
+				IsTrue(expected.Message.Contains("Invalid reference"));
+			}
+		}
+
+		[Test]
+		public virtual void TestInvalidExternal2()
+		{
+			SimpleBindings bindings = new SimpleBindings();
+			bindings.Add(new SortField("valid", SortField.Type_e.INT));
+			bindings.Add("invalid", JavascriptCompiler.Compile("valid + badreference"));
+			try
+			{
+				bindings.Validate();
+				Fail("didn't get expected exception");
+			}
+			catch (ArgumentException expected)
+			{
+				IsTrue(expected.Message.Contains("Invalid reference"));
+			}
+		}
+
+        [Test, Ignore("Causing the runner to crash. revisit after all tests are fixed")]
+		public virtual void TestSelfRecursion()
+		{
+			SimpleBindings bindings = new SimpleBindings();
+			bindings.Add("cycle0", JavascriptCompiler.Compile("cycle0"));
+			try
+			{
+				bindings.Validate();
+				Fail("didn't get expected exception");
+			}
+			catch (ArgumentException expected)
+			{
+				IsTrue(expected.Message.Contains("Cycle detected"));
+			}
+		}
+
+		[Test, Ignore("Causing the runner to crash. revisit after all tests are fixed")]
+		public virtual void TestCoRecursion()
+		{
+			SimpleBindings bindings = new SimpleBindings();
+			bindings.Add("cycle0", JavascriptCompiler.Compile("cycle1"));
+			bindings.Add("cycle1", JavascriptCompiler.Compile("cycle0"));
+			try
+			{
+				bindings.Validate();
+				Fail("didn't get expected exception");
+			}
+			catch (ArgumentException expected)
+			{
+				IsTrue(expected.Message.Contains("Cycle detected"));
+			}
+		}
+
+        [Test, Ignore("Causing the runner to crash. revisit after all tests are fixed")]
+		public virtual void TestCoRecursion2()
+		{
+			SimpleBindings bindings = new SimpleBindings();
+			bindings.Add("cycle0", JavascriptCompiler.Compile("cycle1"));
+			bindings.Add("cycle1", JavascriptCompiler.Compile("cycle2"));
+			bindings.Add("cycle2", JavascriptCompiler.Compile("cycle0"));
+			try
+			{
+				bindings.Validate();
+				Fail("didn't get expected exception");
+			}
+			catch (ArgumentException expected)
+			{
+				IsTrue(expected.Message.Contains("Cycle detected"));
+			}
+		}
+
+        [Test, Ignore("Causing the runner to crash. revisit after all tests are fixed")]
+		public virtual void TestCoRecursion3()
+		{
+			SimpleBindings bindings = new SimpleBindings();
+			bindings.Add("cycle0", JavascriptCompiler.Compile("100"));
+			bindings.Add("cycle1", JavascriptCompiler.Compile("cycle0 + cycle2"));
+			bindings.Add("cycle2", JavascriptCompiler.Compile("cycle0 + cycle1"));
+			try
+			{
+				bindings.Validate();
+				Fail("didn't get expected exception");
+			}
+			catch (ArgumentException expected)
+			{
+				IsTrue(expected.Message.Contains("Cycle detected"));
+			}
+		}
+
+        [Test, Ignore("Causing the runner to crash. revisit after all tests are fixed")]
+		public virtual void TestCoRecursion4()
+		{
+			SimpleBindings bindings = new SimpleBindings();
+			bindings.Add("cycle0", JavascriptCompiler.Compile("100"));
+			bindings.Add("cycle1", JavascriptCompiler.Compile("100"));
+			bindings.Add("cycle2", JavascriptCompiler.Compile("cycle1 + cycle0 + cycle3"));
+			bindings.Add("cycle3", JavascriptCompiler.Compile("cycle0 + cycle1 + cycle2"));
+			try
+			{
+				bindings.Validate();
+				Fail("didn't get expected exception");
+			}
+			catch (ArgumentException expected)
+			{
+				IsTrue(expected.Message.Contains("Cycle detected"));
+			}
+		}
+	}
+}

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/b6c1b5d2/src/Lucene.Net.Tests.Expressions/TestExpressionValueSource.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests.Expressions/TestExpressionValueSource.cs b/src/Lucene.Net.Tests.Expressions/TestExpressionValueSource.cs
new file mode 100644
index 0000000..b6a7df2
--- /dev/null
+++ b/src/Lucene.Net.Tests.Expressions/TestExpressionValueSource.cs
@@ -0,0 +1,157 @@
+using System.Collections.Generic;
+using Lucene.Net.Analysis;
+using Lucene.Net.Documents;
+using Lucene.Net.Expressions;
+using Lucene.Net.Expressions.JS;
+using Lucene.Net.Index;
+using Lucene.Net.Queries.Function;
+using Lucene.Net.Search;
+using Lucene.Net.Store;
+using NUnit.Framework;
+
+namespace Lucene.Net.Tests.Expressions
+{
+	public class TestExpressionValueSource : Util.LuceneTestCase
+	{
+		internal DirectoryReader reader;
+
+		internal Directory dir;
+
+		[SetUp]
+		public override void SetUp()
+		{
+			base.SetUp();
+			dir = NewDirectory();
+			IndexWriterConfig iwc = NewIndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer
+				(Random()));
+			iwc.SetMergePolicy(NewLogMergePolicy());
+			var iw = new RandomIndexWriter(Random(), dir, iwc);
+			var doc = new Document
+			{
+			    NewStringField("id", "1", Field.Store.YES),
+			    NewTextField("body", "some contents and more contents", Field.Store.NO),
+			    new NumericDocValuesField("popularity", 5)
+			};
+		    iw.AddDocument(doc);
+			doc = new Document
+			{
+			    NewStringField("id", "2", Field.Store.YES),
+			    NewTextField("body", "another document with different contents", Field.Store
+			        .NO),
+			    new NumericDocValuesField("popularity", 20)
+			};
+		    iw.AddDocument(doc);
+			doc = new Document
+			{
+			    NewStringField("id", "3", Field.Store.YES),
+			    NewTextField("body", "crappy contents", Field.Store.NO),
+			    new NumericDocValuesField("popularity", 2)
+			};
+		    iw.AddDocument(doc);
+			iw.ForceMerge(1);
+			reader = iw.Reader;
+			iw.Dispose();
+		}
+
+		[TearDown]
+		public override void TearDown()
+		{
+			reader.Dispose();
+			dir.Dispose();
+			base.TearDown();
+		}
+
+		[Test]
+		public virtual void TestTypes()
+		{
+			Expression expr = JavascriptCompiler.Compile("2*popularity");
+			SimpleBindings bindings = new SimpleBindings();
+			bindings.Add(new SortField("popularity", SortField.Type_e.LONG));
+			ValueSource vs = expr.GetValueSource(bindings);
+			AreEqual(1, reader.Leaves.Count);
+			AtomicReaderContext leaf = reader.Leaves[0];
+			FunctionValues values = vs.GetValues(new Dictionary<string, object>(), leaf);
+			AreEqual(10, values.DoubleVal(0), 0);
+			AreEqual(10, values.FloatVal(0), 0);
+			AreEqual(10, values.LongVal(0));
+			AreEqual(10, values.IntVal(0));
+			AreEqual(10, values.ShortVal(0));
+			AreEqual(10, values.ByteVal(0));
+			AreEqual("10", values.StrVal(0));
+			AreEqual(System.Convert.ToDouble(10), values.ObjectVal(0));
+			AreEqual(40, values.DoubleVal(1), 0);
+			AreEqual(40, values.FloatVal(1), 0);
+			AreEqual(40, values.LongVal(1));
+			AreEqual(40, values.IntVal(1));
+			AreEqual(40, values.ShortVal(1));
+			AreEqual(40, values.ByteVal(1));
+			AreEqual("40", values.StrVal(1));
+			AreEqual(System.Convert.ToDouble(40), values.ObjectVal(1));
+			AreEqual(4, values.DoubleVal(2), 0);
+			AreEqual(4, values.FloatVal(2), 0);
+			AreEqual(4, values.LongVal(2));
+			AreEqual(4, values.IntVal(2));
+			AreEqual(4, values.ShortVal(2));
+			AreEqual(4, values.ByteVal(2));
+			AreEqual("4", values.StrVal(2));
+			AreEqual(System.Convert.ToDouble(4), values.ObjectVal(2));
+		}
+
+		[Test]
+		public virtual void TestRangeScorer()
+		{
+			Expression expr = JavascriptCompiler.Compile("2*popularity");
+			SimpleBindings bindings = new SimpleBindings();
+			bindings.Add(new SortField("popularity", SortField.Type_e.LONG));
+			ValueSource vs = expr.GetValueSource(bindings);
+			AreEqual(1, reader.Leaves.Count);
+			AtomicReaderContext leaf = reader.Leaves[0];
+			FunctionValues values = vs.GetValues(new Dictionary<string, object>(), leaf);
+			// everything
+			ValueSourceScorer scorer = values.GetRangeScorer(leaf.Reader, "4"
+				, "40", true, true);
+			AreEqual(-1, scorer.DocID());
+			AreEqual(0, scorer.NextDoc());
+			AreEqual(1, scorer.NextDoc());
+			AreEqual(2, scorer.NextDoc());
+			AreEqual(DocIdSetIterator.NO_MORE_DOCS, scorer.NextDoc());
+			// just the first doc
+			scorer = values.GetRangeScorer(leaf.Reader, "4", "40", false, false);
+			AreEqual(-1, scorer.DocID());
+			AreEqual(0, scorer.NextDoc());
+			AreEqual(DocIdSetIterator.NO_MORE_DOCS, scorer.NextDoc());
+		}
+
+		[Test]
+		public virtual void TestEquals()
+		{
+			Expression expr = JavascriptCompiler.Compile("sqrt(a) + ln(b)");
+			SimpleBindings bindings = new SimpleBindings();
+			bindings.Add(new SortField("a", SortField.Type_e.INT));
+			bindings.Add(new SortField("b", SortField.Type_e.INT));
+			ValueSource vs1 = expr.GetValueSource(bindings);
+			// same instance
+			AreEqual(vs1, vs1);
+			// null
+			IsFalse(vs1.Equals(null));
+			// other object
+			IsFalse(vs1.Equals("foobar"));
+			// same bindings and expression instances
+			ValueSource vs2 = expr.GetValueSource(bindings);
+			AreEqual(vs1.GetHashCode(), vs2.GetHashCode());
+			AreEqual(vs1, vs2);
+			// equiv bindings (different instance)
+			SimpleBindings bindings2 = new SimpleBindings();
+			bindings2.Add(new SortField("a", SortField.Type_e.INT));
+			bindings2.Add(new SortField("b", SortField.Type_e.INT));
+			ValueSource vs3 = expr.GetValueSource(bindings2);
+			AreEqual(vs1, vs3);
+			// different bindings (same names, different types)
+			SimpleBindings bindings3 = new SimpleBindings();
+			bindings3.Add(new SortField("a", SortField.Type_e.LONG));
+			bindings3.Add(new SortField("b", SortField.Type_e.INT));
+			ValueSource vs4 = expr.GetValueSource(bindings3);
+			IsFalse(vs1.Equals(vs4));
+		}
+	}
+}


Mime
View raw message