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
45fe1f5e
Commit
45fe1f5e
authored
Nov 21, 2017
by
antirez
Browse files
Streams: add some initial test for XREVRANGE.
parent
115d076d
Changes
1
Hide whitespace changes
Inline
Side-by-side
tests/unit/type/stream.tcl
View file @
45fe1f5e
...
@@ -121,6 +121,10 @@ start_server {
...
@@ -121,6 +121,10 @@ start_server {
assert
{[
llength
[
r xrange mystream - + COUNT 10
]]
== 10
}
assert
{[
llength
[
r xrange mystream - + COUNT 10
]]
== 10
}
}
}
test
{
XREVRANGE COUNT works as expected
}
{
assert
{[
llength
[
r xrevrange mystream + - COUNT 10
]]
== 10
}
}
test
{
XRANGE can be used to iterate the whole stream
}
{
test
{
XRANGE can be used to iterate the whole stream
}
{
set last_id
"-"
set last_id
"-"
set j 0
set j 0
...
@@ -136,6 +140,10 @@ start_server {
...
@@ -136,6 +140,10 @@ start_server {
assert
{
$j
== 10000
}
assert
{
$j
== 10000
}
}
}
test
{
XREVRANGE returns the reverse of XRANGE
}
{
assert
{[
r xrange mystream - +
]
==
[
lreverse
[
r xrevrange mystream + -
]]}
}
test
{
XREAD with non empty stream
}
{
test
{
XREAD with non empty stream
}
{
set res
[
r XREAD COUNT 1 STREAMS mystream 0.0
]
set res
[
r XREAD COUNT 1 STREAMS mystream 0.0
]
assert
{[
lrange
[
lindex $res 0 1 0 1
]
0 1
]
eq
{
item 0
}}
assert
{[
lrange
[
lindex $res 0 1 0 1
]
0 1
]
eq
{
item 0
}}
...
...
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