mirror of
https://github.com/fluencelabs/redis
synced 2025-03-18 16:40:50 +00:00
GEOADD STORE/STOREDIST tests.
This commit is contained in:
parent
bb75ecddfd
commit
f4befcc0ff
@ -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]} {
|
||||
|
Loading…
x
Reference in New Issue
Block a user