BUG: Lucene.Net.Tests.Spatial.SpatialArgsTest.CalcDistanceFromErrPct(): Test 
fails because floating point asserts didn't contain any delta and the 
implementation has changed in .NET Core 2.0 so it is no longer on the nose (but 
still well within tolerance for floating point numbers).


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

Branch: refs/heads/master
Commit: 60faa9cdcbc9b0e37a2472f5d3cc5af76c96c82a
Parents: ae22f1a
Author: Shad Storhaug <[email protected]>
Authored: Wed Aug 30 23:41:54 2017 +0700
Committer: Shad Storhaug <[email protected]>
Committed: Wed Aug 30 23:41:54 2017 +0700

----------------------------------------------------------------------
 src/Lucene.Net.Tests.Spatial/SpatialArgsTest.cs | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucenenet/blob/60faa9cd/src/Lucene.Net.Tests.Spatial/SpatialArgsTest.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests.Spatial/SpatialArgsTest.cs 
b/src/Lucene.Net.Tests.Spatial/SpatialArgsTest.cs
index afac670..8dd70f4 100644
--- a/src/Lucene.Net.Tests.Spatial/SpatialArgsTest.cs
+++ b/src/Lucene.Net.Tests.Spatial/SpatialArgsTest.cs
@@ -3,6 +3,7 @@ using Lucene.Net.Util;
 using NUnit.Framework;
 using Spatial4n.Core.Context;
 using Spatial4n.Core.Shapes;
+using System;
 
 namespace Lucene.Net.Spatial
 {
@@ -35,12 +36,18 @@ namespace Lucene.Net.Spatial
             // times distErrPct
 
             IShape superwide = ctx.MakeRectangle(-180, 180, 0, 0);
+
+            // LUCENENET specific: Added delta to the first 3 asserts because 
it is not a 
+            // valid expectation that they are exactly on the nose when 
dealing with floating point
+            // types. And in .NET Core 2.0, the implementation has changed 
which now makes this test
+            // fail without delta.
+
             //0 distErrPct means 0 distance always
-            assertEquals(0, SpatialArgs.CalcDistanceFromErrPct(superwide, 0, 
ctx), 0);
-            assertEquals(180 * DEP, 
SpatialArgs.CalcDistanceFromErrPct(superwide, DEP, ctx), 0);
+            assertEquals(0, SpatialArgs.CalcDistanceFromErrPct(superwide, 0, 
ctx), 0.0001);
+            assertEquals(180 * DEP, 
SpatialArgs.CalcDistanceFromErrPct(superwide, DEP, ctx), 0.0001);
 
             IShape supertall = ctx.MakeRectangle(0, 0, -90, 90);
-            assertEquals(90 * DEP, 
SpatialArgs.CalcDistanceFromErrPct(supertall, DEP, ctx), 0);
+            assertEquals(90 * DEP, 
SpatialArgs.CalcDistanceFromErrPct(supertall, DEP, ctx), 0.0001);
 
             IShape upperhalf = ctx.MakeRectangle(-180, 180, 0, 90);
             assertEquals(45 * DEP, 
SpatialArgs.CalcDistanceFromErrPct(upperhalf, DEP, ctx), 0.0001);

Reply via email to