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
f4befcc0
Commit
f4befcc0
authored
Feb 18, 2016
by
antirez
Browse files
GEOADD STORE/STOREDIST tests.
parent
bb75ecdd
Changes
1
Hide whitespace changes
Inline
Side-by-side
tests/unit/geo.tcl
View file @
f4befcc0
...
...
@@ -128,6 +128,60 @@ start_server {tags {"geo"}} {
assert
{
$m
eq
{}}
}
test
{
GEORADIUS STORE option: syntax error
}
{
r del points
r geoadd points 13.361389 38.115556
"Palermo"
\
15.087269 37.502669
"Catania"
catch
{
r georadius points 13.361389 38.115556 50 km store
}
e
set e
}
{
*ERR*syntax*
}
test
{
GEORANGE STORE option: incompatible options
}
{
r del points
r geoadd points 13.361389 38.115556
"Palermo"
\
15.087269 37.502669
"Catania"
catch
{
r georadius points 13.361389 38.115556 50 km store points2 withdist
}
e
assert_match
{
*ERR*
}
$e
catch
{
r georadius points 13.361389 38.115556 50 km store points2 withhash
}
e
assert_match
{
*ERR*
}
$e
catch
{
r georadius points 13.361389 38.115556 50 km store points2 withcoords
}
e
assert_match
{
*ERR*
}
$e
}
test
{
GEORANGE STORE option: plain usage
}
{
r del points
r geoadd points 13.361389 38.115556
"Palermo"
\
15.087269 37.502669
"Catania"
r georadius points 13.361389 38.115556 500 km store points2
assert_equal
[
r zrange points 0 -1
]
[
r zrange points2 0 -1
]
}
test
{
GEORANGE STOREDIST option: plain usage
}
{
r del points
r geoadd points 13.361389 38.115556
"Palermo"
\
15.087269 37.502669
"Catania"
r georadius points 13.361389 38.115556 500 km storedist points2
set res
[
r zrange points2 0 -1 withscores
]
assert
{[
lindex $res 1
]
< 1
}
assert
{[
lindex $res 3
]
> 166
}
assert
{[
lindex $res 3
]
< 167
}
}
test
{
GEORANGE STOREDIST option: COUNT ASC and DESC
}
{
r del points
r geoadd points 13.361389 38.115556
"Palermo"
\
15.087269 37.502669
"Catania"
r georadius points 13.361389 38.115556 500 km storedist points2 asc count 1
assert
{[
r zcard points2
]
== 1
}
set res
[
r zrange points2 0 -1 withscores
]
assert
{[
lindex $res 0
]
eq
"Palermo"
}
r georadius points 13.361389 38.115556 500 km storedist points2 desc count 1
assert
{[
r zcard points2
]
== 1
}
set res
[
r zrange points2 0 -1 withscores
]
assert
{[
lindex $res 0
]
eq
"Catania"
}
}
test
{
GEOADD + GEORANGE randomized test
}
{
set attempt 10
while
{[
incr attempt -1
]}
{
...
...
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