Skip to content

Commit

Permalink
PFCOUNT multi-key test added.
Browse files Browse the repository at this point in the history
  • Loading branch information
antirez committed Apr 18, 2014
1 parent 5eb7ac0 commit 85a2f23
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions tests/unit/hyperloglog.tcl
Expand Up @@ -136,6 +136,21 @@ start_server {tags {"hll"}} {
r pfcount hll
} {5}

test {PFCOUNT multiple-keys merge returns cardinality of union} {
r del hll1 hll2 hll3
for {set x 1} {$x < 10000} {incr x} {
# Force dense representation of hll2
r pfadd hll1 "foo-$x"
r pfadd hll2 "bar-$x"
r pfadd hll3 "zap-$x"

set card [r pfcount hll1 hll2 hll3]
set realcard [expr {$x*3}]
set err [expr {abs($card-$realcard)}]
assert {$err < (double($card)/100)*5}
}
}

test {PFDEBUG GETREG returns the HyperLogLog raw registers} {
r del hll
r pfadd hll 1 2 3
Expand Down

0 comments on commit 85a2f23

Please sign in to comment.