提交 df3fb07e 编写于 作者: X Xavier Léauté

test for correct bytebuffer folding

上级 cc40a339
......@@ -298,6 +298,24 @@ public class HyperLogLogCollectorTest
}
}
@Test
public void testBufferSwap() throws Exception
{
ByteBuffer biggerOffset = makeCollectorBuffer(1, (byte) 0x00, 0x11);
ByteBuffer smallerOffset = makeCollectorBuffer(0, (byte) 0x20, 0x00);
ByteBuffer buffer = ByteBuffer.allocate(HyperLogLogCollector.getLatestNumBytesForDenseStorage());
HyperLogLogCollector collector = HyperLogLogCollector.makeCollector(buffer);
// make sure the original buffer gets modified
collector.fold(biggerOffset);
Assert.assertEquals(collector, HyperLogLogCollector.makeCollector(buffer));
// make sure the original buffer gets modified
collector.fold(smallerOffset);
Assert.assertEquals(collector, HyperLogLogCollector.makeCollector(buffer));
}
@Test
public void testFoldWithArbitraryInitialPositions() throws Exception
{
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册