Merge pull request #142 from dota17/FixedMurmur128x64Cyclic
Bloom filter updates. Fixed Murmur128x64Cyclic. Added test for DynamicHasher NoValuesIterator.
This commit is contained in:
commit
fbc3c06d78
|
@ -31,7 +31,7 @@ import org.apache.commons.collections4.bloomfilter.hasher.HashFunction;
|
|||
* @see <a href="https://github.com/aappleby/smhasher">SMHasher</a>
|
||||
* @since 4.5
|
||||
*/
|
||||
public final class Murmur128x86Cyclic implements HashFunction {
|
||||
public final class Murmur128x64Cyclic implements HashFunction {
|
||||
|
||||
/**
|
||||
* The name of this hash method.
|
||||
|
@ -53,7 +53,7 @@ public final class Murmur128x86Cyclic implements HashFunction {
|
|||
/**
|
||||
* Constructs a Murmur3 x64 128 hash.
|
||||
*/
|
||||
public Murmur128x86Cyclic() {
|
||||
public Murmur128x64Cyclic() {
|
||||
signature = Signatures.getSignature(this);
|
||||
}
|
||||
|
|
@ -19,8 +19,10 @@ package org.apache.commons.collections4.bloomfilter.hasher;
|
|||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.junit.Assert.fail;
|
||||
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.NoSuchElementException;
|
||||
import java.util.PrimitiveIterator.OfInt;
|
||||
|
||||
import org.apache.commons.collections4.bloomfilter.hasher.function.MD5Cyclic;
|
||||
|
@ -63,6 +65,12 @@ public class DynamicHasherBuilderTest {
|
|||
final OfInt iter = hasher.iterator(shape);
|
||||
|
||||
assertFalse(iter.hasNext());
|
||||
try {
|
||||
iter.nextInt();
|
||||
fail("Should have thrown NoSuchElementException");
|
||||
} catch (final NoSuchElementException ignore) {
|
||||
// do nothing
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -23,16 +23,16 @@ import org.apache.commons.collections4.bloomfilter.hasher.HashFunction;
|
|||
import org.junit.Test;
|
||||
|
||||
/**
|
||||
* Test that the Murmur3 128 x86 hash function works correctly.
|
||||
* Test that the Murmur3 128 x64 hash function works correctly.
|
||||
*/
|
||||
public class Murmur128x86CyclicTest extends AbstractHashFunctionTest {
|
||||
public class Murmur128x64CyclicTest extends AbstractHashFunctionTest {
|
||||
|
||||
/**
|
||||
* Test that the apply function returns the proper values.
|
||||
*/
|
||||
@Test
|
||||
public void applyTest() {
|
||||
final Murmur128x86Cyclic murmur = new Murmur128x86Cyclic();
|
||||
final Murmur128x64Cyclic murmur = new Murmur128x64Cyclic();
|
||||
|
||||
final long l1 = 0xe7eb60dabb386407L;
|
||||
final long l2 = 0xc3ca49f691f73056L;
|
||||
|
@ -49,6 +49,6 @@ public class Murmur128x86CyclicTest extends AbstractHashFunctionTest {
|
|||
|
||||
@Override
|
||||
protected HashFunction createHashFunction() {
|
||||
return new Murmur128x86Cyclic();
|
||||
return new Murmur128x64Cyclic();
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue