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
2352a519
Commit
2352a519
authored
Jul 13, 2018
by
antirez
Browse files
Test: XDEL fuzz testing. Remove and check stage.
parent
3d7d20b7
Changes
1
Hide whitespace changes
Inline
Side-by-side
tests/unit/type/stream.tcl
View file @
2352a519
...
@@ -264,6 +264,21 @@ start_server {
...
@@ -264,6 +264,21 @@ start_server {
# to report the right number of elements with XRANGE: this will also
# to report the right number of elements with XRANGE: this will also
# force accessing the whole data structure to check sanity.
# force accessing the whole data structure to check sanity.
assert
{[
r xlen somestream
]
== $x
}
assert
{[
r xlen somestream
]
== $x
}
# We want to remove elements in random order to really test the
# implementation in a better way.
set ids
[
lshuffle $ids
]
foreach id $ids
{
assert
{[
r xdel somestream $id
]
== 1
}
incr x -1
assert
{[
r xlen somestream
]
== $x
}
# The test would be too slow calling XRANGE for every iteration.
# Do it every 100 removal.
if
{
$x
% 100 == 0
}
{
set res
[
r xrange somestream - +
]
assert
{[
llength $res
]
== $x
}
}
}
}
}
test
{
XRANGE fuzzing
}
{
test
{
XRANGE fuzzing
}
{
...
...
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