Skip to content

Commit 4d58928

Browse files
committed
[tests] Add test for Predis\Cluster\Hash\CRC16.
1 parent a523cf7 commit 4d58928

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the Predis package.
5+
*
6+
* (c) Daniele Alessandri <[email protected]>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
namespace Predis\Cluster\Hash;
13+
14+
use PredisTestCase;
15+
16+
/**
17+
*
18+
*/
19+
class CRC16Test extends PredisTestCase
20+
{
21+
/**
22+
* @group disconnected
23+
*/
24+
public function testHashGeneration()
25+
{
26+
$crc16 = new CRC16();
27+
28+
$this->assertSame(58359, $crc16->hash('key:000'));
29+
$this->assertSame(62422, $crc16->hash('key:001'));
30+
$this->assertSame(50101, $crc16->hash('key:002'));
31+
$this->assertSame(54164, $crc16->hash('key:003'));
32+
$this->assertSame(41843, $crc16->hash('key:004'));
33+
$this->assertSame(45906, $crc16->hash('key:005'));
34+
$this->assertSame(33585, $crc16->hash('key:006'));
35+
$this->assertSame(37648, $crc16->hash('key:007'));
36+
$this->assertSame(25343, $crc16->hash('key:008'));
37+
$this->assertSame(29406, $crc16->hash('key:009'));
38+
}
39+
}

0 commit comments

Comments
 (0)