} {1}
test {Basic LPUSH, RPUSH, LLENGTH, LINDEX} {
- $r lpush mylist a
- $r lpush mylist b
- $r rpush mylist c
- set res [$r llen mylist]
+ set res [$r lpush mylist a]
+ append res [$r lpush mylist b]
+ append res [$r rpush mylist c]
+ append res [$r llen mylist]
+ append res [$r rpush anotherlist d]
+ append res [$r lpush anotherlist e]
+ append res [$r llen anotherlist]
append res [$r lindex mylist 0]
append res [$r lindex mylist 1]
append res [$r lindex mylist 2]
+ append res [$r lindex anotherlist 0]
+ append res [$r lindex anotherlist 1]
list $res [$r lindex mylist 100]
- } {3bac {}}
+ } {1233122baced {}}
test {DEL a list} {
$r del mylist
$r zrangebyscore zset 20 50 LIMIT 2 3 withscores
} {d 40 e 50}
- test {ZREMRANGE basics} {
+ test {ZREMRANGEBYSCORE basics} {
$r del zset
$r zadd zset 1 a
$r zadd zset 2 b
list [$r zremrangebyscore zset 2 4] [$r zrange zset 0 -1]
} {3 {a e}}
- test {ZREMRANGE from -inf to +inf} {
+ test {ZREMRANGEBYSCORE from -inf to +inf} {
$r del zset
$r zadd zset 1 a
$r zadd zset 2 b
list [$r zremrangebyscore zset -inf +inf] [$r zrange zset 0 -1]
} {5 {}}
+ test {ZREMRANGEBYRANK basics} {
+ $r del zset
+ $r zadd zset 1 a
+ $r zadd zset 2 b
+ $r zadd zset 3 c
+ $r zadd zset 4 d
+ $r zadd zset 5 e
+ list [$r zremrangebyrank zset 1 3] [$r zrange zset 0 -1]
+ } {3 {a e}}
+
test {SORT against sorted sets} {
$r del zset
$r zadd zset 1 a
format $diff
} {0}
+ test {ZSETs ZRANK augmented skip list stress testing} {
+ set err {}
+ $r del myzset
+ for {set k 0} {$k < 10000} {incr k} {
+ set i [expr {$k%1000}]
+ if {[expr rand()] < .2} {
+ $r zrem myzset $i
+ } else {
+ set score [expr rand()]
+ $r zadd myzset $score $i
+ }
+ set card [$r zcard myzset]
+ if {$card > 0} {
+ set index [randomInt $card]
+ set ele [lindex [$r zrange myzset $index $index] 0]
+ set rank [$r zrank myzset $ele]
+ if {$rank != $index} {
+ set err "$ele RANK is wrong! ($rank != $index)"
+ break
+ }
+ }
+ }
+ set _ $err
+ } {}
+
foreach fuzztype {binary alpha compr} {
test "FUZZ stresser with data model $fuzztype" {
set err 0