use DEBUG DIGEST in the test instead of a function that was doing a similar work, but in a much slower and buggy way

This commit is contained in:
antirez 2010-05-14 16:41:24 +02:00
parent a57d9cc437
commit 758b6d4c27
1 changed files with 1 additions and 39 deletions

View File

@ -191,45 +191,7 @@ proc createComplexDataset {r ops} {
}
proc datasetDigest r {
set keys [lsort [$r keys *]]
set digest {}
foreach k $keys {
set t [$r type $k]
switch $t {
{string} {
set aux [::sha1::sha1 -hex [$r get $k]]
} {list} {
if {[$r llen $k] == 0} {
set aux {}
} else {
set aux [::sha1::sha1 -hex [$r lrange $k 0 -1]]
}
} {set} {
if {[$r scard $k] == 0} {
set aux {}
} else {
set aux [::sha1::sha1 -hex [lsort [$r smembers $k]]]
}
} {zset} {
if {[$r zcard $k] == 0} {
set aux {}
} else {
set aux [::sha1::sha1 -hex [$r zrange $k 0 -1 withscores]]
}
} {hash} {
if {[$r hlen $k] == 0} {
set aux {}
} else {
set aux [::sha1::sha1 -hex [lsort [$r hgetall $k]]]
}
} default {
error "Type not supported: $t"
}
}
if {$aux eq {}} continue
set digest [::sha1::sha1 -hex [join [list $aux $digest $k] "\n"]]
}
return $digest
$r debug digest
}
proc main {} {