// verify channel count
assertEquals(hashStrategy.getChannelCount(), 1);
// verify hashStrategy is consistent with equals and hash code from block
for (int leftBlockIndex = 0; leftBlockIndex < channel.size(); leftBlockIndex++) {
RandomAccessBlock leftBlock = channel.get(leftBlockIndex);
PageBuilder pageBuilder = new PageBuilder(ImmutableList.of(VARCHAR));
for (int leftBlockPosition = 0; leftBlockPosition < leftBlock.getPositionCount(); leftBlockPosition++) {
// hash code of position must match block hash
assertEquals(hashStrategy.hashPosition(leftBlockIndex, leftBlockPosition), leftBlock.hash(leftBlockPosition));
// position must be equal to itself
assertTrue(hashStrategy.positionEqualsPosition(leftBlockIndex, leftBlockPosition, leftBlockIndex, leftBlockPosition));
// check equality of every position against every other position in the block
for (int rightBlockIndex = 0; rightBlockIndex < channel.size(); rightBlockIndex++) {
RandomAccessBlock rightBlock = channel.get(rightBlockIndex);
for (int rightBlockPosition = 0; rightBlockPosition < rightBlock.getPositionCount(); rightBlockPosition++) {
assertEquals(
hashStrategy.positionEqualsPosition(leftBlockIndex, leftBlockPosition, rightBlockIndex, rightBlockPosition),
leftBlock.equalTo(leftBlockPosition, rightBlock, rightBlockPosition));
}
}
// check equality of every position against every other position in the block cursor
for (RandomAccessBlock rightBlock : channel) {
BlockCursor rightCursor = rightBlock.cursor();
BlockCursor[] rightCursors = new BlockCursor[]{rightCursor};
while (rightCursor.advanceNextPosition()) {
assertEquals(
hashStrategy.positionEqualsCursors(leftBlockIndex, leftBlockPosition, rightCursors),
leftBlock.equalTo(leftBlockPosition, rightCursor));