summaryrefslogtreecommitdiff
path: root/tests/unit
diff options
context:
space:
mode:
authorantirez <antirez@gmail.com>2015-05-29 11:28:49 +0200
committerantirez <antirez@gmail.com>2015-05-29 11:28:52 +0200
commit23ba5c10920b9893eb1ed82503157850131819af (patch)
treec7d850c7d741c0fdad95e7550b68dd136cba80e1 /tests/unit
parent910e72d1c10ac8bcb7d869714dcad43dc318c8c5 (diff)
downloadredis-23ba5c10920b9893eb1ed82503157850131819af.tar.gz
Test: ZADD INCR test
Diffstat (limited to 'tests/unit')
-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}