# TODO # test pipelining
+set tcl_precision 17
source redis.tcl
set ::passed 0
} {{1 2 3} 0}
test {SAVE - make sure there are all the types as values} {
+ # Wait for a background saving in progress to terminate
+ while 1 {
+ set i [$r info]
+ if {[string match {*bgsave_in_progress:1*} $i]} {
+ puts -nonewline "\nWaiting for background save to finish... "
+ flush stdout
+ after 100
+ } else {
+ break
+ }
+ }
$r lpush mysavelist hello
$r lpush mysavelist world
$r set myemptykey {}
lappend aux [$r dbsize]
} {0 0}
+ test {Perform a final SAVE to leave a clean DB on disk} {
+ $r save
+ } {OK}
+
puts "\n[expr $::passed+$::failed] tests, $::passed passed, $::failed failed"
if {$::failed > 0} {
puts "\n*** WARNING!!! $::failed FAILED TESTS ***\n"
set randval [expr int(rand()*10000)]
set randidx0 [expr int(rand()*10)]
set randidx1 [expr int(rand()*10)]
- set cmd [expr int(rand()*10)]
+ set cmd [expr int(rand()*20)]
catch {
if {$cmd == 0} {$r set $randkey $randval}
if {$cmd == 1} {$r get $randkey}
if {$cmd == 3} {$r lpush $randkey $randval}
if {$cmd == 4} {$r rpop $randkey}
if {$cmd == 5} {$r del $randkey}
- if {$cmd == 6} {$r lrange $randkey $randidx0 $randidx1}
- if {$cmd == 7} {$r ltrim $randkey $randidx0 $randidx1}
- if {$cmd == 8} {$r lindex $randkey $randidx0}
- if {$cmd == 9} {$r lset $randkey $randidx0 $randval}
+ if {$cmd == 6} {$r llen $randkey}
+ if {$cmd == 7} {$r lrange $randkey $randidx0 $randidx1}
+ if {$cmd == 8} {$r ltrim $randkey $randidx0 $randidx1}
+ if {$cmd == 9} {$r lindex $randkey $randidx0}
+ if {$cmd == 10} {$r lset $randkey $randidx0 $randval}
+ if {$cmd == 11} {$r sadd $randkey $randval}
+ if {$cmd == 12} {$r srem $randkey $randval}
+ if {$cmd == 13} {$r smove $randkey $randval}
+ if {$cmd == 14} {$r scard $randkey}
+ if {$cmd == 15} {$r expire $randkey [expr $randval%60]}
}
flush stdout
}