mirror of
https://gitee.com/dromara/hutool.git
synced 2025-04-05 17:37:59 +08:00
add test
This commit is contained in:
parent
2e9e174594
commit
b6fd1e2beb
@ -0,0 +1,29 @@
|
||||
package cn.hutool.core.util;
|
||||
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
|
||||
public class HashUtilTest {
|
||||
|
||||
@Test
|
||||
public void cityHash128Test(){
|
||||
String s="Google发布的Hash计算算法:CityHash64 与 CityHash128";
|
||||
final long[] hash = HashUtil.cityHash128(StrUtil.utf8Bytes(s));
|
||||
Assert.assertEquals(0x5944f1e788a18db0L, hash[0]);
|
||||
Assert.assertEquals(0xc2f68d8b2bf4a5cfL, hash[1]);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void cityHash64Test(){
|
||||
String s="Google发布的Hash计算算法:CityHash64 与 CityHash128";
|
||||
final long hash = HashUtil.cityHash64(StrUtil.utf8Bytes(s));
|
||||
Assert.assertEquals(0x1d408f2bbf967e2aL, hash);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void cityHash32Test(){
|
||||
String s="Google发布的Hash计算算法:CityHash64 与 CityHash128";
|
||||
final int hash = HashUtil.cityHash32(StrUtil.utf8Bytes(s));
|
||||
Assert.assertEquals(0xa8944fbe, hash);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user