summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorantirez <antirez@gmail.com>2017-11-21 22:22:05 +0100
committerantirez <antirez@gmail.com>2017-12-01 10:24:25 +0100
commit45fe1f5e0019c6745e531da3ea51eee609f15ec3 (patch)
tree666d25d87b1eb1dd1138e6fa95fe3a8c94c2e1da
parent115d076d655d265ef534bb0782da8a2ba0d877ac (diff)
downloadredis-45fe1f5e0019c6745e531da3ea51eee609f15ec3.tar.gz
Streams: add some initial test for XREVRANGE.
-rw-r--r--tests/unit/type/stream.tcl8
1 files changed, 8 insertions, 0 deletions
diff --git a/tests/unit/type/stream.tcl b/tests/unit/type/stream.tcl
index 5c58e7fb2..d7b5ca2a8 100644
--- a/tests/unit/type/stream.tcl
+++ b/tests/unit/type/stream.tcl
@@ -121,6 +121,10 @@ start_server {
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} {
set last_id "-"
set j 0
@@ -136,6 +140,10 @@ start_server {
assert {$j == 10000}
}
+ test {XREVRANGE returns the reverse of XRANGE} {
+ assert {[r xrange mystream - +] == [lreverse [r xrevrange mystream + -]]}
+ }
+
test {XREAD with non empty stream} {
set res [r XREAD COUNT 1 STREAMS mystream 0.0]
assert {[lrange [lindex $res 0 1 0 1] 0 1] eq {item 0}}