Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
ruanhaishen
redis
Commits
8e1b3277
Commit
8e1b3277
authored
Jan 17, 2011
by
Pieter Noordhuis
Browse files
Test for ranges where min > max
parent
df278b8b
Changes
2
Show whitespace changes
Inline
Side-by-side
src/t_zset.c
View file @
8e1b3277
...
...
@@ -196,6 +196,10 @@ static int zslValueInRange(double value, zrangespec *spec) {
int
zslIsInRange
(
zskiplist
*
zsl
,
zrangespec
*
range
)
{
zskiplistNode
*
x
;
/* Test for ranges that will always be empty. */
if
(
range
->
min
>
range
->
max
||
(
range
->
min
==
range
->
max
&&
(
range
->
minex
||
range
->
maxex
)))
return
0
;
x
=
zsl
->
tail
;
if
(
x
==
NULL
||
!
zslValueInMinRange
(
x
->
score
,
range
))
return
0
;
...
...
tests/unit/type/zset.tcl
View file @
8e1b3277
...
...
@@ -233,12 +233,16 @@ start_server {tags {"zset"}} {
r zrem zset g
# inclusive
assert_equal
{}
[
r zrangebyscore zset 4 2
]
assert_equal
{}
[
r zrangebyscore zset 6 +inf
]
assert_equal
{}
[
r zrangebyscore zset -inf -6
]
assert_equal
{}
[
r zrevrangebyscore zset +inf 6
]
assert_equal
{}
[
r zrevrangebyscore zset -6 -inf
]
# exclusive
assert_equal
{}
[
r zrangebyscore zset
(
4
(
2
]
assert_equal
{}
[
r zrangebyscore zset 2
(
2
]
assert_equal
{}
[
r zrangebyscore zset
(
2 2
]
assert_equal
{}
[
r zrangebyscore zset
(
6
(
+inf
]
assert_equal
{}
[
r zrangebyscore zset
(
-inf
(
-6
]
assert_equal
{}
[
r zrevrangebyscore zset
(
+inf
(
6
]
...
...
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