Skip to content

Commit c40a275

Browse files
authored
Added test cases about hyperloglog for redis. (#4079)
1 parent daeb7cd commit c40a275

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

tests/RedisProxyTest.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,19 @@ public function testRedisOptionPrefix()
5151
$this->assertSame('yyy', $this->getRedis()->get('test:test'));
5252
}
5353

54+
public function testHyperLogLog()
55+
{
56+
$redis = $this->getRedis();
57+
$res = $redis->pfAdd('test:hyperloglog', ['123', 'fff']);
58+
$this->assertSame(1, $res);
59+
$res = $redis->pfAdd('test:hyperloglog', ['123']);
60+
$this->assertSame(0, $res);
61+
$this->assertSame(2, $redis->pfCount('test:hyperloglog'));
62+
$redis->pfAdd('test:hyperloglog2', [1234]);
63+
$redis->pfMerge('test:hyperloglog2', ['test:hyperloglog']);
64+
$this->assertSame(3, $redis->pfCount('test:hyperloglog2'));
65+
}
66+
5467
public function testRedisOptionSerializer()
5568
{
5669
$redis = $this->getRedis([

0 commit comments

Comments
 (0)