Fix assertion precision for legacy GeoDistanceRangeQuery tests

This bug existed for GeoDistanceRangeQuery exclusion limits only (e.g., min/max included == false).

closes #14838
This commit is contained in:
Nicholas Knize 2015-11-18 13:59:56 -06:00
parent 756f7876a9
commit 9ed77afe1d
1 changed files with 2 additions and 2 deletions

View File

@ -146,7 +146,7 @@ public class GeoDistanceRangeQueryTests extends AbstractQueryTestCase<GeoDistanc
} }
double fromSlop = Math.abs(fromValue) / 1000; double fromSlop = Math.abs(fromValue) / 1000;
if (queryBuilder.includeLower() == false) { if (queryBuilder.includeLower() == false) {
fromSlop = NumericUtils.sortableLongToDouble((NumericUtils.doubleToSortableLong(fromValue) + 1L)); fromSlop = NumericUtils.sortableLongToDouble((NumericUtils.doubleToSortableLong(Math.abs(fromValue)) + 1L)) / 1000.0;
} }
assertThat(geoQuery.minInclusiveDistance(), closeTo(fromValue, fromSlop)); assertThat(geoQuery.minInclusiveDistance(), closeTo(fromValue, fromSlop));
} }
@ -160,7 +160,7 @@ public class GeoDistanceRangeQueryTests extends AbstractQueryTestCase<GeoDistanc
} }
double toSlop = Math.abs(toValue) / 1000; double toSlop = Math.abs(toValue) / 1000;
if (queryBuilder.includeUpper() == false) { if (queryBuilder.includeUpper() == false) {
toSlop = NumericUtils.sortableLongToDouble((NumericUtils.doubleToSortableLong(toValue) + 1L)); toSlop = NumericUtils.sortableLongToDouble((NumericUtils.doubleToSortableLong(Math.abs(toValue)) - 1L)) / 1000.0;
} }
assertThat(geoQuery.maxInclusiveDistance(), closeTo(toValue, toSlop)); assertThat(geoQuery.maxInclusiveDistance(), closeTo(toValue, toSlop));
} }