mirror of
https://github.com/OpenHFT/Chronicle-Map.git
synced 2021-09-13 01:26:12 +00:00
Make HasherTest a JUnit test
This commit is contained in:
@@ -19,17 +19,20 @@ package net.openhft.chronicle.map;
|
||||
import com.google.common.hash.HashFunction;
|
||||
import com.google.common.hash.Hashing;
|
||||
import net.openhft.chronicle.hash.hashing.Hasher;
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
public class HasherTest {
|
||||
public static void main(String[] args) {
|
||||
|
||||
@Test
|
||||
public void test() {
|
||||
HashFunction hashFunction = Hashing.murmur3_128();
|
||||
for (int i=0;i<10;i++)
|
||||
{
|
||||
String key = "010758403"+String.format("%06d",i)+"S-INJFIX_SLE";
|
||||
long hashCode = Hasher.hash(key.getBytes());
|
||||
long guavaHashCode = hashFunction.hashBytes(key.getBytes()).asLong();
|
||||
System.out.println("<"+key+"> => "+hashCode+" "+guavaHashCode);
|
||||
assertEquals(guavaHashCode, hashCode);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user