mirror of
https://codeberg.org/redict/redict.git
synced 2025-01-23 00:28:26 -05:00
SDIFF fuzz test added.
This commit is contained in:
parent
925090f476
commit
395d663d29
@ -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}
|
||||
|
Loading…
Reference in New Issue
Block a user