You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucenenet.apache.org by la...@apache.org on 2015/05/30 21:10:55 UTC

lucenenet git commit: more diagnostics for query utils

Repository: lucenenet
Updated Branches:
  refs/heads/failingtests 425325e23 -> 3a19ccb86


more diagnostics for query utils


Project: http://git-wip-us.apache.org/repos/asf/lucenenet/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucenenet/commit/3a19ccb8
Tree: http://git-wip-us.apache.org/repos/asf/lucenenet/tree/3a19ccb8
Diff: http://git-wip-us.apache.org/repos/asf/lucenenet/diff/3a19ccb8

Branch: refs/heads/failingtests
Commit: 3a19ccb8672ac208c0396a47bf45a4d2de1e51ae
Parents: 425325e
Author: Laimonas Simutis <la...@gmail.com>
Authored: Sat May 30 15:10:33 2015 -0400
Committer: Laimonas Simutis <la...@gmail.com>
Committed: Sat May 30 15:10:33 2015 -0400

----------------------------------------------------------------------
 src/Lucene.Net.TestFramework/Search/QueryUtils.cs | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucenenet/blob/3a19ccb8/src/Lucene.Net.TestFramework/Search/QueryUtils.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.TestFramework/Search/QueryUtils.cs b/src/Lucene.Net.TestFramework/Search/QueryUtils.cs
index 3eae0af..e28fbfa 100644
--- a/src/Lucene.Net.TestFramework/Search/QueryUtils.cs
+++ b/src/Lucene.Net.TestFramework/Search/QueryUtils.cs
@@ -470,6 +470,7 @@ namespace Lucene.Net.Search
                 float score = scorer.Score();
                 try
                 {
+                    var sb = new StringBuilder();
                     long startMS = Environment.TickCount;
                     for (int i = LastDoc[0] + 1; i <= doc; i++)
                     {
@@ -478,7 +479,22 @@ namespace Lucene.Net.Search
                         Assert.IsTrue(scorer_.Advance(i) != DocIdSetIterator.NO_MORE_DOCS, "query collected " + doc + " but skipTo(" + i + ") says no more docs!");
                         Assert.AreEqual(doc, scorer_.DocID(), "query collected " + doc + " but skipTo(" + i + ") got to " + scorer_.DocID());
                         float skipToScore = scorer_.Score();
-                        Assert.IsTrue(Math.Abs(skipToScore - scorer_.Score()) < MaxDiff, "unstable skipTo(" + i + ") score!");
+                        float secondScore = scorer_.Score();
+                        sb.AppendLine("Comparing equality:");
+                        sb.AppendLine(skipToScore.ToString());
+                        sb.AppendLine(secondScore.ToString());
+                        try
+                        {
+                            Assert.IsTrue(Math.Abs(skipToScore - secondScore) < MaxDiff,
+                                          "unstable skipTo(" + i + ") score!");
+                        }
+                        catch (AssertionException ex)
+                        {
+                            Console.WriteLine("Failed. Collected output:");
+                            Console.WriteLine(sb.ToString());
+                            throw;
+                        }
+
                         Assert.IsTrue(Math.Abs(score - skipToScore) < MaxDiff, "query assigned doc " + doc + " a score of <" + score + "> but skipTo(" + i + ") has <" + skipToScore + ">!");
 
                         // Hurry things along if they are going slow (eg