949596979899100101102103104105106
contains(pb, 2, 4, 6, 8) ; } @Test public void ptrbuffer06() { PtrBuffer pb = make(4,5) ; contains(pb, 2, 4, 6, 8) ; pb.shiftDown(2) ; contains(pb, 2, 4, 8) ; pb.shiftUp(2) ; assertTrue(pb.isClear(2)) ; contains(pb, 2, 4, -1, 8) ; }
106107108109110111112113114115116117118
} // 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) ; }
117118119120121122123124125126127128
contains(pb, 2, 4, 6, 8) ; } @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) ; }
129130131132133134135136137
// Errors - IllegalArgumentException @Test(expected=BufferException.class) public void ptrbuffer09() { PtrBuffer pb = make(4,5) ; contains(pb, 2, 4, 6, 8) ; pb.shiftDown(4) ; }
137138139140141142143144145
} @Test(expected=BufferException.class) public void ptrbuffer10() { PtrBuffer pb = make(4,5) ; contains(pb, 2, 4, 6, 8) ; pb.shiftUp(4) ; }
145146147148149150151152153
} @Test(expected=BufferException.class) public void ptrbuffer11() { PtrBuffer pb = make(5,5) ; contains(pb, 2, 4, 6, 8, 10) ; pb.add(12) ; }
153154155156157158159160161162163164
} // Copy, duplicate, clear @Test public void ptrbuffer12() { PtrBuffer pb = make(5,5) ; contains(pb, 2, 4, 6, 8, 10) ; PtrBuffer pb2 = pb.duplicate() ; pb2.set(1, 99) ; contains(pb, 2, 4, 6, 8, 10) ; contains(pb2, 2, 99, 6, 8, 10) ; }
163164165166167168169170171172
contains(pb2, 2, 99, 6, 8, 10) ; } @Test public void ptrbuffer13() { PtrBuffer pb = make(5,5) ; contains(pb, 2, 4, 6, 8, 10) ; pb.clear(1, 3) ; contains(pb, 2, -1, -1, -1, 10) ; }
171172173174175176177178179180181182183184
contains(pb, 2, -1, -1, -1, 10) ; } @Test public void ptrbuffer14() { PtrBuffer pb = make(5,5) ; contains(pb, 2, 4, 6, 8, 10) ; PtrBuffer pb2 = make(5,5) ; contains(pb2, 2, 4, 6, 8, 10) ; pb.copy(0, pb2, 1, 4) ; contains(pb2, 2, 2, 4, 6, 8) ; }
185186187188189190191192193194195196197198199200201202
// 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) ; }