Skip to content
Permalink
Browse files
[JENKINS-36871] Add some more test cases
  • Loading branch information
stephenc committed Aug 5, 2016
1 parent 6da1cb4 commit d942165c92e31b6b2e716e61e1ce6c9e74269357
Showing 1 changed file with 34 additions and 0 deletions.
@@ -107,6 +107,40 @@ public void putGetOneByteSequences() {
assertThat(queue.hasRemaining(), is(false));
}

@Test
public void putGetByteSequences() {
ByteBufferQueue queue = new ByteBufferQueue(100);
for (int i = Byte.MIN_VALUE; i <= Byte.MAX_VALUE; i++) {
byte b = (byte)i;
queue.put(b);
assertThat(queue.hasRemaining(), is(true));
}
for (int i = Byte.MIN_VALUE; i <= Byte.MAX_VALUE; i++) {
byte b = (byte) i;
assertThat(queue.hasRemaining(), is(true));
assertThat(queue.get(), is(b));
}
assertThat(queue.hasRemaining(), is(false));
}

@Test
public void putGetByteArraySequences() {
ByteBufferQueue queue = new ByteBufferQueue(100);
byte[] dst = new byte[1];
for (int i = Byte.MIN_VALUE; i <= Byte.MAX_VALUE; i++) {
byte b = (byte)i;
queue.put(b);
assertThat(queue.hasRemaining(), is(true));
}
for (int i = Byte.MIN_VALUE; i <= Byte.MAX_VALUE; i++) {
byte b = (byte) i;
assertThat(queue.hasRemaining(), is(true));
assertThat(queue.get(dst, 0, 1), is(1));
assertThat(dst[0], is(b));
}
assertThat(queue.hasRemaining(), is(false));
}

@Test
public void putGetDrainsQueue() {
ByteBufferQueue queue = new ByteBufferQueue(100);

0 comments on commit d942165

Please sign in to comment.