]> git.saurik.com Git - redis.git/commitdiff
test-redis.tcl dataset digest function Hash support
authorantirez <antirez@gmail.com>
Thu, 18 Mar 2010 02:27:08 +0000 (03:27 +0100)
committerantirez <antirez@gmail.com>
Thu, 18 Mar 2010 02:27:08 +0000 (03:27 +0100)
test-redis.tcl

index acb1acedcb8eccfdee2e4d6518939f09f2cfefc6..c8cb301933291c7efbcf30f64f51e265cffb2e53 100644 (file)
@@ -152,7 +152,6 @@ proc createComplexDataset {r ops} {
             } {
                 $r zadd $k $d $v
             } {
-                puts "hset $k $f $v"
                 $r hset $k $f $v
             }
             set t [$r type $k]
@@ -179,7 +178,7 @@ proc createComplexDataset {r ops} {
             }
             {hash} {
                 randpath {$r hset $k $f $v} \
-                        {puts "$r hdel $k $f"; $r hdel $k $f}
+                        {$r hdel $k $f}
             }
         }
     }
@@ -211,6 +210,12 @@ proc datasetDigest r {
                 } else {
                     set aux [::sha1::sha1 -hex [$r zrange $k 0 -1]]
                 }
+            } {hash} {
+                if {[$r hlen $k] == 0} {
+                    set aux {}
+                } else {
+                    set aux [::sha1::sha1 -hex [lsort [$r hgetall $k]]]
+                }
             } default {
                 error "Type not supported: $t"
             }