use of com.hazelcast.internal.util.hashslot.HashSlotCursor12byteKey in project hazelcast by hazelcast.
the class HashSlotArray12byteKeyImplTest method testCursor_key1_withoutAdvance.
// Cursor tests
@Test(expected = AssertionError.class)
@RequireAssertEnabled
public void testCursor_key1_withoutAdvance() {
HashSlotCursor12byteKey cursor = hsa.cursor();
cursor.key1();
}
use of com.hazelcast.internal.util.hashslot.HashSlotCursor12byteKey in project hazelcast by hazelcast.
the class HashSlotArray12byteKeyImplTest method testCursor_key1_whenDisposed.
@Test(expected = AssertionError.class)
public void testCursor_key1_whenDisposed() {
HashSlotCursor12byteKey cursor = hsa.cursor();
hsa.dispose();
cursor.key1();
}
use of com.hazelcast.internal.util.hashslot.HashSlotCursor12byteKey in project hazelcast by hazelcast.
the class HashSlotArray12byteKeyImplTest method testCursor_valueAddress_withoutAdvance.
@Test(expected = AssertionError.class)
@RequireAssertEnabled
public void testCursor_valueAddress_withoutAdvance() {
HashSlotCursor12byteKey cursor = hsa.cursor();
cursor.valueAddress();
}
use of com.hazelcast.internal.util.hashslot.HashSlotCursor12byteKey in project hazelcast by hazelcast.
the class HashSlotArray12byteKeyImplTest method testCursor_key2.
@Test
public void testCursor_key2() {
final long key1 = randomKey();
final int key2 = randomKey();
insert(key1, key2);
HashSlotCursor12byteKey cursor = hsa.cursor();
cursor.advance();
assertEquals(key2, cursor.key2());
}
use of com.hazelcast.internal.util.hashslot.HashSlotCursor12byteKey in project hazelcast by hazelcast.
the class HashSlotArray12byteKeyImplTest method testCursor_withManyValues.
@Test
public void testCursor_withManyValues() {
final int factor = 123456;
final int k = 1000;
for (int i = 1; i <= k; i++) {
insert(i, factor * i);
}
boolean[] verifiedKeys = new boolean[k];
HashSlotCursor12byteKey cursor = hsa.cursor();
while (cursor.advance()) {
long key1 = cursor.key1();
int key2 = cursor.key2();
long valueAddress = cursor.valueAddress();
assertEquals(key1 * factor, key2);
verifyValue(key1, key2, valueAddress);
verifiedKeys[((int) key1) - 1] = true;
}
for (int i = 0; i < k; i++) {
assertTrue("Failed to encounter key " + i, verifiedKeys[i]);
}
}
Aggregations