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
98e1bb81
Commit
98e1bb81
authored
Dec 18, 2009
by
antirez
Browse files
still more tests
parent
5384a2d8
Changes
1
Hide whitespace changes
Inline
Side-by-side
test-redis.tcl
View file @
98e1bb81
...
...
@@ -877,18 +877,23 @@ proc main {server port} {
lsort
[
array names myset
]
}
{
a b c
}
test
{
Create a random list
}
{
test
{
Create a random list
and a random set
}
{
set tosort
{}
array set seenrand
{}
for
{
set i 0
}
{
$i
< 10000
}
{
incr i
}
{
while 1
{
# Make sure all the weights are different because
# Redis does not use a stable sort but Tcl does.
set rint
[
expr int
(
rand
()
*1000000
)]
randpath
{
set rint
[
expr int
(
rand
()
*1000000
)]
}
{
set rint
[
expr rand
()]
}
if
{
!
[
info exists seenrand
(
$rint
)]}
break
}
set seenrand
(
$rint
)
x
$r lpush tosort $i
$r sadd tosort-set $i
$r set weight_$i $rint
lappend tosort
[
list $i $rint
]
}
...
...
@@ -904,6 +909,10 @@ proc main {server port} {
$r sort tosort
{
BY weight_*
}
}
$res
test
{
the same SORT with BY, but against the newly created set
}
{
$r sort tosort-set
{
BY weight_*
}
}
$res
test
{
SORT with BY and STORE against the newly created list
}
{
$r sort tosort
{
BY weight_*
}
store sort-res
$r lrange sort-res 0 -1
...
...
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