use of org.neo4j.io.pagecache.PageCursor in project neo4j by neo4j.
the class CompositePageCursorTest method putByteBeyondEndOfViewMustRaiseBoundsFlag.
@Test
public void putByteBeyondEndOfViewMustRaiseBoundsFlag() throws Exception {
PageCursor pageCursor = CompositePageCursor.compose(first, PAGE_SIZE, second, PAGE_SIZE);
for (int i = 0; i < 3 * PAGE_SIZE; i++) {
pageCursor.putByte((byte) 1);
}
assertTrue(pageCursor.checkAndClearBoundsFlag());
assertFalse(pageCursor.checkAndClearBoundsFlag());
}
use of org.neo4j.io.pagecache.PageCursor in project neo4j by neo4j.
the class CompositePageCursorTest method checkAndClearCursorErrorMustNotThrowIfNoErrorsAreSet.
@Test
public void checkAndClearCursorErrorMustNotThrowIfNoErrorsAreSet() throws Exception {
PageCursor cursor = CompositePageCursor.compose(first, PAGE_SIZE, second, PAGE_SIZE);
cursor.checkAndClearCursorException();
}
use of org.neo4j.io.pagecache.PageCursor in project neo4j by neo4j.
the class CompositePageCursorTest method getBytesMustRespectOffsetIntoSecondCursor.
@Test
public void getBytesMustRespectOffsetIntoSecondCursor() throws Exception {
second.setOffset(1);
PageCursor c = CompositePageCursor.compose(first, 4, second, 4);
c.getBytes(bytes);
assertThat(bytes, byteArray(0xA0, 0xA1, 0xA2, 0xA3));
c.getBytes(bytes);
assertThat(bytes, byteArray(0xB1, 0xB2, 0xB3, 0xB4));
assertFalse(c.checkAndClearBoundsFlag());
}
use of org.neo4j.io.pagecache.PageCursor in project neo4j by neo4j.
the class CompositePageCursorTest method putBytesMustRespectOffsetIntoSecondCursor.
@Test
public void putBytesMustRespectOffsetIntoSecondCursor() throws Exception {
second.setOffset(1);
PageCursor c = CompositePageCursor.compose(first, 1, second, 8);
c.putBytes(new byte[] { 1 });
c.putBytes(new byte[] { 2 });
second.setOffset(1);
second.getBytes(bytes);
assertThat(Arrays.copyOfRange(bytes, 0, 1), byteArray(2));
c.getBytes(bytes);
assertThat(bytes, byteArray(0xB5, 0xB6, 0xB7, 0xB8));
assertFalse(c.checkAndClearBoundsFlag());
}
use of org.neo4j.io.pagecache.PageCursor in project neo4j by neo4j.
the class CompositePageCursorTest method putByteOffsettedBeyondEndOfViewMustRaiseBoundsFlag.
@Test
public void putByteOffsettedBeyondEndOfViewMustRaiseBoundsFlag() throws Exception {
PageCursor pageCursor = CompositePageCursor.compose(first, PAGE_SIZE, second, PAGE_SIZE);
for (int i = 0; i < 3 * PAGE_SIZE; i++) {
pageCursor.putByte(i, (byte) 1);
}
assertTrue(pageCursor.checkAndClearBoundsFlag());
assertFalse(pageCursor.checkAndClearBoundsFlag());
}
Aggregations