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
395d663d
Commit
395d663d
authored
Nov 30, 2012
by
antirez
Browse files
SDIFF fuzz test added.
parent
925090f4
Changes
1
Hide whitespace changes
Inline
Side-by-side
tests/unit/type/set.tcl
View file @
395d663d
...
...
@@ -213,6 +213,32 @@ start_server {
r sdiff set1 set2 set3
}
{}
test
"SDIFF fuzzing"
{
for
{
set j 0
}
{
$j
< 100
}
{
incr j
}
{
unset -nocomplain s
array set s
{}
set args
{}
set num_sets
[
expr
{[
randomInt 10
]
+1
}]
for
{
set i 0
}
{
$i
< $num_sets
}
{
incr i
}
{
set num_elements
[
randomInt 100
]
r del set_$i
lappend args set_$i
while
{
$num
_elements
}
{
set ele
[
randomValue
]
r sadd set_$i $ele
if
{
$i
== 0
}
{
set s
(
$ele
)
x
}
else
{
unset -nocomplain s
(
$ele
)
}
incr num_elements -1
}
}
set result
[
lsort
[
r sdiff
{*}
$args
]]
assert_equal $result
[
lsort
[
array names s
]]
}
}
test
"SINTER against non-set should throw error"
{
r set key1 x
assert_error
"WRONGTYPE*"
{
r sinter key1 noset
}
...
...
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