From: antirez Date: Tue, 31 May 2011 16:49:12 +0000 (+0200) Subject: disabled development test entry, tests moved in the right place X-Git-Url: https://git.saurik.com/redis.git/commitdiff_plain/faa2a80f89b5a3cd35812e71893d812e2877ed2e?ds=inline disabled development test entry, tests moved in the right place --- diff --git a/tests/test_helper.tcl b/tests/test_helper.tcl index bce8ded5..e2a9e525 100644 --- a/tests/test_helper.tcl +++ b/tests/test_helper.tcl @@ -110,7 +110,7 @@ proc cleanup {} { } proc execute_everything {} { - if 1 { + if 0 { # Use this when hacking on new tests. set ::verbose 1 execute_tests "unit/first" diff --git a/tests/unit/type/zset.tcl b/tests/unit/type/zset.tcl index 761cac49..7b757280 100644 --- a/tests/unit/type/zset.tcl +++ b/tests/unit/type/zset.tcl @@ -48,6 +48,34 @@ start_server {tags {"zset"}} { assert_error "*NaN*" {r zincrby myzset -inf abc} } + test {ZADD - Variadic version base case} { + r del myzset + list [r zadd myzset 10 a 20 b 30 c] [r zrange myzset 0 -1 withscores] + } {3 {a 10 b 20 c 30}} + + test {ZADD - Return value is the number of actually added items} { + list [r zadd myzset 5 x 20 b 30 c] [r zrange myzset 0 -1 withscores] + } {1 {x 5 a 10 b 20 c 30}} + + test {ZADD - Variadic version does not add nothing on single parsing err} { + r del myzset + catch {r zadd myzset 10 a 20 b 30.badscore c} e + assert_match {*ERR*not*double*} $e + r exists myzset + } {0} + + test {ZADD - Variadic version will raise error on missing arg} { + r del myzset + catch {r zadd myzset 10 a 20 b 30 c 40} e + assert_match {*ERR*syntax*} $e + } + + test {ZINCRBY does not work variadic even if shares ZADD implementation} { + r del myzset + catch {r zincrby myzset 10 a 20 b 30 c} e + assert_match {*ERR*wrong*number*arg*} $e + } + test "ZCARD basics - $encoding" { assert_equal 3 [r zcard ztmp] assert_equal 0 [r zcard zdoesntexist]