Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ruanhaishen
redis
Commits
4bfcbab8
Commit
4bfcbab8
authored
Apr 16, 2010
by
antirez
Browse files
SORT/GET test added
parent
c4e83132
Changes
1
Show whitespace changes
Inline
Side-by-side
test-redis.tcl
View file @
4bfcbab8
...
...
@@ -972,6 +972,24 @@ proc main {} {
$r sort tosort
{
BY wobj_*->weight
}
}
$res
test
{
SORT with GET
(
key+hash
)
with sanity check of each element
(
list
)}
{
set err
{}
set l1
[
$r
sort tosort GET # GET weight_*
]
set l2
[
$r
sort tosort GET # GET wobj_*->weight
]
foreach
{
id1 w1
}
$l1
{
id2 w2
}
$l2
{
set realweight
[
$r
get weight_$id1
]
if
{
$id1
!= $id2
}
{
set err
"ID mismatch
$id1
!=
$id2
"
break
}
if
{
$realweight
!= $w1 || $realweight != $w2
}
{
set err
"Weights mismatch! w1:
$w1
w2:
$w2
real:
$realweight
"
break
}
}
set _ $err
}
{}
test
{
SORT with BY, but against the newly created set
}
{
$r sort tosort-set
{
BY weight_*
}
}
$res
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment