summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorantirez <antirez@gmail.com>2015-05-29 11:28:49 +0200
committerantirez <antirez@gmail.com>2015-05-29 12:27:17 +0200
commitdf7add9e70daebdeefc6743d1de35ae918c2a947 (patch)
tree001cec5fbb4f601908d717b1d90d4a794c29da42
parent9003483d43f3dfa1bd96659a70cf7cd63857b838 (diff)
downloadredis-df7add9e70daebdeefc6743d1de35ae918c2a947.tar.gz
Test: ZADD INCR test
-rw-r--r--tests/unit/type/zset.tcl14
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/unit/type/zset.tcl b/tests/unit/type/zset.tcl
index d33b4bb35..ea2d4e374 100644
--- a/tests/unit/type/zset.tcl
+++ b/tests/unit/type/zset.tcl
@@ -100,6 +100,20 @@ start_server {tags {"zset"}} {
assert {[r zscore ztmp b] == 200}
}
+ test "ZADD INCR works like ZINCRBY" {
+ r del ztmp
+ r zadd ztmp 10 x 20 y 30 z
+ r zadd ztmp INCR 15 x
+ assert {[r zscore ztmp x] == 25}
+ }
+
+ test "ZADD INCR works with a single score-elemenet pair" {
+ r del ztmp
+ r zadd ztmp 10 x 20 y 30 z
+ catch {r zadd ztmp INCR 15 x 10 y} err
+ set err
+ } {ERR*}
+
test "ZINCRBY calls leading to NaN result in error" {
r zincrby myzset +inf abc
assert_error "*NaN*" {r zincrby myzset -inf abc}