lsort [array names myset]
} {a b c}
+ test {SORT ALPHA against integer encoded strings} {
+ $r del mylist
+ $r lpush mylist 2
+ $r lpush mylist 1
+ $r lpush mylist 3
+ $r lpush mylist 10
+ $r sort mylist alpha
+ } {1 10 2 3}
+
test {Create a random list and a random set} {
set tosort {}
array set seenrand {}
$r sort tosort {BY wobj_*->weight}
} $res
+ test {SORT with GET (key+hash) with sanity check of each element (list)} {
+ set err {}
+ set l1 [$r sort tosort GET # GET weight_*]
+ set l2 [$r sort tosort GET # GET wobj_*->weight]
+ foreach {id1 w1} $l1 {id2 w2} $l2 {
+ set realweight [$r get weight_$id1]
+ if {$id1 != $id2} {
+ set err "ID mismatch $id1 != $id2"
+ break
+ }
+ if {$realweight != $w1 || $realweight != $w2} {
+ set err "Weights mismatch! w1: $w1 w2: $w2 real: $realweight"
+ break
+ }
+ }
+ set _ $err
+ } {}
+
test {SORT with BY, but against the newly created set} {
$r sort tosort-set {BY weight_*}
} $res
$r ttl x
} {1[345]}
+ test {SETEX - Set + Expire combo operation. Check for TTL} {
+ $r setex x 12 test
+ $r ttl x
+ } {1[012]}
+
+ test {SETEX - Check value} {
+ $r get x
+ } {test}
+
+ test {SETEX - Overwrite old key} {
+ $r setex y 1 foo
+ $r get y
+ } {foo}
+
+ test {SETEX - Wait for the key to expire} {
+ after 3000
+ $r get y
+ } {}
+
+ test {SETEX - Wrong time parameter} {
+ catch {$r setex z -10 foo} e
+ set _ $e
+ } {*invalid expire*}
+
test {ZSETs skiplist implementation backlink consistency test} {
set diff 0
set elements 10000