Unverified Commit 091412cf authored by Wen Hui's avatar Wen Hui Committed by GitHub
Browse files

add test cases for decr decrby on missing key (#12070)

Minor test case addition for DECR and DECRBY.

Currently DECR and DECRBY do not have test case coverage for the
scenarios where they run on a non-existing key.
parent e5882da9
...@@ -13,6 +13,12 @@ start_server {tags {"incr"}} { ...@@ -13,6 +13,12 @@ start_server {tags {"incr"}} {
r decr novar r decr novar
} {1} } {1}
test {DECR against key is not exist and incr} {
r del novar_not_exist
assert_equal {-1} [r decr novar_not_exist]
assert_equal {0} [r incr novar_not_exist]
}
test {INCR against key originally set with SET} { test {INCR against key originally set with SET} {
r set novar 100 r set novar 100
r incr novar r incr novar
...@@ -64,6 +70,11 @@ start_server {tags {"incr"}} { ...@@ -64,6 +70,11 @@ start_server {tags {"incr"}} {
r decrby novar 17179869185 r decrby novar 17179869185
} {-1} } {-1}
test {DECRBY against key is not exist} {
r del key_not_exist
assert_equal {-1} [r decrby key_not_exist 1]
}
test {INCR uses shared objects in the 0-9999 range} { test {INCR uses shared objects in the 0-9999 range} {
r set foo -1 r set foo -1
r incr foo r incr foo
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment