Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
别团等shy哥发育
redis
提交
5e1224dc
R
redis
项目概览
别团等shy哥发育
/
redis
与 Fork 源项目一致
从无法访问的项目Fork
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
redis
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
5e1224dc
编写于
4月 17, 2014
作者:
A
antirez
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Basic ZRANGEBYLEX / ZLEXCOUNT tests.
上级
964faba6
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
56 addition
and
0 deletion
+56
-0
tests/unit/type/zset.tcl
tests/unit/type/zset.tcl
+56
-0
未找到文件。
tests/unit/type/zset.tcl
浏览文件 @
5e1224dc
...
...
@@ -296,6 +296,62 @@ start_server {tags {"zset"}} {
assert_error
"*not*float*"
{
r zrangebyscore fooz 1 NaN
}
}
proc create_default_lex_zset
{}
{
create_zset zset
{
0 alpha 0 bar 0 cool 0 down
0 elephant 0 foo 0 great 0 hill
0 omega
}
}
test
"ZRANGEBYLEX/ZREVRANGEBYLEX/ZCOUNT basics"
{
create_default_lex_zset
# inclusive range
assert_equal
{
alpha bar cool
}
[
r zrangebylex zset -
\[
cool
]
assert_equal
{
bar cool down
}
[
r zrangebylex zset
\[
bar
\[
down
]
assert_equal
{
great hill omega
}
[
r zrangebylex zset
\[
g +
]
assert_equal
{
cool bar alpha
}
[
r zrevrangebylex zset
\[
cool -
]
assert_equal
{
down cool bar
}
[
r zrevrangebylex zset
\[
down
\[
bar
]
assert_equal
{
omega hill great foo elephant down
}
[
r zrevrangebylex zset +
\[
d
]
assert_equal 3
[
r zlexcount zset
\[
ele
\[
h
]
# exclusive range
assert_equal
{
alpha bar
}
[
r zrangebylex zset -
(
cool
]
assert_equal
{
cool
}
[
r zrangebylex zset
(
bar
(
down
]
assert_equal
{
hill omega
}
[
r zrangebylex zset
(
great +
]
assert_equal
{
bar alpha
}
[
r zrevrangebylex zset
(
cool -
]
assert_equal
{
cool
}
[
r zrevrangebylex zset
(
down
(
bar
]
assert_equal
{
omega hill
}
[
r zrevrangebylex zset +
(
great
]
assert_equal 2
[
r zlexcount zset
(
ele
(
great
]
# inclusive and exclusive
assert_equal
{}
[
r zrangebylex zset
(
az
(
b
]
assert_equal
{}
[
r zrangebylex zset
(
z +
]
assert_equal
{}
[
r zrangebylex zset -
\[
aaaa
]
assert_equal
{}
[
r zrevrangebylex zset
\[
elez
\[
elex
]
assert_equal
{}
[
r zrevrangebylex zset
(
hill
(
omega
]
}
test
"ZRANGEBYSLEX with LIMIT"
{
create_default_lex_zset
assert_equal
{
alpha bar
}
[
r zrangebylex zset -
\[
cool LIMIT 0 2
]
assert_equal
{
bar cool
}
[
r zrangebylex zset -
\[
cool LIMIT 1 2
]
assert_equal
{}
[
r zrangebylex zset
\[
bar
\[
down LIMIT 0 0
]
assert_equal
{}
[
r zrangebylex zset
\[
bar
\[
down LIMIT 2 0
]
assert_equal
{
bar
}
[
r zrangebylex zset
\[
bar
\[
down LIMIT 0 1
]
assert_equal
{
cool
}
[
r zrangebylex zset
\[
bar
\[
down LIMIT 1 1
]
assert_equal
{
bar cool down
}
[
r zrangebylex zset
\[
bar
\[
down LIMIT 0 100
]
assert_equal
{
omega hill great foo elephant
}
[
r zrevrangebylex zset +
\[
d LIMIT 0 5
]
assert_equal
{
omega hill great foo
}
[
r zrevrangebylex zset +
\[
d LIMIT 0 4
]
}
test
"ZRANGEBYLEX with invalid lex range specifiers"
{
assert_error
"*not*string*"
{
r zrangebylex fooz foo bar
}
assert_error
"*not*string*"
{
r zrangebylex fooz
\[
foo bar
}
assert_error
"*not*string*"
{
r zrangebylex fooz foo
\[
bar
}
assert_error
"*not*string*"
{
r zrangebylex fooz +x
\[
bar
}
assert_error
"*not*string*"
{
r zrangebylex fooz -x
\[
bar
}
}
test
"ZREMRANGEBYSCORE basics"
{
proc remrangebyscore
{
min max
}
{
create_zset zset
{
1 a 2 b 3 c 4 d 5 e
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录