1 /*
2 +----------------------------------------------------------------------+
3 | Swoole |
4 +----------------------------------------------------------------------+
5 | This source file is subject to version 2.0 of the Apache license, |
6 | that is bundled with this package in the file LICENSE, and is |
7 | available through the world-wide-web at the following url: |
8 | http://www.apache.org/licenses/LICENSE-2.0.html |
9 | If you did not receive a copy of the Apache2.0 license and are unable|
10 | to obtain it through the world-wide-web, please send a note to |
11 | license@swoole.com so we can mail you a copy immediately. |
12 +----------------------------------------------------------------------+
13 | @link https://www.swoole.com/ |
14 | @contact team@swoole.com |
15 | @license https://github.com/swoole/swoole-src/blob/master/LICENSE |
16 | @author Tianfeng Han <mikan.tenny@gmail.com> |
17 +----------------------------------------------------------------------+
18 */
19
20 #include "test_core.h"
21 #include "swoole_hash.h"
22
23 static const char *data = "hello world, PHP the best.";
24
TEST(hash,crc32)25 TEST(hash, crc32) {
26 ASSERT_EQ(swoole_crc32(data, strlen(data)), 2962796788);
27 }
28
TEST(hash,php)29 TEST(hash, php) {
30 ASSERT_GT(swoole_hash_php(data, strlen(data)), 0);
31 }
32
TEST(hash,jenkins)33 TEST(hash, jenkins) {
34 ASSERT_GT(swoole_hash_jenkins(data, strlen(data)), 0);
35 }
36
TEST(hash,austin)37 TEST(hash, austin) {
38 ASSERT_GT(swoole_hash_austin(data, strlen(data)), 0);
39 }
40