Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
ruanhaishen
redis
Commits
1a06bf93
Commit
1a06bf93
authored
Sep 24, 2010
by
antirez
Browse files
ziplist implementation fuzzy tests
parent
e43505d6
Changes
1
Show whitespace changes
Inline
Side-by-side
tests/unit/type/list.tcl
View file @
1a06bf93
...
...
@@ -603,5 +603,58 @@ start_server {
assert_equal 1
[
r lrem myotherlist 1 2
]
assert_equal 3
[
r llen myotherlist
]
}
tags
{
slow
}
{
test
{
ziplist implementation: value encoding and backlink
}
{
for
{
set j 0
}
{
$j
< 100
}
{
incr j
}
{
r del l
set l
{}
for
{
set i 0
}
{
$i
< 200
}
{
incr i
}
{
randpath
{
set data
[
string repeat x
[
randomInt 100000
]]
}
{
set data
[
randomInt 65536
]
}
{
set data
[
randomInt 4294967296
]
}
{
set data
[
randomInt 18446744073709551616
]
}
lappend l $data
r rpush l $data
}
assert_equal
[
llength $l
]
[
r llen l
]
# Traverse backward
for
{
set i 199
}
{
$i
>= 0
}
{
incr i -1
}
{
if
{[
lindex $l $i
]
ne
[
r lindex l $i
]}
{
assert_equal
[
lindex $l $i
]
[
r lindex l $i
]
}
}
}
}
test
{
ziplist implementation: encoding stress testing
}
{
for
{
set j 0
}
{
$j
< 200
}
{
incr j
}
{
r del l
set l
{}
set len
[
randomInt 400
]
for
{
set i 0
}
{
$i
< $len
}
{
incr i
}
{
set rv
[
randomValue
]
randpath
{
lappend l $rv
r rpush l $rv
}
{
set l
[
concat
[
list $rv
]
$l
]
r lpush l $rv
}
}
assert_equal
[
llength $l
]
[
r llen l
]
for
{
set i 0
}
{
$i
< 200
}
{
incr i
}
{
if
{[
lindex $l $i
]
ne
[
r lindex l $i
]}
{
assert_equal
[
lindex $l $i
]
[
r lindex l $i
]
}
}
}
}
}
}
}
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