diff --git a/tests/unit/type/hash.tcl b/tests/unit/type/hash.tcl index b3d7ddc77..84e9a5ba5 100644 --- a/tests/unit/type/hash.tcl +++ b/tests/unit/type/hash.tcl @@ -492,6 +492,13 @@ start_server {tags {"hash"}} { list [r hincrby htest foo 2] } {2} + test {HINCRBY HINCRBYFLOAT against non-integer increment value} { + r del incrhash + r hset incrhash field 5 + assert_error "*value is not an integer*" {r hincrby incrhash field v} + assert_error "*value is not a*" {r hincrbyfloat incrhash field v} + } + test {HINCRBY against non existing hash key} { set rv {} r hdel smallhash tmp diff --git a/tests/unit/type/incr.tcl b/tests/unit/type/incr.tcl index 2319b2ce3..4bc130bcb 100644 --- a/tests/unit/type/incr.tcl +++ b/tests/unit/type/incr.tcl @@ -183,6 +183,17 @@ start_server {tags {"incr"}} { r get foo } {0} + test {INCRBY INCRBYFLOAT DECRBY against unhappy path} { + r del mykeyincr + assert_error "*ERR wrong number of arguments*" {r incr mykeyincr v} + assert_error "*ERR wrong number of arguments*" {r decr mykeyincr v} + assert_error "*value is not an integer or out of range*" {r incrby mykeyincr v} + assert_error "*value is not an integer or out of range*" {r incrby mykeyincr 1.5} + assert_error "*value is not an integer or out of range*" {r decrby mykeyincr v} + assert_error "*value is not an integer or out of range*" {r decrby mykeyincr 1.5} + assert_error "*value is not a valid float*" {r incrbyfloat mykeyincr v} + } + foreach cmd {"incr" "decr" "incrby" "decrby"} { test "$cmd operation should update encoding from raw to int" { set res {} diff --git a/tests/unit/type/zset.tcl b/tests/unit/type/zset.tcl index 4f11dea94..765d4bd7a 100644 --- a/tests/unit/type/zset.tcl +++ b/tests/unit/type/zset.tcl @@ -308,6 +308,12 @@ start_server {tags {"zset"}} { assert_error "*NaN*" {r zincrby myzset -inf abc} } + test "ZINCRBY against invalid incr value - $encoding" { + r del zincr + r zadd zincr 1 "one" + assert_error "*value is not a valid*" {r zincrby zincr v "one"} + } + test "ZADD - Variadic version base case - $encoding" { r del myzset list [r zadd myzset 10 a 20 b 30 c] [r zrange myzset 0 -1 withscores]