Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ruanhaishen
redis
Commits
b7b23a0f
Unverified
Commit
b7b23a0f
authored
Feb 05, 2021
by
Yang Bodong
Committed by
GitHub
Feb 04, 2021
Browse files
Fix GEOSEARCH tcl test error (#8451)
Issue with new test due to longitude wraparound.
parent
ded1655d
Changes
1
Hide whitespace changes
Inline
Side-by-side
tests/unit/geo.tcl
View file @
b7b23a0f
...
...
@@ -566,6 +566,13 @@ start_server {tags {"geo"}} {
foreach name
[
array names points
]
{
set x
[
lindex $points
(
$name
)
0
]
set y
[
lindex $points
(
$name
)
1
]
# If longitude crosses -180° or 180°, we need to convert it.
# latitude doesn't have this problem, because it's scope is -70~70, see geo_random_point
if
{
$x
> 180
}
{
set x
[
expr
{
$x-360
}]
}
elseif
{
$x
< -180
}
{
set x
[
expr
{
$x
+360
}]
}
r geoadd mypoints $x $y place:$name
lappend tcl_result
"place:
$name
"
lappend debuginfo
"geoadd mypoints
$x
$y
place:
$name
"
...
...
@@ -579,7 +586,7 @@ start_server {tags {"geo"}} {
set res
[
lsort
[
r geosearch mypoints fromlonlat $search_lon $search_lat bybox $width_new $height_new m
]]
if
{
$res
!= $res2
}
{
set diff
[
compare_lists $res $res2
]
lappend debuginfo
"diff:
$diff
"
lappend debuginfo
"
res:
$res
, res2:
$res2
,
diff:
$diff
"
fail
"place should be found, debuginfo:
$debuginfo
, height_new:
$height
_new width_new:
$width
_new"
}
...
...
@@ -588,8 +595,7 @@ start_server {tags {"geo"}} {
set height_new
[
expr
{
$height
_m+4
}]
set res
[
lsort
[
r geosearch mypoints fromlonlat $search_lon $search_lat bybox $width_new $height_new m
]]
if
{
$res
!=
{
place:north place:south
}}
{
set diff
[
compare_lists $res $res2
]
lappend debuginfo
"diff:
$diff
"
lappend debuginfo
"res:
$res
"
fail
"place should not be found, debuginfo:
$debuginfo
, height_new:
$height
_new width_new:
$width
_new"
}
...
...
@@ -598,8 +604,7 @@ start_server {tags {"geo"}} {
set height_new
[
expr
{
$height
_m-4
}]
set res
[
lsort
[
r geosearch mypoints fromlonlat $search_lon $search_lat bybox $width_new $height_new m
]]
if
{
$res
!=
{
place:east place:west
}}
{
set diff
[
compare_lists $res $res2
]
lappend debuginfo
"diff:
$diff
"
lappend debuginfo
"res:
$res
"
fail
"place should not be found, debuginfo:
$debuginfo
, height_new:
$height
_new width_new:
$width
_new"
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment