Search in sources :

Example 1 with PtrBuffer

use of org.apache.jena.tdb.base.buffer.PtrBuffer in project jena by apache.

the class TestPtrBuffer method ptrbuffer15.

// Remove tests
@Test
public void ptrbuffer15() {
    PtrBuffer pb = make(5, 5);
    contains(pb, 2, 4, 6, 8, 10);
    pb.removeTop();
    contains(pb, 2, 4, 6, 8);
    pb.remove(1);
    contains(pb, 2, 6, 8);
    pb.remove(2);
    contains(pb, 2, 6);
    pb.remove(0);
    contains(pb, 6);
    pb.remove(0);
    contains(pb);
}
Also used : PtrBuffer(org.apache.jena.tdb.base.buffer.PtrBuffer) BaseTest(org.apache.jena.atlas.junit.BaseTest) Test(org.junit.Test)

Example 2 with PtrBuffer

use of org.apache.jena.tdb.base.buffer.PtrBuffer in project jena by apache.

the class TestPtrBuffer method ptrbuffer07.

// Shift RHS - out of bounds
@Test
public void ptrbuffer07() {
    PtrBuffer pb = make(4, 5);
    contains(pb, 2, 4, 6, 8);
    pb.shiftUp(3);
    pb.set(3, 1);
    contains(pb, 2, 4, 6, 1, 8);
    pb.shiftDown(3);
    contains(pb, 2, 4, 6, 8);
}
Also used : PtrBuffer(org.apache.jena.tdb.base.buffer.PtrBuffer) BaseTest(org.apache.jena.atlas.junit.BaseTest) Test(org.junit.Test)

Example 3 with PtrBuffer

use of org.apache.jena.tdb.base.buffer.PtrBuffer in project jena by apache.

the class TestPtrBuffer method ptrbuffer11.

@Test(expected = BufferException.class)
public void ptrbuffer11() {
    PtrBuffer pb = make(5, 5);
    contains(pb, 2, 4, 6, 8, 10);
    pb.add(12);
}
Also used : PtrBuffer(org.apache.jena.tdb.base.buffer.PtrBuffer) BaseTest(org.apache.jena.atlas.junit.BaseTest) Test(org.junit.Test)

Example 4 with PtrBuffer

use of org.apache.jena.tdb.base.buffer.PtrBuffer in project jena by apache.

the class TestPtrBuffer method ptrbuffer08.

@Test
public void ptrbuffer08() {
    PtrBuffer pb = make(4, 5);
    contains(pb, 2, 4, 6, 8);
    pb.shiftDown(3);
    contains(pb, 2, 4, 6);
    pb.shiftUp(2);
    contains(pb, 2, 4, -1, 6);
}
Also used : PtrBuffer(org.apache.jena.tdb.base.buffer.PtrBuffer) BaseTest(org.apache.jena.atlas.junit.BaseTest) Test(org.junit.Test)

Example 5 with PtrBuffer

use of org.apache.jena.tdb.base.buffer.PtrBuffer in project jena by apache.

the class TestPtrBuffer method ptrbuffer29.

@Test
public void ptrbuffer29() {
    PtrBuffer pb1 = make(0, 5);
    PtrBuffer pb2 = make(2, 4);
    pb2.copyToTop(pb1);
    contains(pb1, 2, 4);
}
Also used : PtrBuffer(org.apache.jena.tdb.base.buffer.PtrBuffer) BaseTest(org.apache.jena.atlas.junit.BaseTest) Test(org.junit.Test)

Aggregations

PtrBuffer (org.apache.jena.tdb.base.buffer.PtrBuffer)27 BaseTest (org.apache.jena.atlas.junit.BaseTest)23 Test (org.junit.Test)23 RecordBuffer (org.apache.jena.tdb.base.buffer.RecordBuffer)3 ByteBuffer (java.nio.ByteBuffer)2 Record (org.apache.jena.tdb.base.record.Record)1