summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSalvatore Sanfilippo <antirez@gmail.com>2019-07-15 23:41:57 +0200
committerGitHub <noreply@github.com>2019-07-15 23:41:57 +0200
commit4b2579a0644e469edb80e7c979f44ec7f2724368 (patch)
treec3a7892cb923f12854e4eee91c4c037a9aa7375e
parent3f1c84751a7e665c8831475cd23be1e93285d032 (diff)
parentb00e1891c04bd375bb7d9877397c675335f8b40c (diff)
downloadredis-4b2579a0644e469edb80e7c979f44ec7f2724368.tar.gz
Merge pull request #5779 from madolson/dev-unstable-geo-bugfix
Fixed a rounding bug in geo.tcl
-rw-r--r--tests/unit/geo.tcl14
1 files changed, 13 insertions, 1 deletions
diff --git a/tests/unit/geo.tcl b/tests/unit/geo.tcl
index 604697be4..49e421ee9 100644
--- a/tests/unit/geo.tcl
+++ b/tests/unit/geo.tcl
@@ -61,6 +61,7 @@ set regression_vectors {
{939895 151 59.149620271823181 65.204186651485145}
{1412 156 149.29737817929004 15.95807862745508}
{564862 149 84.062063109158544 -65.685403922426232}
+ {1546032440391 16751 -1.8175081637769495 20.665668878082954}
}
set rv_idx 0
@@ -274,8 +275,19 @@ start_server {tags {"geo"}} {
foreach place $diff {
set mydist [geo_distance $lon $lat $search_lon $search_lat]
set mydist [expr $mydist/1000]
- if {($mydist / $radius_km) > 0.999} {incr rounding_errors}
+ if {($mydist / $radius_km) > 0.999} {
+ incr rounding_errors
+ continue
+ }
+ if {$mydist < $radius_m} {
+ # This is a false positive for redis since given the
+ # same points the higher precision calculation provided
+ # by TCL shows the point within range
+ incr rounding_errors
+ continue
+ }
}
+
# Make sure this is a real error and not a rounidng issue.
if {[llength $diff] == $rounding_errors} {
set res $res2; # Error silenced