diff options
author | Binbin <binloveplay1314@qq.com> | 2023-04-11 16:14:16 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-04-11 11:14:16 +0300 |
commit | 45b8eea19f3e2491dec669f0745e513a4c9d7329 (patch) | |
tree | 556517ef326d3ef5263e2abda3a39a74fdc2bd30 | |
parent | e0b378d22b8eb53a5ce87f7b8d36ee63aafa4131 (diff) | |
download | redis-45b8eea19f3e2491dec669f0745e513a4c9d7329.tar.gz |
Add ZREMRANGEBYLEX basics tests to fix reply-schemas daily (#12021)
We do have ZREMRANGEBYLEX tests, but it is a stress test
marked with slow tag and then skipped in reply-schemas daily.
In the past, we were able to succeed on a daily, i guess
it was because there were some random command executions,
such as corrupt-dump-fuzzy, which might call it.
These test examples are taken from ZRANGEBYLEX basics test.
-rw-r--r-- | tests/unit/type/zset.tcl | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/tests/unit/type/zset.tcl b/tests/unit/type/zset.tcl index a52a77f24..d1da02778 100644 --- a/tests/unit/type/zset.tcl +++ b/tests/unit/type/zset.tcl @@ -755,6 +755,46 @@ start_server {tags {"zset"}} { assert_equal 0 [r exists zset] } + test "ZREMRANGEBYLEX basics - $encoding" { + proc remrangebylex {min max} { + create_default_lex_zset + assert_equal 1 [r exists zset] + r zremrangebylex zset $min $max + } + + # inclusive range + assert_equal 3 [remrangebylex - \[cool] + assert_equal {down elephant foo great hill omega} [r zrange zset 0 -1] + assert_equal 3 [remrangebylex \[bar \[down] + assert_equal {alpha elephant foo great hill omega} [r zrange zset 0 -1] + assert_equal 3 [remrangebylex \[g +] + assert_equal {alpha bar cool down elephant foo} [r zrange zset 0 -1] + assert_equal 6 [r zcard zset] + + # exclusive range + assert_equal 2 [remrangebylex - (cool] + assert_equal {cool down elephant foo great hill omega} [r zrange zset 0 -1] + assert_equal 1 [remrangebylex (bar (down] + assert_equal {alpha bar down elephant foo great hill omega} [r zrange zset 0 -1] + assert_equal 2 [remrangebylex (great +] + assert_equal {alpha bar cool down elephant foo great} [r zrange zset 0 -1] + assert_equal 7 [r zcard zset] + + # inclusive and exclusive + assert_equal 0 [remrangebylex (az (b] + assert_equal {alpha bar cool down elephant foo great hill omega} [r zrange zset 0 -1] + assert_equal 0 [remrangebylex (z +] + assert_equal {alpha bar cool down elephant foo great hill omega} [r zrange zset 0 -1] + assert_equal 0 [remrangebylex - \[aaaa] + assert_equal {alpha bar cool down elephant foo great hill omega} [r zrange zset 0 -1] + assert_equal 9 [r zcard zset] + + # destroy when empty + assert_equal 9 [remrangebylex - +] + assert_equal 0 [r zcard zset] + assert_equal 0 [r exists zset] + } + test "ZUNIONSTORE against non-existing key doesn't set destination - $encoding" { r del zseta{t} assert_equal 0 [r zunionstore dst_key{t} 1 zseta{t}] |