use of org.neo4j.io.pagecache.PageCursor in project neo4j by neo4j.
the class CompositePageCursorTest method putShortBeyondEndOfViewMustRaiseBoundsFlag.
@Test
public void putShortBeyondEndOfViewMustRaiseBoundsFlag() throws Exception {
PageCursor pageCursor = CompositePageCursor.compose(first, PAGE_SIZE, second, PAGE_SIZE);
for (int i = 0; i < 3 * PAGE_SIZE; i++) {
pageCursor.putShort((short) 1);
}
assertTrue(pageCursor.checkAndClearBoundsFlag());
assertFalse(pageCursor.checkAndClearBoundsFlag());
}
use of org.neo4j.io.pagecache.PageCursor in project neo4j by neo4j.
the class CompositePageCursorTest method getByteWithOffsetMustHitCorrectCursors.
@Test
public void getByteWithOffsetMustHitCorrectCursors() throws Exception {
first.setOffset(1);
second.setOffset(2);
PageCursor c = CompositePageCursor.compose(first, 1 + 1, second, 1);
assertThat(c.getByte(1), is((byte) 0xA2));
assertThat(c.getByte(1 + 1), is((byte) 0xB2));
assertFalse(c.checkAndClearBoundsFlag());
}
use of org.neo4j.io.pagecache.PageCursor in project neo4j by neo4j.
the class CompositePageCursorTest method putShortMustHitFirstCursorBeforeFlip.
@Test
public void putShortMustHitFirstCursorBeforeFlip() throws Exception {
PageCursor c = CompositePageCursor.compose(first, 2, second, 2);
c.putShort((short) 1);
c.setOffset(0);
assertThat(c.getShort(), is((short) 1));
assertFalse(c.checkAndClearBoundsFlag());
}
use of org.neo4j.io.pagecache.PageCursor in project neo4j by neo4j.
the class CompositePageCursorTest method putShortMustHitSecondCursorAfterFlip.
@Test
public void putShortMustHitSecondCursorAfterFlip() throws Exception {
PageCursor c = CompositePageCursor.compose(first, 2, second, 2);
c.putShort((short) 1);
c.putShort((short) 2);
c.setOffset(2);
assertThat(c.getShort(), is((short) 2));
assertFalse(c.checkAndClearBoundsFlag());
}
use of org.neo4j.io.pagecache.PageCursor in project neo4j by neo4j.
the class CompositePageCursorTest method putIntBeyondEndOfViewMustRaiseBoundsFlag.
@Test
public void putIntBeyondEndOfViewMustRaiseBoundsFlag() throws Exception {
PageCursor pageCursor = CompositePageCursor.compose(first, PAGE_SIZE, second, PAGE_SIZE);
for (int i = 0; i < 3 * PAGE_SIZE; i++) {
pageCursor.putInt(1);
}
assertTrue(pageCursor.checkAndClearBoundsFlag());
assertFalse(pageCursor.checkAndClearBoundsFlag());
}
Aggregations