EXPIRE tests

This commit is contained in:
antirez 2009-11-20 14:36:32 +01:00
parent b9bb7ba220
commit b9febaab5d
2 changed files with 27 additions and 1 deletions

2
TODO
View File

@ -3,7 +3,7 @@ VERSION 1.1 TODO
* For now only the last argument gets integer encoded, so make sure that: 1) every multi bulk commands implemented will have the last arg that is indeed a value, and not used otherwise. 2) to explicitly call the function to encode the object in MSET and other commands where there are multiple "values". * For now only the last argument gets integer encoded, so make sure that: 1) every multi bulk commands implemented will have the last arg that is indeed a value, and not used otherwise. 2) to explicitly call the function to encode the object in MSET and other commands where there are multiple "values".
* Man pages for MSET MSETNX and SRANDMEMBER, Z-commands, ... * Man pages for MSET MSETNX and SRANDMEMBER, Z-commands, ...
* Use strcoll() to compare objects in sorted sets, like it already happens for SORT. * Use strcoll() to compare objects in sorted sets, like it already happens for SORT.
* RPOPLPUSH, EXPIRE, EXPIREAT, ZSCORE, SRANDMEMBER tests. * Tests for: EXPIREAT, ZSCORE, SRANDMEMBER, SORT with #.
* Write docs for the "STORE" operaiton of SORT, and GET "#" option. * Write docs for the "STORE" operaiton of SORT, and GET "#" option.
* Append only mode: testing and a command to rebuild the log from scratch. * Append only mode: testing and a command to rebuild the log from scratch.
* Redis-cli should be able to select a different DB than 0 using some switch. * Redis-cli should be able to select a different DB than 0 using some switch.

View File

@ -934,6 +934,32 @@ proc main {server port} {
format $delta format $delta
} {0} } {0}
test {EXPIRE - don't set timeouts multiple times} {
$r set x foobar
set v1 [$r expire x 5]
set v2 [$r ttl x]
set v3 [$r expire x 10]
set v4 [$r ttl x]
list $v1 $v2 $v3 $v4
} {1 5 0 5}
test {EXPIRE - It should be still possible to read 'x'} {
$r get x
} {foobar}
test {EXPIRE - After 6 seconds the key should no longer be here} {
after 6000
list [$r get x] [$r exists x]
} {{} 0}
test {EXPIRE - Delete on write policy} {
$r del x
$r lpush x foo
$r expire x 1000
$r lpush x bar
$r lrange x 0 -1
} {bar}
test {ZSETs skiplist implementation backlink consistency test} { test {ZSETs skiplist implementation backlink consistency test} {
set diff 0 set diff 0
set elements 10000 set elements 10000