X-Git-Url: https://git.saurik.com/redis.git/blobdiff_plain/26f3388d27d1be9312d0244890db564c1b22ba0c..f9c6f39b2b0039cf29df6597d41c124048c825cd:/tests/unit/type/set.tcl diff --git a/tests/unit/type/set.tcl b/tests/unit/type/set.tcl index 5608a648..bdd1f9bf 100644 --- a/tests/unit/type/set.tcl +++ b/tests/unit/type/set.tcl @@ -59,6 +59,13 @@ start_server { assert_encoding hashtable myset } + test {Variadic SADD} { + r del myset + assert_equal 3 [r sadd myset a b c] + assert_equal 2 [r sadd myset A a b c B] + assert_equal [lsort {A a b c B}] [lsort [r smembers myset]] + } + test "Set encoding after DEBUG RELOAD" { r del myintset myhashset mylargeintset for {set i 0} {$i < 100} {incr i} { r sadd myintset $i } @@ -90,6 +97,20 @@ start_server { assert_equal {3 5} [lsort [r smembers myset]] } + test {SREM with multiple arguments} { + r del myset + r sadd myset a b c d + assert_equal 0 [r srem myset k k k] + assert_equal 2 [r srem myset b d x y] + lsort [r smembers myset] + } {a c} + + test {SREM variadic version with more args needed to destroy the key} { + r del myset + r sadd myset 1 2 3 + r srem myset 1 2 3 4 5 6 7 8 + } {3} + foreach {type} {hashtable intset} { for {set i 1} {$i <= 5} {incr i} { r del [format "set%d" $i]